Пример #1
0
 /**
  * checkLogin
  * 登陆入口首页验证方法
  * @access public
  * @return html
  * @author copoet
  * 用户状态status设置:1表示开启,2表示禁用,状态默认为1
  *
  */
 public function checkLogin()
 {
     $name = trim(I('post.username'));
     $pass = trim(I('post.password'));
     if (empty($name) || empty($pass)) {
         $this->error('用户名密码不能为空!', './index');
     }
     $info['name'] = $name;
     $info['password'] = get_password($name, $pass);
     $m = D('Manager');
     $User = $m->get_manager($info);
     if ($info['password'] == $User['password']) {
         if ($User['status'] == 10) {
             $data['last_time'] = time();
             $data['up_ip'] = get_client_ip();
             $m->updateManager($data, $User['id']);
             session('LOGIN_STATUS', 'TRUE');
             session('LOGIN_NAME', $User['name']);
             session('LOGIN_ID', $User['id']);
             $this->success('登陆成功!', './index');
         } else {
             $this->error('用户已被禁用,请联系管理员!', './index');
         }
     } else {
         $this->error('用户名或密码错误!', './index');
     }
 }
Пример #2
0
function auth_error($exception = null)
{
    global $connection, $adminer, $has_token;
    $session_name = session_name();
    $error = "";
    if (!$_COOKIE[$session_name] && $_GET[$session_name] && ini_bool("session.use_only_cookies")) {
        $error = lang('Session support must be enabled.');
    } elseif (isset($_GET["username"])) {
        if (($_COOKIE[$session_name] || $_GET[$session_name]) && !$has_token) {
            $error = lang('Session expired, please login again.');
        } else {
            $password = get_password();
            if ($password !== null) {
                $error = h($exception ? $exception->getMessage() : (is_string($connection) ? $connection : lang('Invalid credentials.')));
                if ($password === false) {
                    $error .= '<br>' . lang('Master password expired. <a href="http://www.adminer.org/en/extension/" target="_blank">Implement</a> %s method to make it permanent.', '<code>permanentLogin()</code>');
                }
                set_password(DRIVER, SERVER, $_GET["username"], null);
            }
            unset_permanent();
        }
    }
    $params = session_get_cookie_params();
    cookie("adminer_key", $_COOKIE["adminer_key"] ? $_COOKIE["adminer_key"] : rand_string(), $params["lifetime"]);
    page_header(lang('Login'), $error, null);
    echo "<form action='' method='post'>\n";
    $adminer->loginForm();
    echo "<div>";
    hidden_fields($_POST, array("auth"));
    // expired session
    echo "</div>\n";
    echo "</form>\n";
    page_footer("auth");
}
Пример #3
0
 public function login()
 {
     if (IS_POST) {
         $_username = $this->input->post("username");
         $_password = $this->input->post("password");
         $this->load->model("sys_user_model");
         //print_r($_username);exit();
         $_admin = $this->sys_user_model->getEntity(array("username" => $_username));
         if (!empty($_admin)) {
             if (get_password($_password, $_admin['id']) == $_admin['password']) {
                 if ($_admin['flag_valid'] == 1) {
                     if ($_admin['flag_valid'] == 1) {
                         $this->session->set_userdata(array("admin" => $_admin));
                         header("Location: /" . ADMIN_THEME . "/main");
                         return;
                     } else {
                         $this->put("result", "账号已停用");
                     }
                 } else {
                     $this->put("result", "账号已经停用");
                 }
             } else {
                 $this->put("result", "账号或密码错误");
             }
         } else {
             $this->put("result", "账号或密码错误");
         }
     }
     $this->render('login.html');
 }
