Advertisement
Guest User

Untitled

a guest
Jul 9th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. <?php
  2. $username = check_input($_POST['username'],"<font color='red'>Enter your username!</font>");
  3. $email = check_input($_POST['email'],"<font color='red'>Enter your email!</font>");
  4. ?>
  5. <?php
  6. function check_input($data, $problem='')
  7. {
  8. $data = trim($data);
  9. $data = mysql_real_escape_string($data);
  10. $data = htmlspecialchars($data);
  11. if ($problem && strlen($data) == 0 && ctype_alnum($data))
  12. {
  13. die($problem);
  14. }
  15. return $data;
  16. }
  17. ?>
  18. <?php
  19. $dbserver = "174.121.1.62";
  20. $dblogin = "scswccla_Mine";
  21. $dbpassword = "***********";
  22. $dbname = "scswccla_mine";
  23.  
  24. $con = mysql_connect("$dbserver","$dblogin","$dbpassword");
  25. if (!$con)
  26. {
  27. die('Could not connect: ' . mysql_error());
  28. }
  29.  
  30. mysql_select_db("$dbname", $con);
  31.  
  32. $sql="INSERT INTO users (id, name, groups, prefix, commands, admin, canmodifyworld, ignoresrestrictions, ip, email)
  33. VALUES('','$username','players','','','0','1','0','','$email')";
  34.  
  35. if (!mysql_query($sql,$con))
  36. {
  37. die('<font color="red">Error: ' . mysql_error() . '</font>');
  38. }
  39. else {
  40. echo('<font color="green">Success!</font>');
  41. }
  42. mysql_close($con)
  43. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement