当前位置: 首页>>代码示例>>PHP>>正文


PHP changepassword函数代码示例

本文整理汇总了PHP中changepassword函数的典型用法代码示例。如果您正苦于以下问题:PHP changepassword函数的具体用法?PHP changepassword怎么用?PHP changepassword使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了changepassword函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: authenticate

function authenticate($username, $password)
{
    $encrypted_old = md5($password);
    $row = dbFetchRow('SELECT username,password FROM `users` WHERE `username`= ?', array($username), true);
    if ($row['username'] && $row['username'] == $username) {
        // Migrate from old, unhashed password
        if ($row['password'] == $encrypted_old) {
            $row_type = dbFetchRow('DESCRIBE users password');
            if ($row_type['Type'] == 'varchar(34)') {
                changepassword($username, $password);
            }
            return 1;
        } else {
            if (substr($row['password'], 0, 3) == '$1$') {
                $row_type = dbFetchRow('DESCRIBE users password');
                if ($row_type['Type'] == 'varchar(60)') {
                    if ($row['password'] == crypt($password, $row['password'])) {
                        changepassword($username, $password);
                    }
                }
            }
        }
        $hasher = new PasswordHash(8, false);
        if ($hasher->CheckPassword($password, $row['password'])) {
            return 1;
        }
    }
    //end if
    return 0;
}
开发者ID:samyscoub,项目名称:librenms,代码行数:30,代码来源:mysql.inc.php

示例2: authenticate

function authenticate($username, $password)
{
    $encrypted_old = md5($password);
    $row = dbFetchRow("SELECT username,password FROM `users` WHERE `username`= ?", array($username));
    if ($row['username'] && $row['username'] == $username) {
        // Migrate from old, unhashed password
        if ($row['password'] == $encrypted_old) {
            $row = dbFetchRow("DESCRIBE users password");
            if ($row['Type'] == 'varchar(34)') {
                changepassword($username, $password);
            }
            return 1;
        }
        if ($row['password'] == crypt($password, $row['password'])) {
            return 1;
        }
    }
    return 0;
}
开发者ID:RomanBogachev,项目名称:observium,代码行数:19,代码来源:mysql.inc.php

示例3: mysql_fetch_array