Пример #4
0
function get_password()
{
    $site_password = common::readSingleline('Enter system user password, and hit return: ');
    $site_password2 = common::readSingleline('Retype system user password, and hit return: ');
    if ($site_password == $site_password2) {
        return $site_password;
    } else {
        get_password();
    }
}
Пример #5
0
 public function edit()
 {
     $_id = $this->input->get('id');
     if (IS_POST) {
         $_check = $this->sys_user_model->getCount(array('username' => $this->input->post('username'), 'id <>' => $_id));
         if ($_check == 0) {
             $_password = $this->input->post('password');
             $_data = $this->parseData(array('username', 'truename', 'email', 'flag_valid', 'sys_group_id'));
             $_data['id'] = $_id;
             if (notBlank($_password)) {
                 $_data['password'] = get_password($_password, $_id);
             }
             $this->handleResult($this->sys_user_model->updateEntityByID($_data, $_id));
         } else {
             $this->handleResult(false, '账户号名已存在,不能重复!');
         }
     }
     $this->put("group_list", $this->sys_user_group_model->getSysGroupArray());
     $this->put('entity', $this->sys_user_model->getEntityByID($_id));
     $this->render('sys_user_edit.html');
 }
Пример #6
0
 $tmpquery = "WHERE mem.login = '******'";
 $existsUser = new request();
 $existsUser->openMembers($tmpquery);
 $comptExistsUser = count($existsUser->mem_id);
 if ($comptExistsUser != "0") {
     $error = $strings["user_already_exists"];
 } else {
     // test if 2 passwords match
     if ($pw != $pwa || $pw == "") {
         $error = $strings["new_password_error"];
     } else {
         // replace quotes by html code in name and address
         $fn = convertData($fn);
         $tit = convertData($tit);
         $c = convertData($c);
         $pw = get_password($pw);
         $tmpquery1 = "INSERT INTO " . $tableCollab["members"] . "(organization,login,name,title,email_work,phone_work,phone_home,mobile,fax,comments,password,profil,created,timezone) VALUES('{$clod}','{$un}','{$fn}','{$tit}','{$em}','{$wp}','{$hp}','{$mp}','{$fax}','{$c}','{$pw}','3','{$dateheure}','0')";
         connectSql("{$tmpquery1}");
         $tmpquery = $tableCollab["members"];
         last_id($tmpquery);
         $num = $lastId[0];
         unset($lastId);
         $tmpquery3 = "INSERT INTO " . $tableCollab["notifications"] . "(member,taskAssignment,removeProjectTeam,addProjectTeam,newTopic,newPost,statusTaskChange,priorityTaskChange,duedateTaskChange,clientAddTask) VALUES ('{$num}','0','0','0','0','0','0','0','0','0')";
         connectSql("{$tmpquery3}");
         // if mantis bug tracker enabled
         if ($enableMantis == "true") {
             // Call mantis function for new user creation!!!
             $f_access_level = $client_user_level;
             // Reporter
             require_once "../mantis/create_new_user.php";
         }
require_once '../includes/library.php';
$pageSection = 'login';
// test send query
if ($action == 'send') {
    $tmpquery = "WHERE mem.login = '******'";
    $userDetail = new request();
    $userDetail->openMembers($tmpquery);
    $comptUserDetail = count($userDetail->mem_id);
    // test if user exists
    if ($comptUserDetail == "0") {
        $error = $strings["no_login"];
    } else {
        if ($userDetail->mem_email_work[0] != "") {
            // test if email of user exists
            password_generator();
            $pw = get_password($pass_g);
            $tmpquery = 'UPDATE ' . $tableCollab['members'] . " SET password='******' WHERE login = '******'";
            connectSql($tmpquery);
            $body = $strings['user_name'] . ' : ' . $userDetail->mem_login[0] . "\n\n" . $strings['password'] . " : {$pass_g}";
            $mail = new notification();
            $mail->getUserinfo('1', 'from');
            $subject = 'NetOffice ' . $strings['password'];
            $mail->Subject = $subject;
            $mail->Priority = '1';
            $mail->Body = $body;
            $mail->AddAddress($userDetail->mem_email_work[0], $userDetail->mem_name[0]);
            $mail->Send();
            $mail->ClearAddresses();
            // redirect to login page with message
            header('Location: ../general/login.php?msg=emailpwd');
            exit;
Пример #8
0
/**
 * Requests the user information, including username and email.
 */
function get_user()
{
    $username = get_input('Username (e.g. first.last)?', '/[A-Za-z0-9]*\\.[A-Za-z0-9]*/');
    $email = get_input('Email address (e.g. ' . $username . '@domain.com)?', '/[A-Za-z0-9]*\\.[A-Za-z0-9]*@.*\\..*/');
    $role = get_role();
    $password = get_password();
    $user = new User($username, $email, $role, $password);
    if (DEBUG) {
        print_line('User specified: ' . $user->username . ' (' . $user->email . ', ' . $user->role . ', ' . $user->get_formatted_password() . ')', DEBUG);
    }
    return $user;
}
Пример #9
0
<?php

require_once 'functions.php';
require_once 'connect.php';
require_once 'lib/safemysql.class.php';
if ($_GET['state'] == 'vk_reg') {
    $token = get_token($_GET['code'], $g_url);
    if (!empty($token)) {
        $mysql_check = $db_connect->getRow("SELECT user_id FROM sf_user WHERE user_id='" . $user_id . "'");
        if (count($mysql_check) > 0) {
            $l_msg = 'Вы уже зарегистрированны!';
        } else {
            $user_name = get_name($user_id);
            $user_login = $user_id;
            $user_pass = get_password(12);
            $db_input = $db_connect->query("INSERT INTO sf_user (user_id, name, user_group, email, login, pass) VALUES ('{$user_id}','{$user_name}','1','*****@*****.**','{$user_login}','{$user_pass}')");
            if ($db_input == 1) {
                $l_msg = 'Вы успешно зарегистрированны';
            } else {
                $l_msg = 'В процессе регистрации возникла ошибка, попробуйте ещё раз!';
            }
        }
    }
}
if ($_GET['state'] == 'login_reg') {
    $user_login = $_POST['login'];
    $user_pass = $_POST['pass'];
    $user_mail = $_POST['mail'];
    $md5_pass = md5($user_pass);
    if (!empty($user_login) and !empty($user_pass) and !empty($user_mail)) {
        $mysql_check = $db_connect->getRow("SELECT login FROM sf_user WHERE login='******'");
Пример #10
0
        $stmt->execute();
        $stmt->bind_result($password);
        $stmt->fetch();
        $stmt->close();
        return $password;
    }
}
function verify_hash($password, $hash, $salt)
{
    $md5 = md5($salt . $password);
    return $md5 == $hash;
}
$protocol = $_SERVER["HTTP_AUTH_PROTOCOL"];
if ($_SERVER["HTTP_AUTH_METHOD"] == "apop") {
    $username = $_SERVER["HTTP_AUTH_USER"];
    $userpass = get_password($username);
    if ($userpass) {
        $hash = $_SERVER["HTTP_AUTH_PASS"];
        $salt = $_SERVER["HTTP_AUTH_SALT"];
        if (verify_hash($userpass, $hash, $salt)) {
            get_mailserver($DBMAIL, $protocol);
            header("Auth-Pass: {$userpass}");
        } else {
            fail();
        }
    } else {
        fail();
    }
} else {
    get_mailserver($DBMAIL, $protocol);
}
                }
            }
            $tmpquery = "UPDATE " . $tableCollab["members"] . " SET password='******' WHERE id = '" . $_SESSION['idSession'] . "'";
            connectSql("{$tmpquery}");
            // if CVS repository enabled
            if ($enable_cvs == "true") {
                $query = "WHERE tea.member = '" . $_SESSION['idSession'] . "'";
                $cvsMembers = new request();
                $cvsMembers->openTeams($query);
                // change the password in every repository
                for ($i = 0; $i < count($cvsMembers->tea_id); $i++) {
                    cvs_change_password($cvsMembers->tea_mem_login[$i], $cnpw, $cvsMembers->tea_pro_id[$i]);
                }
            }
            // encrypt the new password using the defined loginMethod
            $npw = get_password($npw);
            $_SESSION['passwordSession'] = $npw;
            header('Location: changepassword.php?msg=update');
            exit;
        }
    }
}
$tmpquery = "WHERE mem.id = '" . $_SESSION['idSession'] . "'";
$userDetail = new request();
$userDetail->openMembers($tmpquery);
$comptUserDetail = count($userDetail->mem_id);
if ($comptUserDetail == "0") {
    header('Location: userlist.php?msg=blankUser');
    exit;
}
$titlePage = $strings["change_password"];
Пример #12
0
 function credentials()
 {
     return array('localhost', $_GET["username"], get_password());
 }
