fork download
  1. <?php session_start();?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://w...content-available-to-author-only...3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://w...content-available-to-author-only...3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>無標題文件</title>
  7. </head>
  8. <body>
  9. <?php
  10.  
  11. $username=$_SESSION[name];
  12. $current_page=$_POST[current_page];
  13.  
  14. $current_board;
  15. $i=0;
  16. $total=0;
  17. $last_page;
  18. $last_k;
  19. $last_j;
  20. $page;
  21.  
  22. $link = mysql_pconnect("localhost", "root", "1234") or die("無法與MySQL建立連線");
  23. $select=mysql_select_db("cake") or die("無法選擇cake資料庫");
  24. $myquery = "select current_board from member where username='$username'";
  25. $current_board_result = mysql_query($myquery) or die("查詢 Query 錯誤");
  26. mysql_query("SET NAMES 'utf8'");
  27. while($current_board_row = mysql_fetch_array($current_board_result)){
  28. $current_board=$current_board_row[current_board];
  29. }
  30.  
  31. $myquery = "select current_page from member where username='$username'";
  32. $last_page_result = mysql_query($myquery) or die("查詢 Query 錯誤");
  33. mysql_query("SET NAMES 'utf8'");
  34. while($last_page_row = mysql_fetch_array($last_page_result)){
  35. $last_page=$last_page_row[current_page];
  36. }
  37. $myquery = "select id from article";
  38. $count_result = mysql_query($myquery) or die("查詢 Query 錯誤");
  39. mysql_query("SET NAMES 'utf8'");
  40. while($count_row = mysql_fetch_array($count_result)){
  41. $total++;
  42. }
  43.  
  44. if(($total%5)==0)
  45. $page=floor($total/5);
  46. else
  47. $page=ceil($total/5);
  48. if($current_page==1){
  49. $k=(5*$current_page)-5;
  50. $j=(5*$current_page);
  51.  
  52. }
  53. else if($current_page==$page){
  54. $k=$total-5;
  55. $j=$total;
  56. }
  57. else if(($last_page-$current_page)>0){
  58.  
  59. $myquery = "select current_k from member where username='$username'";
  60. $last_k_result = mysql_query($myquery) or die("查詢 Query 錯誤");
  61. mysql_query("SET NAMES 'utf8'");
  62. while($last_k_row = mysql_fetch_array($last_k_result)){
  63. $last_k=$last_k_row[current_k];
  64. }
  65.  
  66. $myquery = "select current_j from member where username='$username'";
  67. $last_j_result = mysql_query($myquery) or die("查詢 Query 錯誤");
  68. mysql_query("SET NAMES 'utf8'");
  69. while($last_j_row = mysql_fetch_array($last_j_result)){
  70. $last_j=$last_j_row[current_j];
  71. }
  72.  
  73. $k=$last_k-5;
  74. $j=$last_j-5;
  75.  
  76. }
  77. else if(($last_page-$current_page)<0){
  78.  
  79. $myquery = "select current_k from member where username='$username'";
  80. $last_k_result = mysql_query($myquery) or die("查詢 Query 錯誤");
  81. mysql_query("SET NAMES 'utf8'");
  82. while($last_k_row = mysql_fetch_array($last_k_result)){
  83. $last_k=$last_k_row[current_k];
  84. }
  85.  
  86. $myquery = "select current_j from member where username='$username'";
  87. $last_j_result = mysql_query($myquery) or die("查詢 Query 錯誤");
  88. mysql_query("SET NAMES 'utf8'");
  89. while($last_j_row = mysql_fetch_array($last_j_result)){
  90. $last_j=$last_j_row[current_j];
  91. }
  92. $k=$last_k+5;
  93. $j=$last_j+5;
  94. }
  95.  
  96. $myquery = "select id where board='$current_board' limit $k,$j ";
  97. $id_result = mysql_query($myquery) or die("查詢 Query 錯誤");
  98. mysql_query("SET NAMES 'utf8'");
  99. while($id_row = mysql_fetch_array($id_result)){
  100. $k++;
  101. echo "<div onmouseover=\"change_background(".$k.")\" id=\"".$k."\" style=\"background-color:white;\">";
  102. echo "<div id=\"z".($i+1)."\">";
  103. echo $k;
  104. echo "&nbsp;&nbsp;";
  105. echo "</div>";
  106. echo "</div>";
  107. $i++;
  108. if($i==5)
  109. break;
  110. }
  111. ?>
  112. </body>
  113. </html>
Runtime error #stdin #stdout #stderr 0.01s 20520KB
stdin
Standard input is empty
stdout
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://w...content-available-to-author-only...3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://w...content-available-to-author-only...3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文件</title>
</head>
<body>
stderr
PHP Warning:  session_start(): open(/var/lib/php5/sess_trkf8cq9htcrfhlgu93d1clc22, O_RDWR) failed: Permission denied (13) in /home/rLcC6Q/prog.php on line 1
PHP Notice:  Use of undefined constant name - assumed 'name' in /home/rLcC6Q/prog.php on line 11
PHP Notice:  Undefined index: name in /home/rLcC6Q/prog.php on line 11
PHP Notice:  Use of undefined constant current_page - assumed 'current_page' in /home/rLcC6Q/prog.php on line 12
PHP Notice:  Undefined index: current_page in /home/rLcC6Q/prog.php on line 12
PHP Fatal error:  Call to undefined function mysql_pconnect() in /home/rLcC6Q/prog.php on line 22
PHP Warning:  Unknown: open(/var/lib/php5/sess_trkf8cq9htcrfhlgu93d1clc22, O_RDWR) failed: Permission denied (13) in Unknown on line 0
PHP Warning:  Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php5) in Unknown on line 0