$dbh = getConnection(); $editData = $app->request->post(); edits::save($dbh, $editData); }); $app->get('/login', function () use($app) { //This should only flow over HTTPS connections as the password is coming in plain text. $data = []; $dbh = getConnection(); $data = mergeEnv($data, 'home'); $app->render('login.html', $data); })->name('login'); $app->post('/login', function () use($app) { //This should only flow over HTTPS connections as the password is coming in plain text. $userData = $app->request->post(); $dbh = getConnection(); users::login($dbh, $userData); $app->redirect($app->urlFor('home')); }); $app->get('/logout', function () use($app) { if (!empty($_SESSION['jwt'])) { unset($_SESSION['jwt']); } if (!empty($_SESSION['token'])) { unset($_SESSION['token']); } $app->redirect($app->urlFor('home')); })->name('logout'); $app->get('(/:page+)', $authenticate, function ($page) use($app) { $data = array(); $dbh = getConnection(); $data = mergeEnv($data, $page[0]);
<?php /* autoloading classes */ function my_autoloader($class) { require_once 'classes/' . $class . '.php'; } spl_autoload_register('my_autoloader'); $page = new html(); $user = new users(); $login_msg = ""; if (isset($_POST['login']) && !$user->login_status()) { if (!$user->login()) { $login_msg = "Invalid login, Please try again"; } } ?> <!DOCTYPE html> <html lang="en"> <head> <?php include_once 'html/default_css_js.html'; ?> <meta charset="utf-8"/> <meta http-equiv="X-UA-Compatible" content="IE=edge"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>Logic++ eCab</title> <?php echo $page->htmlHeader(); ?> </head>
<?php #Login if (isset($_POST['login'])) { echo ' f**k d'; $username = trim($_POST['username']); $password = trim($_POST['password']); $postElements = array("Username" => $username, "Password" => $password); foreach ($postElements as $identifier => $postElement) { if (empty($postElement) == true) { $errors[] = 'You haven\'t filled in the ' . $identifier . ' field.'; } } if (empty($errors) == true) { $userID = users::login($username, $password); if ($userID == false) { $errors[] = 'Sorry your username & password do not match.'; } else { //Creating session and assigning id. $_SESSION['id'] = $userID; // Sending user to home header('Location: main.php'); } } //Error displayer if (empty($errors) === false) { echo '<p>' . implode('</p><p>', $errors) . '</p>'; } }
<?php session_start(); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(-1); //require('class.bitcoind.php'); require 'config.php'; require 'class.users.php'; $i = new users($conf); //$i->login(); if (isset($_SESSION['user_session'])) { if (isset($_GET['logout'])) { $i->logout(); } echo "Welcome " . $_SESSION['user_session'] . " <br><br><a href=?logout=true>Logout</a>"; } else { if (isset($_GET['login'])) { $i->login(); } else { echo 'login please: <form action="test2.php" method="GET"><input type="hidden" name="login" value="true"><input name="user" type="text" ><input type="text" name="pass"><input type="submit" value="Submit"></form>'; } } //$bitcoin = new Bitcoin('bitcoinrpc','123'); //print_r($bitcoin->getblock('000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f'));
} } #激活资料页 if (isset($_GET['command']) && $_GET['command'] == 'activate' && isset($_GET['user']) && isset($_GET['key'])) { $usersClass = new users(); $s = $usersClass->activateUser($_GET['user'], $_GET['key']); if ($s === true) { refresh('/' . $languageURL . 'sign_up/complete/'); } else { addErrorMessage($s['valid'], '', 'error'); } } #登录 if (isset($_POST['login'])) { $usersClass = new users(); $s = $usersClass->login(); if ($s === true) { if (isset($_SESSION['temp']['golink'])) { $web = $_SESSION['temp']['golink']; unset($_SESSION['temp']['golink']); refresh($web); } refresh('/' . $languageURL); } else { // error_invalid_username_or_password //账号未激活 if ($s == 'error_invalid_activation_no') { //通过用户名密码获取用户信息 $username = $_POST['username']; $password = $_POST['password']; $user_info = $usersClass->getuserinfoByNamePwd($username, $password);
* GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with Paradise-Bird-Project. If not, see <http://www.gnu.org/licenses/>. */ include "users_class.php"; include "users_functions.php"; global $user; $user = new users($config); if (isset($_GET['users_action'])) { $action = $_GET['users_action']; } else { $action = 'main'; } switch ($action) { case 'login': $result = $user->login($_POST['users_username'], $_POST['users_password']); if ($result < 1) { $pm->showPackError('login_incorrect', 'users', 403, true); exit; } if ($result == true) { $pm->showPackError('login_done', 'users', 200, true, 'index.php'); exit; } break; case 'logout': if ($user->logout()) { $pm->showPackError('logout_done', 'users', 200, true, 'index.php'); exit; } else { $pm->showPackError('logout_failed', 'users');
$username = $_POST["username"]; $password = $_POST["password"]; session_start(); $_SESSION['username'] = $username; if (isset($_POST["re"])) { setcookie("username", $username, time() + 60 * 60 * 7, '/'); } if (empty($_POST["username"]) || $_POST["username"] == "") { $corruser = "******"; } if (empty($_POST["password"]) || $_POST["password"] == "") { $corrpass = "******"; } else { // $query="SELECT * FROM users WHERE username='******'"; // $sql= mysqli_query($link, $query); if ($users->login($username, $password) > 0) { // while($rows= mysqli_fetch_array($sql)){ // if(@$rows['password']==@$password){ $_SESSION['userlogin'] = true; $_SESSION['userid'] = $users->userlogin_id; if (isset($_POST["re"])) { setcookie("userlogin", true, time() + 60 * 60 * 7, '/'); setcookie("userid", $users->userlogin_id, time() + 60 * 60 * 7, '/'); } // if($rows['permission']=="admin"){ //// echo "<meta http-equiv='refresh' content='0; url=$url'>" ; // } // else{ echo "<meta http-equiv='refresh' content='0; url={$url}'>"; // } // }
include "../include/db/users.php"; session_start(); /* Sample Processing of Forgot password form via ajax Page: extra-register.html */ # Response Data Array $resp = array(); // Fields Submitted $username = $_POST["username"]; $password = $_POST["password"]; // This array of data is returned for demo purpose, see assets/js/neon-forgotpassword.js $resp['submitted_data'] = $_POST; // Login success or invalid login data [success|invalid] // Your code will decide if username and password are correct $login_status = 'invalid'; $userlogin = new users(); $result = $userlogin->login($username, $password); if ($result >= 1) { $login_status = 'success'; } $resp['login_status'] = $login_status; // Login Success URL if ($login_status == 'success') { // If you validate the user you may set the user cookies/sessions here //setcookie("logged_in", "user_id"); $_SESSION["user_id"] = $result; // Set the redirect url after successful login $resp['redirect_url'] = 'http://myakil.com/admin'; } echo json_encode($resp);