Пример #13
0
function change_password($id, $oldPassword, $newPassword)
{
    if ($GLOBALS['$connected'] == False) {
        connect_to_db();
    }
    $hash = get_password($id);
    //Unhashing the password to see if it matches what was entered.
    if (password_verify($oldPassword, $hash)) {
        $newHash = password_hash($newPassword, PASSWORD_DEFAULT);
        $sql1 = mysql_query("UPDATE users SET password='******' WHERE id='{$id}'");
        echo '<script>';
        echo 'alert("Password Update Successfull");';
        echo '</script>';
    } else {
        echo '<script>';
        echo 'alert("Old Password is invalid");';
        echo '</script>';
    }
}
Пример #14
0
function get_connection()
{
    static $pdo;
    if (empty($pdo)) {
        echo get_dsn();
        echo "\n";
        echo get_username();
        echo "\n";
        echo get_password();
        echo "\n";
        $pdo = new PDO(get_dsn(), get_username(), get_password());
        $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    }
    return $pdo;
}
Пример #15
0
    while ($res = @mysql_fetch_row($tmp)) {
        $submit_problems[$res[0]] = $res[1];
    }
    return $submit_problems;
}
$key = $_GET['key'];
if ($key == $api_key) {
    $task = $_GET['task'];
    if ($task == 'account') {
        $user_id = $_GET['user_id'];
        if (check_user_id($user_id) == 0) {
            //no user
            echo json_encode(array('error' => 'no_such_user'));
            exit;
        }
        $password = get_password($user_id);
        $json = array('password' => $password);
        echo json_encode($json);
    } else {
        if ($task == 'submit_problems') {
            $user_id = $_GET['user_id'];
            if (check_user_id($user_id) == 0) {
                //no user
                echo json_encode(array('error' => 'no_such_user'));
                exit;
            }
            $submit_problems = get_submit_problems($user_id);
            echo json_encode(array('submit_problems' => $submit_problems));
        } else {
            echo json_encode(array('error' => 'no_such_task'));
        }
Пример #16
0
function connect_and_bind($options = array())
{
    $ldapServer = isset($options['host']) ? $options['host'] : "ldap.netsoc.dit.ie";
    $ldapPort = isset($options['port']) ? $options['port'] : "389";
    if (isset($options['bindDN'])) {
        $ldapBindDN = $options['bindDN'];
    } elseif (isset($options['username'])) {
        $ldapBindDN = "cn=" . $options['username'] . ",ou=members,ou=users,dc=netsoc,dc=dit,dc=ie";
    } else {
        $ldapBindDN = 'cn=admin,dc=netsoc,dc=dit,dc=ie';
    }
    $ldapPass = isset($options['password']) ? $options['password'] : get_password($ldapBindDN);
    $ldapConnection = ldap_connect($ldapServer, $ldapPort);
    ldap_set_option($ldapConnection, LDAP_OPT_PROTOCOL_VERSION, 3);
    ldap_set_option($ldapConnection, LDAP_OPT_NETWORK_TIMEOUT, 1);
    $bindResult = @ldap_bind($ldapConnection, $ldapBindDN, $ldapPass);
    if (!$bindResult) {
        echo "Error, " . ldap_error($ldapConnection) . ". Server: {$ldapServer}\n";
        exit;
    }
    return $ldapConnection;
}
Пример #17
0
					<br>
					<label>Word Cases:</label>
					<div class="br">
						<br>
					</div>
					<select name="cases" class="form-box">
						<option value="start">First Letter Capitalized</option>
  						<option value="upper">All Upper Case</option>
  						<option value="lower">All Lower Case</option>
					</select> 
					<br>
					<input type="submit" class="btn btn-primary" value="Generate Password">
				</form>
				<div class="password">
					<p><?php 
echo get_password($words, $symbols_list);
?>
</p>
				</div>
				<div class="row">
					<div class="col-lg-2 col-md-2 col-sm-0 col-xs-0"></div>
					<div class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
						<a href="http://xkcd.com/936/" target="_blank" id="comic"><img src="images/password_comic.png" alt="Password comic." class="img-responsive img-border"></a>
					</div>
					<div class="col-lg-2 col-md-2 col-sm-0 col-xs-0"></div>
				</div>
				<footer>Copyright &copy; 2015 Hannah Riggs</footer>
			</div>
			<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2"></div>
		</div> <!-- end main row -->
	</div> <!-- end container-fluid -->
Пример #18
0
 * 
 */
if ($_GET['type'] === "student") {
    $alunni = array();
    // file di log
    $log_file = fopen("../tmp/studenti" . date("Ymd"), "w+");
    $index = 0;
    $incompleti = 0;
    $sel = "SELECT id_alunno, nome, cognome, username, password FROM alunni WHERE attivo = 1";
    $res = $db->execute($sel);
    while ($_alunno = $res->fetch_assoc()) {
        if ($_alunno['username'] == '') {
            $al = new Alunno($_alunno);
            $incompleti++;
            $al->username = get_login($db, $al->nome, $al->cognome);
            $al->password = get_password($al->nome, $al->cognome, &$al->clean_pwd);
            //print ($al->username).":".$al->password."<br/>";
            $upd = "UPDATE alunni SET username = '******', password = '******' WHERE id_alunno = " . $al->id_alunno;
            $r = $db->execute($upd);
            $str_log = $al->nome . " " . $al->cognome . ":" . $al->username . ":" . $al->password . ":" . $al->clean_pwd . "\n";
            fwrite($log_file, $str_log);
        }
    }
} else {
}
?>

<html>
<head>
<title>Creazione account</title>
<link rel="stylesheet" type="text/css" href="../css/Underground.css">
Пример #19
0
 function changePassword()
 {
     $user = $this->session->userdata('user');
     $this->db->where('use_id', $user['use_id']);
     $this->db->where('use_pass', get_password($this->input->post('password_old')));
     $data = $this->db->get(TABLE_PREFIX . 'users');
     if ($data->num_rows() > 0) {
         $this->db->where('use_id', $user['use_id']);
         $this->db->where('use_pass', get_password($this->input->post('password_old')));
         $this->db->set('use_pass', get_password($this->input->post('use_pass')));
         $this->db->set('use_modified', "NOW()", false);
         return $this->db->update(TABLE_PREFIX . 'users');
     }
     return false;
 }
Пример #20
0
} else {
    //test blank fields in form
    if ($auth == "test") {
        if ($loginForm == "" && $passwordForm == "") {
            $error = $strings["login_username"] . "<br/>" . $strings["login_password"];
        } else {
            if ($loginForm == "") {
                $error = $strings["login_username"];
            } else {
                if ($passwordForm == "") {
                    $error = $strings["login_password"];
                } else {
                    $auth = "on";
                    if ($rememberForm == "on") {
                        $oneyear = 22896000;
                        $storePwd = get_password($passwordForm);
                        setcookie("loginCookie", $loginForm, time() + $oneyear);
                        setcookie("passwordCookie", $storePwd, time() + $oneyear);
                    } else {
                        setcookie("loginCookie");
                        setcookie("passwordCookie");
                    }
                }
            }
        }
    }
    if ($forcedLogin == "false") {
        if ($auth == "on" && !$loginForm && !$passwordForm) {
            $auth = "off";
            $error = "Detecting variables poisoning ;-)";
        }
Пример #21
0
             $error = $strings['invalid_login'];
             setcookie('NetOfficeAuthCookie', '', time() - 3600, $base_uri);
         } else {
             $match = true;
         }
     }
 } else {
     if (!$ssl and !is_password_match($loginForm, $passwordForm, $loginUser->mem_password[0])) {
         $error = $strings['invalid_login'];
     } else {
         $match = true;
     }
 }
 if ($match == true) {
     // encrypt password in session using the defined loginMethod from settings.php
     $passwordForm = get_password($passwordForm);
     // get the ip addr
     $ip = SESS_REMOTE_ADDR;
     // set session variables
     $_SESSION['browserSession'] = $HTTP_USER_AGENT;
     $_SESSION['idSession'] = $loginUser->mem_id[0];
     $_SESSION['timezoneSession'] = $loginUser->mem_timezone[0];
     $_SESSION['languageSession'] = $languageForm;
     $_SESSION['loginSession'] = $loginForm;
     $_SESSION['passwordSession'] = $passwordForm;
     $_SESSION['nameSession'] = $loginUser->mem_name[0];
     $_SESSION['ipSession'] = $ip;
     $_SESSION['dateunixSession'] = date('U');
     $_SESSION['dateSession'] = date('d-m-Y H:i:s');
     $_SESSION['profilSession'] = $loginUser->mem_profil[0];
     $_SESSION['logouttimeSession'] = $loginUser->mem_logout_time[0];
Пример #22
0
 /**
  * 会员信息更新
  * updateUserInfo
  * @author copoet
  */
 public function updateUserInfo()
 {
     $userModel = D('users');
     $id = I('post.id');
     if (empty($id)) {
         $this->assign('系统异常');
     }
     $username = I('post.username');
     if (empty($username)) {
         $this->error('用户名不能为空');
         exit;
     }
     $phone = I('post.phone');
     $check_phone = CheckToolServices::checkPhoneFormat($phone);
     //验证手机格式
     if ($check_phone['status'] === false) {
         $this->error("{$check_phone['msg']}");
     }
     $email = I('post.email');
     $check = CheckToolServices::checkEmailFormat($email);
     //验证邮箱格式
     if ($check['status'] === false) {
         $this->error("{$check['msg']}");
     }
     $member_info = $userModel->getUsersInfo($id);
     if ($member_info['username'] !== $username) {
         $check_data = checkUsers($username, '', '');
         if ($check_data['status'] === false) {
             $this->error("{$check_data['msg']}");
         }
     } elseif ($member_info['email'] !== $email) {
         $check_data = checkUsers('', $email, '');
         if ($check_data['status'] === false) {
             $this->error("{$check_data['msg']}");
         }
     } elseif ($member_info['phone'] !== $phone) {
         $check_data = checkUsers('', '', $phone);
         if ($check_data['status'] === false) {
             $this->error("{$check_data['msg']}");
         }
     }
     $password = I('post.password');
     if (!empty($password)) {
         $data['password'] = get_password($username, $password);
     } else {
         $data['password'] = $member_info['password'];
     }
     $data['username'] = $username;
     $data['phone'] = $phone;
     $data['email'] = $email;
     $data['status'] = $_POST['status'][0];
     $data['up_time'] = time();
     $where['id'] = array('eq', $id);
     $result = $userModel->updateUser($where, $data);
     if ($result) {
         $this->success('会员信息更新成功');
     } else {
         $this->error('会员信息更新失败');
     }
 }
Пример #23
0
}
?>
		<div class="container">
	        <div class="row">
				<div class="col-md-12">
					<div class="col-md-6" style="margin:0 auto;">
					<h2> Hospital Management </h2>
        <?php 
