Advertisement
Guest User

Untitled

a guest
Jul 11th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. <?php
  2. include("confff.php");//check
  3.  
  4. //set variable
  5. $passkey=$_GET['passkey'];
  6. $sql1="SELECT * FROM temp WHERE code='$passkey'";
  7. $result1=mysql_query($sql1);
  8.  
  9. //if sucessfully queried
  10. if($result1)
  11. {
  12.  
  13. //how many rows have key
  14. $count=mysql_num_rows($result1);
  15.  
  16. //if passkey in database, retrieve data
  17. if($count==1)
  18. {
  19. $rows=mysql_fetch_array($result1);
  20. $namex=$rows['username'];
  21. $emailx=$rows['email'];
  22. $passwordx=$rows['password'];
  23.  
  24. //takeoutspace
  25. $name=str_replace(' ','',$namex);
  26. $email=str_replace(' ','',$emailx);
  27. $password=str_replace(' ','',$passwordx);
  28.  
  29. //insert into users table
  30. $sql2="INSERT INTO users SET username='$name', points='5', mycities='1', email='$email', password='$password'";
  31. $result2=mysql_query($sql2);
  32.  
  33. if ($result2)
  34. {
  35.  
  36. //starting values
  37. $myCityname = $name . '\'s city';
  38. $sql3="INSERT INTO resources SET username='$name', cityname='$myCityname', wood='200', stone='200', iron='200', people='10', gold='100', happiness='100', loyalty='100'";
  39. $result3=mysql_query($sql3);
  40.  
  41. //remove from temp
  42. $sql5="DELETE FROM temp WHERE code='$passkey'";
  43. $result=mysql_query($sql5);
  44.  
  45. header("location:confirmation2.html");
  46. }
  47. else
  48. {
  49. echo "wrong confirmation code";
  50. }
  51. }
  52. }
  53.  
  54. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement