本文整理匯總了PHP中SessionHandler::setSession方法的典型用法代碼示例。如果您正苦於以下問題:PHP SessionHandler::setSession方法的具體用法?PHP SessionHandler::setSession怎麽用?PHP SessionHandler::setSession使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SessionHandler
的用法示例。
在下文中一共展示了SessionHandler::setSession方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: DatabaseHandler
$database = new DatabaseHandler();
$session = new SessionHandler();
//Mendapatkan semua informasi yang telah divalidasi di client-side
$fullname = $_POST['fullname'];
$username = $session->username;
$password = md5($_POST['password']);
$birthdate = $_POST['birthdate'];
$location = $_POST['location'];
$img_src = "./res/upload/";
$img_extension = substr($_FILES["profpict"]["name"], strrpos($_FILES["profpict"]["name"], '.'));
$new_img_location;
if ($img_extension == "") {
$query = "SELECT img_location FROM {$database->t_user}\n WHERE username='{$username}'";
$result = $database->execQuery($query);
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$new_img_location = $row['img_location'];
} else {
move_uploaded_file($_FILES["profpict"]["tmp_name"], "../res/upload/" . $username . $img_extension);
$new_img_location = $img_src . $username . $img_extension;
}
$query = "UPDATE {$database->t_user}\n SET\n fullname='{$fullname}',\n password='{$password}',\n birthdate='{$birthdate}',\n location='{$location}',\n img_location = '{$new_img_location}'\n WHERE\n username='{$username}' ";
if ($database->execQuery($query)) {
$query = "SELECT * FROM " . $database->t_user . " WHERE username='" . $username . "' ";
$result = $database->execQuery($query);
$result = mysql_fetch_array($result);
$session->setSession($result);
header("location:../profile.php?ref=editSuccess");
} else {
header("location:../profile.php?ref=editFailed");
die;
}