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(); } } ?> <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)
8.0.120.0000.00613.50
8.0.110.0000.01013.63
8.0.100.0110.00013.52
8.0.90.0080.00213.55
8.0.80.0060.00613.57
8.0.70.0060.00613.46
8.0.60.0090.00313.54
8.0.50.0120.00013.55
8.0.30.0120.00013.47
8.0.20.0090.00313.61
8.0.10.0100.00213.61
8.0.00.0030.00513.59
7.4.250.0000.00713.39
7.4.240.0000.01313.50
7.4.230.0090.00513.39
7.4.220.0120.00013.39
7.4.210.0040.00813.39
7.4.200.0090.00413.40
7.4.190.0080.00413.48
7.4.180.0070.00013.48
7.4.160.0040.00213.41
7.4.150.0030.00313.42
7.4.140.0080.00013.37
7.4.130.0080.00413.34
7.4.120.0040.00413.46
7.4.110.0030.00513.41
7.4.100.0080.00013.48
7.4.90.0020.00513.30
7.4.80.0040.00413.39
7.4.70.0000.00913.41
7.4.60.0000.00913.40
7.4.50.0050.00513.26
7.4.40.0090.00013.25
7.4.30.0040.00413.23
7.4.20.0070.00213.16
7.4.10.0050.00313.13
7.4.00.0090.00012.98
7.3.310.0080.00013.40
7.3.300.0000.00713.24
7.3.290.0000.00613.47
7.3.280.0060.00013.27
7.3.270.0060.00013.34
7.3.260.0060.00013.35
7.3.250.0030.00313.25
7.3.240.0000.00613.31
7.3.230.0060.00013.32
7.3.220.0060.00013.41
7.3.210.0060.00013.33
7.3.200.0000.00613.43
7.3.190.0060.00013.26
7.3.180.0030.00313.38
7.3.170.0000.00613.48
7.3.160.0060.00013.39
7.3.150.0000.00613.44
7.3.140.0030.00313.42
7.3.130.0060.00013.21
7.3.120.0030.00313.43
7.3.110.0000.00613.36
7.3.100.0030.00313.26
7.3.90.0000.00613.57
7.3.80.0000.00613.15
7.3.70.0000.00613.24
7.3.60.0030.00313.47
7.3.50.0060.00013.39
7.3.40.0000.00613.30
7.3.30.0060.00013.43
7.3.20.0070.00015.13
7.3.10.0000.00614.99
7.3.00.0030.00314.95
7.2.340.0080.00413.45
7.2.330.0140.00013.22
7.2.320.0100.00513.21
7.2.310.0120.00313.39
7.2.300.0140.00013.35
7.2.290.0040.00913.32
7.2.280.0060.00613.34
7.2.270.0090.00313.32
7.2.260.0110.00313.22
7.2.250.0130.00013.41
7.2.240.0100.00313.40
7.2.230.0120.00013.22
7.2.220.0050.00913.38
7.2.210.0120.00013.31
7.2.200.0090.00413.36
7.2.190.0130.00013.29
7.2.180.0060.00713.41
7.2.170.0120.00013.50
7.2.160.0090.00513.43
7.2.150.0140.00014.98
7.2.140.0060.00615.05
7.2.130.0100.00315.27
7.2.120.0040.00815.05
7.2.110.0090.00315.27
7.2.100.0120.00015.23
7.2.90.0110.00315.21
7.2.80.0060.00615.32
7.2.70.0080.00415.20
7.2.60.0080.00415.20
7.2.50.0140.00015.09
7.2.40.0120.00015.08
7.2.30.0090.00515.17
7.2.20.0060.00615.25
7.2.10.0040.00915.31
7.2.00.0050.00915.13
7.1.330.0120.00014.30
7.1.320.0080.00314.22
7.1.310.0080.00314.04
7.1.300.0090.00314.21
7.1.290.0100.00214.25
7.1.280.0120.00014.05
7.1.270.0110.00014.06
7.1.260.0120.00014.05
7.1.250.0000.01214.14
7.1.240.0000.01214.11
7.1.230.0100.00214.17
7.1.220.0060.00614.17
7.1.210.0060.00614.20
7.1.200.0120.00014.21
7.1.190.0100.00314.06
7.1.180.0120.00014.00
7.1.170.0080.00314.13
7.1.160.0100.00313.98
7.1.150.0100.00314.10
7.1.140.0000.01314.01
7.1.130.0100.00313.98
7.1.120.0100.00214.11
7.1.110.0120.00014.07
7.1.100.0100.00314.12
7.1.90.0100.00213.98
7.1.80.0090.00314.06
7.1.70.0060.00415.59
7.1.60.0060.00615.75
7.1.50.0060.00615.48
7.1.40.0090.00314.25
7.1.30.0100.00214.15
7.1.20.0120.00014.09
7.1.10.0000.01214.07
7.1.00.0050.04118.26
7.0.330.0060.00613.88
7.0.320.0080.00414.08
7.0.310.0090.00313.95
7.0.300.0090.00314.16
7.0.290.0090.00213.97
7.0.280.0120.00013.96
7.0.270.0060.00614.09
7.0.260.0120.00014.07
7.0.250.0120.00013.96
7.0.240.0040.00814.17
7.0.230.0120.00014.12
7.0.220.0060.00614.04
7.0.210.0080.00413.96
7.0.200.0090.00615.46
7.0.190.0100.00214.08
7.0.180.0000.01214.12
7.0.170.0110.00214.20
7.0.160.0060.00614.06
7.0.150.0120.00013.91
7.0.140.0050.04018.13
7.0.130.0120.00014.17
7.0.120.0060.00614.14
7.0.110.0090.00314.04
7.0.100.0110.03917.05
7.0.90.0100.04017.01
7.0.80.0090.03916.96
7.0.70.0110.02517.02
7.0.60.0060.04516.99
7.0.50.0090.01617.09
7.0.40.0090.02017.05
7.0.30.0090.02217.04
7.0.20.0070.02716.95
7.0.10.0050.03816.98
7.0.00.0090.04217.04
5.6.400.0030.00812.74
5.6.390.0090.00312.78
5.6.380.0080.00412.64
5.6.370.0120.00012.92
5.6.360.0100.00212.77
5.6.350.0090.00312.88
5.6.340.0120.00012.77
5.6.330.0040.00712.63
5.6.320.0060.00612.65
5.6.310.0060.00612.75
5.6.300.0120.00012.70
5.6.290.0060.00612.95
5.6.280.0070.03716.79
5.6.270.0090.00312.78
5.6.260.0040.00812.95
5.6.250.0040.03716.78
5.6.240.0120.03416.75
5.6.230.0110.04016.65
5.6.220.0080.04016.72
5.6.210.0090.02616.78
5.6.200.0140.01816.95
5.6.190.0040.04317.00
5.6.180.0050.02516.93
5.6.170.0050.02416.82
5.6.160.0120.04016.92
5.6.150.0060.02616.97
5.6.140.0090.04216.89
5.6.130.0100.04516.83
5.6.120.0140.03016.86
5.6.110.0090.04016.76
5.6.100.0050.04616.91
5.6.90.0110.02216.88
5.6.80.0090.04116.66
5.6.70.0040.03616.79
5.6.60.0090.02316.62
5.6.50.0090.02216.66
5.6.40.0050.03216.58
5.6.30.0050.03916.55
5.6.20.0090.04116.52
5.6.10.0050.04016.55
5.6.00.0190.02816.62
5.5.380.0090.03016.64
5.5.370.0110.04016.73
5.5.360.0090.04016.67
5.5.350.0140.03516.55
5.5.340.0080.02316.74
5.5.330.0080.02216.87
5.5.320.0110.03816.81
5.5.310.0090.04116.75
5.5.300.0070.04216.72
5.5.290.0160.03216.85
5.5.280.0130.04016.78
5.5.270.0090.03816.67
5.5.260.0050.04616.77
5.5.250.0130.02316.81
5.5.240.0050.04116.45
5.5.230.0070.03916.47
5.5.220.0090.02316.37
5.5.210.0070.04016.55
5.5.200.0120.02016.34
5.5.190.0140.01816.46
5.5.180.0090.04016.48
5.5.170.0110.00012.66
5.5.160.0150.03816.44
5.5.150.0060.02816.41
5.5.140.0080.02316.49
5.5.130.0120.02316.35
5.5.120.0080.02516.44
5.5.110.0040.03116.44
5.5.100.0070.04016.47
5.5.90.0070.02216.32
5.5.80.0030.04116.44
5.5.70.0080.03816.32
5.5.60.0110.03616.41
5.5.50.0090.03516.48
5.5.40.0070.03916.51
5.5.30.0090.02316.34
5.5.20.0110.03316.30
5.5.10.0050.03016.33
5.5.00.0030.02816.30
5.4.450.0080.04416.04
5.4.440.0020.04716.12
5.4.430.0090.03416.00
5.4.420.0110.03915.94
5.4.410.0060.02115.82
5.4.400.0030.04015.87
5.4.390.0060.04115.72
5.4.380.0090.03215.87
5.4.370.0120.03515.79
5.4.360.0040.04415.82
5.4.350.0090.03415.91
5.4.340.0110.03515.80
5.4.330.0120.00012.55
5.4.320.0080.03815.88
5.4.310.0140.02216.01
5.4.300.0040.02715.90
5.4.290.0040.02615.82
5.4.280.0050.02515.83
5.4.270.0080.03715.73
5.4.260.0090.03815.96
5.4.250.0050.03415.80
5.4.240.0050.03515.79
5.4.230.0050.04415.66
5.4.220.0050.04215.75
5.4.210.0050.02815.80
5.4.200.0080.02415.86
5.4.190.0100.03715.79
5.4.180.0060.03615.77
5.4.170.0070.03315.85
5.4.160.0060.02115.75
5.4.150.0060.02315.96
5.4.140.0060.01914.53
5.4.130.0100.01414.49
5.4.120.0040.02114.60
5.4.110.0030.02214.49
5.4.100.0050.02014.47
5.4.90.0050.02014.62
5.4.80.0100.01314.54
5.4.70.0060.02014.59
5.4.60.0040.02214.45
5.4.50.0050.01814.51
5.4.40.0030.02114.53
5.4.30.0030.01914.57
5.4.20.0050.02014.64
5.4.10.0080.01714.48
5.4.00.0070.01814.13

preferences:
41.18 ms | 403 KiB | 5 Q