3v4l.org

run code in 300+ PHP versions simultaneously
<?php /*************** PHP LOGIN SCRIPT V 2.0********************* ***************** Auto Approve Version********************** (c) Balakrishnan 2009. All Rights Reserved Usage: This script can be used FREE of charge for any commercial or personal projects. Limitations: - This script cannot be sold. - This script may not be provided for download except on its original site. For further usage, please contact me. ***********************************************************/ include 'dbc.php'; $err = array(); /********** formulier verzonden***************************/ if($_SERVER['REQUEST_METHOD']=="POST") { echo "Je formulier is via POST verstuurd"; } else { echo "Je formulier is niet verstuurd. Hier kan je bijvoorbeeld je formulier tonen"; } if($_SERVER['REQUEST_METHOD']=="POST") { /******************* Filtering/Sanitizing Input ***************************** This code filters harmful script code and escapes data of all POST data from the user submitted form. *****************************************************************/ foreach($_POST as $key => $value) { $data[$key] = filter($value); } /********************* RECAPTCHA CHECK ******************************* This code checks and validates recaptcha ****************************************************************/ /** * Sample PHP code to use reCAPTCHA V2. * * @copyright Copyright (c) 2014, Google Inc. * @link http://www.google.com/recaptcha * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ require_once "recaptchalib.php"; // Register API keys at https://www.google.com/recaptcha/admin $siteKey = "*********************************ui"; $secret = "**********************************rS"; // reCAPTCHA supported 40+ languages listed here: https://developers.google.com/recaptcha/docs/language $lang = "en"; // The response from reCAPTCHA $resp = null; // The error code from reCAPTCHA, if any $error = null; $reCaptcha = new ReCaptcha($secret); // Was there a reCAPTCHA response? if ($_POST["g-recaptcha-response"]) { $resp = $reCaptcha->verifyResponse( $_SERVER["REMOTE_ADDR"], $_POST["g-recaptcha-response"] ); } /************************ SERVER SIDE VALIDATION **************************************/ /********** This validation is useful if javascript is disabled in the browswer ***/ if(empty($data['full_name']) || strlen($data['full_name']) < 4) { $err[] = "ERROR - Invalid name. Please enter atleast 3 or more characters for your name"; //header("Location: register.php?msg=$err"); //exit(); } // Validate User Name if (!isUserID($data['user_name'])) { $err[] = "ERROR - Invalid user name. It can contain alphabet, number and underscore."; //header("Location: register.php?msg=$err"); //exit(); } // Validate Email if(!isEmail($data['usr_email'])) { $err[] = "ERROR - Invalid email address."; //header("Location: register.php?msg=$err"); //exit(); } // Check User Passwords if (!checkPwd($data['pwd'],$data['pwd2'])) { $err[] = "ERROR - Invalid Password or mismatch. Enter 5 chars or more"; //header("Location: register.php?msg=$err"); //exit(); } // ReCapcha check if ($resp != null && $resp->success) { echo "You got it!"; } $user_ip = $_SERVER['REMOTE_ADDR']; // stores sha1 of password $sha1pass = PwdHash($data['pwd']); // Automatically collects the hostname or domain like example.com) $host = $_SERVER['HTTP_HOST']; $host_upper = strtoupper($host); $path = rtrim(dirname($_SERVER['PHP_SELF']), '/\\'); // Generates activation code simple 4 digit number $activ_code = rand(1000,9999); $usr_email = $data['usr_email']; $user_name = $data['user_name']; /************ USER EMAIL CHECK ************************************ This code does a second check on the server side if the email already exists. It queries the database and if it has any existing email it throws user email already exists *******************************************************************/ $rs_duplicate = mysql_query("select count(*) as total from users where user_email='$usr_email' OR user_name='$user_name'") or die(mysql_error()); list($total) = mysql_fetch_row($rs_duplicate); if ($total > 0) { $err[] = "ERROR - The username/email already exists. Please try again with different username and email."; //header("Location: register.php?msg=$err"); //exit(); } /***************************************************************************/ if(empty($err)) { $sql_insert = "INSERT into `users` (`full_name`,`user_email`,`pwd`,`address`,`tel`,`fax`,`website`,`date`,`users_ip`,`activation_code`,`country`,`user_name` ) VALUES ('$data[full_name]','$usr_email','$sha1pass','$data[address]','$data[tel]','$data[fax]','$data[web]' ,now(),'$user_ip','$activ_code','$data[country]','$user_name' ) "; mysql_query($sql_insert,$link) or die("Insertion Failed:" . mysql_error()); $user_id = mysql_insert_id($link); $md5_id = md5($user_id); mysql_query("update users set md5_id='$md5_id' where id='$user_id'"); // echo "<h3>Thank You</h3> We received your submission."; if($user_registration) { $a_link = " *****ACTIVATION LINK*****\n http://$host$path/activate.php?user=$md5_id&activ_code=$activ_code "; } else { $a_link = "Your account is *PENDING APPROVAL* and will be soon activated the administrator. "; } $message = "Hello \n Thank you for registering with us. Here are your login details...\n User ID: $user_name Email: $usr_email \n Passwd: $data[pwd] \n $a_link Thank You Administrator $host_upper ______________________________________________________ THIS IS AN AUTOMATED RESPONSE. ***DO NOT RESPOND TO THIS EMAIL**** "; mail($usr_email, "Login Details", $message, "From: \"Member Registration\" <mijn Mailadrss>\r\n" . "X-Mailer: PHP/" . phpversion()); header("Location: thankyou.php"); exit(); } } ?> <?php <html> <head> <title>PHP Login :: Free Registration/Signup Form</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript" type="text/javascript" src="js/jquery-1.3.2.min.js"></script> <script language="JavaScript" type="text/javascript" src="js/jquery.validate.js"></script> <script> $(document).ready(function(){ $.validator.addMethod("username", function(value, element) { return this.optional(element) || /^[a-z0-9\_]+$/i.test(value); }, "Username must contain only letters, numbers, or underscore."); $("#regForm").validate(); }); </script> <link href="styles.css" rel="stylesheet" type="text/css"> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="5" class="main"> <tr> <td colspan="3">&nbsp;</td> </tr> <tr> <td width="160" valign="top"><p>&nbsp;</p> <p>&nbsp; </p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p></td> <td width="732" valign="top"><p> <?php if (isset($_GET['done'])) { ?> <h2>Thank you</h2> Your registration is now complete and you can <a href="login.php">login here</a>"; <?php exit(); } ?></p> <h3 class="titlehdr">Free Registration / Signup</h3> <p>Please register a free account, before you can start posting your ads. Registration is quick and free! Please note that fields marked <span class="required">*</span> are required.</p> <?php if(!empty($err)) { echo "<div class=\"msg\">"; foreach ($err as $e) { echo "* $e <br>"; } echo "</div>"; } ?> <br> <form action="register.php" method="post" name="regForm" id="regForm" > <table width="95%" border="0" cellpadding="3" cellspacing="3" class="forms"> <tr> <td colspan="2">Your Name / Company Name<span class="required"><font color="#CC0000">*</font></span><br> <input name="full_name" type="text" id="full_name" size="40" class="required"></td> </tr> <tr> <td colspan="2">&nbsp;</td> </tr> <tr> <td colspan="2">Contact Address (with ZIP)<span class="required"><font color="#CC0000">*</font></span><br> <textarea name="address" cols="40" rows="4" id="address" class="required"></textarea> <span class="example">VALID CONTACT DETAILS</span> </td> </tr> <tr> <td>Country <font color="#CC0000">*</font></span></td> </tr> <tr> <td>Phone<span class="required"><font color="#CC0000">*</font></span> </td> <td><input name="tel" type="text" id="tel" class="required"></td> </tr> <tr> <td>Fax </td> <td><input name="fax" type="text" id="fax"> </td> </tr> <tr> <td>Website </td> <td><input name="web" type="text" id="web" class="optional defaultInvalid url"> <span class="example">http://www.example.com</span></td> </tr> <tr> <td colspan="2">&nbsp;</td> </tr> <tr> <td colspan="2"><h4><strong>Login Details</strong></h4></td> </tr> <tr> <td>Username<span class="required"><font color="#CC0000">*</font></span></td> <td><input name="user_name" type="text" id="user_name" class="required username" minlength="5" > <input name="btnAvailable" type="button" id="btnAvailable" onclick='$("#checkid").html("Please wait..."); $.get("checkuser.php",{ cmd: "check", user: $("#user_name").val() } ,function(data){ $("#checkid").html(data); });' value="Check Availability"> <span style="color:red; font: bold 12px verdana; " id="checkid" ></span> </td> </tr> <tr> <td>Your Email<span class="required"><font color="#CC0000">*</font></span> </td> <td><input name="usr_email" type="text" id="usr_email3" class="required email"> <span class="example">** Valid email please..</span></td> </tr> <tr> <td>Password<span class="required"><font color="#CC0000">*</font></span> </td> <td><input name="pwd" type="password" class="required password" minlength="5" id="pwd"> <span class="example">** 5 chars minimum..</span></td> </tr> <tr> <td>Retype Password<span class="required"><font color="#CC0000">*</font></span> </td> <td><input name="pwd2" id="pwd2" class="required password" type="password" minlength="5" equalto="#pwd"></td> </tr> <tr> <td colspan="2">&nbsp;</td> </tr> <tr> <td width="22%"><strong>Image Verification </strong></td> <td width="78%"> <div class="g-recaptcha" data-sitekey="<?php echo $siteKey;?>"></div> <script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl=<?php echo $lang;?>"> </script> <br/> </td> </tr> </table> <p align="center"> <input name="doRegister" type="submit" id="doRegister" value="Register"> </p> </form> <p align="right"><span style="font: normal 9px verdana">Powered by <a href="http://php-login-script.com">PHP Login Script v2.0</a></span></p> </td> <td width="196" valign="top">&nbsp;</td> </tr> <tr> <td colspan="3">&nbsp;</td> </tr> </table> </body> </html>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.360.0230.04318.80
5.4.350.0130.03014.04
5.4.340.0030.04013.77
5.4.320.0100.03714.46
5.4.310.0070.04014.31
5.4.300.0000.04714.50
5.4.290.0000.04714.31
5.4.280.0170.03314.16
5.4.270.0070.03714.21
5.4.260.0100.03714.16
5.4.250.0130.03314.26
5.4.240.0070.03714.39
5.4.230.0070.04014.25
5.4.220.0100.03714.23
5.4.210.0170.03714.23
5.4.200.0030.04314.46
5.4.190.0000.04314.20
5.4.180.0070.04014.20
5.4.170.0070.03714.29
5.4.160.0030.04014.21
5.4.150.0170.03314.19
5.4.140.0070.05013.88
5.4.130.0070.03713.80
5.4.120.0100.04313.94
5.4.110.0030.05013.76
5.4.100.0030.04713.75
5.4.90.0070.04313.79
5.4.80.0070.03713.81
5.4.70.0100.05313.84
5.4.60.0000.05313.82
5.4.50.0070.04313.81
5.4.40.0200.02713.79
5.4.30.0070.04013.77
5.4.20.0100.03313.73
5.4.10.0070.03713.86
5.4.00.0000.04713.29
5.3.290.0130.03714.66
5.3.280.0100.04314.66
5.3.270.0070.04314.65
5.3.260.0070.05014.66
5.3.250.0170.03714.69
5.3.240.0100.04014.50
5.3.230.0030.04314.60
5.3.220.0070.04314.65
5.3.210.0130.03714.54
5.3.200.0100.03714.53
5.3.190.0000.05014.52
5.3.180.0030.04714.46
5.3.170.0030.04714.63
5.3.160.0130.03314.45
5.3.150.0100.04014.46
5.3.140.0100.03714.55
5.3.130.0100.04014.61
5.3.120.0070.04014.58
5.3.110.0030.04314.43
5.3.100.0100.04014.03
5.3.90.0130.03014.05
5.3.80.0070.03713.97
5.3.70.0130.03713.94
5.3.60.0100.04013.88
5.3.50.0100.03713.91
5.3.40.0130.03313.92
5.3.30.0100.03713.86
5.3.20.0130.03313.70
5.3.10.0100.03313.57
5.3.00.0170.03713.66
5.2.170.0070.03011.16
5.2.160.0000.03711.15
5.2.150.0100.03011.10
5.2.140.0070.03011.27
5.2.130.0070.03011.11
5.2.120.0170.02711.01
5.2.110.0130.03711.04
5.2.100.0170.03311.11
5.2.90.0100.02711.22
5.2.80.0130.02311.02
5.2.70.0100.02711.04
5.2.60.0100.04711.14
5.2.50.0030.03310.96
5.2.40.0070.02710.95
5.2.30.0030.03310.98
5.2.20.0100.02311.10
5.2.10.0030.03010.93
5.2.00.0000.03310.74
5.1.60.0030.02710.07
5.1.50.0070.02310.03
5.1.40.0000.03010.16
5.1.30.0100.02310.39
5.1.20.0070.03010.52
5.1.10.0000.03010.25
5.1.00.0070.03010.05
5.0.50.0100.0178.61
5.0.40.0030.0278.57
5.0.30.0000.0338.22
5.0.20.0070.0178.35
5.0.10.0000.0278.23
5.0.00.0030.0338.38
4.4.90.0100.0135.90
4.4.80.0070.0135.90
4.4.70.0070.0135.93
4.4.60.0070.0135.91
4.4.50.0070.0135.88
4.4.40.0030.0275.90
4.4.30.0030.0175.93
4.4.20.0000.0205.96
4.4.10.0000.0206.01
4.4.00.0000.0275.92
4.3.110.0000.0205.81
4.3.100.0030.0135.82
4.3.90.0030.0135.89
4.3.80.0000.0275.93
4.3.70.0000.0175.79
4.3.60.0000.0175.84
4.3.50.0030.0135.84
4.3.40.0030.0235.78
4.3.30.0070.0104.63
4.3.20.0000.0174.57
4.3.10.0000.0204.50
4.3.00.0030.0277.32

preferences:
149.03 ms | 1394 KiB | 7 Q