3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL & ~E_NOTICE); //MySQL database connection information //MySQL connection information: $mysql_host = "localhost"; //Host Name $mysql_user = "User"; //Username $mysql_pass = "User4812A"; //Password $mysql_db = "mailserver"; //Database //General Configuration: $account_max = "10000000"; //Maximum size per account (1000000 = 1MB -> Do not uses spaces or commas!) $admin_notIfy = "1"; //1 = yes & 0 = no $from_add = "info@openmail.se"; $admin_email = "info@sonexa.se"; //Administrators email to send notifications) $admin_Default_activate = "1"; //1 = yes & 0 = no -> If no, the administrator has to authorise the account $accountisad = 0; // account is AD-account? 0 = no (default), 1 = yws; $encryption = 2; //Password encryption level - 2 means md5; $domain = 'openmail.se'; // the domain, where the account should be added too $date = date('Y-m-d H:i:s'); $msg=""; $a=""; $serv_webmail_url = 'http://webmail.openmail.se'; // full URL to the webmail-application $url = $_SERVER["HTTP_HOST"]; $domain = (empty($domain))? $_SERVER["HTTP_HOST"] : $domain; $domain = (substr($domain,0,4) == "www.")? strstr($domain, ".") : $domain; // Protect database entries and use MD5 encryption $strName = (isset($_POST['name']))? addslashes( $_POST['name'] ) : ''; $strUser = (isset($_POST['user']))? addslashes( $_POST['user'] ) : ''; $strDomain = addslashes( "$domain" ); $strPass1 = (isset($_POST['pass1']))? addslashes( $_POST['pass1'] ) : ''; //Connect to database using information from above $Conn = mysqli_connect("$mysql_host", "$mysql_user", "$mysql_pass", "$mysql_db"); if (!$Conn) { echo $a; print_r(error_get_last()); $msg = "Unable to open database, contact your administrator!"; } else { if ( isset($_POST['submit']) && $_POST['submit'] == 'create account' ) { //Check to see if email account exists, if not process signup $account_res = mysqli_query($Conn, "SELECT * FROM `hm_accounts` WHERE `accountaddress` = '{$strUser}@$strDomain' LIMIT 1"); $v1 = mysql_num_rows($account_res); If ($v1 >= 1) { // Account exists $msg = "En abonnent med det användarnamnet finns redan!<br><br>Vänligen <a href=\"javascript:history.go(-1)\">klicka här </a> för att gå tillbaka."; return false; } else { if ( !$_POST['pass1'] || !$_POST['pass2'] ) { // User did not enter both passwords $msg = "Du angav inte bägge lösenorden!<br><br>Vänligen <a href=\"javascript:history.go(-1)\">klicka här</a> för att gå tillbaka."; } elseif ( $_POST['pass1'] != $_POST['pass2'] ) { // Passwords do not match $msg = "Lösenorden som du angav matchar inte!<br><br>Vänligen <a href=\"javascript:history.go(-1)\">klicka här</a> för att gå tillbaka."; } else { $domain_id = $domain_info['domainid']; $account_pass = ($encryption == 2)? md5( $strPass1 ) : $strPass1; // Everything seems ok, insert values into database $account_add = mysqli_query($Conn, "INSERT INTO `hm_accounts` (`accountdomainid`,`accountadminlevel`,`accountaddress`,`accountpassword`,`accountactive`,`accountlastlogontime`,`accountvacationexpiredate`,`accountmaxsize`,`accountpwencryption`) VALUES ('$domain_id','0','$strUser@$strDomain','$account_pass','1','$date','$date','$account_max','$encryption')"); // Get the accountid from that last input $rt = mysqli_query($Conn, "SELECT MAX(accountid) FROM hm_accounts"); $row = mysql_fetch_row($rt); // Create folder INBOX in DB $account_add = mysqli_query($Conn, "INSERT INTO `hm_imapfolders` (`folderaccountid`,`folderparentid`,`foldername`,`folderissubscribed`,`foldercreationtime`,`foldercurrentuid`) VALUES ('$row[0]','-1','INBOX','1','$date','0')"); // Create folder TRASH in DB $account_add = mysqli_query($Conn, "INSERT INTO `hm_imapfolders` (`folderaccountid`,`folderparentid`,`foldername`,`folderissubscribed`,`foldercreationtime`,`foldercurrentuid`) VALUES ('$row[0]','-1','Trash','1','$date','0')"); // Create folder SENT in DB $account_add = mysqli_query($Conn, "INSERT INTO `hm_imapfolders` (`folderaccountid`,`folderparentid`,`foldername`,`folderissubscribed`,`foldercreationtime`,`foldercurrentuid`) VALUES ('$row[0]','-1','Sent','1','$date','0')"); // Create folder DRAFTS in DB $account_add = mysqli_query($Conn, "INSERT INTO `hm_imapfolders` (`folderaccountid`,`folderparentid`,`foldername`,`folderissubscribed`,`foldercreationtime`,`foldercurrentuid`) VALUES ('$row[0]','-1','Drafts','1','$date','0')"); } } if (!$account_add) { // Database error, could not create account die('<br><br>Databasfel, kunde inte lägga till konto. Vänligen kontakta en administratör!<br> ' . mysqli_error($Conn)); } If ($admin_Default_activate == 0) { // Account created but requires verification $message = "Ditt konto har skapats men <b>kräver aktivering</b> av en administratör."; $message .= "Så fort ditt konto har blivit godkänt, kommer du att få ett meddelande om detta.<br><br>"; } else { // Account created, sending all account info to user $subject = "Välkommen till $strDomain !"; $message = "Tack! Din nya e-postadress är nu registrerad hos oss.<br><br>Du är välkommen att logga in via http://webmail.openmail.se eller<br>med hjälp av nedanstående kontouppgifter.<br><br>"; $message .= "E-postadress: $strUser@$strDomain<br><br>"; $message .= "POP3: mail.openmail.se<br>"; $message .= "IMAP: mail.openmail.se<br>"; $message .= "SMTP: mail.openmail.se<br><br>"; $message .= "Frågor gällande ditt e-postkontot besvaras enklast av<br>vår supportavdelning som du når på support@openmail.se.<br><br>Välkommen till oss...<br><br>"; $message .= "OpenMail is powered by Sonexa IT<br>info@sonexa.se | http://www.sonexa.se"; $headers = "MIME-Version: 1.0 \r\n"; $headers .= "Content-type: text/html; charset=UTF-8 \r\n"; $headers .= "From: $from_add \r\n"; $headers .= "Reply-To: $from_add \r\n"; $headers .= "Return-Path: $from_add\r\n"; $headers .= "X-Mailer: PHP \r\n"; //Check if email is sent to user if(mail("{$_POST['user']}@$strDomain", "$subject", "$message", "$headers", "From: $from_add")) { //Success $msg ="Registreringen lyckades - 1"; } else { //Fail $msg ="Registreringen misslyckades - 1!"; } } //Notify admin about new email and request activation if ($admin_Default_activate == 0 && $admin_notIfy == 1) { $admin_mail_subject = "E-postkonto kräver aktivering!"; $admin_mail_message = "E-postkontot {$_POST['user']}@$strDomain har skapats av {$_POST['name']} och kräver aktivering av en administratör!\r\n\r\nVänligen logga in på kontrollpanelen för att verifiera och aktivera e-postkontot.\r\n\r\n"; //Check if email activation notice is sent to admin if(mail($admin_email, "$admin_mail_subject", "$admin_mail_message", "From: $from_add")) { //Success $msg ="Registreringen lyckades - 2"; } else { //Fail $msg ="Registreringen misslyckades - 2!"; } } //Notify admin about new email elseif ($admin_Default_activate == 1 && $admin_notIfy == 1) { $admin_mail_subject = "Nytt e-postkonto skapat!"; $admin_mail_message = "{$_POST['user']}@$strDomain har skapats av {$_POST['name']}!"; //Check if email notification is sent to admin if(mail($admin_email, "$admin_mail_subject", "$admin_mail_message", "From: $from_add")) { //Success $msg ="Registreringen lyckades - 3"; } else { //Fail $msg ="Registreringen misslyckades - 3!"; } } } } //Email account signup page echo " <table width=\"350\" border=\"0\" cellpadding=\"0\" cellspacing=\"2\"> <form action=\"\" method=\"POST\"> <tr><td>Full Name:</td><td><input type=\"text\" name=\"name\" size=\"21\">".$msg."</td></tr> <tr><td>E-Mail:</td><td><input type=\"text\" name=\"user\" size=\"21\"> @ ".$domain."</td></tr> <tr><td>Password:</td><td><input type=\"password\" name=\"pass1\" size=\"21\"></td></tr> <tr><td>Password:</td><td><input type=\"password\" name=\"pass2\" size=\"21\"> (For Confirmation)</td></tr> <tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"create account\" style=\"width: 98%\"></td></tr> </form> </table>"; ?>

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.3.60.0030.01516.74
8.3.50.0130.00716.60
8.3.40.0150.00419.07
8.3.30.0090.00618.88
8.3.20.0050.00322.12
8.3.10.0000.00821.98
8.3.00.0050.00320.77
8.2.180.0140.00718.54
8.2.170.0040.01122.96
8.2.160.0140.00722.08
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0050.00322.12
8.2.120.0040.00426.35
8.2.110.0070.00720.77
8.2.100.0090.00318.04
8.2.90.0000.00819.51
8.2.80.0050.00318.16
8.2.70.0050.00317.88
8.2.60.0040.00418.18
8.2.50.0030.00518.10
8.2.40.0040.00422.34
8.2.30.0080.00021.03
8.2.20.0040.00418.24
8.2.10.0030.00618.29
8.2.00.0080.00018.40
8.1.280.0120.00325.92
8.1.270.0080.00023.84
8.1.260.0050.00326.35
8.1.250.0070.00028.09
8.1.240.0040.00421.08
8.1.230.0040.00819.34
8.1.220.0050.00317.88
8.1.210.0060.00318.77
8.1.200.0040.00817.60
8.1.190.0060.00317.48
8.1.180.0030.00618.10
8.1.170.0030.00518.82
8.1.160.0050.00319.19
8.1.150.0000.00819.02
8.1.140.0000.00819.73
8.1.130.0070.00019.15
8.1.120.0040.00417.80
8.1.110.0040.00417.74
8.1.100.0040.00417.76
8.1.90.0040.00417.69
8.1.80.0000.00717.79
8.1.70.0030.00517.73
8.1.60.0050.00317.68
8.1.50.0040.00417.73
8.1.40.0040.00417.79
8.1.30.0060.00317.79
8.1.20.0000.01017.91
8.1.10.0000.00817.83
8.1.00.0080.00017.67
8.0.300.0000.00818.77
8.0.290.0030.00617.00
8.0.280.0030.00418.53
8.0.270.0000.00717.49
8.0.260.0030.00318.57
8.0.250.0030.00317.32
8.0.240.0080.00017.25
8.0.230.0000.00717.30
8.0.220.0040.00417.12
8.0.210.0040.00417.19
8.0.200.0000.00817.14
8.0.190.0030.00617.27
8.0.180.0000.00817.24
8.0.170.0060.00317.19
8.0.160.0000.00717.03
8.0.150.0080.00017.21
8.0.140.0000.00817.15
8.0.130.0060.00013.60
8.0.120.0050.00317.02
8.0.110.0000.00817.09
8.0.100.0050.00217.20
8.0.90.0020.00517.28
8.0.80.0070.01017.18
8.0.70.0040.00417.22
8.0.60.0030.00517.14
8.0.50.0000.00817.03
8.0.30.0110.01017.30
8.0.20.0080.01117.40
8.0.10.0040.00417.32
8.0.00.0170.00016.89
7.4.330.0050.00015.55
7.4.320.0060.00016.58
7.4.300.0030.00316.83
7.4.290.0070.00016.82
7.4.280.0040.00416.84
7.4.270.0070.00016.85
7.4.260.0060.00013.47
7.4.250.0000.00816.65
7.4.240.0040.00416.73
7.4.230.0000.00716.92
7.4.220.0160.00516.74
7.4.210.0090.00916.70
7.4.200.0070.00016.64
7.4.160.0050.01216.76
7.4.150.0030.01417.40
7.4.140.0120.00717.86
7.4.130.0120.01216.88
7.4.120.0100.01116.83
7.4.110.0130.00416.68
7.4.100.0110.01116.90
7.4.90.0070.01116.79
7.4.80.0090.01219.39
7.4.70.0030.01316.94
7.4.60.0070.01516.64
7.4.50.0100.00716.79
7.4.40.0100.00716.97
7.4.30.0140.00716.82
7.4.00.0070.01015.16
7.3.330.0030.00313.50
7.3.320.0030.00313.49
7.3.310.0050.00316.56
7.3.300.0000.00716.61
7.3.290.0060.00916.64
7.3.280.0090.00816.59
7.3.270.0180.00317.40
7.3.260.0070.01216.76
7.3.250.0100.00916.66
7.3.240.0080.01216.74
7.3.230.0130.01016.67
7.3.210.0110.01116.68
7.3.200.0130.00916.71
7.3.190.0100.00716.64
7.3.180.0070.01416.76
7.3.170.0120.00616.57
7.3.160.0070.01016.63
7.3.10.0140.00016.77
7.3.00.0060.00316.67
7.2.330.0090.01116.88
7.2.320.0030.01616.99
7.2.310.0060.01216.98
7.2.300.0140.01116.91
7.2.290.0100.00716.69
7.2.130.0090.00416.84
7.2.120.0070.00717.02
7.2.110.0110.00017.04
7.2.100.0080.00317.06
7.2.90.0070.00416.99
7.2.80.0000.00917.04
7.2.70.0030.00616.77
7.2.60.0050.00717.03
7.2.50.0040.00717.06
7.2.40.0000.01416.87
7.2.30.0030.00717.21
7.2.20.0060.00617.15
7.2.10.0090.00616.73
7.2.00.0060.00618.41
7.1.250.0070.00315.76
7.1.200.0000.01015.68
7.1.100.0000.01217.91
7.1.70.0040.00417.30
7.1.60.0070.00717.35
7.1.50.0060.00617.27
7.1.40.0070.01016.73
7.1.30.0000.01516.79
7.1.20.0080.00416.97
7.1.10.0030.00616.71
7.1.00.0040.00416.82
7.0.200.0030.00717.02
7.0.190.0000.00816.55
7.0.180.0040.00416.30
7.0.170.0030.00516.47
7.0.160.0040.00716.24
7.0.150.0000.00816.22
7.0.140.0000.01016.39
7.0.130.0000.00916.59
7.0.120.0070.00416.67
7.0.110.0000.01116.28
7.0.100.0000.01016.43
7.0.90.0070.00016.47
7.0.80.0070.00316.27
7.0.70.0000.01016.38
7.0.60.0000.00916.12
7.0.50.0040.00416.37
7.0.40.0040.00416.07
7.0.30.0000.01016.07
7.0.20.0000.00816.07
7.0.10.0000.00816.07
7.0.00.0030.00516.07
5.6.300.0070.04120.98
5.6.290.0060.04120.85
5.6.280.0030.04621.09
5.6.270.0070.03721.11
5.6.260.0100.03320.93
5.6.250.0030.05020.84
5.6.240.0070.06420.91
5.6.230.0030.05421.01
5.6.220.0030.04520.84
5.6.210.0030.04021.10
5.6.200.0030.05021.04
5.6.190.0030.05620.88
5.6.180.0030.04620.89
5.6.170.0030.04420.97
5.6.160.0060.04221.05
5.6.150.0030.04421.07
5.6.140.0030.05120.91
5.6.130.0030.05320.84
5.6.120.0070.04020.86
5.6.110.0070.05320.91
5.6.100.0130.05021.06
5.6.90.0040.04221.02
5.6.80.0030.04120.46
5.6.70.0200.04020.44
5.6.60.0030.03820.29
5.6.50.0000.04420.21
5.6.40.0000.04420.45
5.6.30.0030.04220.27
5.6.20.0060.03520.44
5.6.10.0070.03520.39
5.6.00.0070.06520.26
5.5.380.0000.04217.59
5.5.370.0040.04317.54
5.5.360.0100.04017.53
5.5.350.0000.04517.61
5.5.340.0040.04418.15
5.5.330.0070.03618.08
5.5.320.0000.05017.89
5.5.310.0130.03717.77
5.5.300.0210.04518.09
5.5.290.0060.04218.10
5.5.280.0170.03718.10
5.5.270.0000.04518.08
5.5.260.0040.04317.99
5.5.250.0060.03617.91
5.5.240.0070.04017.48
5.5.230.0030.04317.14
5.5.220.0000.06617.43
5.5.210.0060.03717.52
5.5.200.0060.03517.51
5.5.190.0070.03817.50
5.5.180.0070.03817.41
5.5.160.0100.03617.39
5.5.150.0030.03817.34
5.5.140.0070.04117.33
5.5.130.0030.03717.23
5.5.120.0040.03917.41
5.5.110.0030.04817.38
5.5.100.0070.04117.15
5.5.90.0090.03617.15
5.5.80.0030.04417.22
5.5.70.0000.04117.25
5.5.60.0000.04517.13
5.5.50.0000.04817.34
5.5.40.0000.04317.14
5.5.30.0030.07117.31
5.5.20.0070.04017.32
5.5.10.0030.04217.23
5.5.00.0000.05616.99
5.4.450.0030.04519.35
5.4.440.0040.05319.19
5.4.430.0070.06319.15
5.4.420.0030.04019.30
5.4.410.0030.04119.03
5.4.400.0070.03818.99
5.4.390.0000.05718.82
5.4.380.0040.04019.01
5.4.370.0060.03519.07
5.4.360.0190.03719.14
5.4.350.0070.03719.07
5.4.340.0030.04318.98
5.4.320.0040.03918.86
5.4.310.0190.02918.87
5.4.300.0060.03518.94
5.4.290.0070.03719.05
5.4.280.0030.04518.83
5.4.270.0090.03118.98
5.4.260.0000.04419.05
5.4.250.0000.04019.00
5.4.240.0030.03819.12
5.4.230.0000.04919.13
5.4.220.0040.04019.14
5.4.210.0060.03719.06
5.4.200.0100.03319.14
5.4.190.0060.05518.85
5.4.180.0070.03619.09
5.4.170.0030.03818.91
5.4.160.0030.03919.04
5.4.150.0030.04319.13
5.4.140.0070.07916.52
5.4.130.0090.03316.67
5.4.120.0000.04016.74
5.4.110.0090.03316.41
5.4.100.0030.06516.41
5.4.90.0000.04216.75
5.4.80.0030.03816.64
5.4.70.0030.03816.40
5.4.60.0040.03716.67
5.4.50.0000.04116.66
5.4.40.0030.03716.63
5.4.30.0190.02616.45
5.4.20.0060.03116.38
5.4.10.0060.03516.69
5.4.00.0060.03216.10
5.3.290.0030.04216.07
5.3.280.0060.03416.07
5.3.270.0070.03516.07
5.3.260.0030.04016.07
5.3.250.0030.03616.07
5.3.240.0030.03716.07
5.3.230.0030.03616.07
5.3.220.0000.04716.07
5.3.210.0060.03316.07
5.3.200.0030.03716.07
5.3.190.0000.04016.07
5.3.180.0100.03616.07
5.3.170.0030.03916.07
5.3.160.0060.03716.07
5.3.150.0030.03616.07
5.3.140.0090.06016.07
5.3.130.0060.04516.07
5.3.120.0000.04316.07
5.3.110.0070.03316.07
5.3.100.0030.03716.07
5.3.90.0060.03816.07
5.3.80.0070.03216.07
5.3.70.0000.03816.07
5.3.60.0130.03616.07
5.3.50.0000.03816.07
5.3.40.0000.03916.07
5.3.30.0030.03416.07
5.3.20.0030.03416.07
5.3.10.0000.03616.07
5.3.00.0030.03616.07
5.2.170.0000.03216.07
5.2.160.0030.03116.07
5.2.150.0030.03116.07
5.2.140.0000.03316.07
5.2.130.0060.02816.07
5.2.120.0030.02816.07
5.2.110.0030.03016.07
5.2.100.0000.03216.07
5.2.90.0030.04316.07
5.2.80.0030.03016.07
5.2.70.0030.03216.07
5.2.60.0030.02916.07
5.2.50.0060.02916.07
5.2.40.0040.02916.07
5.2.30.0030.03016.07
5.2.20.0090.02516.07
5.2.10.0060.02416.07
5.2.00.0070.02716.07
5.1.60.0000.02816.07
5.1.50.0030.02616.07
5.1.40.0000.03016.07
5.1.30.0000.03816.07
5.1.20.0060.02316.07
5.1.10.0000.02916.07
5.1.00.0070.02316.07
5.0.50.0000.02216.07
5.0.40.0030.01816.07
5.0.30.0000.03516.07
5.0.20.0000.02516.07
5.0.10.0000.02116.07
5.0.00.0030.02816.07
4.4.90.0040.01416.07
4.4.80.0040.01816.07
4.4.70.0040.01516.07
4.4.60.0000.01716.07
4.4.50.0000.01716.07
4.4.40.0030.02416.07
4.4.30.0000.02216.07
4.4.20.0030.01316.07
4.4.10.0000.02716.07
4.4.00.0000.02716.07
4.3.110.0030.01516.07
4.3.100.0030.01416.07
4.3.90.0000.01816.07
4.3.80.0070.05216.07
4.3.70.0000.01716.07
4.3.60.0200.01016.07
4.3.50.0000.01816.07
4.3.40.0060.02316.07
4.3.30.0000.02316.07
4.3.20.0000.02416.07
4.3.10.0000.01716.07
4.3.00.0000.01816.07

preferences:
54.98 ms | 401 KiB | 5 Q