Problem logging in

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Problem logging in

    Guys i created a script and i am able to login with every browser even old phones like motorola v360 but when i try to login with opera mini i just can't, what confuses me is it also returns no errors, what could be the reason?
    Last edited by s3nzo; 17.09.11, 13:27.
    libra.wen.ru

    #2
    Are you using session like

    session_start();

    to

    $user = $_SESSION['user']=$user();

    if so you will need to send the user session id as well ;)
    Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
    Visit: WapMasterz Coming Back Soon!
    _______
    SCRIPTS FOR SALE BY SUBZERO
    Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
    FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
    _______
    Info & Tips
    php.net
    w3schools.com

    Comment


      #3
      You mean something like index.php?sid=session_id() ?
      libra.wen.ru

      Comment


        #4
        No the point of using session is to hide your code.
        Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
        Visit: WapMasterz Coming Back Soon!
        _______
        SCRIPTS FOR SALE BY SUBZERO
        Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
        FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
        _______
        Info & Tips
        php.net
        w3schools.com

        Comment


          #5
          Check the names of dynamic pages, or post code simply.
          <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

          Comment


            #6
            login.php
            PHP Code:
            <?php
                
            require    'inc/head.inc';

                if(isset(
            $_SESSION['id']))
                        
            header('Location:index.php');
                if(!isset(
            $_POST['loginName']))
                {    

                    require    
            'inc/header.inc';

                    if(isset(
            $_SESSION['errors']))
                    {
                        if(
            is_array($_SESSION['errors']))
                        {
                            foreach(
            $_SESSION['errors'] as $error)
                                print    
            $error.'<br>';
                        }
                        else
                            print    
            $_SESSION['errors'];
                    }
                                    
            $forms->login();
                        unset(
            $_SESSION['errors']);
                }

                else
                    {
                        
            $_SESSION['loginName']    =    mysql_real_escape_string(htmlentities(stripslashes($_POST['loginName'])));
                        
            $pass        =    mysql_real_escape_string(trim(htmlentities(stripslashes(md5($_POST['pass']))));
                        
            $errors    =    array();
                        if(empty(
            $_SESSION['loginName']))
                            
            $errors    =    'Login name can not be empty';
                        if(empty(
            $pass))
                            
            $errors    =    'Password is required';
                            
                        
            $sql    =    "SELECT password FROM users WHERE loginName    =    '{$_SESSION['loginName']}' AND password    =    '{$pass}'";
                            
            $query    =    mysql_query($sql$con);
                            
                    if((
            mysql_num_rows($query)) != 1)
                        
            $errors    =    'Your details do not match';
                                
                    if(
            count($errors))
                        {
                            unset(
            $_POST['loginName']);
                            
            $_SESSION['errors']    =    $errors;
                            
            header('Location:login.php');
                        }
                else
                        {
                        
            session_regenerate_id();
                        
            $sql    =    "SELECT * FROM users WHERE loginName    =    '{$_SESSION['loginName']}'";
                        
            $query2    =    mysql_query($sql$con);
                        
            $result    =    mysql_fetch_array($query2);
                        
            $_SESSION['nick']        =    $result['nick'];
                        
            $_SESSION['id']            =    $result['id'];
                        if(isset(
            $_SERVER['HTTP_X_FORWARDED_FOR']))
                            
            $_SESSION['ip']            =    $_SERVER['HTTP_X_FORWARDED_FOR'];
                        else
                            
            $_SESSION['ip']            =    $_SERVER['REMOTE_ADDR'];
                        
            $updateIP    =    mysql_query("UPDATE    users    SET    ip    =    '{$_SESSION['ip']}'    WHERE id    =    '{$_SESSION['id']}'");
                        if(empty(
            $_SESSION['nick']))
                            
            header('Location:profile.php');
                        else
                            
            header('Location:index.php');
                        }
                    }
                require    
            'inc/foot.inc';
            ?>
            And here is index.php

            PHP Code:
            <?php
                
            require    'inc/head.inc';
                require    
            'inc/header.inc';    

                if(isset(
            $_SESSION['errors']))
                    if(
            is_array($_SESSION['errors']))
                    {
                        foreach(
            $_SESSION['errors'] as $error)
                        print    
            '<div class=dl2>'.$error.'</div>';
                        unset(
            $_SESSION['errors']);
                    }
                    else
                    {
                        print    
            '<div class=dl2>'.$_SESSION['errors'].'</div>';
                        unset(
            $_SESSION['errors']);
                    }
                    if(isset(
            $_SESSION['nick']))
                        {
                            print    
            '<form action="insert.php" method=post>
                                        <div class=dl>Chat | <a href="">Check messages</a></div>
                                        <input type=text size=text name=msg maxlength=200>
                                        <input class=button type=submit value=Send>
                                    </form>'
            ;
                        }
                    else
                        if(isset(
            $_SESSION['id']) && !isset($_SESSION['nick']))
                        print    
            '<div class=dl><a href=more.php>Update</a> your nick to chat</div>';
                        
                        
            $sql    =    "SELECT * FROM chatroom ORDER BY date DESC LIMIT 0, 25";
                        
            $query    =    mysql_query($sql$con);
                        if((
            mysql_num_rows($query)) < 1)
                        if(!isset(
            $_SESSION['id']))
                            print    
            'something';
                        else
                            print    
            'something else';
                        
            $style    =    0;
                        while(
            $result    =    mysql_fetch_array($query))
                        {
                            require    
            'inc/emos.inc';
                            if(
            is_int($style/2))
                                print 
            '<div class=conv><a href=user.php?nick='.$result['nick'].'>'.$result['nick'].'</a> : '.$chatmsg.'</div>';
                            else
                                print 
            '<div class=conv1><a href=user.php?nick='.$result['nick'].'>'.$result['nick'].'</a> : '.$chatmsg.'</div>';
                            
            $style++;
                        }
                        
                    
            $msql    =    "SELECT * FROM users ORDER BY signup_date DESC LIMIT 0,1";
                    if(
            $mquery    =    mysql_query($msql))
                        while(
            $mrows    =    mysql_fetch_array($mquery))
                            {
                                print    
            '<div class=dl>Newest member : <a href=user.php?nick='.$mrows['nick'].'>'.$mrows['nick'].'</a></div>';
                            }
                        
                    require    
            'inc/foot.inc';
            ?>
            libra.wen.ru

            Comment


              #7
              i have notice when i builded my site using session it didn't like me using session id but using session username works on all type of browsers but netfront that not my problem thou as its do with there cache
              Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
              Visit: WapMasterz Coming Back Soon!
              _______
              SCRIPTS FOR SALE BY SUBZERO
              Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
              FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
              _______
              Info & Tips
              php.net
              w3schools.com

              Comment


                #8
                For a quick fix try this:

                PHP Code:
                <?php
                    
                require    'inc/head.inc';

                    if(isset(
                $_SESSION['id']))
                            
                header('Location:index.php'); exit(); // <- exit here
                    
                if(!isset($_POST['loginName']))
                    {    

                        require    
                'inc/header.inc';

                        if(isset(
                $_SESSION['errors']))
                        {
                            if(
                is_array($_SESSION['errors']))
                            {
                                foreach(
                $_SESSION['errors'] as $error)
                                    print    
                $error.'<br/>';
                                    break; 
                // <- stop loop
                            
                }
                            else
                                print    
                $_SESSION['errors'];
                        }
                                        
                $forms->login();
                            unset(
                $_SESSION['errors']);
                    }

                    else
                        {
                            
                $_SESSION['loginName']    =    mysql_real_escape_string(htmlentities(stripslashes($_POST['loginName'])));
                            
                $pass        =    mysql_real_escape_string(trim(htmlentities(stripslashes(md5($_POST['pass']))));
                            
                $errors    =    array();
                            if(empty(
                $_SESSION['loginName']))
                                
                $errors    =    'Login name can not be empty';
                            if(empty(
                $pass))
                                
                $errors    =    'Password is required';
                                
                            
                $sql    =    "SELECT password FROM users WHERE loginName    =    '{$_SESSION['loginName']}' AND password    =    '{$pass}'";
                                
                $query    =    mysql_query($sql$con);
                                
                        if(
                mysql_num_rows($query) != 1// was: if((mysql_num_rows($query)) != 1)
                            
                $errors    =    'Your details do not match';
                                    
                        if(
                count($errors))
                            {
                                unset(
                $_SESSION['loginName']);// was: unset($_POST['loginName']);
                                
                $_SESSION['errors']    =    $errors;
                                
                header('Location:login.php');
                            }
                    else
                            {
                            
                session_regenerate_id();
                            
                $sql    =    "SELECT * FROM users WHERE loginName    =    '{$_SESSION['loginName']}'";
                            
                $query2    =    mysql_query($sql$con);
                            
                $result    =    mysql_fetch_array($query2);
                            
                $_SESSION['nick']        =    $result['nick'];
                            
                $_SESSION['id']            =    $result['id'];
                            if(isset(
                $_SERVER['HTTP_X_FORWARDED_FOR']))
                                
                $_SESSION['ip']            =    $_SERVER['HTTP_X_FORWARDED_FOR'];
                            else
                                
                $_SESSION['ip']            =    $_SERVER['REMOTE_ADDR'];
                          @
                mysql_query("UPDATE    users    SET    ip    =    '{$_SESSION['ip']}'    WHERE id    =    '{$_SESSION['id']}'");
                // was: $updateIP    =    mysql_query("UPDATE    users    SET    ip    =    '{$_SESSION['ip']}'    WHERE id    =    '{$_SESSION['id']}'");
                            
                if(empty($_SESSION['nick']))
                                
                header('Location:profile.php');
                            else
                                
                header('Location:index.php');
                            }
                        }
                    require    
                'inc/foot.inc';
                ?>
                If not, u will have to recode whole login and error handling. Its not good to cut corners in this part by skipping {}, unchecked globals, creating errors array and counting it if there is no error...
                Last edited by arnage; 18.09.11, 12:01.
                <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

                Comment

                Working...
                X