PageRenderTime 41ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/addfriend.php

https://bitbucket.org/wlynch92/cs336-dbproject
PHP | 31 lines | 23 code | 8 blank | 0 comment | 1 complexity | 69b8fdd4b59043036d6bc2c79519ac64 MD5 | raw file
  1. <html><body>
  2. <?php
  3. session_start();
  4. echo $_SESSION['receiver'];
  5. ?>
  6. <?php
  7. session_start();
  8. $con = mysql_connect("cs336-64.rutgers.edu", "csuser", "cs277315");
  9. if (!$con) {
  10. die('cannot connect: '.mysql_error());
  11. }
  12. mysql_select_db("cs336", $con);
  13. $user = $_SESSION['uid'];
  14. $friending = $_SESSION['receiver'];
  15. $friendingtemp = mysql_query("select uid from user where username = '$friending'");
  16. $friendingID = mysql_fetch_array($friendingtemp);
  17. $friendingID = $friendingID['uid'];
  18. mysql_query("insert into pending_friend values('$user', '$friendingID')");
  19. mysql_close($con);
  20. header("Location: /profile.php");
  21. exit();
  22. ?>
  23. </html></body>