3v4l.org

run code in 300+ PHP versions simultaneously
<? include "db_info.php"; if(!$_COOKIE['level']){ echo "<script>alert('error');history.back(-1)</script>"; } $page_size=10; $page_list_size=10; $no = $_GET[no]; $search = $_GET['search']; if(!$no || $no<0) $no =0; if($search){ $query = "select * from board where title like '%$search%' or content like '%$search%' order by id desc limit $no, $page_size"; $result_count=mysql_query("select count(*) from board where title like '%$search%' or content like '%$search%'", $conn); }else{ $query = "select * from board order by id desc limit $no, $page_size"; $result_count=mysql_query("select count(*) from board", $conn); } echo "$query<br><br><br>"; $result = mysql_query($query, $conn); $result_row = mysql_fetch_row($result_count); $total_row = $result_row[0]; if($total_row <= 0) $total_row = 0; $total_page = ceil($total_row / $page_size); $current_page = ceil(($no+1)/$page_size); ?> <html> <head> <title>board</title> <br> <table> <tr> <td><a font size=2>yeonghoo2.com</a></td> <td width=280></td> <td align=left><form action=list.php method=get> <input type=text name=search> <input type=submit value=search> </form> </td> <table witdh=500 border=1 cellpadding=0 cellspacing=0> <tr height=20> <td width=30 align=center>no</td> <td width=370 align=center>title</td> <td width=50 align=center>user</td> <td width=60 align=center>date</td> <td width=40 align=center>view</td> </tr> <? while($row=mysql_fetch_array($result)){ ?> <tr> <td height=20 align=center> <a href="read.php?id=<?=$row[id]?>&no=<?=$no?>"> <?=$row[id]?></a> </td> <td height=20>&nbsp;<a href="read.php?id=<?=$row[id]?>&no=<?=$no?>"> <?=strip_tags($row[title],'<b><i>');?></a> </td> <td align=center height=20> <a href="mailto:<?=$row[email]?>"> <?=$row[name]?></a> </td> <td align=center height=20><?=$row[wdate]?> </td> <td align=center height=20><?=$row[view]?> </td> </tr> <? } mysql_close($conn); ?> </table> <table border=0> <tr> <td width=600 height=20 align=center rowspan=4> <? $start_page = floor(($current_page -1 ) / $page_list_size) * $page_list_size + 1; $end_page = $start_page + $page_list_size -1; if($total_page < $end_page) $end_page = $total_page; if(start_page >= $page_list_size){ $prev_list = ($start_page - 2) * $page_size; echo "<a href='$PHP_SELF?no=prev_list'><</a>"; } for($i=$start_page; $i<=$end_page; $i++){ $page= ($i-1)*$page_size; if($no != $page){ if(!$search){ echo "<a href='$PHP_SELF?no=$page'>"; }else{ echo "<a href='$PHP_SELF?no=$page&search=$search'>"; } } echo "$i&nbsp;"; if($no != $page ){ echo "</a>"; } } if($total_page > $end_page){ $next_list = $end_page * $page_size; echo "<a href=$PHP_SELF?no=$next_list>></a><p>"; } ?> </td> </tr> </table> <a href=write.php>write</a> <a href=logout.php>logout</a> </center> <? if($_COOKIE['level']==99){ echo "<a href=adm.php>adminpage</a>"; } ?> </html>

preferences:
47.98 ms | 402 KiB | 5 Q