SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Apr 2012
    Location
    algeria,constantine
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    session not working with me

    the session not working with me this morning ,I don't know why
    look at the code:
    PHP Code:
    <?php ob_start();
    session_start();
    ?>
    <html xmlns='http://www.w3.org/1999/xhtml'>
       <body>
          <div class='container'>
            <div class='header'>
           <img src='../pictures/logo.png' />
       
         </div>
         
         <div class='corps' dir='rtl'>
        <?php   
           
    include '../config/configdb.php';
        include 
    '../api/usersapi.php';
        if(isset(
    $_POST['user']) && $_POST['user'] == 'login'){
        
                 
    $username strip_tags($_POST['username']);
               
    $password strip_tags(sha1($_POST['password']));
        if(
    $username && $password){
         
    $getuser tutofilter_users_get("WHERE `username` = '$username' AND `password` = '$password'");
         if(
    $getuser == NULL)
            echo 
    'no member with this name ';
         else{
          foreach(
    $getuser as $user):
              
    $uname $user->username;
           
    $upass $user->password;
           if(
    $username == $uname && $password == $upass):
            
    $tname $_SESSION['tname'];
            
    $tpass $_SESSION['tpass'];
           
            echo 
    "welcome $tname to your controll panel<a href='profile.php'>go to your profile</a>";  
           else:
               die(
    'login failed');
           endif;
             endforeach;
         }
        
        } }    
         
    ?>    
      </div>
        
          </div>
    the result in profile.php : welcome to your controll panel go to your profile
    the problem is the variables $tname and $tpass do not stock any session in the login
    help me please

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,183
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Where does your session indexes get set as i don't see them been set anywhere in the above code?
    Blog/Portfolio | Evolution Xtreme | DFG Design | DFG Hosting | CSS-Tricks | Stack Overflow | Paul Irish
    Having lame problems with your code? Let us help by using a jsFiddle

  3. #3
    SitePoint Addict tom8's Avatar
    Join Date
    Mar 2012
    Location
    New Jersey
    Posts
    310
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Maybe you got them transposed?

    Code:
    $_SESSION['tname'] = $tname = $uname;
    $_SESSION['tpass'] = $tpass = $upass;

  4. #4
    SitePoint Member
    Join Date
    Apr 2012
    Location
    algeria,constantine
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you
    solved
    did not pay attention to this


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
  •