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>
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
<? 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= Fatal error: Uncaught Error: Undefined constant "id" in /in/QPhKW:62 Stack trace: #0 {main} thrown in /in/QPhKW on line 62
Process exited with code 255.
Output for 8.0.13
Warning: include(db_info.php): Failed to open stream: No such file or directory in /in/QPhKW on line 2 Warning: include(): Failed opening 'db_info.php' for inclusion (include_path='.:') in /in/QPhKW on line 2 Warning: Undefined array key "level" in /in/QPhKW on line 4 <script>alert('error');history.back(-1)</script> Fatal error: Uncaught Error: Undefined constant "no" in /in/QPhKW:10 Stack trace: #0 {main} thrown in /in/QPhKW on line 10
Process exited with code 255.
Output for 7.2.0, 7.4.33
Warning: include(db_info.php): failed to open stream: No such file or directory in /in/QPhKW on line 2 Warning: include(): Failed opening 'db_info.php' for inclusion (include_path='.:') in /in/QPhKW on line 2 Notice: Undefined index: level in /in/QPhKW on line 4 <script>alert('error');history.back(-1)</script> Warning: Use of undefined constant no - assumed 'no' (this will throw an Error in a future version of PHP) in /in/QPhKW on line 10 Notice: Undefined index: no in /in/QPhKW on line 10 Notice: Undefined index: search in /in/QPhKW on line 11 Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/QPhKW:22 Stack trace: #0 {main} thrown in /in/QPhKW on line 22
Process exited with code 255.
Output for 7.4.0 - 7.4.32
<? 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= Warning: Use of undefined constant id - assumed 'id' (this will throw an Error in a future version of PHP) in /in/QPhKW on line 62 Notice: Undefined variable: row in /in/QPhKW on line 62 Notice: Trying to access array offset on value of type null in /in/QPhKW on line 62 &no= Notice: Undefined variable: no in /in/QPhKW on line 62 "> Warning: Use of undefined constant id - assumed 'id' (this will throw an Error in a future version of PHP) in /in/QPhKW on line 63 Notice: Undefined variable: row in /in/QPhKW on line 63 Notice: Trying to access array offset on value of type null in /in/QPhKW on line 63 </a> </td> <td height=20>&nbsp;<a href="read.php?id= Warning: Use of undefined constant id - assumed 'id' (this will throw an Error in a future version of PHP) in /in/QPhKW on line 65 Notice: Undefined variable: row in /in/QPhKW on line 65 Notice: Trying to access array offset on value of type null in /in/QPhKW on line 65 &no= Notice: Undefined variable: no in /in/QPhKW on line 65 "> Warning: Use of undefined constant title - assumed 'title' (this will throw an Error in a future version of PHP) in /in/QPhKW on line 66 Notice: Undefined variable: row in /in/QPhKW on line 66 Notice: Trying to access array offset on value of type null in /in/QPhKW on line 66 </a> </td> <td align=center height=20> <a href="mailto: Warning: Use of undefined constant email - assumed 'email' (this will throw an Error in a future version of PHP) in /in/QPhKW on line 69 Notice: Undefined variable: row in /in/QPhKW on line 69 Notice: Trying to access array offset on value of type null in /in/QPhKW on line 69 "> Warning: Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /in/QPhKW on line 70 Notice: Undefined variable: row in /in/QPhKW on line 70 Notice: Trying to access array offset on value of type null in /in/QPhKW on line 70 </a> </td> <td align=center height=20> Warning: Use of undefined constant wdate - assumed 'wdate' (this will throw an Error in a future version of PHP) in /in/QPhKW on line 72 Notice: Undefined variable: row in /in/QPhKW on line 72 Notice: Trying to access array offset on value of type null in /in/QPhKW on line 72 </td> <td align=center height=20> Warning: Use of undefined constant view - assumed 'view' (this will throw an Error in a future version of PHP) in /in/QPhKW on line 74 Notice: Undefined variable: row in /in/QPhKW on line 74 Notice: Trying to access array offset on value of type null in /in/QPhKW on line 74 </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>
Output for 7.3.32 - 7.3.33
Warning: include(db_info.php): failed to open stream: No such file or directory in /in/QPhKW on line 2 Warning: include(): Failed opening 'db_info.php' for inclusion (include_path='.:') in /in/QPhKW on line 2 <script>alert('error');history.back(-1)</script> Warning: Use of undefined constant no - assumed 'no' (this will throw an Error in a future version of PHP) in /in/QPhKW on line 10 Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/QPhKW:22 Stack trace: #0 {main} thrown in /in/QPhKW on line 22
Process exited with code 255.
Output for 7.2.29 - 7.2.33, 7.3.16 - 7.3.31
<? 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= Warning: Use of undefined constant id - assumed 'id' (this will throw an Error in a future version of PHP) in /in/QPhKW on line 62 Notice: Undefined variable: row in /in/QPhKW on line 62 &no= Notice: Undefined variable: no in /in/QPhKW on line 62 "> Warning: Use of undefined constant id - assumed 'id' (this will throw an Error in a future version of PHP) in /in/QPhKW on line 63 Notice: Undefined variable: row in /in/QPhKW on line 63 </a> </td> <td height=20>&nbsp;<a href="read.php?id= Warning: Use of undefined constant id - assumed 'id' (this will throw an Error in a future version of PHP) in /in/QPhKW on line 65 Notice: Undefined variable: row in /in/QPhKW on line 65 &no= Notice: Undefined variable: no in /in/QPhKW on line 65 "> Warning: Use of undefined constant title - assumed 'title' (this will throw an Error in a future version of PHP) in /in/QPhKW on line 66 Notice: Undefined variable: row in /in/QPhKW on line 66 </a> </td> <td align=center height=20> <a href="mailto: Warning: Use of undefined constant email - assumed 'email' (this will throw an Error in a future version of PHP) in /in/QPhKW on line 69 Notice: Undefined variable: row in /in/QPhKW on line 69 "> Warning: Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /in/QPhKW on line 70 Notice: Undefined variable: row in /in/QPhKW on line 70 </a> </td> <td align=center height=20> Warning: Use of undefined constant wdate - assumed 'wdate' (this will throw an Error in a future version of PHP) in /in/QPhKW on line 72 Notice: Undefined variable: row in /in/QPhKW on line 72 </td> <td align=center height=20> Warning: Use of undefined constant view - assumed 'view' (this will throw an Error in a future version of PHP) in /in/QPhKW on line 74 Notice: Undefined variable: row in /in/QPhKW on line 74 </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>
Output for 7.2.6
Warning: include(): open_basedir restriction in effect. File(db_info.php) is not within the allowed path(s): (/tmp:/in) in /in/QPhKW on line 2 Warning: include(db_info.php): failed to open stream: Operation not permitted in /in/QPhKW on line 2 Warning: include(): Failed opening 'db_info.php' for inclusion (include_path='.:') in /in/QPhKW on line 2 Notice: Undefined index: level in /in/QPhKW on line 4 <script>alert('error');history.back(-1)</script> Warning: Use of undefined constant no - assumed 'no' (this will throw an Error in a future version of PHP) in /in/QPhKW on line 10 Notice: Undefined index: no in /in/QPhKW on line 10 Notice: Undefined index: search in /in/QPhKW on line 11 Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/QPhKW:22 Stack trace: #0 {main} thrown in /in/QPhKW on line 22
Process exited with code 255.
Output for 7.1.20
Warning: include(): open_basedir restriction in effect. File(db_info.php) is not within the allowed path(s): (/tmp:/in) in /in/QPhKW on line 2 Warning: include(db_info.php): failed to open stream: Operation not permitted in /in/QPhKW on line 2 Warning: include(): Failed opening 'db_info.php' for inclusion (include_path='.:') in /in/QPhKW on line 2 Notice: Undefined index: level in /in/QPhKW on line 4 <script>alert('error');history.back(-1)</script> Notice: Use of undefined constant no - assumed 'no' in /in/QPhKW on line 10 Notice: Undefined index: no in /in/QPhKW on line 10 Notice: Undefined index: search in /in/QPhKW on line 11 Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/QPhKW:22 Stack trace: #0 {main} thrown in /in/QPhKW on line 22
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.10
Warning: include(db_info.php): failed to open stream: No such file or directory in /in/QPhKW on line 2 Warning: include(): Failed opening 'db_info.php' for inclusion (include_path='.:') in /in/QPhKW on line 2 Notice: Undefined index: level in /in/QPhKW on line 4 <script>alert('error');history.back(-1)</script> Notice: Use of undefined constant no - assumed 'no' in /in/QPhKW on line 10 Notice: Undefined index: no in /in/QPhKW on line 10 Notice: Undefined index: search in /in/QPhKW on line 11 Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/QPhKW:22 Stack trace: #0 {main} thrown in /in/QPhKW on line 22
Process exited with code 255.
Output for 5.4.1 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Warning: include(db_info.php): failed to open stream: No such file or directory in /in/QPhKW on line 2 Warning: include(): Failed opening 'db_info.php' for inclusion (include_path='.:') in /in/QPhKW on line 2 Notice: Undefined index: level in /in/QPhKW on line 4 <script>alert('error');history.back(-1)</script> Notice: Use of undefined constant no - assumed 'no' in /in/QPhKW on line 10 Notice: Undefined index: no in /in/QPhKW on line 10 Notice: Undefined index: search in /in/QPhKW on line 11 Fatal error: Call to undefined function mysql_query() in /in/QPhKW on line 22
Process exited with code 255.

preferences:
202.12 ms | 402 KiB | 227 Q