Example #1
0
 /**
  * rollback transaction
  */
 public function rollback()
 {
     if ($this->connection === null) {
         $this->open();
     }
     $this->connection->rollback();
     $this->connection->autocommit(true);
 }
Example #2
0
 /**
  * Connection constructor.
  *
  * @param $config string[]
  */
 public function __construct($config)
 {
     mysqli_report(MYSQLI_REPORT_STRICT);
     // attempt to connect to the db
     $this->mysqli = new \mysqli($config['host'], $config['user'], $config['password'], $config['database'], $config['port']);
     // we will manually commit our sql changes
     $this->mysqli->autocommit(false);
     $this->statementCache = new Statement(500);
 }
Example #3
0
 /**
  * Class constructor
  *
  * @param string $readWriteMode "read", "write" or "admin"
  * @throws ControllerException
  */
 public function __construct($readWriteMode = 'write')
 {
     try {
         $dbc = new DBConnection($readWriteMode);
         $this->_dbh = $dbc->getConnection();
         $this->_dbh->autocommit(TRUE);
     } catch (Exception $e) {
         throw new ControllerException('Problem connecting to database: ' . $this->_dbh->error);
     }
 }
 public function instance()
 {
     try {
         $settings = $this->settings;
         $host = Properties::string("host", $settings, false, "127.0.0.1");
         $user = Properties::string("user", $settings, false);
         $password = Properties::string("password", $settings, false);
         $database = Properties::string("database", $settings, false, "");
         $port = Properties::int("port", $settings, false, 3306);
         $autoCommit = Properties::bool("autoCommit", $settings, false, true);
         $charSet = Properties::string("charSet", $settings, false, "utf8");
         //Turn off error reporting for MariaDB compliance.
         $err_level = error_reporting(E_ALL ^ E_WARNING);
         $mysql = new \mysqli($host, $user, $password, $database, $port);
         error_reporting($err_level);
         if ($mysql->connect_error) {
             throw new DbException($mysql->connect_error, $mysql->connect_errno);
         }
         if (!$mysql->set_charset($charSet)) {
             throw new DbException("Could not set charset {$charSet}");
         }
         if ($autoCommit !== null) {
             if (!$mysql->autocommit($autoCommit)) {
                 throw new DbException("Could not set autoCommit to {$autoCommit}");
             }
         }
         return $mysql;
     } catch (PropertyException $e) {
         throw new DbException("Missing setting property {$e->getProperty()}");
     }
 }
 public function load_client_details_by_phone_number($phone_number)
 {
     //$client_details = array("Error"=> "Data Not Found", "status"=>"false");
     //return $client_details;
     //Create a container object which will hold complete information required to display the complete order page
     $container = new stdClass();
     //Establish mysqli connection
     $mysqli_connection = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
     if ($mysqli_connection->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli_connection->connect_errno . ") " . $mysqli_connection->connect_error;
         //$container->show_failure_message = true;
         return $container;
     }
     //Set auto-commit to FALSE explicitly
     if (!$mysqli_connection->autocommit(FALSE)) {
         return;
     }
     $access = new ClientDetailsAccess($mysqli_connection);
     $client_details = $access->load_by_client_phone_number($phone_number);
     //Validate whether order loading is successful or not.
     if ($access->m_status == false || $access->m_status_code == STATUS_FETCH_NO_DATA) {
         $container->show_failure_message = true;
         //Close the connection
         $mysqli_connection->close();
         $client_details = array("Error" => "Data Not Found", "status" => "false");
     }
     return $client_details;
 }
 /**
  * Removes a transaction from the current stack.
  */
 private function popTransaction()
 {
     --$this->transactionCount;
     if ($this->transactionCount == 0) {
         @$this->mysqli->autocommit(true);
     }
 }
Example #7
0
/**
 * Commonly used function
 * @author Alex
 */
