Recent
:: anonymous
3 hrs ago
:: anonymous
9 hrs ago
:: anonymous
18 hrs ago
:: igd-jojo
1 day ago
:: jteam
1 day ago
:: anonymous
1 day ago
:: jteam
1 day ago
:: jteam
1 day ago
:: jteam
1 day ago
:: jteam
1 day ago
:: anonymous
1 day ago
:: This post is secret anonymous
1 day ago
:: anonymous
3 days ago
:: jteam
3 days ago
:: This post is secret anonymous
3 days ago
rss 2.0 feed

Make New Post
Posts: 22308

Syntax:       Wrapping:  

   #15409 Posted by anonymous 2009-07-04 20:21:25
Formated by GeSHi
  1. <?php
  2. include('db_connect.function.php');
  3. function login(){
  4. if($_SESSION['prihlaseny'] != 'ano'){
  5. echo "You are not logged in.<a href='login.php'>Click here to login.</a>";
  6. die();}
  7. if($_SESSION['prihlaseny'] == 'ano'){
  8. echo "<a href='logout.php?logout=yes'>Logout</a>";}
  9. }
  10.  
  11. function write_threads(){
  12. $nickname = $_SESSION['nickname'];
  13. $sql = "SELECT * FROM threads";
  14. $query = mysql_query($sql) or die(mysql_error());
  15. while($write = mysql_fetch_array($query)){
  16. echo "<a href=\"write.php?user=". htmlspecialchars($nickname) ."&thread=".htmlspecialchars((int) $write['id'])."\">".htmlspecialchars($write['title'])."</a><br>";}
  17. }
  18.  
  19. function write_topics(){
  20. $nickname = $_SESSION['nickname'];
  21. (int) $thread_id = (int) $_GET['thread'];
  22. $sql1 = "SELECT * FROM topics WHERE thread='" . $thread_id . "'";
  23. $query1 = mysql_query($sql1) or die(mysql_error());
  24. while($write1 = mysql_fetch_array($query1)){
  25. echo "<a href=\"write.php?user=". htmlspecialchars($nickname) ."&thread=".htmlspecialchars((int) $write1['thread']). "&topic=".htmlspecialchars((int) $write1['id'])."\">". htmlspecialchars($write1['title'])."</a><br>";
  26. }
  27.  
  28. (int) $test = (int) $_GET['thread'];
  29. if(!empty($test)){
  30. echo "";}
  31. else{write_threads();}
  32. }
  33. function write_back(){
  34. $nickname = $_SESSION['nickname'];
  35. if(!empty($_GET['thread']) && empty($_GET['topic'])){
  36. echo "<a href=\"write.php?user=".htmlspecialchars($nickname)."\">Back on threads</a>";}
  37. }
  38. write_back();
  39. function write_posts(){
  40. $nickname = $_SESSION['nickname'];
  41. (int) $topic = (int) $_GET['topic'];
  42. if(!empty($topic)){echo "<a href=\"write.php?user=".htmlspecialchars($nickname)."&thread=".htmlspecialchars($topic)."\">Back on topics</a>";}
  43. $sql2 = "SELECT * FROM posts WHERE topic='". $topic ."'";
  44. $query2 =mysql_query($sql2) or die(mysql_error());
  45. while($write2 = mysql_fetch_array($query2)){
  46. echo htmlspecialchars($write2['author']);
  47. echo htmlspecialchars($write2['content']);}
  48.  
  49. (int) $test1 = (int) $_GET['topic'];
  50. if(!empty($test1)){
  51. echo "";}
  52. else{write_topics();}
  53. }
  54.  
  55.  
  56.  
  57.  
  58.  
  59. ?>
Parsed in 0.25430012 seconds
::  Inline view Inline view ::  Email this post Email  ::  Print Print   

:: Download   Download Text File15409.txt   Download Gziped text File15409.txt.gz   Download HTML File15409.html   Download PDF File15409.pdf
:: Print into    Print into HTML FileHTML document   Print into PDF FilePDF document

:: Make Diff

:: Erase Post

* Code:

To highlight particular lines, prefix each line with @@


Description:


Secret key (for later deletion)
Syntax:     


comments (0)


Copyright © 2006 Openpastebin