/** * Created by PhpStorm. * User: lyn * Date: 15/7/13 * Time: 下午11:03 */ header("Content-Type: text/html; charset=utf-8"); require_once "../entity/User.php"; require_once "../config.php"; require_once "../provider/Database.php"; require_once "../action/UserAction.php"; require_once "../provider/testFormat.php"; require_once "../entity/response/Response.php"; session_start(); $arr = $_POST; $result = testLogin($arr); $myjson = json_encode($result); echo $myjson; function testLogin($arr) { $email = $arr["username"]; $password = $arr["password"]; $testformat = new testFormat(); if ($testformat->testLogin($email, $password)) { $user = UserAction::login($email, $password); if (!($user === UserAction::$LOGIN_FAIL)) { $_SESSION['user'] = $user; $result = new Response(true, ""); return $result; } else { $result = new Response(false, "错误的账号/密码");
<?php $I = new AcceptanceTester($scenario); $I->wantTo('Test creating an item'); testLogin($I); $I->amOnPage('/database.php'); $I->click('/html/body/section/div/menu/div/div[1]/form/select/option[2]'); $I->see('successfully.');
$userName = "******"; $userPassword = "******"; testLogin($userName, $userPassword, $db, $mode); //user3 $userName = "******"; $userPassword = "******"; testLogin($userName, $userPassword, $db, $mode); echo "Attempting to login in users with non-registered usernames...<br><br>"; //user 1 $userName = "******"; $userPassword = "******"; testLogin($userName, $userPassword, $db, $mode); //user 2 $userName = "******"; $userPassword = "******"; testLogin($userName, $userPassword, $db, $mode); function testLogin($userName, $userPassword, $db, $mode) { echo "Test user: username: {$userName}, Password: {$userPassword}<br> "; $db->login($userName, $userPassword); echo "Result: {$db->feedback}"; if ($mode == 1) { if ($db->feedback == "Password is incorrect - try again") { echo '<p style="color:red">----FAILED</p><br><br>'; } else { echo '<p style="color:green">----PASSED</p><br><br>'; } } else { if ($db->feedback == "Password is incorrect - try again") { echo '<p style="color:green">----PASSED</p><br><br>'; } else {
<?php include 'lib.php'; $in = testLogin(); print_header("Login"); ?> <div class="grid_10 suffix_1 prefix_1"> <div id="gatherling_main" class="box"> <div class="uppertitle"> Login to Gatherling </div> <?php if (isset($_POST['mode'])) { print_loginFailed(); } ?> <form action="login.php" method="post"> <table class="form" align="center" style="border-width: 0px" cellpadding="3"> <tr><th>MTGO Username</th> <td><input type="text" name="username" value=""></td></tr> <tr><th>Gatherling Password</th> <td><input type="password" name="password" value=""> </td></tr> <tr><td> </td></tr> <tr><td colspan="2" class="buttons"> <input type="submit" name="mode" value="Log In"><br /> Please <a href="register.php">Click Here</a> if you need to register. </td> </tr> </table> </form> </div> <!-- gatherling_main --> </div> <!-- grid 10 pre 1 suff 1 -->
* Initialise the Workbooks API object */ $service_params = array('application_name' => $application_name, 'user_agent' => $user_agent, 'logger_callback' => array('WorkbooksApi', 'logAllToStdout'), 'connect_timeout' => 120, 'request_timeout' => 120, 'verify_peer' => $verify_peer, 'api_key' => $api_key); if (isset($service)) { $service_params['service'] = $service; } $workbooks = new WorkbooksApi($service_params); return $workbooks; } } /* * Exit. Does not return! */ if (!function_exists('testExit')) { function testExit($workbooks, $exit_code = 0) { if ($exit_code == 0) { $workbooks->log('script exited', 'OK', 'info'); } else { $workbooks->log('script exited with error', $exit_code, 'error'); } exit($exit_code); } } if ($workbooks == NULL) { /* Not already authenticated or running under the Workbooks Process Engine, so setup a session */ $workbooks = testLogin(); } ?>
<?php require_once "inc/user.inc.php"; require_once "inc/misc.inc.php"; require_once "inc/alerts.inc.php"; require_once "inc/mail.inc.php"; if (!isLoggedIn()) { header("Location: login.php?error=Please+login+first"); } // Change password if (isset($_POST['changepassword']) && valid(clean($_POST['changepassword']))) { $c = sha1(clean($_POST['cpwd'])); $n = sha1(clean($_POST['npwd'])); $n2 = sha1(clean($_POST['npwd2'])); if (testLogin($_SESSION['username'], $c, false)) { if ($n == $n2) { changePassword($_SESSION['username'], $n, false); } else { $alerts->setError("New passwords don't match!"); } } else { $alerts->setError("Incorrect current password!"); } } ?> <html> <head> <title>xMail</title> <link rel='stylesheet' href='style.css'> </head> </body>
<?php /* * Page : login.php * Description : This page is the home page whene the users are connected. * Authors : Chauche Benoit & Boccard Nicolas * Date : 01.12.2015 * Version : 1.0 */ //Insersion du fichier de fonction include_once "../functions/dbFunctions.php"; $pseudo = $_POST["pseudo"]; $password = $_POST["password"]; $idLogin = testLogin($pseudo, $password); if ($idLogin != false) { $_SESSION["idLogged"] = $idLogin; header('Location: index.php'); } else { header('Location: index.php?pseudo=' . $pseudo . '&message=Identifiants incorrects.'); }