3v4l.org

run code in 300+ PHP versions simultaneously
<?php require_once('config.php'); // page title $pagetitle="Results - ".$sitename; require_once('login.php'); $totalmarks = '50'; $passingmarks = '18'; $totalpassing = '33'; // total passing percentage ?> <!DOCTYPE html> <html> <head> <title><?=$pagetitle?></title> <script> function printpage() { window.print() } </script> </head> <body style="text-align:center"> <?php if($_GET['id']){ $id=mysql_real_escape_string($_GET['id']); $uq=mysql_query("SELECT * FROM $tbl_name WHERE id='$id'") or die("ERROR"); $u=mysql_fetch_array($uq); $user_name=$u['user_name']; $rq=mysql_query("SELECT * FROM $tbl2 WHERE user='$user_name'") or die("Error fetching result"); ?> <div class="content2" style="center;width:780px"> <div style="text-align:center;margin-bottom:20px;overflow:hidden"> <a style="float:right;" href="#" onClick="printpage()">Print</a> <a href="/" ><img style="width: 500px;height: 130px;" src="images/logo-main.png" alt="logo" title="The Lahore Institute" /></a> <hr/> </div> <div> <div style="font-weight:bold;text-align:center;margin-bottom:10px;"> Roll No: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <?=$u['id']?><br/> Name: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?=$u['fullname']?><br/> </div> <table width="450" border="0" align="center" cellpadding="1" cellspacing="0" style="border:1px solid #666;border-radius:10px;"> <tr bgcolor="#003063"> <td style="padding:5px;"><strong style="color:#fff">Name of Paper </strong></td> <td style="padding:5px;"><div style="color:#fff" align="center"><strong>Marks Obtained</strong></div></td> <td style="padding:5px;"><div style="color:#fff" align="center"><strong>Total Marks</strong></div></td> <td style="padding:5px;"><div style="color:#fff" align="center"><strong>Status</strong></div></td> </tr> <?php while($r=mysql_fetch_array($rq)){ $i='0'; $i++; if($_SESSION['allmarks']){ $_SESSION['allmarks']=$_SESSION['allmarks']+$r['marks']; } else { $_SESSION['allmarks']=$r['marks']; } echo "<tr>"; if($r['marks']<$passingmarks){ $status='Fail'; } echo '<td style="padding:5px;" align="left">'.$r['subject'].'</td>'; echo '<td style="padding:5px;"><div align="center"><em><strong>'.$r['marks'].'</strong></em></div></td>'; echo '<td style="padding:5px;"><div align="center">'.$totalmarks.'</div></td>'; echo '<td style="padding:5px;"><div align="center">'.$status.'</div></td>'; echo "</tr>"; ?> <?php } $totalall=$i*$totalmarks; $totallgained=$_SESSION['allmarks']; if($totallgained*100/$totallall<$totalpassing){ $fstatus='Failed'; } else { $fstatus='Passed'; } if($fstatus!=='Failed'){ $comments=$passingcomments; } else { $comments=$failingcomments; } ?> </table> <div style="margin-top:10px;text-align:center;font-weight:bold;">Total Marks: <?=$totalgained?><br/>Final Status: <?=$fstatus?><br/>Comments: <?=$comments?><br/></div> </div> </div> </body> </html> <?php } else { require_once('header.php'); ?> <div class="content2"> <h2>Get Result</h2><hr/> <div style="text-align:center"> <span style="color:#F00">*</span> &nbsp; Enter your Roll number and click GET to get your result<br /> <br /> <br /> <form action="result.php" method="get"> <input type="text" name="id" id="id" placeholder="Enter Roll No." size="35" /><br /> <br /> <input style="width: 100px;" type="submit" name="Submit" value="GET" /> </form> </div> </div> <?php require_once('footer.php'); } ?>
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
Warning: require_once(): open_basedir restriction in effect. File(config.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/TgL8O on line 2 Warning: require_once(config.php): Failed to open stream: Operation not permitted in /in/TgL8O on line 2 Fatal error: Uncaught Error: Failed opening required 'config.php' (include_path='.:') in /in/TgL8O:2 Stack trace: #0 {main} thrown in /in/TgL8O on line 2
Process exited with code 255.
Output for 8.0.13
Warning: require_once(config.php): Failed to open stream: No such file or directory in /in/TgL8O on line 2 Fatal error: Uncaught Error: Failed opening required 'config.php' (include_path='.:') in /in/TgL8O:2 Stack trace: #0 {main} thrown in /in/TgL8O on line 2
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.36, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.3.32 - 7.3.33, 7.4.26, 7.4.33
Warning: require_once(config.php): failed to open stream: No such file or directory in /in/TgL8O on line 2 Fatal error: require_once(): Failed opening required 'config.php' (include_path='.:') in /in/TgL8O on line 2
Process exited with code 255.
Output for 7.1.25 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.25, 7.4.27 - 7.4.32
Warning: require_once(): open_basedir restriction in effect. File(config.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/TgL8O on line 2 Warning: require_once(config.php): failed to open stream: Operation not permitted in /in/TgL8O on line 2 Fatal error: require_once(): Failed opening required 'config.php' (include_path='.:') in /in/TgL8O on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5
Warning: main(config.php): failed to open stream: No such file or directory in /in/TgL8O on line 2 Fatal error: main(): Failed opening required 'config.php' (include_path='.:') in /in/TgL8O on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: main(config.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/TgL8O on line 2 Fatal error: main() [http://www.php.net/function.main]: Failed opening required 'config.php' (include_path='.:') in /in/TgL8O on line 2

preferences:
265.13 ms | 402 KiB | 389 Q