Flat File Login System

Discussion in 'General Webmaster Support' started by TFlan, Aug 23, 2006.

  1. TFlan

    TFlan I could change this in my User CP.

    Ratings:
    +64 / 0 / -0
    http://tristian.php1h.com/index.php

    in that template there is a members area that i created and i made it so that it has the same names as the forum form for loging in, but i cant seem to find where it acually makes the person login... the action is forum/index.php and i checked that multiple times, but i cant seem to find it! Also when they login from the main page and not the forum i would like to find a away to make it show a link to new pms like (You have 1 new Private Message) or (You have no new Private Messages) at the bottom with a logout link, im rusty with my php skill so explain what your answer please

    any help would be great!
     
  2. TFlan

    TFlan I could change this in my User CP.

    Ratings:
    +64 / 0 / -0
    ok i found the login script... it was in the globals.php file... stupid me

    Code:
    //if user is logging out
    if(isset($logout)&&$logout==1){
    	setcookie("navboardlogin","",time()-3600);
    	setcookie("navboardpass","",time()-3600);
    	unset($navboardlogin);
    	unset($navboardpass);
    }
    
    //already logged in (navboardlogin and navboardpass in cookies), rechecking login access
    if(isset($navboardlogin)&&trim($navboardlogin)!=""&&isset($navboardpass)&&trim($navboardpass)!=""&&nb_check_hash($navboardpass)){
    	//check login, but dont reset cookies
    	$login=nb_login($navboardlogin,$navboardpass,0,0);
    }
    
    //new login, but only when not logged in already
    if(isset($navboardlogin2)&&isset($navboardpass2)&&$login!=1){
    	//md5 the pass
    	$navboardpass2=md5($navboardpass2);
    
    	//check login, set cookies
    	if(isset($rememberme)&&$rememberme=="on"){
    		$login=nb_login($navboardlogin2,$navboardpass2,1,1);
    	}else{
    		$login=nb_login($navboardlogin2,$navboardpass2,1,0);
    	}
    }
    
    unset($sess);
    
    //if there is a sess stored in the cookie
    if(isset($navboardsess)&&nb_check_hash($navboardsess)){
    	$sess=$navboardsess;
    }else{
    	//no sess stored in cookie so make a new sess and store in the cookie
    	$sess=md5(uniqid(microtime()));
    	setcookie("navboardsess","$sess");
    }
    
    unset($navboardpass);
    unset($navboardlogin);
    unset($navboardpass2);
    unset($navboardlogin2);
    unset($navboardsess);
    
    
    if($login==1){
    
    	//user custom options
    	$userloggedinoptarray=nb_get_data("$configarray[1]/$userloggedinarray[25]/options.php");
    	//sets up time offset seconds for use later
    	$timeoffsetseconds=($userloggedinarray[23]*60)*60;
    
    	//current session different than stored session (new login)
    	if($userloggedinarray[20]!=$sess){
    		//set current session into user data
    		$userloggedinarray[20]=$sess;
    
    		//update last login time and ip
    		if(isset($userloggedinarray[30])&&$userloggedinarray[30]!=""){
    			$userloggedinarray[5]=$userloggedinarray[30];
    		}else{
    			$userloggedinarray[5]="";
    		}
    		$userloggedinarray[30]=time();
    
    		$userloggedinarray[19]=nb_get_ip();
    
    	}else{
    		//current sess same as stored sess (same login)
    		//update last login time and ip
    		//$userloggedinarray[5]=$userloggedinarray[30];
    		$userloggedinarray[30]=time();
    		$userloggedinarray[19]=nb_get_ip();
    	}
    
    	//die();
    
    	nb_write_data("$configarray[1]/$userloggedinarray[25]/main.php",$userloggedinarray,0);
    
    }else{
    	//guests drool users rule!
    	$userloggedinarray[5]="1";
    	$userloggedinarray[17]="";
    	$userloggedinarray[15]="0";
    	$userloggedinarray[23]="0";
    	$userloggedinarray[25]="0";
    	$userloggedinarray[28]="";
    	$userloggedinarray[30]="1";
    	$timeoffsetseconds=0;
    
    }
    there is everything that i think i would need, now i just need a way of intigrating it into the template
     
  3. TFlan

    TFlan I could change this in my User CP.

    Ratings:
    +64 / 0 / -0
    ok i have this error... how do i fix?
    Code:
    Warning: Cannot modify header information - headers already sent by (output started at /home/tristian/www/index.php:9) in /home/tristian/www/login.php on line 37
     
  4. phyrex1an

    phyrex1an Staff Member and irregular helper Staff Member

    Ratings:
    +446 / 0 / -0
    Ryoko knows best :)
     
  5. TFlan

    TFlan I could change this in my User CP.

    Ratings:
    +64 / 0 / -0
    ok thanks
     

Share This Page