3v4l.org

run code in 300+ PHP versions simultaneously
<html> <body> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Untitled Document</title> <style> .colortext { background-color: #ffe; /* Цвет фона */ color: #930; /* Цвет текста */ } </style> <?php if (!isset($_COOKIE['id']) and !isset($_COOKIE['hash'])) { header("Location: login.php"); exit(); } mysql_connect("localhost", "root", "root"); mysql_select_db("bifly"); $query = mysql_query("SELECT * FROM users WHERE user_id = '".intval($_COOKIE['id'])."' LIMIT 1"); $userdata = mysql_fetch_assoc($query); # $query = mysql_query("SELECT * FROM users WHERE user_id = '".intval($_COOKIE['id'])."' LIMIT 1"); # $userdata = mysql_fetch_assoc($query); # if(($userdata['user_hash'] !== $_COOKIE['hash']) or ($userdata['user_id'] !== $_COOKIE['id'])) #or (($userdata['user_ip'] !== $_SERVER['REMOTE_ADDR']) and ($userdata['user_ip'] !== "0"))) if(($userdata['user_hash'] !== $_COOKIE['hash']) or ($userdata['user_id'] !== $_COOKIE['id'])) { setcookie("id", "", time() - 3600*24*30*12, "/"); setcookie("hash", "", time() - 3600*24*30*12, "/"); print "Хм, что-то не получилось"; sleep(3); header("Location: login.php"); exit(); } if(isset($_POST['submit'])) { $err = array(); # проверям логин if(!preg_match("/^[a-zA-Z]+$/",$_POST['domain'])) { $err[] = "Домен может состоять только из букв английского алфавита"; } if(strlen($_POST['domain']) < 3 or strlen($_POST['domain']) > 16) { $err[] = "Домен должен быть не меньше 3-х символов и не больше 16"; } # проверяем, не сущестует ли пользователя с таким именем $query = mysql_query("SELECT COUNT(user_id) FROM users WHERE user_domain='".mysql_real_escape_string($_POST['domain'])."'"); if(mysql_result($query, 0) > 0) { $err[] = "Такой домен уже существует в базе данных"; } # Если нет ошибок, то добавляем в БД нового пользователя if(count($err) == 0) { $domain = $_POST['domain']; var_dump($domain); print("test"); # Убираем лишние пробелы и делаем двойное шифрование mysql_query("UPDATE users SET user_domain = '".$domain."' WHERE user_id = '".intval($_COOKIE['id'])."'"); #mysql_query("INSERT INTO users SET user_domain='".$domain."'"); #header("Location: cabinet.php"); exit(); } } else # { print "<b>При регистрации произошли следующие ошибки:</b><br>"; # foreach($err AS $error) # { # print $error."<br>"; # } # } print("<h1>Добро пожаловать в личный кабинет!</h1>"); #var_dump($userdata['user_domain']); if($userdata['user_domain'] == "NULL") { print("<br>Ваше доменное имя: <font color='green'>{$userdata['user_domain']}</font>"); } else { print("<br>Ваше доменное имя: <font color='red'>отсутствует</font>\n"); print("<form method='POST'>\n"); print("Введите имя (только латинские буквы) <input name='domain' type='text'><br>\n"); print("<input name='submit' type='submit' value='Зарегистрировать'>\n"); print("</form>\n"); } #print("<br>Ваше доменное имя") #`echo "test" > temp/test;` ?> </body> </html>
Output for 7.0.20, 7.1.5 - 7.1.20, 7.2.0 - 7.2.6
<html> <body> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Untitled Document</title> <style> .colortext { background-color: #ffe; /* Цвет фона */ color: #930; /* Цвет текста */ } </style> Warning: Cannot modify header information - headers already sent by (output started at /in/IubCD:1) in /in/IubCD on line 15
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.14, 7.1.0
<html> <body> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Untitled Document</title> <style> .colortext { background-color: #ffe; /* Цвет фона */ color: #930; /* Цвет текста */ } </style> Warning: Cannot modify header information - headers already sent by (output started at /in/IubCD:11) in /in/IubCD on line 15
Output for 5.2.3 - 5.2.17
<html> <body> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Untitled Document</title> <style> .colortext { background-color: #ffe; /* Цвет фона */ color: #930; /* Цвет текста */ } </style> Warning: Cannot modify header information - headers already sent by (output started at /in/IubCD:5) in /in/IubCD on line 15
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.2
<html> <body> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Untitled Document</title> <style> .colortext { background-color: #ffe; /* Цвет фона */ color: #930; /* Цвет текста */ } </style>

preferences:
156.34 ms | 403 KiB | 219 Q