Jump to content

Login Authentication Assistance


inquisitive

Recommended Posts

My code is throwing errors at  me...exact line is this : unexpected T_VARIABLE, expecting T_FUNCTION in C:\xampp\htdocs\xampp\X_websites_X\webdesign4idiots.com\admin\add_users.php on line 29...line 29 is $date= date('Ymd');

 

<?php

include('conn.php');

 

function session_defaults() {

$_SESSION['logged'] = false;

$_SESSION['uid'] = 0;

$_SESSION['username'] = '';

$_SESSION['cookie'] = 0;

$_SESSION['remember'] = false;

}

 

if (!isset($_SESSION['uid']) ) {

session_defaults();

}

 

class User {

var $db = null; // PEAR::DB pointer

var $failed = false; // failed login attempt

var $date; // current date EST

var $id = 0; // the current user's id

function User(&$db) {

$this->db = $db;

if ($_SESSION['logged']) {

$this->_checkSession();

} elseif (!isset($_COOKIE['mtwebLogin']) ) {

$this->_checkRemembered($_COOKIE['mtwebLogin']);

}

}

$date = date('Ymd');

$db = db_connect();

$user = new User($db);

function _checkLogin($username, $password, $remember) {

$username = $this->db->quote($username);

$password = $this->db->quote(md5($password));

$sql = "SELECT * FROM users WHERE " .

"username = $username AND " .

"password = $password";

$result = $this->db->getRow($sql);

if ( is_object($result) ) {

$this->_setSession($result, $remember);

return true;

} else {

$this->failed = true;

$this->_logout();

return false;

}

}

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.