Guest User

Untitled

a guest
Jul 21st, 2018
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. <html>
  2. <head>
  3.  
  4. </head>
  5. <body>
  6. <h1 align="center">Create your user admin</h1>
  7. <table align="center">
  8. <tr align="center">
  9. <td align="left">
  10. <FORM style="width:300px; float:left;" id="form" name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
  11. <label>username:</lable><input style="margin-left:10px;" type="field" id="username" name="username"></br>
  12. <label>password:</lable><input style="margin-left:10px;" type="field" id="password" name="password"></br>
  13. <label>email:</lable><input style="margin-left:35px;" type="field" id="email" name="email"></br>
  14. <input type="submit" name="submit" value="submit"></br>
  15. </form>
  16. </td>
  17. </tr>
  18. </table>
  19. <?php include_once("../connect/config.php");
  20.  
  21. if(empty($_POST['username'])) { die('</body></html>'); }
  22. $username = $_POST["username"];
  23. $password = $_POST["password"];
  24. $email = $_POST["email"];
  25.  
  26. mysql_select_db('$db_selected') or die('Cannot select database you suck try again');
  27. if(isset($_POST['submit']))
  28. {
  29. $query = 'CREATE TABLE users( '.
  30. 'id INT NOT NULL AUTO_INCREMENT, '.
  31. 'username VARCHAR(20) NOT NULL, '.
  32. 'password VARCHAR(50) NOT NULL, '.
  33. 'email VARCHAR(30) NOT NULL, '.
  34. 'PRIMARY KEY(id))';
  35. $result = mysql_query($query);
  36.  
  37. mysql_select_db('$db_selected') or die('Cannot select database you suck try again');
  38.  
  39. $sql="INSERT INTO users ($username, $password, $email)
  40. VALUES ('$username','$password','$email')";
  41. if (!mysql_query($sql)) { die('Error: ' . mysql_error()); }
  42. echo "1 record added"; }
  43.  
  44. ?>
  45.  
  46. </body>
  47. </html>
Add Comment
Please, Sign In to add comment