本文整理汇总了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;
}