SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    May 2008
    Posts
    231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    logging users automatically after verification

    when a user signs up on my website,they get a similar link;

    website.com/confirm_register.php?id=2d3ca81caf061fe873b16b98573ebd10

    after clicking the link ,they are directed to a similar link website.com/alerts.php

    but the alerts.php checks for authentication,here is the code below;
    PHP Code:
    require("inc/conn.php");
    session_start();


    if(!isset(
    $_SESSION['username'])) {
        
    header("Location: login.php");

    as you can see the code above ,only checks for session,i also want to check if a user came direct from clicking the verfication link so that they can access automatically without having to login again

    cheers

  2. #2
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Just set the same session variables in confirm_register.php, as you would when the user logs in.

    However I wouldn't advise this, it would leave a gaping hole in your security. However, it maybe excusable to allow this once, and expire the key after it's been used.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •