Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="container">
- <form method="post" action="myscript.php">
- <div class="imgcontainer">
- <img src="loginpage.jpg" alt="Avatar" class="avatar">
- <div class="container2">
- <label><b style="font-family:'Microsoft Sans Serif'">Username</b></label>
- <input type="text" placeholder="Enter Username" name="userame" required>
- <label><b style="font-family: 'Microsoft Sans Serif'">Password</b></label>
- <input type="password" placeholder="Enter Password" name="password" required>
- <button input type="submit" style="font-family:'Microsoft Sans Serif'" value="save">Login</button>
- <input type="checkbox" style="font-family:'Microsoft Sans Serif'" checked="checked"> Remember me
- </div>
- </form>
- <?php
- $servername = "localhost"; //assigns the name of the server to be hosted on to a variable called servername
- $username = "root"; //assigns the username to be used to access the server to a variable called username
- $password = ""; //sets a null password
- $conn = mysql_connect($servername,$username,$password) or die ("Unable to connect to the server, contact system admin."); //used to open a connection to a mySQL server + some error handling.
- $sql = mysql_select_db('test',$conn) or die ("Unable to connect to database"); //used to select the databsae created in localhost/phpmyadmin
- $user_info = "INSERT INTO users (username,password) VALUES ('$_POST[username]','$_POST[password]')";
- IF (!mysql_query($user_info,$conn)) {die('Error:' .mysql_error());}
- echo "Your information was added to the database.";
- mysql_close($conn);
Add Comment
Please, Sign In to add comment