當前位置: 首頁>>代碼示例>>PHP>>正文


PHP MyDB::modifyDB方法代碼示例

本文整理匯總了PHP中MyDB::modifyDB方法的典型用法代碼示例。如果您正苦於以下問題:PHP MyDB::modifyDB方法的具體用法?PHP MyDB::modifyDB怎麽用?PHP MyDB::modifyDB使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MyDB的用法示例。


在下文中一共展示了MyDB::modifyDB方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: MyDB

<?php

// save old password  and username to session
if ($_GET['password']) {
    session_start();
    $_SESSION['oldPassword'] = $_GET['password'];
    $_SESSION['username'] = $_GET['username'];
}
// connect ot database and change password according old password and username
if (isset($_POST['newPassword'])) {
    include_once "MyDB.php";
    $myDB = new MyDB();
    $myDB->modifyDB("update userProfile set password ='" . md5($_POST['newPassword']) . "' where password ='" . $_SESSION['oldPassword'] . "' and username='" . $_SESSION['username'] . "';");
    session_destroy();
    header("Location: login.php");
}
?>


<html>
    <body>
        <form method="post">
            <table>
                <tr>
                    <td>set a new password: </td>
                    <td><input type="password" name="newPassword"></td>
                </tr>
                <tr>
                    <td><button type="submit">change password</button></td>
                </tr>
            </table>
開發者ID:EricZhang90,項目名稱:Recite,代碼行數:31,代碼來源:changePassword.php

示例2: MyDB

    }
    if ($_POST['password'] == "") {
        $passwordErr = "  - please enter password";
        $isValid = false;
    }
    if ($_POST['hint'] == "") {
        $hintErr = "  - please enter hint";
        $isValid = false;
    }
    // if is valid, encrtpt password then connect to database and create accout in user projile and user progress
    if ($isValid) {
        include_once "php/MyDB.php";
        $DBManager = new MyDB();
        $password = md5($_POST['password']);
        $query = "insert into userProfile values( '" . $_POST['username'] . "','" . md5($password) . "','" . $_POST['hint'] . "');";
        $DBManager->modifyDB($query);
        $query = "insert into accomplishment values('" . $_POST['username'] . "','" . "2016-01-01" . "','" . "0" . "','" . "0" . "','" . "0" . "0" . "','" . "');";
        $DBManager->modifyDB($query);
        header("Location: php/login.php");
    }
}
?>


<html>
<head>
<title>
  Recite
</title>
</head>
<body bgcolor="87cefa" link="c80000">
開發者ID:EricZhang90,項目名稱:Recite,代碼行數:31,代碼來源:index.php


注:本文中的MyDB::modifyDB方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。