if (!isset($_REQUEST["step"]) && !isset($_GET["auto"])) {
    /** Step 1 */
    // Check if application is installled or not
    if (is_installed()) {
        /** Check the version */
        $server = get_server();
        $username = get_username();
        $password = get_password();
        $database = get_database();
        $dbprefix = get_dbprefix();
        // Connect to Server
        $conn = new Database();
        echo $conn->Connection($server, $username, $password);
        $con = $conn->get_Connection();
        // Select Database
        mysql_select_db($database, $con);
        if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . $dbprefix . "version'")) == 1) {
            $sql = "Select current_version from " . $dbprefix . "version;";
            $result = mysql_query($sql, $con);
            if (!$result) {
                $current_version = '0.0.1';
            } else {
                $row = mysql_fetch_assoc($result);
Пример #24
0
 if ($installationType == "offline") {
     $updatechecker = "false";
 }
 require_once './setup_settings.php';
 if (!$error) {
     $fp = fopen('../includes/settings.php', 'wb+');
     $fw = fwrite($fp, $content);
     if (!$fw) {
         $error = 1;
         echo "<br><b>PANIC! <br> settings.php can't be written!</b><br>";
     }
     fclose($fp);
     $msg = 'File settings.php created correctly.';
     // crypt admin and demo password
     $demoPwd = get_password("demo");
     $adminPwd = get_password($adminPwd);
     // create all tables
     require_once "./db_var.inc.php";
     require_once "./setup_db.php";
     if ($databaseType == "mysql") {
         $my = mysql_connect($myserver, $mylogin, $mypassword);
         if (mysql_errno($my) != 0) {
             print '<br><b>PANIC! <br> Error during connection on server MySQL.</b><br>';
             print "[" . mysql_errno($my) . "] " . mysql_error($my) . "<br/>\n";
             exit;
         }
         mysql_select_db($mydatabase, $my);
         if (mysql_errno() != 0) {
             exit('<br><b>PANIC! <br> Error during selection database.</b><br>');
         }
         for ($con = 0; $con < count($SQL); $con++) {
Пример #25
0
 }
 $sql = file_get_contents($sqlfile);
 $sql = str_replace("\r\n", "\n", $sql);
 include INSTALL_ROOT . 'tpl' . DIRECTORY_SEPARATOR . $step . '.tpl.php';
 runquery($sql, $tablepre, $db);
 // ob
 for ($i = 1; $i <= 3; $i++) {
     $sql_district = file_get_contents(INSTALL_ROOT . 'data/keke_witkey_district_' . $i . '.sql');
     $sql_district = str_replace("\r\n", "\n", $sql_district);
     runquery($sql_district, $tablepre, $db);
     // ob
 }
 $password = md5($admin_password);
 $slt = randomkeys(6);
 // 随机码
 $sec_code = get_password($password, $slt);
 if ($data_type == 'b') {
     // 演示版本,更新数据
     $db->query("update `{$tablepre}witkey_member` set username = '******',password = '******',email = '{$admin_email}',rand_code='{$slt}' where uid = 1");
     $db->query("update `{$tablepre}witkey_space` set username = '******',password = '******',email = '{$admin_email}',sec_code='{$sec_code}',group_id = 1,status = 1 where uid = 1");
 } else {
     // 纯净版本、插入数据
     $db->query("replace INTO `{$tablepre}witkey_member`(`uid`,`username`,`password`,`email`,`rand_code`) VALUES ('1', '{$admin_account}','{$password}','{$admin_email}','{$slt}')");
     $db->query("replace INTO `{$tablepre}witkey_space` (`uid`,`username`,`password`,`email`,`sec_code`,`group_id`,`status`,`reg_time`) VALUES('1','{$admin_account}','{$password}','{$admin_email}','{$sec_code}','1','1','" . time() . "')");
     $db->query("replace INTO `{$tablepre}witkey_shop`(`uid`,`username`,`shop_name`,`shop_status`,`shop_type`) VALUES ('1', '{$admin_account}','{$admin_account}','1','1')");
 }
 $db->query("update `{$tablepre}witkey_basic_config` set v = '{$weburl}' where config_id=3");
 $file_obj = new keke_file_class();
 $file_obj->delete_files($data_cache_path);
 $file_obj->delete_files($tpl_cache_path);
 $pars = array('ac' => 'install', 'sitename' => '', 'siteurl' => $weburl, 'charset' => CHARSET, 'version' => KEKE_VERSION, 'release' => KEKE_RELEASE, 'os' => PHP_OS, 'php' => $_SERVER['SERVER_SOFTWARE'], 'mysql' => mysql_get_server_info(), 'browser' => urlencode($_SERVER['HTTP_USER_AGENT']), 'username' => urlencode($_SESSION['username']), 'email' => $admin_email, 'ip' => $_SERVER['SERVER_ADDR']);
            if ($enableMantis == "true") {
                // call mantis function to reset user password
                require_once "../mantis/user_reset_pwd.php";
            }
            // if CVS repository enabled
            if ($enable_cvs == "true") {
                $query = "WHERE tea.member = '" . $_SESSION['idSession'] . "'";
                $cvsMembers = new request();
                $cvsMembers->openTeams($query);
                // change the password in every repository
                for ($i = 0; $i < count($cvsMembers->tea_id); $i++) {
                    cvs_change_password($cvsMembers->tea_mem_login[$i], $cnpw, $cvsMembers->tea_pro_id[$i]);
                }
            }
            // encrypt the new password to the session using the defined loginMethod
            $_SESSION['passwordSession'] = get_password($npw);
            header("Location: ../preferences/updateuser.php?msg=update");
            exit;
        }
    }
}
$tmpquery = "WHERE mem.id = '" . $_SESSION['idSession'] . "'";
$userDetail = new request();
$userDetail->openMembers($tmpquery);
$comptUserDetail = count($userDetail->mem_id);
if ($comptUserDetail == "0") {
    header("Location: ../users/listusers.php?msg=blankUser");
    exit;
}
//--- header ---
$breadcrumbs[] = $strings["preferences"];
Пример #27
0
 /** Connection parameters
  * @return array ($server, $username, $password)
  */
 function credentials()
 {
     return array(SERVER, $_GET["username"], get_password());
 }
Пример #28
0
<?php

ini_set('display_errors', 1);
//require("functions.php");
require_once "functions.php";
//include ("functions.php");
//include_once ("functions.php");
$str = "1234567890qwertyuiopQWERTYUIOP";
echo get_password($str, 10);
echo "<br>------------------------------------------------------<br>";
$password = generate_password($str, 15);
echo $password;
echo "<br>------------------------------------------------------<br>";
if (function_exists('generate_password')) {
    echo generate_password($str, 13);
} else {
    echo "error";
}
echo "<br>------------------------------------------------------<br>";
if (!function_exists('hello')) {
    function hello()
    {
        echo "HELLO";
    }
} else {
    echo 'hello() difined<br>';
    hello();
}
echo "<br>------------------------------------------------------<br>";
$my_print();
echo "<br>------------------------------------------------------<br>";
Пример #29
0
require_once __ISN_PATH__ . 'functions_template.php';
require_once __ISN_PATH__ . 'functions_challenges.php';
require_once __ISN_PATH__ . 'db_config.php';
require_once __ROOTPATH__ . 'extension.php';
require_once __ROOTPATH__ . 'welcomemessage.php';
process_uri($_SERVER['REQUEST_URI']);
//Process the REQUEST_URI and set the mode and current_page
session_start();
//Start the Session
db_connect();
//Connect to the Database
if (!isset($_SESSION['hs_uname']) && !isset($_SESSION['hs_unique'])) {
    $_SESSION['hs_uname'] = null;
    $_SESSION['hs_unique'] = null;
}
$pwdlist = null;
/* Check if the User has Already Logged in and set the Global */
if (isset($_SESSION['hs_uname']) && isset($_SESSION['hs_unique']) && $_SESSION['hs_uname'] != '' && $_SESSION['hs_unique'] != '') {
    $query = "SELECT user_id, user_pwdset FROM " . USER_TABLE . " WHERE " . "user_name='" . $_SESSION['hs_uname'] . "' AND " . "user_lastsession='" . session_id() . "' AND " . "user_uniqueid='" . $_SESSION['hs_unique'] . "' " . "LIMIT 1";
    $result = $conn->query($query);
    if ($result) {
        if ($result->num_rows == 1) {
            $row = $result->fetch_assoc();
            $user_id = $row['user_id'];
            $pwdlist = get_password($row['user_pwdset']);
            $user_loggedin = true;
        }
    } else {
        msg_die($conn->error, 'D');
    }
}
Пример #30
0
<?php

/* This file handles the function of password change. */
require_once 'repository_fns.php';
session_start();
$current_user = $_SESSION['valid_user'];
do_html_header_login();
$old_password = $_POST['old_password'];
$new_password = $_POST['new_password'];
$new_password2 = $_POST['new_password2'];
$user_password = get_password($current_user);
if (sha1($old_password) != $user_password) {
    echo '<div class="container theme-showcase">';
    echo '<div class="page-header">';
    echo '<p>Password incorrect. Try again.</p>';
    echo '</div>';
    echo '</div>';
} else {
    if ($new_password != $new_password2) {
        echo '<div class="container theme-showcase">';
        echo '<div class="page-header">';
        echo '<p>Password not match.</p>';
        echo '</div>';
        echo '</div>';
    } else {
        if (strlen($new_password) > 16 || strlen($new_password) < 6) {
            echo '<div class="container theme-showcase">';
            echo '<div class="page-header">';
            echo '<p>New password must be between 6 and 16 characters. Try again.</p>';
            echo '</div>';
            echo '</div>';