public function index() { if (isset($_POST) && $_POST) { $post = $_POST; if ($info = DB::fetch_first("select * from %t where email = %s", array('member', $post['email']))) { if (checkpassword($info['id'], $info['password'], $info['salt'], $post['password'])) { //登陆成功 $this->loginState($info); $this->redirect('Chat/index'); } else { echo '密码错误'; } } else { echo '用户不存在'; } $_POST = null; // $this->redirect('Login/index'); exit; } unset($_POST); $api = Config::get('global', 'qqconnect'); $qqcallback = url('Login/qqlogin', '', '', 1); $weibocallback = url('Login/weibologin', '', '', 1); $weixincallback = url('Login/weibologin', '', '', 1); $wbloginurl = $this->wbo->getAuthorizeURL($weibocallback); $qqloginurl = $this->getQqLoginUrl($api['appid'], $qqcallback); include template('login'); }
public function signin() { $session = $this->session->userdata('user_session'); #pr($session,1); if (isset($session['uid'])) { redirect(base_url()); } $post = $this->input->post(); if ($_SERVER['REDIRECT_URL'] != $_SERVER['HTTP_REFERER']) { $this->session->set_userdata('last_pageurl', $_SERVER['HTTP_REFERER']); } if ($post) { $this->form_validation->set_rules('mobileno', 'Mobile Number', 'trim|required'); $this->form_validation->set_rules('password', 'Password', 'trim|required'); $result = array(); if ($this->form_validation->run() !== false) { $where = "u_mobile ='" . $post['mobileno'] . "' AND u_password ='******'password']) . "'"; $ret = $this->common_model->selectData(USER, "*", $where); if (count($ret) != 0) { if ($ret[0]->u_is_verified == 0 && $ret[0]->u_active == 0) { $data['error_msg'] = 'Your account is deactivated. Please contact to administrator.'; } else { $red_uri = $this->session->userdata('last_pageurl'); if ($red_uri == '') { $red_uri = '/'; } ## insert login history $loginid = $this->common_model->insertLoginHistory($ret[0]->u_id); ## set user session $data = array('uid' => $ret[0]->u_id, 'firstname' => $ret[0]->u_fname, 'lastname' => $ret[0]->u_lname, 'email' => $ret[0]->u_email, "mobile" => $ret[0]->u_mobile, "user_verified" => $ret[0]->u_is_verified, "u_canpost" => $ret[0]->u_canpost, "loginid" => $loginid); $this->session->set_userdata('user_session', $data); //pr($this->get_userdata,9); //echo $this->user_session['uid'];die; ## process message cache $this->processMessageCache($data); ## update active and user verified flag $where = 'u_id = ' . $ret[0]->u_id; $updateRecord = array('u_active' => 1, 'u_is_verified' => 1); $updateuser = $this->common_model->updateData(USER, $updateRecord, $where); if (checkpassword($post['password'])) { redirect("/myaccount/change-password"); } else { redirect($red_uri); } } } else { $data['error_msg'] = "Incorrect Mobile number or password"; } } else { $data['error_msg'] = validation_errors(); } } $data['view'] = "signin"; $data['nosearchbar'] = false; $this->load->view('content', $data); }
if ($pass == mysql_result($res, 0, "passwd")) { $user_type = mysql_result($res, 0, "type"); $user_group = mysql_result($res, 0, "grp"); return TRUE; } else { return FALSE; } } else { return FALSE; } } session_start(); $p_id = $_POST['id']; $p_pass = $_POST['pass']; connect_db(); $check = checkpassword($p_id, $p_pass, $user_type, $user_group); close_db(); if ($check) { $_SESSION['id'] = $p_id; $_SESSION['type'] = $user_type; $_SESSION['group'] = $user_group; echo '<html>'; echo '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=main.php">'; echo '</html>'; } else { session_destroy(); echo '<html>'; echo '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=login.php?error=1">'; echo '</html>'; } ?>
private function _init_config() { $error = false; $lockfile = TOOLS_ROOT . 'tools.lock'; if (@file_exists($lockfile)) { $error = true; $errormsg = "工具箱已关闭,如需开启只要通过 FTP 删除 /source/plugin/tools/ 下的 tools.lock 文件即可"; } $_config = array(); global $tpassword; if ($errormsg = checkpassword($tpassword)) { $error = true; } @(include TDISCUZ_ROOT . './config/config_global.php'); if (empty($_config)) { $error = true; $errormsg = '没有找到config文件,请检查 /config/config_global.php 是否存在或有读权限!'; } $uc_config_file = TDISCUZ_ROOT . './config/config_ucenter.php'; if (!@file_exists($uc_config_file)) { $error = true; $errormsg = '没有找到uc config文件,请检查 /config/config_ucenter.php 是否存在或有读权限!'; } @(include $uc_config_file); if ($error) { show_msg($errormsg); } $this->config =& $_config; $this->config['dbcharset'] = $_config['db']['1']['dbcharset']; $this->config['charset'] = $_config['output']['charset']; }
} // check if entered email already exists if (!strlen($strEmail)) { $pageObject->jsSettings['tableSettings'][$strTableName]['msg_emailError'] = "Please enter a valid email address."; $allow_registration = false; } else { $strSQL = "select count(*) from " . $pageObject->connection->addTableWrappers("ConsolidatedStockEnquiry_users") . " where " . $pageObject->getFieldSQLDecrypt("email") . "=" . $sEmail; $data = $pageObject->connection->query($strSQL)->fetchNumeric(); if ($data[0] > 0) { $pageObject->jsSettings['tableSettings'][$strTableName]['msg_emailError'] = "Email" . " <i>" . $strEmail . "</i> " . "already registered. If you forgot your username or password use the password reminder form."; $allow_registration = false; } } $values["active1"] = 0; if ($pageObject->pwdStrong) { if (!checkpassword($values["password"])) { $msg = ""; $pwdLen = GetGlobalData("pwdLen", 0); if ($pwdLen) { $fmt = "Password must be at least %% characters length."; $fmt = str_replace("%%", "" . $pwdLen, $fmt); $msg .= "<br>" . $fmt; } $pwdUnique = GetGlobalData("pwdUnique", 0); if ($pwdUnique) { $fmt = "Password must contain %% unique characters."; $fmt = str_replace("%%", "" . $pwdUnique, $fmt); $msg .= "<br>" . $fmt; } $pwdDigits = GetGlobalData("pwdDigits", 0); if ($pwdDigits) {
private function _init_config() { $error = false; $_config = array(); global $tpassword; if($errormsg = checkpassword($tpassword)) { $error = true; } @include TOOLS_ROOT.'config/config_global.php'; if(empty($_config)) { $error = true; $errormsg = '没有找到config文件,请检查 /config/config_global.php 是否存在或有读权限!'; } $uc_config_file = TOOLS_ROOT.'config/config_ucenter.php'; if(!@file_exists($uc_config_file)) { $error = true; $errormsg = '没有找到uc config文件,请检查 /config/config_ucenter.php 是否存在或有读权限!'; } @include $uc_config_file; if($error) { show_msg($errormsg); } $this->config = & $_config; $this->config['dbcharset'] = $_config['db']['1']['dbcharset']; $this->config['charset'] = $_config['output']['charset']; }
echo '<tr><td class="altbg1" width="45%"><b>' . $lang['insenz_register_tel'] . '</b><br />' . $lang['insenz_register_tel_comment'] . '</td><td class="altbg2"><input type="text" name="tel1" size="3" value="' . $tel1 . '" onmousedown="clearinput(this, \'' . $lang['insenz_register_zone'] . '\')"> - <input type="text" name="tel2" size="8" value="' . $tel2 . '" onmousedown="clearinput(this,\'' . $lang['insenz_register_exchange'] . '\')"> - <input type="text" name="tel3" size="5" value="' . $tel3 . '" onmousedown="clearinput(this, \'' . $lang['insenz_register_extension'] . '\')"></td></tr>'; showsetting('insenz_register_mobile', 'mobile', $mobile, 'text'); echo '<tr><td class="altbg1" width="45%"><b>' . $lang['insenz_register_fax'] . '</b><br />' . $lang['insenz_register_fax_comment'] . '</td><td class="altbg2"><input type="text" name="fax1" size="3" value="' . $fax1 . '"> - <input type="text" name="fax2" size="8" value="' . $fax2 . '"> - <input type="text" name="fax3"size="5" value="' . $fax3 . '"></td></tr>'; echo '<tr><td class="altbg1" width="45%"><b>' . $lang['insenz_register_country'] . '</b></td><td class="altbg2"><select name="country" onChange="changeseleccountry(this.value)"><option value="0">' . $lang['select'] . '</option></select></td></tr>'; echo '<tr><td class="altbg1" width="45%"><b>' . $lang['insenz_register_province'] . '</b></td><td class="altbg2"><select name="province" onChange="changeseleccity(this.value)"><option value="0">' . $lang['select'] . '</option></select> </td></tr>'; echo '<tr><td class="altbg1" width="45%"><b>' . $lang['insenz_register_city'] . '</b></td><td class="altbg2"><select name="city"><option value="0">' . $lang['select'] . '</option></select> </td></tr>'; showsetting('insenz_register_address', 'address', $address, 'text'); showsetting('insenz_register_postcode', 'postcode', $postcode, 'text'); echo '<tr class="category"><td colspan="2">' . $lang['insenz_register_account'] . '</td></tr>'; showsetting('insenz_register_alipay', 'alipay', $alipay, 'text'); showtype('', 'bottom'); echo '<br /><center><input type="submit" class="button" name="regsubmit" value="' . $lang['submit'] . '" onclick="this.form.target=\'register\';"><iframe name="register" style="display: none"></iframe> <input type="button" class="button" value="' . $lang['cancel'] . '" onclick="window.location=\'admincp.php?action=insenz\'"></center></form> <script type="text/javascript" src="./include/javascript/insenz_reg.js"></script>'; } else { $username = checkusername($username); $password = checkpassword($password, $password2); $name = checkname($name); $idcard = checkidcard($idcard); $email1 = checkemail($email1, 'email1'); $email2 = $email2 ? checkemail($email2, 'email2') : ''; $qq = checkqq($qq); $msn = $msn ? checkemail($msn, 'msn') : ''; $tel3 = $tel3 != $lang['insenz_register_extension'] ? intval($tel3) : ''; $tel = checktel($tel1, $tel2, $tel3, 'tel'); $fax = $fax2 ? checktel($fax1, $fax2, $fax3, 'fax') : ''; $mobile = checkmobile($mobile); $cpc = checkcpc($country, $province, $city); $country = $cpc[0]; $province = $cpc[1]; $city = $cpc[2]; $address = checkaddress($address);
error('Cannot start a new PHP session. Please contact server administrator or webmaster!'); } /* If no action parameter is set let's force visitor to login */ if (empty($_REQUEST['action'])) { if (isset($_SESSION['logged']) && $_SESSION['logged'] == "Y") { pj_session_regenerate_id(); mainpage(); } else { login(); } } else { $action = htmlspecialchars($_REQUEST['action']); } /* Do the action that is set in $action variable */ if ($action == 'login') { checkpassword(); $_SESSION['logged'] = 'Y'; pj_session_regenerate_id(); mainpage(); } elseif ($action == 'save') { checklogin(); savelink(); } elseif ($action == 'edit') { checklogin(); editlink(); } elseif ($action == 'backup') { checklogin(); sendbackup(); } elseif ($action == 'remove') { checklogin(); removelink();
updateuser($apikeyvalue, $userid, $username, $password, $newpassword, $displayname, $avatarfile, $avatarlink, $profilelink); break; case 'addfriend': addFriend($apikeyvalue, $userid, $friends); break; case 'removefriend': removeFriend($apikeyvalue, $userid, $friends); break; case 'getfriend': getfriend($apikeyvalue, $userid); break; case 'checkAPIKEY': checkAPIKEY($apikeyvalue); break; case 'checkpassword': checkpassword($apikeyvalue, $password); break; case 'authenticateUser': authenticateUser($apikeyvalue, $username, $password); break; case 'removeuser': removeuser($apikeyvalue, $userid); default: echo 'Invalid Action'; exit; break; } } /* FUNCTIONS */ function checkAPIKEY($keyvalue) {
if ($cipherer->isFieldEncrypted($cPasswordField)) { $passvalue = $cipherer->MakeDBValue($cPasswordField, $passvalue); } else { if (NeedQuotes($cPasswordFieldType)) { $passvalue = $pageObject->connection->prepareString($passvalue); } else { $passvalue = 0 + $passvalue; } } $sWhere = " where " . $pageObject->getFieldSQLDecrypt($cUserNameField) . "=" . $value; $strSQL = "select " . $pageObject->getFieldSQLDecrypt($cPasswordField); $strSQL .= " as " . $pageObject->connection->addFieldWrappers($cPasswordField) . " from " . $pageObject->connection->addTableWrappers($cLoginTable) . $sWhere; $qResult = $pageObject->connection->query($strSQL); $row = $cipherer->DecryptFetchedArray($qResult->fetchAssoc()); if ($row && $values['oldpass'] == $row[$cPasswordField]) { if ($pageObject->pwdStrong && !checkpassword($values['newpass'])) { $msg = ""; $pwdLen = GetGlobalData("pwdLen", 0); if ($pwdLen) { $fmt = "Password must be at least %% characters length."; $fmt = str_replace("%%", "" . $pwdLen, $fmt); $msg .= "<br>" . $fmt; } $pwdUnique = GetGlobalData("pwdUnique", 0); if ($pwdUnique) { $fmt = "Password must contain %% unique characters."; $fmt = str_replace("%%", "" . $pwdUnique, $fmt); $msg .= "<br>" . $fmt; } $pwdDigits = GetGlobalData("pwdDigits", 0); if ($pwdDigits) {
<html> <body> //validation <?php require_once 'functions.php'; $valid = TRUE; if (isset($_POST['submit'])) { foreach ($_POST as $key => $value) { ${$key} = $value; } $valid = $fn = checklength($fname, 1, 30); $ln = checklength($lname, 1, 30); $valid = $valid && $ln; $em = checkemail($email); $valid = $valid && $em; $ps = checkpassword($password); $valid = $valid && $ps; $ps2 = $password == $password2; $valid = $valid && $ps2; $zp = checkmail($zipcode, 'US'); $valid = $valid && $zp; if ($valid) { echo "form filled successfully!"; exit; } } else { $fn = $ln = $em = $ps = $ps2 = $hp = $zp = TRUE; $fname = $lname = $email = $zipcode = $omepage = ""; } if (!$valid) { ?>
/** * validating input based on conditions passed as an array */ function validateinput($inputname, $valuename, $conditions) { if (isset($_POST[$inputname])) { $value = $_POST[$inputname]; $conditionschecks = array(); $index = 0; foreach ($conditions as $condition) { if ($skipnext) { $index++; $skipnext = false; } else { //echo $condition; switch ($condition) { case "required": if (checkrequired($value, $conditions[$index + 1])) { $conditionschecks[$condition] = true; } else { $conditionschecks[$condition] = array(false, " required to have a min. length of {$conditions[$index + 1]} chararcters"); } $index++; $skipnext = true; break; case "email": if (checkemail($value)) { $conditionschecks[$condition] = true; } else { $conditionschecks[$condition] = array(false, " invalid"); } $index++; break; case "emailused": if (isemailused($value)) { $conditionschecks[$condition] = array(false, " used"); } else { $conditionschecks[$condition] = true; } $index++; break; case "username": if (checkusername($value)) { $conditionschecks[$condition] = true; } else { $conditionschecks[$condition] = array(false, " used"); } $index++; break; case "password": if (checkpassword($value)) { $conditionschecks[$condition] = true; } else { $conditionschecks[$condition] = array(false, " required to have a min. length of 8 chararcters"); } $index++; break; case "match|repassword": if (checkmatch($value, substr($condition, strpos($condition, "|") + 1))) { $conditionschecks[$condition] = true; } else { $conditionschecks[$condition] = array(false, " does not match"); } $index++; break; case "validpassword": if (validpassword($_POST['userid'], $value)) { $conditionschecks[$condition] = true; } else { $conditionschecks[$condition] = array(false, " current password is invalid."); } $index++; break; } } } //construct a message $isvalid = true; $errormessage = $valuename . " fails on ("; foreach ($conditionschecks as $check) { if (is_array($check)) { $errormessage .= $check[1] . " ,"; $isvalid = false; } } if ($isvalid) { return true; } else { return substr_replace($errormessage, "", -1) . " )"; } } else { return "There is not input with {$inputname} name"; } }
<?php require 'core/init.php'; ?> <div class="container"> <form class="form-signin" method="POST" action=""> <?php if (empty($_POST) == false) { $username = $_POST['username']; $password = $_POST['password']; if (checkuserexist($username) == false) { $error[] = 'Username not exist'; } $user = checkpassword($username, $password); if ($user == false) { $error[] = 'Wrong Password'; } else { $_SESSION['id'] = $user; header('Location:main.php'); exit; } $warning = implode('<br/>', $error); echo '<div class="alert alert-danger"><p>'; echo $warning; echo '</p></div>'; } ?> <h1 class="form-signin-heading">XBase HRMS Login</h1>
public function verification() { if ($this->session->userdata('user_verification') == true) { $post = $this->input->post(); if ($post) { $this->form_validation->set_rules('codenumber', 'Verify Code', 'trim|required'); if ($this->form_validation->run() !== false) { $uArr = $this->common_model->selectData(USER, '*', array("u_id" => $this->session->userdata('user_id'), "u_password" => md5($post['codenumber']))); $curDate = date('Y-m-d H:i:s'); if (!empty($uArr)) { $where = 'u_id = ' . $this->session->userdata('user_id'); $updateRecord = array('u_active' => 1, 'u_is_verified' => 1); $mobile = $this->session->userdata('user_mobile'); if (isset($mobile) && $mobile != '') { $updateRecord['u_mobile'] = $mobile; } $email = $this->session->userdata('user_email'); if (isset($email) && $email != '') { $updateRecord['u_email'] = $email; } $updateRecord['u_modified_date'] = $curDate; $updateuser = $this->common_model->updateData(USER, $updateRecord, $where); if ($this->session->userdata('user_from') == 'signup') { $flash_arr = array('flash_type' => 'success', 'flash_msg' => 'Your account successfully activated.'); } else { if ($this->session->userdata('user_from') == 'forgot') { $flash_arr = array('flash_type' => 'success', 'flash_msg' => 'Your OTP verification successfully completed.'); } else { $wheread = 'clad_id = ' . $this->session->userdata('user_ads'); $updateRecord = array('clad_active' => 2, 'is_deleted' => 0); $updateads = $this->common_model->updateData(CLASSIFIEDAD, $updateRecord, $wheread); $flash_arr = array('flash_type' => 'success', 'flash_msg' => 'Your ad submitted successfully and available on our site after reviewed by company.'); } } $this->session->set_userdata('user_verification', false); $this->session->set_userdata('user_ads', ''); $this->session->set_userdata('user_from', ''); $this->session->set_flashdata($flash_arr); $loginid = $this->common_model->insertLoginHistory($uArr[0]->u_id); $data = array('uid' => $uArr[0]->u_id, 'firstname' => $uArr[0]->u_fname, 'lastname' => $uArr[0]->u_lname, 'email' => $uArr[0]->u_email, "mobile" => $uArr[0]->u_mobile, "user_verified" => 1, "u_canpost" => $uArr[0]->u_canpost, "loginid" => $loginid); $this->session->set_userdata('user_session', $data); $this->processMessageCache($data); if (checkpassword($post['codenumber'])) { redirect("/myaccount/change-password"); } else { redirect("/"); } } else { $data['error_msg'] = "Please enter correct verification code."; } } else { $flash_arr = array('flash_type' => 'error', 'flash_msg' => validation_errors()); $data['error_msg'] = validation_errors(); } //$this->session->set_flashdata($flash_arr); } $data['view'] = "verification"; $data['pageFrom'] = $this->session->userdata('user_from'); $this->load->view('content', $data); } else { redirect("/"); } }
<html> <body> <?php require_once 'functions.php'; $as = digits(23); //echo(int) $as.'dfs'.'<br>'; $a = letter('123'); //echo(int) $a.'asd'.'<br>'; $b = checklength('adfdkzisdmfjk', 3, 9); //echo(int) $b.'sd'.'<br>'; $d = checkmail('asd-432', 'CA'); //echo(int)$d.'fcxgxd'.'<br>'; $check = checkurl('http//www.someone.co'); //echo(int) $check.'sdg'.'<br.'; $emails = checkemail('*****@*****.**'); //echo(int) $emails.'sdaerg'.'<br>'; $pass = checkpassword('rishu-23'); echo (int) $pass . '<br>'; ?> </body> </html>