function db_connect($autocommit = true)
{
    global $db_info;
    global $connected;
    global $connection;
    //		static $connection = null;
    $retryCount = 3;
    //		if($connection) return $connection;
    while (!$connected && $retryCount > 1) {
        $connection = new mysqli($db_info['HOST'], $db_info['USER'], $db_info['PASSWORD'], $db_info['DATABASE']);
        //print_r($connection);exit();
        if ($connection && !mysqli_connect_errno()) {
            $connection->autocommit($autocommit);
            $connection->query("set names '" . $db_info['CHARSET'] . "'");
            $connected = true;
        } else {
            usleep(500000);
            $retryCount--;
        }
    }
    if ($connected) {
        return $connection;
    } else {
        print mysqli_connect_error();
    }
}
Example #8
0
 /**
  * Constructor. Get singleton instance via iveeCore\SDE::instance() instead.
  *
  * @param \mysqli $db is an optional reference to an existing DB connection object
  */
 protected function __construct(\mysqli $db = null)
 {
     if (!isset($db)) {
         $db = $this->connectDb();
         if ($db->connect_error) {
             exit('Fatal Error: ' . $db->connect_error . PHP_EOL);
         }
     } elseif (!$db instanceof \mysqli) {
         exit('Fatal Error: parameter given is not a mysqli object' . PHP_EOL);
     }
     $this->db = $db;
     //ivee uses transactions so turn off autocommit
     $this->db->autocommit(false);
     //eve runs on UTC time
     $this->db->query("SET time_zone='+0:00';");
 }
Example #9
0
 /**
  * Ends a transaction.
  *
  * @return Boolean
  */
 public function end_transaction()
 {
     $this->connect();
     if ($this->connected === TRUE) {
         return $this->mysqli->autocommit(TRUE);
     }
     return FALSE;
 }
Example #10
0
 /**
  * Begin transaction
  *
  * @return void
  */
 public function beginTransaction()
 {
     if (!$this->isConnected()) {
         $this->connect();
     }
     $this->resource->autocommit(false);
     $this->inTransaction = true;
 }
Example #11
0
function db_connect()
{
    $result = new mysqli('localhost', 'food_galaxy', 'password', 'food_galaxy');
    if (!$result) {
        return false;
    }
    $result->autocommit(TRUE);
    return $result;
}
Example #12
0
function db_connect()
{
    $result = new mysqli('silo.soic.indiana.edu', 'shopping', '0', 'eggplants', 11006);
    if (!$result) {
        return false;
    }
    $result->autocommit(TRUE);
    return $result;
}
Example #13
0
function db_connect()
{
    $result = new mysqli('localhost', 'grade_computer', 'password', 'grade_computer');
    //$result = new mysqli('localhost', 'sevsevel_deng', 'deng21', 'sevsevel_GradeComputer');
    if (!$result) {
        return false;
    }
    $result->autocommit(TRUE);
    return $result;
}
Example #14
0
function db_connect()
{
    // Set your Username, Password, And DB Name.
    $result = new mysqli('localhost', '', '', '');
    if (!$result) {
        return false;
    }
    $result->autocommit(TRUE);
    return $result;
}
Example #15
0
/**
 * Inserts a new order into the orders DB
 *
 * @param $orderinfo
 * @param $cart
 * @param $username
 * @return order ID, or FALSE on failure
 */
function insertOrder($orderinfo, $cart, $username)
{
    if (!$orderinfo || !$cart || !$username) {
        return FALSE;
    }
    include 'db_info.php';
    //include('userfunctions.php');
    @($db = new mysqli($dbhost, $dbuser, $dbpassword, $dbname));
    if (mysqli_connect_errno()) {
        echo "<br><h2 style='color:red'>Database connection error.</h2><br>" . mysqli_connect_error();
        return FALSE;
    }
    extract($orderinfo);
    // $orderinfo["addr"] = $addr
    // Only store the last 4 digits of cards in the db
    $cardnumber = substr($cardnumber, -4);
    $db->autocommit(FALSE);
    // Partial commits are bad
    $query = "INSERT INTO orders (shipping_addr, shipping_city, shipping_state, shipping_zip, creditcard, shipping_cost, ordertotal) VALUES \r\n\t\t ('" . addslashes($addr) . "', '" . addslashes($city) . "', '" . addslashes($state) . "', '" . addslashes($zip) . "', '" . $cardnumber . "', '" . $shipping . "', '" . $total . "');";
    $result = $db->query($query);
    if (!$result) {
        return FALSE;
    }
    $orderid = $db->insert_id;
    $query = "INSERT INTO user_orders (username, orderid) VALUES ('" . addslashes($username) . "', '" . $orderid . "');";
    $result = $db->query($query);
    if (!$result) {
        return FALSE;
    }
    foreach ($cart as $pid => $qty) {
        $product = getProductInfo($pid);
        $curprice = $product["price"];
        $query = "INSERT INTO product_orders (orderid, pid, qty, purchaseprice) VALUES \r\n\t\t\t\t('" . $orderid . "', '" . $pid . "', '" . $qty . "', '" . $curprice . "');";
        $result = $db->query($query);
        if (!$result) {
            return FALSE;
        }
    }
    $db->commit();
    $db->autocommit(TRUE);
    $db->close();
    return $orderid;
}
Example #16
0
 /**
  *
  */
 function connect()
 {
     $connect = new mysqli("localhost", "root", "copihue15", 'prod_pjud');
     $connect->autocommit(true);
     if ($connect->connect_errno) {
         printf("Fall� la conexi�n: %s\n", $connect->connect_error);
         exit;
     }
     return $connect;
 }
