Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. <?php
  2.  
  3. $fb_user_id = $user_profile['id']; //unique key
  4. $fb_name = $user_profile['name'];
  5.  
  6.  
  7. $dbc = mysql_connect('mysql.greekius.com', 'tdiepiv', 'stopit');
  8. mysql_select_db('greekius_db');
  9.  
  10. $query = "INSERT INTO user_table (userid, name) VALUES
  11. ('$fb_user_id', '$fb_name')";
  12.  
  13. @mysql_query($query, $dbc);
  14.  
  15. mysql_close($dbc);
  16.  
  17.  
  18. if ($_SERVER['REQUEST_METHOD'] == 'POST'){ //handle the form
  19. $dbc = mysql_connect('mysql.greekius.com', 'tdiepiv', 'stopit');
  20. mysql_select_db('greekius_db');
  21.  
  22.  
  23.  
  24.  
  25. //validate the form data:
  26. $problem = FALSE;
  27. if (!empty($_POST['greek_name'])) {
  28. $greek_name = trim(strip_tags($_POST['greek_name']));
  29.  
  30. }
  31. //if the entry is improper
  32. else {
  33. print '<p style="color: red;">Please enter a valid name and greek organization.</p>';
  34. $problem = TRUE;
  35. }
  36. if (!$problem){
  37. //define the query:
  38. $query = "UPDATE user_table SET greek_org = '$greek_name' WHERE userid = '$fb_user_id'";
  39.  
  40. //execute the query now:
  41. if (mysql_query($query, $dbc)){
  42. print '<p>Welcome. You\'ve been listed. However, we need your friends to verify!' . '</p>';
  43. }
  44. else {
  45. print '<p style="color: red;">Sorry, you were not listed because:<br />'
  46. . mysql_error($dbc) . '.</p><p>The query being run was: ' . $query . '</p>';
  47. }
  48. } //THERE WERE NO FUCKING PROBLEMS.
  49.  
  50. mysql_close($dbc);
  51. }
  52.  
  53. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement