You guys asked me to create an updated tutorial on how to install XAMPP, so here it is. I wanted to cover everything though, so I show how to install XAMPP. I also cover how to fix all of the common errors. I show how to setup Administrator accounts on Windows 10 and then allow them to run apps, which is normally restricted. Then using phpMyAdmin we create user accounts and a database. To round out the tutorial I then create PHP / MySQL configuration files and PHP scripts that are used to query and update the database.
All of the code used among other things, follows the video below.
If you like videos like this, it helps me when you tell Google with a click here [googleplusone]
Code From the Video
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
Fixing the Registry Keys for the Administrator account To use Microsoft Edge as the Administrator you have to change a few registry registry keys. Change the following registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System Create a DWORD value if it doesn’t exist called FilterAdministratorToken and set the value to 1 Change the following registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\UIPI\ Change the Default string key to 0x00000001(1) ---------- mysqli_connect.php ---------- <?php // Opens a connection to the database // Since it is a php file it won't open in a browser // It should be saved outside of the main web documents folder // and imported when needed /* Command that gives the database user the least amount of power as is needed. GRANT INSERT, SELECT, DELETE, UPDATE ON test3.* TO 'studentweb'@'localhost' IDENTIFIED BY 'turtledove'; SELECT : Select rows in tables INSERT : Insert new rows into tables UPDATE : Change data in rows DELETE : Delete existing rows (Remove privilege if not required) */ // Defined as constants so that they can't be changed DEFINE ('DB_USER', 'studentweb'); DEFINE ('DB_PASSWORD', 'turtledove'); DEFINE ('DB_HOST', 'localhost'); DEFINE ('DB_NAME', 'test3'); // $dbc will contain a resource link to the database // @ keeps the error from showing in the browser $dbc = @mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) OR die('Could not connect to MySQL: ' . mysqli_connect_error()); ?> ---------- getstudentinfo.php ---------- <?php // Get a connection for the database require_once('../mysqli_connect.php'); // Create a query for the database $query = "SELECT first_name, last_name FROM students"; // Get a response from the database by sending the connection // and the query $response = @mysqli_query($dbc, $query); // If the query executed properly proceed if($response){ echo '<table align="left" cellspacing="5" cellpadding="8"> <tr><td align="left"><b>First Name</b></td> <td align="left"><b>Last Name</b></td></tr>'; // mysqli_fetch_array will return a row of data from the query // until no further data is available while($row = mysqli_fetch_array($response)){ echo '<tr><td align="left">' . $row['first_name'] . '</td><td align="left">' . $row['last_name'] . '</td>'; echo '</tr>'; } echo '</table>'; } else { echo "Couldn't issue database query<br />"; echo mysqli_error($dbc); } // Close connection to the database mysqli_close($dbc); ?> ---------- addstudent.php ---------- <html> <head> <title>Add Student</title> </head> <body> <form action="http://localhost:1234/studentadded.php" method="post"> <b>Add a New Student</b> <p>First Name: <input type="text" name="first_name" size="30" value="" /> </p> <p>Last Name: <input type="text" name="last_name" size="30" value="" /> </p> <p> <input type="submit" name="submit" value="Send" /> </p> </form> </body> </html> ---------- studentadded.php ---------- <html> <head> <title>Add Student</title> </head> <body> <?php if(isset($_POST['submit'])){ $data_missing = array(); if(empty($_POST['first_name'])){ // Adds name to array $data_missing[] = 'First Name'; } else { // Trim white space from the name and store the name $f_name = trim($_POST['first_name']); } if(empty($_POST['last_name'])){ // Adds name to array $data_missing[] = 'Last Name'; } else{ // Trim white space from the name and store the name $l_name = trim($_POST['last_name']); } if(empty($data_missing)){ require_once('../mysqli_connect.php'); $query = "INSERT INTO students (first_name, last_name) VALUES (?, ?)"; $stmt = mysqli_prepare($dbc, $query); mysqli_stmt_bind_param($stmt, "ss", $f_name, $l_name); mysqli_stmt_execute($stmt); $affected_rows = mysqli_stmt_affected_rows($stmt); if($affected_rows == 1){ echo 'Student Entered'; mysqli_stmt_close($stmt); mysqli_close($dbc); } else { echo 'Error Occurred<br />'; echo mysqli_error(); mysqli_stmt_close($stmt); mysqli_close($dbc); } } else { echo 'You need to enter the following data<br />'; foreach($data_missing as $missing){ echo "$missing<br />"; } } } ?> <form action="http://localhost:1234/studentadded.php" method="post"> <b>Add a New Student</b> <p>First Name: <input type="text" name="first_name" size="30" value="" /> </p> <p>Last Name: <input type="text" name="last_name" size="30" value="" /> </p> <p> <input type="submit" name="submit" value="Send" /> </p> </form> </body> </html> |
Leave a Reply