/** * 插入数据库 * @param [type] $data [description] * @return [type] $inser_num [返回成功插入的数量] */ function insert_db($data) { echo "开始写入数据库\n"; $insert_num = 0; //成功插入的数量 $con = new mysqli("localhost", "root", "", "collection"); if (!$con) { die('连接数据库失败:' . $con->error() . "\n\n"); } $con->query('SET NAMES UTF8'); foreach ($data as $v) { $sql = 'INSERT INTO yisheng (name, price, skuId, url, category_1, category_2) VALUES ("' . characet($v['name']) . '", "' . $v['price'] . '", "' . $v['skuId'] . '", "' . $v['url'] . '", "' . characet($v['category_1']) . '", "' . characet($v['category_2']) . '")'; $res = $con->query($sql); //echo iconv("UTF-8","gb2312",$sql)."\n"; if (!$res) { echo "插入失败!商品地址:" . $v[1] . "\n"; echo iconv("UTF-8", "gb2312", $sql) . "\n"; } else { echo "."; $insert_num++; } } echo "\n"; echo "成功写入" . $insert_num . "条数据\n"; $con->close(); return $insert_num; }
/** * Perform sql query and return result. * Increase sqlCnt and save error if occured * * @param string $sql query * @return misc * @author Dmitry (dio) Levashov **/ protected function query($sql) { $this->sqlCnt++; $res = $this->db->query($sql); if (!$res) { $this->dbError = $this->db->error(); } return $res; }
/** * 插入数据库 * @param [type] $data [description] * @return [type] $inser_num [返回成功插入的数量] */ function insert_db($data) { echo "开始写入数据库\n"; $insert_num = 0; //成功插入的数量 $con = new mysqli("localhost", "root", "", "collection"); if (!$con) { die('连接数据库失败:' . $con->error() . "\n\n"); } $con->query('SET NAMES UTF8'); foreach ($data as $v) { $sql = 'INSERT INTO test (title, tip, price, currentPrice, unitPrice, unit, loc, href) VALUES ("' . $v["title"] . '", "' . $v['tip'] . '", "' . $v['price'] . '", "' . $v['currentPrice'] . '", "' . $v['unitPrice'] . '", "' . $v['unit'] . '", "' . $v['loc'] . '", "' . $v['href'] . '")'; $res = $con->query($sql); if (!$res) { echo "插入失败!商品地址:" . $v['href'] . "\n"; echo iconv("UTF-8", "gb2312", $sql) . "\n"; } else { echo "."; $insert_num++; } } $con->close(); return $insert_num; }
/** * 插入数据库 * @param [type] $data [description] * @return [type] $inser_num [返回成功插入的数量] */ function insert_db($data) { $con = new mysqli("localhost", "root", "", "collection"); if (!$con) { die('连接数据库失败:' . $con->error() . "\n\n"); } $con->query('SET NAMES UTF8'); $sql = "INSERT INTO jiajiale (skuId, name, adword, jdPrice, martPrice, good, good_num, url, category_1, category_2, category_3, brand_name, manufacturer, specification, methods_of_food, ingredients, main_ingredient, valid, storage, precautions, taboo_crowd) VALUES ({$data['skuId']}, {$data['name']}, {$dada['adword']}, {$data['jdPrice']}, {$data['martPrice']}, {$data['good']}, {$data['good_num']}, {$data['url']}, {$data['category_1']}, {$data['category_2']}, {$data['category_3']}, {$data['brand_name']}, {$data['manufacturer']}, {$data['specification']}, {$data['methods_of_food']}, {$data['ingredients']}, {$data['main_ingredient']}, {$data['valid']}, {$data['storage']}, {$data['precautions']}, {$data['taboo_crowd']})"; $res = $con->query($sql); if ($res) { echo "success insert db\n"; } else { echo iconv("UTF-8", "gb2312", $sql) . "\n"; die("fail insert db\n"); } $con->close(); return; }
} $stmt->bind_param("s", $user->getId()); if (!$stmt->execute()) { die('could not check user: '******'insert into users (id, name, created) VALUES (?,?, NOW())'))) { die('could not prepare statement: ' . $my->error()); } $stmt2->bind_param('ss', $user->getId(), $user->getName()); if (!$stmt2->execute()) { die('could not create user.' . $my->error); } } //Create user session, and redirect $_SESSION['fb_access_token'] = (string) $accessToken; $_SESSION['fb_user_name'] = (string) $user->getName(); $_SESSION['fb_user_id'] = $user->getId(); $_SESSION['fb_user_first_name'] = $user['first_name']; header('Location: /html'); /* //echo '<h3>Access Token</h3>'; //var_dump($accessToken->getValue());
$_SESSION = array(); // get session parameters $params = session_get_cookie_params(); // Delete the actual cookie. setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"]); // Destroy session session_destroy(); unset($_GET["logout"]); header("Location: {$_SERVER['SCRIPT_NAME']}"); } } // MySQL if (!empty($include_mysqli)) { $mysqli_connection = new mysqli($database_server, $database_username, $database_password, $database_name); if ($mysqli_connection->connect_error) { die($mysqli_connection->error()); } else { $mysqli_connected = true; } } elseif (!empty($include_mysqlo)) { // connection /* using deprecated mysql_connect() will need to upgrade to mysqli ASAP until then, silence server error notice */ $mysqlo_connection = @mysql_connect($database_server, $database_username, $database_password); // use database $mysqlo_selected = mysql_select_db($database_name, $mysqlo_connection); if ($mysqlo_connection && $mysqlo_selected) { $mysqlo_connected = true;
require_once 'config.php'; // database credentials // Create connection $conn = new mysqli($servername, $username, $password); // Check connection if ($conn->connect_error) { header('HTTP/1.1 500 Internal Server Error'); die("Connection failed: " . $conn->connect_error); } echo "<html>"; echo "<body>"; $sql = "SELECT VARIABLE_VALUE as 'message' FROM information_schema.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'"; if (!($result = $conn->query($sql))) { // echo "Error"; printf("Errormessage: %s\n", $conn->error()); } if ($result->num_rows > 0) { // output data of each row while ($row = $result->fetch_assoc()) { echo "wsrep_cluster_size: " . $row["message"]; } } else { echo "0 results"; } $conn->close(); include "links.php"; ?> </body> </html>
* the default 'member' value should be changed under the standard setup. * However, additional roles can be added and so there's nothing stopping * anyone from defining a different default. */ define("CAN_REGISTER", "any"); define("DEFAULT_ROLE", "member"); /** * Is this a secure connection? The default is FALSE, but the use of an * HTTPS connection for logging in is recommended. * * If you are using an HTTPS connection, change this to TRUE */ define("SECURE", empty($require_ssl) ? FALSE : $require_ssl); $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); if ($mysqli->connect_error) { die($mysqli->error()); } function login($email, $password, $mysqli) { // Using prepared statements means that SQL injection is not possible. if ($stmt = $mysqli->prepare("SELECT user_key, username, password, salt \n\t\t\t\t FROM Users \n WHERE email = ? LIMIT 1")) { $stmt->bind_param('s', $email); // Bind "$email" to parameter. $stmt->execute(); // Execute the prepared query. $stmt->store_result(); // get variables from result. $stmt->bind_result($user_key, $username, $db_password, $salt); $stmt->fetch(); // hash the password with the unique salt. $password = hash('sha512', $password . $salt);
<?php echo "<h1>Hello world</h1>"; $mysqli = new mysqli(getenv("HELLO_PHP_MYSQL_SERVICE_HOST"), getenv("MYSQL_USER"), getenv("MYSQL_PASSWORD"), getenv("MYSQL_DATABASE")); if ($mysqli->connect_error) { exit($mysqli->connect_error); } else { $mysqli->set_charset("utf8"); } $result = $mysqli->query("select 1") or exit($mysqli->error()); echo var_dump($result->fetch_assoc()); $mysqli->close(); ?>
} /* ---------------------------------------------------------------- */ /* GET EMPLOYEE DETAILS FROM CLOVER AND INSERT INTO DATABASE */ /* ---------------------------------------------------------------- */ $emp_response = file_get_contents('https://api.clover.com/v3/merchants/' . $merchant_id . '/employees/' . $employee_id . '?access_token=' . $access_token . '&return_null_fields=true'); $emp_data = json_decode($emp_response); echo "Employee id==" . $employee_id; //Let's check employee records already exists or not. $emp_select = "SELECT * FROM foodkonnektfood_delivery_employees WHERE employee_id = '" . $employee_id . "'"; $emp_result = $conn->query($emp_select); if ($emp_result->num_rows == 0) { $emp_query = "INSERT INTO foodkonnektfood_delivery_employees (employee_id, name, nickname, email, role) VALUES ('" . $employee_id . "', '" . $emp_data->name . "', '" . $emp_data->nickname . "', '" . $emp_data->email . "', '" . $emp_data->role . "')"; if ($conn->query($emp_query) == TRUE) { echo '<br />Employee record inserted!.<br />'; } else { echo '<br />Error : ' . $conn->error() . '<br />'; } } else { echo '<br />This employee already exists.<br />'; } $emp_query1 = "UPDATE foodkonnektfood_delivery_locations_map SET employee_id= '" . $employee_id . "' WHERE CLOVER_MID ='" . $merchant_id . "'"; $conn->query($emp_query1); /* ---------------------------------------------------------------- */ /* GET EMPLOYEE DETAILS FROM CLOVER AND INSERT INTO DATABASE */ /* ---------------------------------------------------------------- */ $tender_response = file_get_contents('https://api.clover.com:443/v3/merchants/' . $merchant_id . '/tenders?access_token=' . $access_token); $tender_data = json_decode($tender_response); $t = 1; $tender_select = "SELECT * FROM foodkonnektfood_delivery_tenders WHERE location_id=" . $location_id; $tender_result = $conn->query($tender_select); if ($tender_result->num_rows == 0) {
static function buildDB($menuPages) { $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); if ($mysqli->connect_errno) { exit("Couldn't connect to the database." . $mysqli->connect_error()); } $admin_u = DEV_NAME; $admin_e = DEV_EMAIL; $admin_p = AdminUtilities::createSaltedHash(DEV_PASS); $sql = "CREATE DATABASE IF NOT EXISTS `" . DB_NAME . "`\n DEFAULT CHARACTER SET " . DEFAULT_CHARACTER_SET . " COLLATE " . DEFAULT_COLLATION . ";\n CREATE TABLE IF NOT EXISTS `" . DB_NAME . "`.`" . DB_PREFIX . "entryMgr`\n (\n `id` INT UNSIGNED NOT NULL PRIMARY KEY auto_increment,\n `page` VARCHAR(64) NOT NULL,\n `title` VARCHAR(255) DEFAULT NULL,\n `subhead` VARCHAR(75) DEFAULT NULL,\n `body` TEXT DEFAULT NULL,\n `img` VARCHAR(128) DEFAULT NULL,\n `imgcap` VARCHAR(128) DEFAULT NULL,\n `data1` VARCHAR(255) DEFAULT NULL,\n `data2` VARCHAR(255) DEFAULT NULL,\n `data3` VARCHAR(255) DEFAULT NULL,\n `data4` VARCHAR(255) DEFAULT NULL,\n `data5` VARCHAR(255) DEFAULT NULL,\n `data6` VARCHAR(255) DEFAULT NULL,\n `data7` VARCHAR(255) DEFAULT NULL,\n `data8` VARCHAR(255) DEFAULT NULL,\n `author` VARCHAR(64) DEFAULT '" . SITE_CONTACT_NAME . "',\n `created` INT(12),\n INDEX(`page`),\n INDEX(`created`),\n INDEX(`title`),\n FULLTEXT KEY `search` (`title`,`body`,`data2`)\n ) ENGINE=MYISAM CHARACTER SET " . DEFAULT_CHARACTER_SET . " COLLATE " . DEFAULT_COLLATION . ";\n CREATE TABLE IF NOT EXISTS `" . DB_NAME . "`.`" . DB_PREFIX . "adminMgr`\n (\n `id` INT UNSIGNED NOT NULL PRIMARY KEY auto_increment,\n `admin_u` VARCHAR(60) UNIQUE,\n `admin_e` VARCHAR(100) UNIQUE,\n `admin_p` VARCHAR(150) DEFAULT NULL,\n `admin_v` VARCHAR(150) NOT NULL,\n `is_admin` TINYINT(1) DEFAULT '0',\n INDEX(admin_v)\n ) ENGINE=MYISAM CHARACTER SET " . DEFAULT_CHARACTER_SET . " COLLATE " . DEFAULT_COLLATION . ";\n INSERT INTO `" . DB_NAME . "`.`" . DB_PREFIX . "entryMgr`\n (\n `page`, `title`, `body`, `img`, `imgcap`,\n `data2`, `data6`, `author`, `created`\n )\n VALUES\n (\n '" . DEFAULT_PAGE . "', 'Welcome to the ECMS!',\n '<p>You have successfully installed the " . "<a href=\"http://ennuicms.com/\">ECMS</a>.</p>" . "\r\n<p>To get started:</p>\r\n<ul>\r\n<li>" . "<a href=\"/admin\">Log in</a> using the username " . "and password you set up in the config files</li>\r\n" . "<li>Edit this entry to contain the content for your " . "site''s home page</li>\r\n<li>Add content to the " . "rest of the pages on your site</li>\r\n</ul>\r\n" . "<h2>HTML Element Style Test (h2)</h2>\r\n" . "<blockquote>\r\n<p>This is a blockquote. Putamus " . "lectores litterarum dynamicus facilisi dolore. " . "Facilisi qui zzril legunt nibh in. Nostrud nonummy " . "sequitur autem consequat ut. Assum tincidunt " . "vulputate gothica molestie veniam.</p>\r\n" . "</blockquote>\r\n<h3>H3 Element</h3>\r\n<p>Sed " . "consequat tempor ex formas dignissim. Lobortis " . "anteposuerit consectetuer consequat ullamcorper " . "dolore. Dolore imperdiet amet iis sed iriure. " . "Luptatum adipiscing lorem augue diam te. Cum autem " . "claritas tempor sed augue.</p>\r\n<h4>H4 Element" . "</h4>\r\n<ol>\r\n<li>This is an ordered list</li>" . "\r\n<li>Typi at doming usus lectores parum.</li>" . "\r\n<li>Parum quod legentis qui nonummy mirum. Nunc " . "quis consequat in seacula consectetuer.</li>\r\n" . "</ol>\r\n<h5>H5 Element</h5>\r\n<p>Parum quod " . "legentis qui nonummy mirum. Nunc quis consequat in " . "seacula consectetuer. Est humanitatis eros duis qui " . "quarta. Enim quod in aliquip placerat insitam. " . "Putamus consequat hendrerit demonstraverunt " . "eleifend claram. Videntur molestie typi hendrerit " . "duis qui.</p>\r\n<h6>H6 Element</h6>\r\n<p>Mazim ut " . "euismod formas amet in. Ex blandit nulla tincidunt " . "wisi consequat. Typi illum ad luptatum " . "Investigationes legentis.</p>',\n 'blog, entry, testing', 'welcome-to-the-ecms',\n 'Ennui Design', " . time() . "\n )\n ON DUPLICATE KEY UPDATE `created`=" . time() . ";"; if (DEV_PASS != '') { $sql .= "INSERT INTO `" . DB_NAME . "`.`" . DB_PREFIX . "adminMgr`\n (`admin_u`, `admin_e`, `admin_p`, `admin_v`, `is_admin`)\n VALUES\n ('{$admin_u}', '{$admin_e}', '{$admin_p}', '" . sha1(time()) . "', '1')\n ON DUPLICATE KEY UPDATE `is_admin`=1;"; } if (array_key_exists('blog', $menuPages)) { $sql .= "\n CREATE TABLE IF NOT EXISTS `" . DB_NAME . "`.`" . DB_PREFIX . "blogCmnt`\n (\n `id` INT(5) PRIMARY KEY auto_increment,\n `bid` INT(5),\n `user` VARCHAR(60),\n `email` VARCHAR(100),\n `link` VARCHAR(100),\n `comment` TEXT,\n `timestamp` INT(12),\n `subscribe` TINYINT(1) DEFAULT '0',\n INDEX(bid),\n INDEX(timestamp),\n INDEX(subscribe)\n ) ENGINE=MYISAM CHARACTER SET " . DEFAULT_CHARACTER_SET . " COLLATE " . DEFAULT_COLLATION . ";"; } if ($mysqli->multi_query($sql)) { do { if ($result = $mysqli->store_result()) { echo "Table created.<br />\n"; $result->close(); } } while ($mysqli->next_result()); } else { exit('Database tables could not be created. ' . $mysqli->error()); } $mysqli->close(); return true; }
<?php //defines variables required for the given comic $thispage = urlencode($_SERVER['SCRIPT_FILENAME'] . "?" . $_SERVER['QUERY_STRING']); //set timezone for use with date function date_default_timezone_set('UTC'); //use $c_des as the comic name. //connect to MySQL $config = parse_ini_file(__DIR__ . '/../../../../etc/jim_config.ini', true); $mysqli = new mysqli($config['database']['host'], $config['database']['user'], $config['database']['password']) or die($mysqli->error()); $mysqli->select_db($c_des); //include the user functions include "../z-users/user_functions.php"; //load the variables from the database into variables $query_v = $mysqli->query("SELECT * FROM settings LIMIT 1") or die($mysqli->error); $row_v = $query_v->fetch_assoc(); $com_name = $row_v['com_name']; $com_title = $row_v['com_title']; $com_desc = $row_v['com_desc']; $com_bg = $row_v['com_bg']; $com_fg = $row_v['com_fg']; $com_com_bg = $row_v['com_com_bg']; $logocolour = $row_v['logocolour']; $a_comment = $row_v['a_comment']; $p_comments = $row_v['p_comments']; $p_links = $row_v['p_links']; $p_about = $row_v['p_about']; $p_forum = $row_v['p_forum']; $p_forum_link = $row_v['p_forum_link']; $com_first = $row_v['com_first']; $about = $row_v['about'];
} $result = $db->query("create table Equipment (Equip_id int primary key not null, Equip char(30) not null)") or die("Invalid: " . $db->error); $equips = file("Equip.flat"); foreach ($equips as $equipstring) { $equipstring = rtrim($equipstring); $equip = preg_split("/ +/", $equipstring); $query = "insert into Equipment values ('{$equip['0']}','{$equip['1']}')"; $db->query($query) or die("Invalid insert " . $db->error); } $result = $db->query("create table Corvettes_Equipment(Vette_id int not null, Equip int not null)") or die("Invalid: " . $db->error); $equips = file("CorEq.flat"); foreach ($equips as $equipstring) { $equipstring = rtrim($equipstring); $equip = preg_split("/ +/", $equipstring); $query = "insert into Corvettes_Equipment values ('{$equip['0']}','{$equip['1']}')"; $db->query($query) or die("Invalid insert " . $db->error()); } echo "<b>The database has been initialized with the following tables:</b>"; echo "<br /><br />"; # Once the tables have been created, I show them for verification. This # involves a query for each table, followed by printing out all of the # values in the table. I have hard coded the keys into the array below. # We can also obtain the keys from the result of the query itself. See # access_cars.php from the text for a way of doing this. $tables = array("Corvettes" => array("Vette_id", "Body_Style", "Miles", "Year", "State"), "States" => array("State_id", "State"), "Equipment" => array("Equip_id", "Equip"), "Corvettes_Equipment" => array("Vette_id", "Equip")); foreach ($tables as $curr_table => $curr_keys) { $query = "select * from " . $curr_table; #Define query $result = $db->query($query); #Eval and store result $rows = $result->num_rows;
/** * 插入数据库 * @param [type] $data [description] * @param [type] $category 二级和三级分类名称 * @return [type] [description] */ function insert_db($data) { $con = new mysqli("localhost", "root", "", "collection"); if (!$con) { die('连接数据库失败:' . $con->error() . "\n\n"); } $con->query('SET NAMES UTF8'); $sql = 'INSERT INTO jd (skuId, name, adword, jdPrice, marketPrice, good, good_num, url, category_1, category_2, category_3, brand_name, sale_time, value_weight, product_area) VALUES ("' . $data["skuId"] . '", "' . $data['name'] . '", "' . $data['adword'] . '", "' . $data['jdPrice'] . '", "' . $data['marketPrice'] . '", "' . $data['good'] . '", "' . $data['good_num'] . '", "' . $data['url'] . '", "' . $data['category_1'] . '", "' . $data['category_2'] . '", "' . $data['category_3'] . '", "' . $data['brand_name'] . '", "' . $data['sale_time'] . '", "' . $data['value_weight'] . '", "' . $data['product_area'] . '")'; $res = $con->query($sql); if ($res) { echo "success insert db\n"; } else { echo 'fail insert db\\n'; } $con->close(); }
$statuses = $matches2[1]; // Update the database when a chair opens or closes. for ($i = 0; $i < sizeof($lifts); ++$i) { // The lift IS NOT in the database for this date and it now open. // INSERT a row and record the opening time. if (!isset($current[$lifts[$i]]) && $statuses[$i] == "OPEN") { $query .= "INSERT INTO `status` (`name`, `opened`, `date`) VALUES ('" . addslashes($lifts[$i]) . "', CURTIME(), CURDATE());\n"; $query .= "INSERT INTO `log` (`logtext`) VALUES ('" . addslashes($lifts[$i]) . " is NOT in database. Inserting. Now Open.');\n"; } else { if (isset($current[$lifts[$i]]) && $current[$lifts[$i]]["opened"] == null && $statuses[$i] == "OPEN") { $query .= "UPDATE `status` SET `opened` = CURTIME(), `closed` = null WHERE name = '" . addslashes($lifts[$i]) . "' AND `date` = CURDATE();\n"; $query .= "INSERT INTO `log` (`logtext`) VALUES ('" . addslashes($lifts[$i]) . " IS in database. Updating. Now Open.');\n"; } else { if (!isset($current[$lifts[$i]]) && $statuses[$i] == "STANDBY") { $query .= "INSERT INTO `status` (`name`, `standby`, `date`) VALUES ('" . addslashes($lifts[$i]) . "', CURTIME(), CURDATE());\n"; $query .= "INSERT INTO `log` (`logtext`) VALUES ('" . addslashes($lifts[$i]) . " is NOT in database. Inserting. Now Standby.');\n"; } else { if (isset($current[$lifts[$i]]) && $current[$lifts[$i]]["closed"] == null && $statuses[$i] == "CLOSED") { $query .= "UPDATE `status` SET `closed` = CURTIME() WHERE name = '" . addslashes($lifts[$i]) . "' AND `date` = CURDATE();\n"; $query .= "INSERT INTO `log` (`logtext`) VALUES ('" . addslashes($lifts[$i]) . " IS in database. Updating. No Closed.');\n"; } } } } } $result = $mysqli->multi_query($query); if (!$result) { die('Invalid query: ' . $mysqli->error()); } $mysqli->close(); echo time();
<?php $data = json_decode(file_get_contents('/home/ubuntu/workspace/data.json'), true); echo 'hej'; $my = new mysqli("127.0.0.1", "stumpdk", "", "test"); if (!($stmt = $my->prepare('insert into images_tags (tag_id, image_id, x, y, value, confidence) values (?, ?, ?, ?, ?, ?)'))) { die('could not prepare statement:' . $my->error); } $count = 0; for ($j = 0; $j < count($data); $j++) { $row = $data[$j]; if ($row['value']['data'] == NULL) { continue; } $image_id = $row['key']; $imgHeight = $row['value']['dimensions']['height']; $imgWidth = $row['value']['dimensions']['width']; for ($i = 1; $i < count($row['value']['data']) - 1; $i++) { $age = $row['value']['data'][$i][1]; $confidence = $row['value']['data'][$i][2]; $first_eye_x = $row['value']['data'][$i][4] / $imgWidth; $first_eye_y = $row['value']['data'][$i][5] / $imgHeight; $tag_id = '1000'; $stmt->bind_param("ssssss", $tag_id, $image_id, $first_eye_x, $first_eye_y, $age, $confidence); if (!$stmt->execute()) { die($my->error() . ' ' . $str); } } $count = $j; } echo 'inserted: ' . $count;
} if ($user == $user2 && (hash_equals($pass2, crypt($password, $pass2)) || $pass2 == "web000")) { $_SESSION['session_username'] = $user; $_SESSION['nick'] = $user; $_SESSION['asmatutakoak'] = 0; $_SESSION['okerrak'] = 0; $ordua = Date('Y-m-d H:i:s'); $konexioa = $link->query("SELECT emaila FROM konexioak WHERE emaila={$user}"); $konkop = mysqli_num_rows($konexioa); if ($konkop == 0) { $sql = "INSERT INTO konexioak(emaila,ordua) values ('{$user}','{$ordua}')"; } else { $sql = "UPDATE konexioak SET ordua='{$ordua}' WHERE emaila='{$user}'"; } if (!$link->query($sql)) { die("<p>An error happened: " . $link->error() . "</p>"); } if ($_SESSION['session_username'] == '*****@*****.**') { header("Location: reviewingQuizzes.php"); } else { /* Redirect browser */ header("Location: handlingQuizzes.php"); } } else { $message = "Wrong email or password"; } } else { $message = "You tried 3 times, your ip has been banned until tomorrow."; } } }