Classes With Friends (index.php)


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <html>
  2. <head>
  3. <title>
  4. Facebook App
  5. </title>
  6. </head>
  7.  
  8. <body>
  9.  
  10. <?
  11.  
  12. include ('connect.php');
  13. include ('fbconnect.php');
  14.  
  15. $fidQuery = "Select count(fid) as ct FROM users where fid =".$var4."";
  16. $runfid = mysql_query($fidQuery);
  17. $row1 = mysql_fetch_array($runfid);
  18. if ($row1['ct'] == 1)
  19. {
  20. echo "<br>Welcome Back ".$var1."!<BR>";
  21. }
  22. else
  23. {
  24.  
  25. echo "<br>Hey...its your first time. Welcome!<br>";
  26. mysql_query("INSERT INTO users (name, gender, email, fid, link) VALUES ('".$var1."','".$var2."','".$var3."','".$var4."','".$var5."')")or die(mysql_error());
  27. }
  28.  
  29.  
  30. ?><br /><br />
  31. Classes that students at Hofstra have enrolled in...<br /><br />
  32. <?
  33.  
  34. $query = "SELECT * from class order by day ASC";
  35. $result = mysql_query($query);
  36.  
  37. $printedTitle = 0;
  38. $printedTitle2 = 0;
  39.  
  40. while ($row = mysql_fetch_array($result))
  41. {
  42.  
  43. if ($printedTitle == 0 && $row['day'] == "MWF")
  44. {
  45. echo "Classes that run on Monday, Wed & Fridays<br>";
  46. $printedTitle++;
  47. }
  48.  
  49. if ($printedTitle2 == 0 && $row['day'] == "TTH")
  50. {
  51. echo "Classes that run on Tuesdays and Thursdays<br>";
  52. $printedTitle2++;
  53. }
  54.  
  55.  
  56. echo $row['className'] ." at ".
  57. $row['time'].
  58. $row['day']." is in the department of ".$row['dept']."<a href='addfromindex.php?id=".$var4."&coursecode=".$row['className']."&time=".$row['time']."&day=".$row['day']."'>[+]</a><br>";
  59. }
  60. ?>
  61. <br />
  62. <br />
  63. Dont see your class here?
  64. <a href="addClass.php?id=<? echo $var4;?>">
  65. Lets Insert A Class Now!</a> or <a href="myclasses.php?id=<? echo $var4;?>">take a look at what classes you're in.</a>
  66. </body>
  67. </html>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.