[PHP] Need help with cookies and header's menu

Shout-Out

User Tag List

Results 1 to 1 of 1
  1. #1
    ntsmarkv's Avatar Active Member
    Reputation
    30
    Join Date
    Dec 2006
    Posts
    266
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [PHP] Need help with cookies and header's

    OK so I created my own OTP auth system, and It work's 100% but this is what I need help with;

    When you go to my site, it will load the auth system. You click on get auth code, it will then either SMS the code to you or send via email depending on your preference. Then you enter your email and your code you just got.

    Now my problem is when you enter both, it doesn't direct you to the right part of the site, it keep's loading the auth system.

    checkauth.php
    Code:
    if(isSet($cookie_name))
    {
    	// Check if the cookie exists
    if(isSet($_COOKIE[$cookie_name]))
    	{
    	parse_str($_COOKIE[$cookie_name]);
    
    	// Make a verification
    
    	if(($usr == $config_username) && ($hash == md5($config_password)))
    		{
    		// Register the session
    		$_SESSION['Site-Key'] = $config_username;
    		}
    	}
    }
    dologin.php
    Code:
    if(empty($_POST)) exit;
    
    include 'config.php';
    
    // declare post fields
    
    $post_username = trim($_POST['username']);
    $post_password = trim($_POST['authcode']);
    
    $post_autologin = $_POST['autologin'];
    
    if(($post_username == $config_username) && ($post_password == $config_password))
    {
    $_SESSION['Site-Key'] = $config_username;
    
    // Autologin Requested?
    
    if($post_autologin == 1)
    	{
    	$password_hash = md5($config_password); // will result in a 32 characters hash
    
    	setcookie ($cookie_name, 'usr='.$config_username.'&hash='.$password_hash, time() + $cookie_time);
    	}
    
    exit('OK');
    }
    else
    {
    echo '<div id="error_notification">The submitted login info is incorrect.</div>';
    }
    doauth.php
    Code:
    if(isSet($_COOKIE['Site-Key']))
    {
    header("Location: http://mysite.com/forum");
    }
    else
    {
    header("Location: http://auth.mysite.com");
    exit;
    }

    Any help would be greatly appreciated

    [PHP] Need help with cookies and header's

Similar Threads

  1. Need help with iniread and Mysql
    By lustikus12 in forum Programming
    Replies: 2
    Last Post: 12-26-2009, 11:01 PM
  2. need help with morpher and teleporter
    By lolzz in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 07-25-2008, 08:21 PM
  3. need help with items and professions
    By greekkiller in forum World of Warcraft General
    Replies: 3
    Last Post: 06-16-2008, 02:41 PM
  4. Need help with website and server
    By Ukrajinc in forum World of Warcraft Emulator Servers
    Replies: 0
    Last Post: 12-26-2007, 08:41 PM
All times are GMT -5. The time now is 08:35 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search