Jump to content

Search the Community

Showing results for tags 'google-chrome'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. I've come across a problem within (at least) Google Chrome and Safari. Upon the first attempt at logging in, the user is not redirected. The session is created, but it is almost as if it is not detected, and takes the user back to the index page. Upon a second attempt, the correct redirect is issued and the user is taken to the correct page. The script works fine in Firefox, and I have checked extensively to see if the correct data is being returned, which it is. I've searched and I've searched and I've searched, but unfortunately nothing of use has cropped up. Access.php - User logging in <?php session_start(); ob_start(); include_once('db.class.php'); include_once('register.class.php'); include_once('login.class.php'); $db = null; $reg = null; $log = null; $db = new Database(); $log = new Login($db, null, null, null, null, null, null); if (isset($_SESSION['login'])) { $log->redirectUser($_SESSION['login']); } include_once('includes/header.html'); ?> Some HTML... <?php if (isset($_POST['logsub'])) { $db = new Database(); $log = new Login($db, $_POST['email'], $_POST['pass']); $validation = &$log->validate(); if(empty($validation)) { $log->redirectUser($_SESSION['login']); } else { echo "<div id='error'><div class='box-error'><p style='font-weight: bold'>The following errors occured...</p><ul>"; for ($i = 0; $i < count($validation); $i++) { echo "<li>" . $log->getErrorMessage($validation[$i]) . "</li>"; } echo "</ul></div></div>"; } } ?> Login.class.php - Login class // Validate the credentials given public function validateLogin() { // Hash the plain text password $this->hashedPass = $this->hashPassword(); try { $query = $this->dbcon->prepare("SELECT Login_ID, Login_Email, Login_Password FROM Login WHERE Login_Email = :email AND Login_Password = :pass"); $query->bindParam(':email', $this->email, PDO::PARAM_STR); $query->bindParam(':pass', $this->hashedPass, PDO::PARAM_STR); $query->execute(); $fetch = $query->fetch(PDO::FETCH_NUM); $this->loginid = $fetch[0]; // If a match is found, create a session storing the login_id for the user if ($query->rowCount() == 1) { $_SESSION['login'] = $this->loginid; session_write_close(); } else { return LOG_ERR_NO_MATCH; } } catch (PDOException $e) { $this->dbcon->rollback(); echo "Error: " . $e->getMessage(); } } // Fetch the customer ID private function getCustId() { try { $query = $this->dbcon->prepare("SELECT Customer.Cust_ID FROM Customer JOIN Login ON Customer.Login_ID = Login.Login_ID WHERE Customer.Login_ID = :loginid"); $query->bindParam(':loginid', $this->loginid, PDO::PARAM_INT); $query->execute(); $fetch = $query->fetch(PDO::FETCH_NUM); return $fetch[0]; } catch (PDOException $e) { $this->dbcon->rollback(); echo "Error: " . $e->getMessage(); } } // Check the registration progress - are they verified? paid? // This function is used elsewhere hence the $sessionid argument public function checkRegistration($sessionid) { $this->loginid = $sessionid; $this->custid = $this->getCustId(); try { $queryVer = $this->dbcon->prepare("SELECT Cust_ID FROM Customer_Verify_Email WHERE Cust_ID = :custid"); $queryVer->bindParam(":custid", $this->custid, PDO::PARAM_INT); $queryVer->execute(); $queryFee = $this->dbcon->prepare("SELECT Cust_ID FROM Initial_Fee_Payment WHERE Cust_ID = :custid"); $queryFee->bindParam(":custid", $this->custid, PDO::PARAM_INT); $queryFee->execute(); // If a record exists in the verify table, return the value 1. This means the user has not yet verified their email. if ($queryVer->rowCount() == 1) { return 1; } else { // If a record does not exist in the payment table, no payment has been made. Return 2. if ($queryFee->rowCount() == 0) { return 2; // Otherwise, email is verified and the payment has been made. } else { return 0; } } } catch (PDOException $e) { $this->dbcon->rollback(); echo "Error: " . $e->getMessage(); } } // Redirect the user accordingly public function redirectUser($sessionid) { $this->loginid = $sessionid; $logNum = $this->checkRegistration($this->loginid); if ($logNum == 0) { header("Location: http://www.jonline.me.uk/fbedder/details.php", true, 200); exit(); } else if ($logNum == 1) { header("Location: http://www.jonline.me.uk/fbedder/verification.php", true, 200); exit(); } else if ($logNum == 2) { header("Location: http://www.jonline.me.uk/fbedder/payment.php", true, 200); exit(); } } Here's a link to the site: http://www.jonline.me.uk/fbedder/ -> I have set-up a test account with the credentials -> email: test@jonline.me.uk / password: test123321 To reiterate, the problem exists only in Google Chrome and Safari (the Safari being on my iPhone) and lies purely within the logging in aspect. On the first attempt, the session will be ignored (it is created), and on the second attempt, the user will be redirected. Any ideas? I've tried a multitude of possibilities... Thanks
×
×
  • 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.