Example #17
0
 /**
  * Set autocommit
  * @param boolean $autocommit
  * @throws MysqltcsException on error
  */
 public function setAutocommit($autocommit)
 {
     if ($this->mysqliRef->autocommit($autocommit)) {
         $this->log("autocommit set to " . ($autocommit ? "true" : "false"));
         return;
     }
     $mex = "Mysql error: it is not possible set autocommit to " . ($autocommit ? "true" : "false") . " state. " . $this->mysqliRef->error;
     $this->log($mex);
     throw new MysqltcsException($mex);
 }
function db_open_trans()
{
    //conecta ao mysqli
    $mysqli = new mysqli(DBHOST, DBUSER, DBPASS, DBNAME);
    /* check connection */
    if (mysqli_connect_errno()) {
        die("Falha na conexao: " . mysqli_connect_error());
    }
    $mysqli->autocommit(false);
    return $mysqli;
}
Example #19
0
	public function __construct(){
		
		@ $db = new mysqli(self::localhost,self::username,self::password,self::databaseName);
		$db->autocommit(FALSE);
		$db->set_charset('utf8');
		
		if(mysqli_connect_errno()){
			$this->setDB(null);
		}else{
			$this->setDB($db);
		}
	}
Example #20
0
 /**
  * Rollback
  *
  * @throws Exception\RuntimeException
  * @return Connection
  */
 public function rollback()
 {
     if (!$this->resource) {
         throw new Exception\RuntimeException('Must be connected before you can rollback.');
     }
     if (!$this->inTransaction) {
         throw new Exception\RuntimeException('Must call commit() before you can rollback.');
     }
     $this->resource->rollback();
     $this->resource->autocommit(true);
     return $this;
 }
