Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. <?php
  2. $con = mysql_connect("localhost","root","password") or die(mysql_error());
  3. mysql_select_db("learning",$con) or die(mysql_error());
  4. echo "Connection established, DB selected <br />";
  5. $user = mysql_real_escape_string($_GET['user']);
  6. $pass = mysql_real_escape_string($_GET['pass']);
  7. $email = $_GET['email'];
  8. /*Check to see if user is registered*/
  9. if(isset($user,$pass)){
  10. $array = mysql_query("select * from knowledge");
  11. while($ar = mysql_fetch_array($array)){
  12. $check = $ar['user'];
  13. if($check == $user){
  14. echo "User already exists!";
  15. exit(0);
  16.   }
  17. }
  18. $sql = "insert into knowledge(user,passw) values('$user',md5('$pass'))";
  19. mysql_query($sql) or die(mysql_error());
  20. }
  21. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement