public function logar() { $parameters = array(); $parameters[':username'] = $this->getUsername(); $parameters[':senha'] = $this->getSenha(); $objLoginDao = new LoginDao(); return $objLoginDao->login($parameters); }
/** * 用户登录校验 * */ public function loginCheck($user) { $dao = new LoginDao(); $loginName = $user["loginName"]; $passWord = $user["passWord"]; $result = $dao->find("loginName = '{$loginName}' and passWord = '******'", "users"); if (!$result) { throw new Exception("用户名/密码不正确!"); } return $result; }
public static function authUser($username, $password) { $login = LoginDao::getLoginByUsername($username); if ($login != null && CryptoUtil::encrypt($password) == $login->getEncryptedPassword()) { return $login; } return null; }
public function handleClientDesign(Context $context) { $insertDate = explode('/', $_POST['insertdate']); $mysqlFormattedDate = $insertDate[2] . "-" . $insertDate[1] . "-" . $insertDate[0]; $clientId = ClientDao::getClientByLogin(LoginDao::getLoginByUsername(SessionUtil::getUsername()))->getID(); $filename = $this->saveSampleImage($context, $_FILES['sampleimage'], $clientId); if ($filename != "") { InsertionOrderDao::createForClientWithImage(ClientDao::getClientByLogin(LoginDao::getLoginByUsername(SessionUtil::getUsername()))->getID(), $mysqlFormattedDate, $_POST['design'], $_POST['color'], $_POST['columns'], $_POST['height'], $_POST['inserts'], $_POST['placements'], $filename); } }
public static function getClientByID($ID) { $query = "SELECT * FROM " . Database::addPrefix('clients') . " WHERE ClientID = '" . Database::makeStringSafe($ID) . "' LIMIT 1"; $result = Database::doQuery($query); if (mysql_num_rows($result) == 1) { $client = mysql_fetch_assoc($result); return new Client($client['ClientID'], LoginDao::getLoginById($client['LoginID']), $client['Name'], $client['Email'], $client['Phone'], $client['Address']); } else { return null; } }
public function __construct($clientId, $login, $name, $email, $phone, $address) { $this->clientId = $clientId; if ($login instanceof Login) { $this->login = $login; } else { $this->login = LoginDao::getLoginById($login); } $this->name = $name; $this->email = $email; $this->phone = $phone; $this->address = $address; }
public function generateClientHTML() { $adRep = new AdRep(1, "Andrew Melton", "*****@*****.**", "804-267-0327"); $status = new Status(1, "Design", "Your ad has been aproved and is being designed."); $designStatus = new Status(1, "To Be Designed", "A designer is working on your ad."); $billingStatus = new Status(1, "Paid", ""); $orders = InsertionOrderDao::getOrdersByClientID(ClientDao::getClientByLogin(LoginDao::getLoginByUsername(SessionUtil::getUsername()))->getID()); $ordersHTML = ""; foreach ($orders as $order) { $ordersHTML = $ordersHTML . $order->generateDualRowHTML(); } return "<br />\n\t\t\t\t<div id=\"insertsheader\">\n\t\t\t\t<table id=\"report2\" border=\"0\">\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<th class=\"adrep\">Your Ad Rep</th>\n\t\t\t\t\t\t<th class=\"created\">Created</th>\n\t\t\t\t\t\t<th class=\"updated\">Updated</th>\n\t\t\t\t\t\t<th class=\"issue\">Issue</th>\n\t\t\t\t\t\t<th class=\"status\">Status</th>\n\t\t\t\t\t\t<th class=\"designstatus\">Design-Status</th>\n\t\t\t\t\t\t<th class=\"billingstatus\">Billing</th>\n\t\t\t\t\t\t<!--<th class=\"arrow\"></th>-->\n\t\t\t\t\t\t\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t\t</div>\n\t\t\t\n\t\t\t\t<div id=\"contentdiv\" class=\"scroll\">\n\t\t\t\t\n\t\t\t\t\t<table id=\"report\" border=\"0\">\n\t\t\t\t\t\t\n\t\t\t\t\t\t" . $ordersHTML . "\n\t\t\t\t\t\n\t\t\t\t\t</table>\n\t\t\t\t\n\t\t\t\t</div>"; }
public static function logar() { $nme_login = isset($_POST['nme_login']) ? $_POST['nme_login'] : ""; $nme_senha = isset($_POST['nme_senha']) ? $_POST['nme_senha'] : ""; $validator = new DataValidator(); $validator->set_msg('O login é obrigatório')->set('nme_login', $nme_login)->is_required(); $validator->set_msg('A senha é obrigatória')->set('nme_senha', $nme_senha)->is_required(); if (!$validator->validate()) { Flight::response()->status(406)->header('Content-Type', 'application/json')->write(json_encode($validator->get_errors()))->send(); return; } try { $loginDao = new LoginDao(); $usuario = $loginDao->logar($nme_login, md5($nme_senha)); if ($usuario) { Flight::json($usuario); } else { Flight::response()->status(406)->header('Content-Type', 'application/json')->write(json_encode(array("msg" => "Login ou Senha inválidos!")))->send(); } } catch (PDOException $e) { Flight::halt(500, $e->getMessage()); } }
public function handleForm($context, $action) { if ($action == "login") { $login = LoginDao::authUser($_POST['username'], $_POST['password']); if ($login) { SessionUtil::login($login); $context->setPageID("home"); } else { $context->addError("Incorrect Login"); } } else { $context->addError("Incorrect Action."); } }
function generateHTML() { $login = LoginDao::getLoginByUsername(SessionUtil::getUsername()); if ($login->getType() == Login::CLIENT) { $client = ClientDao::getClientByLogin($login); return $this->context->getErrorHTML() . "<div class=\"centered\">\n\t\t\n\t\t\t\t<h3>Login</h3>\n\t\t\t\t\n\t\t\t\t<form action=\"./index.php?pageid=myAccount\" method=\"post\">\n\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"changePassword\" />\n\t\t\t\t\t<label for=\"password\" class=\"sameline\">Password</label>\n\t\t\t\t\t<input type=\"password\" name=\"password\" placeholder=\"Password\" class=\"text bluefocus\"/>\n\t\t\t\t\t<label for=\"password\" class=\"sameline\">Repeat Password</label>\n\t\t\t\t\t<input type=\"password\" name=\"repeatpassword\" placeholder=\"Repeat Password\" class=\"text bluefocus\"/>\n\t\t\t\t\t<input type=\"submit\" value=\"Change Password\" class=\"stdbutton bluefocus\"/>\n\t\t\t\t</form>\n\t\t\t\t\n\t\t\t\t<h3>Account Info</h3>\n\t\t\t\t\n\t\t\t\t<div style=\"width: 45%; margin-left: auto; margin-right: auto;\">\n\t\t\t\t\t<form action=\"./index.php?pageid=myAccount\" method=\"post\">\n\t\t\t\t\t\t<div style=\"float: left; text-align: left;\">\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"updateAccount\" />\n\t\t\t\t\t\t\t<label for=\"name\" class=\"above\">Name</label>\n\t\t\t\t\t\t\t<input type=\"text\" name=\"name\" placeholder=\"Name\" value=\"" . $client->getName() . "\" class=\"text bluefocus\"/>\n\t\t\t\t\t\t\t<label for=\"email\" class=\"above\">Email</label>\n\t\t\t\t\t\t\t<input type=\"email\" name=\"email\" placeholder=\"Email\" value=\"" . $client->getEmail() . "\" class=\"text bluefocus\"/>\n\t\t\t\t\t\t\t<label for=\"phone\" class=\"above\">Phone</label>\n\t\t\t\t\t\t\t<input type=\"text\" name=\"phone\" placeholder=\"Phone\" value=\"" . $client->getPhone() . "\" class=\"text bluefocus\"/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div style=\"float: right; text-align: right;\">\n\t\t\t\t\t\t\t<br /><label for=\"address\" class=\"above\">Address</label>\n\t\t\t\t\t\t\t<textarea name=\"address\" rows=\"3\" cols=\"23\" class=\"text bluefocus\">" . $client->getAddress() . "</textarea>\n\t\t\t\t\t\t\t<br /><br /><input type=\"submit\" value=\"Update Account\" class=\"stdbutton bluefocus\"/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</form>\n\t\t\t\t</div>\n\t\t\t\n\t\t\t</div>"; } else { if ($login->getType() == Login::ADREP) { $adrep = AdRepDao::getAdRepByLogin($login); return $this->context->getErrorHTML() . "<div class=\"centered\">\n\t\t\n\t\t\t\t<h3>Login Info</h3>\n\t\t\t\t\n\t\t\t\t<form action=\"./index.php?pageid=myAccount\" method=\"post\">\n\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"changePassword\" />\n\t\t\t\t\t<label for=\"password\" class=\"sameline\">Password</label>\n\t\t\t\t\t<input type=\"password\" name=\"password\" placeholder=\"Password\" class=\"text bluefocus\"/>\n\t\t\t\t\t<label for=\"password\" class=\"sameline\">Repeat Password</label>\n\t\t\t\t\t<input type=\"password\" name=\"repeatpassword\" placeholder=\"Repeat Password\" class=\"text bluefocus\"/>\n\t\t\t\t\t<input type=\"submit\" value=\"Change Password\" class=\"stdbutton bluefocus\"/>\n\t\t\t\t</form>\n\t\t\t\t\n\t\t\t\t<h3>Account Info (Ad Rep)</h3>\n\t\t\t\t\n\t\t\t\t<div style=\"width: 45%; margin-left: auto; margin-right: auto;\">\n\t\t\t\t\t<form action=\"./index.php?pageid=myAccount\" method=\"post\">\n\t\t\t\t\t\t<div style=\"float: left; text-align: left;\">\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"updateAccount\" />\n\t\t\t\t\t\t\t<label for=\"name\" class=\"above\">Name</label>\n\t\t\t\t\t\t\t<input type=\"text\" name=\"name\" placeholder=\"Name\" value=\"" . $adrep->getName() . "\" class=\"text bluefocus\"/>\n\t\t\t\t\t\t\t<label for=\"email\" class=\"above\">Email</label>\n\t\t\t\t\t\t\t<input type=\"email\" name=\"email\" placeholder=\"Email\" value=\"" . $adrep->getEmail() . "\" class=\"text bluefocus\"/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div style=\"float: right; text-align: right;\">\n\t\t\t\t\t\t\t<label for=\"phone\" class=\"above\">Phone</label>\n\t\t\t\t\t\t\t<input type=\"text\" name=\"phone\" placeholder=\"Phone\" value=\"" . $adrep->getPhone() . "\" class=\"text bluefocus\"/>\n\t\t\t\t\t\t\t<br /><br /><input type=\"submit\" value=\"Update Account\" class=\"stdbutton bluefocus\"/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</form>\n\t\t\t\t</div>\n\t\t\t\n\t\t\t</div>"; } else { return $this->context->getErrorHTML() . "<div class=\"centered\">\n\t\t\t\n\t\t\t\t<h3>Login Info</h3>\n\t\t\t\t\n\t\t\t\t<form action=\"./index.php?pageid=myAccount\" method=\"post\">\n\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"changePassword\" />\n\t\t\t\t\t<label for=\"password\" class=\"sameline\">Password</label>\n\t\t\t\t\t<input type=\"password\" name=\"password\" placeholder=\"Password\" class=\"text bluefocus\"/>\n\t\t\t\t\t<label for=\"password\" class=\"sameline\">Repeat Password</label>\n\t\t\t\t\t<input type=\"password\" name=\"repeatpassword\" placeholder=\"Repeat Password\" class=\"text bluefocus\"/>\n\t\t\t\t\t<input type=\"submit\" value=\"Change Password\" class=\"stdbutton bluefocus\"/>\n\t\t\t\t</form>\n\t\t\t\t\n\t\t\t\t<h3>Account Info</h3>\n\t\t\t\t\n\t\t\t\t<div class=\"centered error\">Unknown Account Type</div>\n\t\t\t\n\t\t\t</div>"; } } }
public function handleForm(Context $context, $action) { if ($action == "changePassword") { if ($_POST['password'] != "" && $_POST['repeatpassword'] != "") { $sessionLogin = LoginDao::getLoginByUsername(SessionUtil::getUsername()); if ($_POST['password'] == $_POST['repeatpassword']) { LoginDao::updateUserPassword($sessionLogin, $_POST['password']); } else { $context->addError("Passwords don't match."); } } else { $context->addError("Required field left blank."); } } else { if ($action == "updateAccount") { if ($_POST['name'] != "" && $_POST['email'] != "" && $_POST['phone'] != "") { $sessionLogin = LoginDao::getLoginByUsername(SessionUtil::getUsername()); if ($sessionLogin->getType() == Login::ADREP) { $adrep = AdRepDao::getAdRepByLogin($sessionLogin); AdRepDao::updateAdRep($adrep, $_POST['name'], $_POST['email'], $_POST['phone']); } else { if ($sessionLogin->getType() == Login::CLIENT) { if ($_POST['address'] != "") { $client = ClientDao::getClientByLogin($sessionLogin); ClientDao::updateClient($client, $_POST['name'], $_POST['email'], $_POST['phone'], $_POST['address']); } else { $context->addError("Required field left blank."); } } else { $context->addError("Unknown Account Type."); } } } else { $context->addError("Required field left blank."); } } else { $context->addError("Incorrect Action."); } } }
public function handleForm(Context $context, $action) { if ($action == "client") { if ($_POST['name'] != "" && $_POST['username'] != "" && $_POST['password'] != "" && $_POST['repeatpassword'] != "" && $_POST['email'] != "" && $_POST['phone'] != "" && $_POST['address'] != "") { if ($_POST['password'] == $_POST['repeatpassword']) { if (LoginDao::usernameFree($_POST['username'])) { $newLogin = LoginDao::createLogin($_POST['username'], $_POST['password'], Login::CLIENT); $newClient = ClientDao::createClient($newLogin, $_POST['name'], $_POST['email'], $_POST['phone'], $_POST['address']); SessionUtil::login($newLogin); $context->setPageID("home"); } else { $context->addError("Username already taken."); } } else { $context->addError("Passwords don't match."); } } else { $context->addError("Required field left blank."); } } else { $context->addError("Incorrect Action."); } }
document.getElementById("time").innerHTML = 3 - Time; ++Time; if(parseInt(Time) >= 3) forward(); else{ t=setTimeout("timedCount()", 1000); } } </script> <?php require_once '../dao/LoginDao.php'; $admin_id = $_POST['admin_id']; $ori_pwd = $_POST['ori_pwd']; $new_pwd = $_POST['new_pwd']; $loginDao = new LoginDao(); $obj_arr = $loginDao->getAdminPassword($admin_id); if ($ori_pwd != $obj_arr[0]->ad_password) { echo <<<EOD \t<center> \t<div style="margin-top:200px;"> <h1>原始密码输入错误,<font color="red"><span id="time"></span></font>秒钟之后跳转回修改密码页面!</h1> </div> \t<script>window.onload=function(){redirect='alter_admin_password';timedCount();}</script> \t</center> EOD; exit; } if ($ori_pwd == $new_pwd) { echo <<<EOD \t<center>
<?php require '../dao/LoginDao.php'; $ad_id = $_POST['ad_id']; $ad_password = $_POST['ad_password']; $loginDao = new LoginDao(); $obj = $loginDao->getAdminPassword($ad_id); if (count($obj) == 1) { if ($obj[0]->ad_password == $ad_password) { session_start(); $_SESSION['admin'] = $ad_id; echo true; exit; } } else { echo false; }
function timedCount(){ document.getElementById("time").innerHTML = 3 - Time; ++Time; if(parseInt(Time) >= 3) forward(); else{ t=setTimeout("timedCount()", 1000); } } </script> <?php require_once '../dao/LoginDao.php'; $user_id = $_POST['user_id']; $ori_pwd = $_POST['ori_pwd']; $new_pwd = $_POST['new_pwd']; $loginDao = new LoginDao(); $obj_arr = $loginDao->getUserPassword($user_id); if ($ori_pwd != $obj_arr[0]->user_password) { echo <<<EOD \t<center> \t<div style="margin-top:200px;"> <h1>原始密码输入错误,<font color="red"><span id="time"></span></font>秒钟之后跳转回修改密码页面!</h1> </div> \t<script>window.onload=function(){redirect='alter_password';timedCount();}</script> \t</center> EOD; exit; } if ($ori_pwd == $new_pwd) { echo <<<EOD \t<center>
color:#fff; text-shadow:1px 1px 0 #888; margin:10px 10px 10px 180px; border-radius:10px; border:1px solid #aaa; background:rgba(0,0,0,0.3); font-size:12px; } </style> </head> <body> <?php include 'nav.php'; require_once 'php/dao/LoginDao.php'; $user = $_SESSION['u_sid']; $loginDao = new LoginDao(); $user_arr = $loginDao->getUserName($user); ?> <div class="main-box"> <center> <div class="main"> <div class="notice-title">欢迎你!<?php echo $user_arr[0]->user_name; ?> </div><hr class="hr"> <div class="notice-sub-title"><img src="image/notice.png"/>最新消息</div><hr> <div class="notice-content"> <table> <thead> <tr> <th>奖学金评审阶段</th>
$logger = new FileWriter('spire_api_log', 'a'); $request_data = json_decode(file_get_contents("php://input")); $logger->writeLog("\n#####NEW REQUEST#####"); $logger->writeLog("Request Type: " . $_SERVER['REQUEST_METHOD']); $logger->writeLog("_GET = " . json_encode($_GET)); $logger->writeLog("_FILES = " . json_encode($_FILES)); $logger->writeLog("_POST = " . json_encode($_POST)); $logger->writeLog("request_data = " . json_encode($request_data)); $headers = apache_request_headers(); foreach ($headers as $header => $value) { $logger->writeLog("{$header}: {$value}"); } $TOKEN = $headers['Token']; $logger->writeLog("\$TOKEN: {$TOKEN}"); $TOKEN_DATA = null; $tokenDataHash = LoginDao::getTokenData($TOKEN); if ($tokenDataHash['ok']) { $TOKEN_DATA = $tokenDataHash['result']; $_SESSION['user'] = $TOKEN_DATA['user_id']; $_SESSION['user_type'] = $TOKEN_DATA['user_type_nbr']; $logger->writeLog("isAdmin:" . User::isAdmin($_SESSION['user_type'])); $logger->writeLog("User = "******"User Type = " . $_SESSION['user_type']); } if ($_SERVER['REQUEST_METHOD'] === "OPTIONS") { JsonResponse::sendResponse(204, ""); } else { if (isset($_GET['login']) && $_SERVER['REQUEST_METHOD'] === "POST") { if (isset($_GET['auth'])) { $fnHash = LoginDAO::getAndSaveToken($request_data->usernameOrEmail, $request_data->password); if ($fnHash['ok']) {
<?php require '../dao/LoginDao.php'; date_default_timezone_set('PRC'); $user_id = $_POST['user_id']; $user_password = $_POST['user_password']; $startTest = strtotime("2015-8-5 8:00:00"); $endTest = strtotime("2015-8-16 17:00:00"); $startTime = strtotime("2015-8-29 8:00:00"); $endTime = strtotime("2015-9-7 22:00:00"); $now = strtotime(Date("Y-m-d H:i:s")); $loginDao = new LoginDao(); $obj = $loginDao->getUserPassword($user_id); if (count($obj) == 1) { @session_start(); if (isset($_SESSION['admin'])) { $_SESSION['u_sid'] = $user_id; echo true; exit; } if ($obj[0]->user_password == $user_password) { /*$arr=array('201303111','201303067','201203126','201404031'); if(in_array($user_id,$arr)){ session_start(); $_SESSION['u_sid']=$user_id; echo true; exit; }*/ if ($now < $startTest || $now > $endTest && $now < $startTime) { $name_arr = $loginDao->getUserName($user_id); echo "{$name_arr[0]->user_name} 同学:\n\t\t\t\t\t欢迎登录Torch奖学金评审系统,本次登录不在测试或评审阶段内,系统暂未开放(⊙o⊙)\n\t\t\t\t\t【系统测试】08月05日8:00-08月16日17:00\n\t\t\t\t\t【正式申请】08月29日8:00-09月07日22:00";
<?php //include '../dao/TenderoDao.php'; // //$tenderoDao = new TenderoDao(); // // //$tenderoDao->sp_get_id_tendero_by_dni('46435523'); include '../dao/LoginDao.php'; $loginDao = new LoginDao(); $res = $loginDao->logeUsu('admin', '1234'); //json_encode .... print false if ($res == false) { echo '00000'; } else { echo $res->usuario; } //echo json_encode($res[0]);
<?php include '../dao/LoginDao.php'; $postdata = file_get_contents("php://input"); $request = json_decode($postdata); $loginDao = new LoginDao(); $username = $request->usuario->username; $password = $request->usuario->password; echo json_encode($loginDao->logeUsu($username, $password));
public function recuperarContrasena() { $parameters[':email'] = $this->email; $objLoginDao = new LoginDao(); return $objLoginDao->recuperacion($parameters); }
<?php /* 临时脚本 14级临时增加需求,在申请时间之外的基一时间段临时开放文体竞赛的申请入口,其他年级不能进入。 */ require_once 'php/dao/LoginDao.php'; $loginDao = new LoginDao(); @session_start(); $user_id = $_SESSION['u_sid']; $start = strtotime("2015-9-9 20:00:00"); $end = strtotime("2015-9-9 22:45:00"); $now = strtotime(Date("Y-m-d H:i:s")); $obj_arr = $loginDao->getUserGrade($user_id); $user_grade = $obj_arr[0]->user_grade; if (!isset($_SESSION['admin'])) { if ($user_grade == "2014") { if ($now > $start && $now < $end) { echo "<script>\$(function(){var obj=document.getElementById('role');obj.style.display='none';})</script>"; } else { echo "<script>location='error.php';</script>"; exit; } } else { echo "<script>location='error.php';</script>"; exit; } }
require_once './lib/Util/SessionUtil.php'; require_once './lib/Util/SimpleImage.php'; if (!SessionUtil::start()) { echo "Error Starting Session"; } Database::Open(); if (isset($_GET['insertId'])) { $insert = InsertionOrderDao::getByID($_GET['insertId']); if (!$insert) { $image = new SimpleImage(); $image->load('./images/notfound.png'); header('Content-Type: image/jpeg'); echo $image->output(); exit; } $client = ClientDao::getClientByLogin(LoginDao::getLoginByUsername(SessionUtil::getUsername())); if ($insert->getClient()->getID() == $client->getID() && file_exists($insert->getImageLoc())) { $image = new SimpleImage(); $image->load($insert->getImageLoc()); $hratio = 150 / $image->getHeight(); $wratio = 150 / $image->getWidth(); $image->scale(min($hratio, $wratio) * 100); header('Content-Type: image/jpeg'); echo $image->output(); } else { $image = new SimpleImage(); $image->load('./images/notfound.png'); header('Content-Type: image/jpeg'); echo $image->output(); exit; }