Example #21
0
function create_connection(&$connection)
{
    // Global variables
    global $db_server, $db_username, $db_password, $db_name;
    $connection = new mysqli($db_server, $db_username, $db_password, $db_name);
    if ($connection->connect_error) {
        return false;
    }
    // Set charset to utf8
    $connection->set_charset("utf8");
    // Disable autocommit (begin transaction)
    $connection->autocommit(FALSE);
    return true;
}
Example #22
0
function compraProdotto($id, $email)
{
    $mysqli = new mysqli(DB_SERVER, DB_USER, DB_PASS, DB_NAME);
    $mysqli->autocommit(false);
    $add = $mysqli->query("INSERT INTO ordini (id_prodotto, nomeutente) VALUES ({$id}, '{$email}')");
    $q = $mysqli->query("SELECT * FROM prodotti WHERE id={$id}");
    if (!$add) {
        $mysqli->rollback();
        return false;
    }
    $prodottoSelezionato = mysqli_fetch_assoc($q);
    if ($prodottoSelezionato['quantita'] == 0) {
        $mysqli->rollback();
        return false;
    }
    $nuovaQuantita = $prodottoSelezionato['quantita'] - 1;
    $u = $mysqli->query("UPDATE prodotti SET quantita = {$nuovaQuantita} WHERE id={$id}");
    if ($u) {
        $mysqli->commit();
        $mysqli->autocommit(true);
        return true;
    }
}
 function social_worker_login($login_container)
 {
     //Create a container object which will hold complete information required to display the complete order page
     $container = new stdClass();
     //Establish mysqli connection
     $mysqli_connection = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
     if ($mysqli_connection->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli_connection->connect_errno . ") " . $mysqli_connection->connect_error;
         $container->show_failure_message = true;
         $container->destination_page = LOGIN_PAGE;
         return $container;
     }
     //Set auto-commit to FALSE explicitly
     if (!$mysqli_connection->autocommit(FALSE)) {
         echo "Failed to turn off auto-commit to false";
     }
     $sw_details_info_do = new SocialWorkerDetailsDO();
     $sw_details_info_access = new SocialWorkerDetailsAccess($mysqli_connection);
     $sw_details_info_do = $sw_details_info_access->load_by_sw_details_phonenumber($login_container->login_username);
     //Validate whether order loading is successful or not.
     if ($sw_details_info_access->m_status == false || $sw_details_info_access->m_status_code == STATUS_FETCH_NO_DATA) {
         echo "Failed to load Admin details for the Admin User Name - " . $admin_login_container->user_name;
         $container->show_failure_message = true;
         $container->destination_page = LOGIN_PAGE;
         //Close the connection
         $mysqli_connection->close();
         return $container;
     }
     //Password Validation
     if (!strcmp($sw_details_info_do->password, $login_container->password)) {
         echo "User Authentication Successful.";
     } else {
         echo "User Authentication Failed. Password Mismatch.";
         $container->show_failure_message = true;
         $container->destination_page = ADMIN_LOGIN_PAGE;
         //Close the connection
         $mysqli_connection->close();
         return $container;
     }
     $container->sw_user_loggedin = true;
     $container->sw_user_name = $sw_details_info_do->m_name;
     //everything is fine
     $mysqli_connection->commit();
     //Close the connection
     $mysqli_connection->close();
     return $container;
 }
Example #24
0
 public static function getConnection($mode = true)
 {
     $conn = null;
     try {
         $config = self::getDbConfig();
         $conn = new mysqli();
         $conn->connect($config["host"], $config["user"], $config["password"], $config["db"], $config["port"]);
         if ($conn->connect_error) {
             throw new Exception($conn->connect_error);
         }
         $conn->autocommit($mode);
         //是否自动提交,默认自动提交
     } catch (Exception $e) {
         Tool::logger(__METHOD__, __LINE__, "连接数据库失败:" . $e->getMessage());
         throw $e;
     }
     return $conn;
 }
Example #25
0
 /**
  *
  * @param String $server address to the server
  * @param String $user the username used to connect to the DB
  * @param String $pass the password used to connect to the DB
  * @param String $db the DB to use in the server
  */
 public function connect($server, $user, $pass, $db)
 {
     if ($this->logger != null)
     {
         $this->logger->log(
                 Logger::LEVEL_TRACE,
                 __FUNCTION__." called");
     }
     $this->db = $db;
     $this->conn = new mysqli($server, $user, $pass, $db);
     if (mysqli_connect_error())
     {
         throw new DBConnectException(
                 "Error(".mysqli_connect_errno().") ".
                 mysqli_connect_error());
     }
     $this->conn->autocommit(false);
 }
 public function load_clients_by_sw_details_phone_number($phone_number)
 {
     //Establish mysqli connection
     $mysqli_connection = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
     if ($mysqli_connection->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli_connection->connect_errno . ") " . $mysqli_connection->connect_error;
         $sw_details = array("Error" => "Database error occured", "status" => "false");
         return $sw_details;
     }
     //Set auto-commit to FALSE explicitly
     if (!$mysqli_connection->autocommit(FALSE)) {
         return;
     }
     $access = new SocialWorkerDetailsAccess($mysqli_connection);
     $sw_details = $access->load_clients_by_sw_phone_number($phone_number);
     //Validate whether order loading is successful or not.
     if ($access->m_status == false || $access->m_status_code == STATUS_FETCH_NO_DATA) {
         //Close the connection
         $mysqli_connection->close();
     }
     return $sw_details;
 }
Example #27
0
<?php