/*$controlquery = doquery("SELECT * FROM {{table}} WHERE id='1' LIMIT 1", "control");
$controlrow = mysql_fetch_array($controlquery);*/
include 'lib.php';
$link = opendb();
include 'cookies.php';
$userrow = checkcookies();
if (isset($_GET["do"])) {
    $do = $_GET["do"];
    if ($do == "register") {
        register();
    } elseif ($do == "verify") {
        verify();
    } elseif ($do == "lostpassword") {
        lostpassword();
    } elseif ($do == "changepassword") {
        changepassword();
    } elseif ($do == "doardinheiro") {
        doardinheiro();
    } elseif ($do == "banco") {
        banco();
    } elseif ($do == "doaritem") {
        doaritem();
    } elseif ($do == "troca1") {
        troca1();
    } elseif ($do == "troca2") {
        troca2();
    } elseif ($do == "troca3") {
        troca3();
    } elseif ($do == "troca4") {
        troca4();
    } elseif ($do == "batalha1") {
开发者ID:arveo,项目名称:NarutoBrowserMmorpg,代码行数:31,代码来源:users.php

示例4: demo_account

<?php

$no_refresh = true;
$pagetitle[] = 'Preferences';
echo '<h3>User Preferences</h3>';
if ($_SESSION['userlevel'] == 11) {
    demo_account();
} else {
    if ($_POST['action'] == 'changepass') {
        if (authenticate($_SESSION['username'], $_POST['old_pass'])) {
            if ($_POST['new_pass'] == '' || $_POST['new_pass2'] == '') {
                $changepass_message = 'Password must not be blank.';
            } else {
                if ($_POST['new_pass'] == $_POST['new_pass2']) {
                    changepassword($_SESSION['username'], $_POST['new_pass']);
                    $changepass_message = 'Password Changed.';
                } else {
                    $changepass_message = "Passwords don't match.";
                }
            }
        } else {
            $changepass_message = 'Incorrect password';
        }
    }
    include 'includes/update-preferences-password.inc.php';
    echo "<div class='well'>";
    if (passwordscanchange($_SESSION['username'])) {
        echo '<h3>Change Password</h3>';
        echo $changepass_message;
        echo "<form method='post' action='preferences/' class='form-horizontal' role='form'>\n  <input type=hidden name='action' value='changepass'>\n  <div class='form-group'>\n    <label for='old_pass' class='col-sm-2 control-label'>Old Password</label>\n    <div class='col-sm-4'>\n      <input type=password name=old_pass autocomplete='off' class='form-control input-sm'>\n    </div>\n    <div class='col-sm-6'>\n    </div>\n  </div>\n  <div class='form-group'>\n    <label for='new_pass' class='col-sm-2 control-label'>New Password</label>\n    <div class='col-sm-4'>\n      <input type=password name=new_pass autocomplete='off' class='form-control input-sm'>\n    </div>\n    <div class='col-sm-6'>\n    </div>\n  </div>\n  <div class='form-group'>\n    <label for='new_pass2' class='col-sm-2 control-label'>New Password</label>\n    <div class='col-sm-4'>\n      <input type=password name=new_pass2 autocomplete='off' class='form-control input-sm'>\n    </div>\n    <div class='col-sm-6'>\n    </div>\n  </div>\n  <button type='submit' class='btn btn-default'>Submit</button>\n</form>";
        echo '</div>';
开发者ID:rasssta,项目名称:librenms,代码行数:31,代码来源:preferences.inc.php

示例5: writebody

function writebody()
{
    global $db, $domain, $suserid, $sitename, $cachelife, $template, $gamesfolder, $thumbsfolder, $limitboxgames, $seo_on, $blogentriesshown, $enabledcode_on, $comments_on, $directorypath, $autoapprovecomments, $gamesonpage, $abovegames, $belowgames, $showwebsitelimit, $supportemail, $showblog, $blogentriesshown, $blogcharactersshown, $blogcommentpermissions, $blogcommentsshown, $blogfollowtags, $blogcharactersrss, $usrdata, $userid, $avatar_on, $gender_on, $aimg, $fimg, $mimg;
    if (!isset($suserid)) {
        echo '<div class=\'error\'>Please login first.</div>';
        return;
    }
    function changeavatar()
    {
        global $domain, $db, $usrdata, $seo_on, $template, $directorypath;
        $userid = $usrdata['userid'];
        if (isset($_POST['avatar'])) {
            $avatar = clean($_POST['avatar']);
            if ($avatar == 0) {
                mysql_query("UPDATE fas_users SET avatar='{$avatar}', avatarfile=''  WHERE userid='{$userid}'");
                echo '<div class=\'msg\'>Profile updated</div>';
            } else {
                function findexts($filename)
                {
                    $filename = strtolower($filename);
                    $exts = explode(".", $filename);
                    $n = count($exts) - 1;
                    $exts = $exts[$n];
                    return $exts;
                }
                if ($_FILES['uploaded']['size'] > 40000) {
                    echo '<div class=\'error\'>File size too big.</div>';
                    return;
                }
                $ext = findexts($_FILES['uploaded']['name']);
                $os = array("gif", "jpg", "jpeg", "png");
                if (!in_array($ext, $os)) {
                    echo '<div class=\'error\'>File type not allowed or no file selected!</div>';
                    return;
                } else {
                }
                $ran = "avatar";
                $ran3 = $usrdata['userid'];
                $ran4 = $ran . $userid . '.';
                $avatarfile = $ran4 . $ext;
                //This assigns the subdirectory you want to save into... make sure it exists!
                $target = $directorypath . "avatars/";
                //This combines the directory, the userid, and the extension
                $target = $target . $ran4 . $ext;
                if (move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) {
                    echo '<div class=\'msg\'>The file has been uploaded.</div>';
                    mysql_query("UPDATE fas_users SET avatar='{$avatar}', avatarfile='{$avatarfile}'   WHERE userid='{$userid}'");
                } else {
                    echo '<div class=\'error\'>Sorry, there was a problem uploading your file.</div>';
                }
            }
        } else {
            if ($seo_on == 1) {
                $curl1 = '' . $domain . '/myaccount/changeavatar/';
            } else {
                $curl1 = '' . $domain . '/index.php?action=myaccount&cmd=changeavatar';
            }
            echo '<table align=\'center\' width="100%">
	<tr>
		<td colspan=\'4\' class=\'header\'>Edit Avatar</td>
	</tr>
<tr>
<td class=\'content\'>
<form enctype=\'multipart/form-data\' action=\'' . $curl1 . '\' method=\'POST\'>

Use Avatar?:
 <select type=\'dropdown\' name=\'avatar\'>

<option value=\'0\'>No</option>
<option value=\'1\' >Yes</option>
</select>
<p>

Please choose a file: <input name=\'uploaded\' type=\'file\' /><br />
<input type=\'submit\' value=\'Upload\' />
</form>
</td>
</tr>
</table>';
        }
    }
    function account()
    {
        global $domain, $db, $seo_on, $usrdata, $utemplate, $template, $avatar_on, $gender_on, $aimg, $fimg, $mimg;
        if ($seo_on == 1) {
            $url1 = '' . $domain . '/myaccount/favorites/';
            $url2 = '' . $domain . '/myaccount/changepassword/';
            $url3 = '' . $domain . '/myaccount/';
            $url4 = '' . $domain . '/messages/';
            $url5 = '' . $domain . '/myaccount/changeavatar/';
            $url6 = '' . $domain . '/myaccount/changequestion/';
            $url7 = '' . $domain . '/myaccount/changeemail/';
        } else {
            $url1 = '' . $domain . '/index.php?action=myaccount&cmd=favorites';
            $url2 = '' . $domain . '/index.php?action=myaccount&cmd=changepassword';
            $url3 = '' . $domain . '/index.php?action=myaccount';
            $url4 = '' . $domain . '/index.php?action=messages';
            $url5 = '' . $domain . '/index.php?action=myaccount&cmd=changeavatar';
            $url6 = '' . $domain . '/index.php?action=myaccount&cmd=changequestion';
            $url7 = '' . $domain . '/index.php?action=myaccount&cmd=changeemail';
//.........这里部分代码省略.........
开发者ID:freearcadescript,项目名称:FreeArcadeScript,代码行数:101,代码来源:myaccount.php

示例6: elseif

             echo "<option value='" . $bill['bill_id'] . "'>" . $bill['bill_name'] . '</option>';
         }
     }
     echo "</select>\n          </div>\n          <button type='submit' class='btn btn-default' name='Submit' value='Add'>Add</button>\n        </form>\n        </div>";
 } elseif ($vars['user_id'] && $vars['edit']) {
     if ($_SESSION['userlevel'] == 11) {
         demo_account();
     } else {
         if (!empty($vars['new_level'])) {
             if ($vars['can_modify_passwd'] == 'on') {
                 $vars['can_modify_passwd'] = '1';
             }
             update_user($vars['user_id'], $vars['new_realname'], $vars['new_level'], $vars['can_modify_passwd'], $vars['new_email']);
             print_message('User has been updated');
             if (!empty($vars['new_pass1']) && $vars['new_pass1'] == $vars['new_pass2'] && passwordscanchange($vars['cur_username'])) {
                 if (changepassword($vars['cur_username'], $vars['new_pass1']) == 1) {
                     print_message("User password has been updated");
                 } else {
                     print_error("Password couldn't be updated");
                 }
             } elseif (!empty($vars['new_pass1']) && $vars['new_pass1'] != $vars['new_pass2']) {
                 print_error("The supplied passwords didn't match so weren't updated");
             }
         }
         if (can_update_users() == '1') {
             $users_details = get_user($vars['user_id']);
             if (!empty($users_details)) {
                 if (empty($vars['new_realname'])) {
                     $vars['new_realname'] = $users_details['realname'];
                 }
                 if (empty($vars['new_level'])) {
开发者ID:Tatermen,项目名称:librenms,代码行数:31,代码来源:edituser.inc.php

示例7: session_unset

     session_unset();
     header('Location: index.php?action=home');
 case "addUsers":
     $page['title'] = "Faculty - Add New Users";
     require_once 'header.php';
     require_once 'staff/addUsers.php';
     require_once 'footer.php';
     break;
 case 'myaccount':
     $page['title'] = "My Account";
     require_once 'header.php';
     require_once 'myaccount.php';
     require_once 'footer.php';
     break;
 case 'changepassword':
     changepassword($_SESSION['userID'], $_POST['NewPassword']);
     break;
 case "createUser":
     addUser();
     break;
 case "addCourse":
     addNewCourse();
     break;
 case "addSemester":
     addNewSemester();
     break;
 case "addAssignment":
     addNewAssignment();
     break;
 case "updateRemoveEnrollment":
     updateRemoveEnrollment();
开发者ID:RedDragonJ,项目名称:My-Projects,代码行数:31,代码来源:index.php

示例8: mb_convert_encoding

    echo mb_convert_encoding(long_help($argv, $lang), $termtopage, 'UTF-8');
    exit;
}
$bError = $argc !== 3 && $argc !== 4;
if (!$bError) {
    $out = false;
    require_once dirname(__FILE__) . '/../synapp/connect.php';
    switch ($argv[1]) {
        case 'adduser':
            $out = $argc === 4 ? adduser($argv[2], $argv[3], prompt($termfrompage, $termtopage), $lang, connect()) : false;
            break;
        case 'deluser':
            $out = $argc === 3 ? deluser($argv[2], $lang, connect()) : false;
            break;
        case 'changepassword':
            $out = $argc === 3 ? changepassword($argv[2], prompt($termfrompage, $termtopage), connect()) : false;
            break;
        default:
            $bError = true;
    }
    $bError = $out !== true;
}
if ($bError !== false) {
    if (isset($out) && is_string($out)) {
        echo mb_convert_encoding($out, $termtopage, 'UTF-8') . PHP_EOL . PHP_EOL;
    }
    echo mb_convert_encoding(short_help($argv, $lang), $termtopage, 'UTF-8');
    exit;
}
/**
 * @param array $argv
开发者ID:elcodedocle,项目名称:synapp,代码行数:31,代码来源:synadmin.php

示例9: strtolower

     break;
 case "SendInvites":
     $to = strtolower(trim($_POST['to']));
     SendInvites($to);
     break;
 case "homelist":
     $userid = mysql_real_escape_string($_POST['userid']);
     homelist($userid, $viddler_session_id);
     break;
 case "changepassword":
     $userid = mysql_real_escape_string($_POST['userid']);
     $oldpassword = mysql_real_escape_string(md5($_POST['oldpassword']));
     $newpassword = mysql_real_escape_string($_POST['newpassword']);
     $confirmpassword = mysql_real_escape_string($_POST['confirmpassword']);
     $email = mysql_real_escape_string($_POST['email']);
     changepassword($userid, $oldpassword, $newpassword, $confirmpassword, $email);
     break;
 case "user_details":
     $userid = $authuserid;
     user_details($userid);
     break;
 case "searchusers":
     //$tile_name = strtolower(trim($_POST['tile_name']));
     $username = strtolower(trim($_POST['username']));
     //searchusers($username, $tile_name);
     searchdata($username);
     break;
 case "search":
     $search = $_POST['search'];
     searchdata($search);
     break;
开发者ID:gopi158,项目名称:Sample,代码行数:31,代码来源:api.php

示例10: check_password

<?php

require "./todolist.php";
$act = $_GET["act"];
if ($act == "check_password") {
    $old_password = $_POST["old_password"];
    $json_message = check_password($old_password);
    echo $json_message;
} else {
    if ($act = "changepassword") {
        $new_password = $_POST['new_password'];
        $json_message = changepassword($new_password);
        $message = json_decode($json_message);
        if ($message->changepassword == "change success") {
            logout();
        }
        //echo "nvwiopnb";
        echo $json_message;
    }
}
开发者ID:snoweek,项目名称:php-todolist,代码行数:20,代码来源:changepassword_handle.php

示例11: changepassword

      </ul>
    </div>
  </div>
</div>
</form>

<?php 
    if ($vars['user_id']) {
        if ($vars['action'] == "deleteuser") {
            include "pages/edituser/deleteuser.inc.php";
        } else {
            // Perform actions if requested
            if (passwordscanchange($user_data['username']) && $vars['action'] == "changepass") {
                if ($_POST['new_pass'] == $_POST['new_pass2']) {
                    changepassword($user_data['username'], $_POST['new_pass']);
                    print_message("Password Changed.");
                } else {
                    print_error("Passwords don't match!");
                }
            }
            if ($vars['action'] == "becomeuser") {
                $_SESSION['origusername'] = $_SESSION['username'];
                $_SESSION['username'] = $user_data['username'];
                header("Location: /");
                dbInsert(array('user' => $_SESSION['origusername'], 'address' => $_SERVER["REMOTE_ADDR"], 'result' => 'Became ' . $_SESSION['username']), 'authlog');
                include "includes/authenticate.inc.php";
            }
            if ($vars['action'] == "deldevperm") {
                if (dbFetchCell("SELECT COUNT(*) FROM devices_perms WHERE `device_id` = ? AND `user_id` = ?", array($vars['device_id'], $vars['user_id']))) {
                    dbDelete('devices_perms', "`device_id` =  ? AND `user_id` = ?", array($vars['device_id'], $vars['user_id']));
开发者ID:RomanBogachev,项目名称:observium,代码行数:30,代码来源:edituser.inc.php


注:本文中的changepassword函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。