Guest User

Untitled

a guest
Nov 22nd, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. <div class="container">
  2. <form method="post" action="myscript.php">
  3. <div class="imgcontainer">
  4. <img src="loginpage.jpg" alt="Avatar" class="avatar">
  5.  
  6. <div class="container2">
  7. <label><b style="font-family:'Microsoft Sans Serif'">Username</b></label>
  8. <input type="text" placeholder="Enter Username" name="userame" required>
  9.  
  10. <label><b style="font-family: 'Microsoft Sans Serif'">Password</b></label>
  11. <input type="password" placeholder="Enter Password" name="password" required>
  12.  
  13. <button input type="submit" style="font-family:'Microsoft Sans Serif'" value="save">Login</button>
  14. <input type="checkbox" style="font-family:'Microsoft Sans Serif'" checked="checked"> Remember me
  15. </div>
  16.  
  17. </form>
  18.  
  19. <?php
  20. $servername = "localhost"; //assigns the name of the server to be hosted on to a variable called servername
  21. $username = "root"; //assigns the username to be used to access the server to a variable called username
  22. $password = ""; //sets a null password
  23. $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.
  24. $sql = mysql_select_db('test',$conn) or die ("Unable to connect to database"); //used to select the databsae created in localhost/phpmyadmin
  25.  
  26. $user_info = "INSERT INTO users (username,password) VALUES ('$_POST[username]','$_POST[password]')";
  27. IF (!mysql_query($user_info,$conn)) {die('Error:' .mysql_error());}
  28. echo "Your information was added to the database.";
  29. mysql_close($conn);
Add Comment
Please, Sign In to add comment