$mysqli = new mysqli("localhost", "xjun", "999999/aBc", "test");
/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit;
}
/* disable autocommit */
$mysqli->autocommit(FALSE);
$mysqli->query("CREATE TABLE myCity LIKE City");
$mysqli->query("ALTER TABLE myCity Type=InnoDB");
$mysqli->query("INSERT INTO myCity SELECT * FROM City LIMIT 50");
/* commit insert */
$mysqli->commit();
/* delete all rows */
$mysqli->query("DELETE FROM myCity");
if ($result = $mysqli->query("SELECT COUNT(*) FROM myCity")) {
    $row = $result->fetch_row();
    printf("%d rows in table myCity.\n", $row[0]);
    /* Free result */
    $result->close();
}
/* Rollback */
$mysqli->rollback();
if ($result = $mysqli->query("SELECT COUNT(*) FROM myCity")) {
    $row = $result->fetch_row();
    printf("%d rows in table myCity (after rollback).\n", $row[0]);
    /* Free result */
    $result->close();
}
Example #28
0
 /**
  * Transaction rollback function
  *
  * @uses mysqli->rollback();
  * @uses mysqli->autocommit(true);
  */
 public function rollback()
 {
     $this->_mysqli->rollback();
     $this->_transaction_in_progress = false;
     $this->_mysqli->autocommit(true);
 }
function save_image()
{
    include "dbconfig.php";
    // normally this info would be pulled from a database.
    // build JSON array.
    // 1. 업로드 파일 존재여부 확인
    if (!isset($_FILES['image'])) {
        exit("업로드 파일 존재하지 않음");
    }
    // if
    // 2. 업로드 오류여부 확인
    if ($_FILES['image']['error'] > 0) {
        switch ($_FILES['image']['error']) {
            case 1:
                exit("php.ini 파일의 upload_max_filesize 설정값을 초과함(업로드 최대용량 초과)");
            case 2:
                exit("Form에서 설정된 MAX_FILE_SIZE 설정값을 초과함(업로드 최대용량 초과)");
            case 3:
                exit("파일 일부만 업로드 됨");
            case 4:
                exit("업로드된 파일이 없음");
            case 6:
                exit("사용가능한 임시폴더가 없음");
            case 7:
                exit("디스크에 저장할수 없음");
            case 8:
                exit("파일 업로드가 중지됨");
            default:
                exit("시스템 오류가 발생");
        }
        // switch
    }
    // if
    // 3. 업로드 제한용량 체크(서버측에서 8M로 제한)
    if ($_FILES['image']['size'] > 8388608) {
        exit("업로드 최대용량 초과");
    }
    // if
    // 4. 업로드 허용 확장자 체크(보편적인 jpg,jpeg,gif,png,bmp 확장자만 필터링)
    $ableExt = array('jpg', 'jpeg', 'gif', 'png', 'bmp');
    $path = pathinfo($_FILES['image']['name']);
    $ext = strtolower($path['extension']);
    if (!in_array($ext, $ableExt)) {
        exit("허용되지 않는 확장자입니다.");
    }
    // if
    // 5. MIME를 통해 이미지파일만 허용(2차 확인)
    // $ableImage = array('image/jpeg', 'image/JPG', 'image/X-PNG', 'image/PNG', 'image/png', 'image/x-png', 'image/gif','image/bmp','image/pjpeg');
    // if(!in_array($_FILES['image']['type'], $ableImage)) {
    // exit("지정된 이미지만 허용됩니다.");
    // }//if
    // 6. DB에 저장할 이미지 정보 가져오기(width,height 값 활용)
    $img_size = getimagesize($_FILES['image']['tmp_name']);
    // DB연결
    $mysqli = new mysqli($dbhost, $dbusr, $dbpass, $dbname);
    if ($mysqli->connect_errno) {
        echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
    }
    $create_table = "CREATE TABLE if not exists image_files( \n\t\t\t\t\tid int auto_increment, \n\t\t\t\t\tupload_filename varchar(100), \n\t\t\t\t\tdb_filename varchar(100), \n\t\t\t\t\tfilepath varchar(100), \n\t\t\t\t\tfilesize int(8),\n\t\t\t\t\tfile_type VARCHAR(40),\n\t\t\t\t\tupload_date DATETIME DEFAULT CURRENT_TIMESTAMP,\n\t\t\t\t\twidth int(8), \n\t\t\t\t\theight int(8), \n\t\t\t\t\tPRIMARY KEY (id) \n\t\t\t\t\t);";
    $mysqli->query($create_table);
    // do~while: 새로만든 파일명이 중복일경우 반복하기 위한 루틴
    do {
        // 6. 새로운 파일명 생성(마이크로타임과 확장자 이용)
        $time = explode(' ', microtime());
        $fileName = $time[1] . substr($time[0], 2, 6) . '.' . strtoupper($ext);
        // 중요 이미지의 경우 웹루트(www) 밖에 위치할 것을 권장(예제 편의상 아래와 같이 설정)
        $filePath = $_SERVER['DOCUMENT_ROOT'] . '/web_test/image_test/upload_image/';
        // 7. 생성한 파일명이 DB내에 존재하는지 체크
        $query = sprintf("SELECT no FROM image_files WHERE db_filename = '%s'", $fileName);
        $result = $mysqli->query($query);
        if ($result === NULL) {
            break;
        }
        // 생성한 파일명이 중복하는 경우 새로 생성해서 체크를 반복(동시저장수가 대량이 아닌경우 중복가능 희박)
    } while ($result != NULL && $result->num_rows > 0);
    // db에 저장할 정보 가져옴
    $upload_filename = $mysqli->real_escape_string($_FILES['image']['name']);
    $file_size = $_FILES['image']['size'];
    $file_type = $_FILES['image']['type'];
    $upload_date = date("Y-m-d H:i:s");
    // $ip = $_SERVER['REMOTE_ADDR'];
    // 오토커밋 해제
    $mysqli->autocommit(false);
    // 8. db에 업로드 파일 및 새로 생성된 파일정보등을 저장
    $query = sprintf("INSERT INTO image_files\n\t\t(upload_filename,db_filename,filepath,filesize,file_type,upload_date,width,height) \n\t\tVALUES ('%s','%s','%s','%s','%s','%s',%d,%d)", $upload_filename, $fileName, $filePath, $file_size, $file_type, $upload_date, $img_size[0], $img_size[1]);
    $mysqli->query($query);
    if ($mysqli->error) {
        echo "Failed to insert image db: (" . $mysqli->error . ") ";
    }
    $insert_id = $mysqli->insert_id;
    // DB에 파일내용 저장 성공시
    if ($mysqli->affected_rows > 0) {
        // 9. 업로드 파일을 새로 만든 파일명으로 변경 및 이동
        if (move_uploaded_file($_FILES['image']['tmp_name'], $filePath . $fileName)) {
            // 10. 성공시 db저장 내용을 적용(커밋)
            $mysqli->commit();
        } else {
            // 실패시 db에 저장했던 내용 취소를 위한 롤백
            $mysqli->rollback();
            exit("업로드 실패");
        }
        // if
    }
    // if
    $image_saving_info = array("id" => $insert_id);
    $mysqli->close();
    return $image_saving_info;
}
Example #30
0
$picture = "http://volumeone.org/uploads/image/article/007/060/7060/header_custom/7060_52121_688_blank_avatar_220.png";
$servername = "localhost";
$susername = "root";
$password = "";
$db = "timsrp";
$conn = new mysqli($servername, $susername, $password, $db);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT userid FROM users WHERE email='" . $_POST["email"] . "' OR userid='" . $user . "'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
    $error = "Error: Email or Username already exists<br/>";
} else {
    $row = $result->fetch_assoc();
    $conn->autocommit(FALSE);
    $stmt = $conn->prepare("INSERT INTO users (userid,firstname,lastname,email,picture,sex,birthday,password) VALUES (?,?,?,?,?,?,?,?)");
    if ($stmt === FALSE) {
        $error = "Failed to prepare statement<br/>";
    } else {
        $stmt->bind_param("sssssiss", $user, $first, $last, $email, $picture, $sex, $dob, $pswd);
        $stmt->execute();
        $conn->commit();
        $stmt->close();
        setcookie("loggedInUID", $user, time() + 60 * 60 * 24 * 30);
    }
}
$conn->close();
?>

<!DOCTYPE html>