Users having problems with my Registration and Login page

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

    Users having problems with my Registration and Login page

    idk whats the prob some mobile users are unable to login after registering or login at all...cant seem to see whats the prob heres my codes

    <!-- REGISTRATION PAGE -->
    PHP Code:
    <?php
    session_name
    ("PHPSESSID");
    session_start();

    include(
    "includes/config.php");
    include(
    "includes/function.php");
    $ses $_SESSION['ses'];
    $uid getuid_sid($ses);

    //MATH CAPTCHA
    $cap=rand(149);
    $cap1=rand(149);

    $ans $cap $cap1;

    if(isset(
    $_POST['submit']))
    {
    //SECURING FROM MYSQL INJECTIONS

    $username mysql_real_escape_string($_POST['username']);
    $password trim(mysql_real_escape_string($_POST['password']));
    $email mysql_real_escape_string($_POST['email']);
    $numb md5(mysql_real_escape_string($_POST['numb']));
    $answer mysql_real_escape_string($_POST['numans']);
    $gender mysql_real_escape_string($_POST['gender']);
    $cnt mysql_real_escape_string($_POST['country']);
    $day $_POST["day"];
    $month $_POST["month"];
    $year $_POST["year"];
    $age "$year-$month-$day";
    if(
    $numb!=$answer)
    {
    $error '<div class="error"><strong>ERROR:</strong> Calculation is Incorrect!</div>';

    }
    else
    {
    if(empty(
    $numb))
    {
    $error '<div class="error"><strong>ERROR:</strong> Numbers field is empty!</div>';
    }
    else
    {
    $taken mysql_fetch_array(mysql_query("SELECT * FROM users WHERE name='{$username}'"));
    if(
    $taken>0)
    {
    $error '<div class="error"><strong>ERROR:</strong> <strong>not</strong> added correctly!</div>';
    }
    else
    {
    if(empty(
    $username))
    {
    $error '<div class="error"><strong>ERROR:</strong> Please provide a preferred User name!</div>';
    }
    if(empty(
    $cnt))
    {
    $error '<div class="error"><strong>ERROR:</strong> Please enter where you are from</div>';
    }
    else
    {
    if(
    strlen($username)<3)
    {
    $error '<div class="error"><strong>ERROR:</strong> User name is too short should be 4 - 20 characters!</div>';
    }
    else
    {
    if(
    strlen($password)<5)
    {
    $error '<div class="error"><strong>ERROR:</strong> Password is too short should be 6 - 25 characters!</div>';
    }
    else
    {
    if(empty(
    $password))
    {
    $error '<div class="error"><strong>ERROR:</strong> Please provide a preferred password</div>';
    }
    else
    {
    if(!
    preg_match("/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[@][A-z0-9_]+([.][A-z0-9_]+)*[.][A-z]{2,4}$/"$email))
    {
    $error '<div class="error"><strong>ERROR:</strong> Please provide a valid email address</div>';
    }
    else
    {
    $ip=$_SERVER['REMOTE_ADDR'];
    $user_agent=$_SERVER['HTTP_USER_AGENT'];
    $encpass md5($password);
    $insert mysql_query("INSERT INTO users SET name='{$username}', password='{$encpass}', email='{$email}', date='".time()."', ip='{$ip}', browser='{$user_agent}', lastvisit='".time()."', lastactive='".time()."', gender='{$gender}', location='".$cnt."', age='".mysql_real_escape_string($age)."', day='".mysql_real_escape_string($day)."', month='".mysql_real_escape_string($month)."', year='".$year."'");

    if(
    $insert)
    {
    //IF USER IS REGISTERED SUCCESSFULL THEY RECEIVES A WELCOME MESSAGE

    $memid mysql_fetch_array(mysql_query("SELECT id, name FROM users ORDER BY date DESC LIMIT 0,1"));
    $autopm ":welcome:, Thanks for joining WEBSITE, the best place to make new friends and play games on your phone. Here are some tips for getting started: [br/][br/] 1. [a=/upload_photo/?user_id=$memid[0]]Add a Photo[/a]. Members with a photo make more friends faster. [br/][br/] 2. Bookmark WEBSITE, and write down your user name & password. To retrieve your password later if you forget it, you must enter your email in your[br/] [a=/profile-edit/?action=settings]Account Settings![/a]";
    $admn "2";
    mysql_query("INSERT INTO messages SET text='".mysql_real_escape_string($autopm)."', byuid='".mysql_real_escape_string($admn)."', touid='".mysql_real_escape_string($memid[0])."', unread='1', timesent='".time()."'"); 

    //UPDATE RECENT UPDATES
    $msg 'has just registered!';
    mysql_query("INSERT INTO feeds SET uid='".mysql_real_escape_string($memid[0])."', did='".$msg."'");
    mail($email"WEBSITE REGISTRATION COMPLETED""THANK YOU FOR REGISTERING AT WEBSITE FORUM YOUR USERNAME IS: ".$username." AND YOUR PASSWORD IS: ".$password."""From: support@WEBITE" );

    //USERS LOGGED IN AND REDIRECTED STRAIGHT TO MAIN PAGE AFTER REGISTRATION
    $tm time();
    $xtm $tm + (sesext()*60);
    $did $username.$tm;
    $login mysql_query("INSERT INTO session SET id='".md5($did)."', uid='".getuid_nick($username)."', expiretm='".$xtm."'");
    if(
    $login)
    {
            
    $tologin=true;
            
    $idn getuid_nick($username);
            
                
    $lact mysql_fetch_array(mysql_query("SELECT lastactive, lastvisit FROM users WHERE id='".mysql_real_escape_string($idn)."'")); 
                 
    mysql_query("UPDATE users SET lastvisit='".mysql_real_escape_string($lact[0])."', ip='{$ip}', browser='{$user_agent}' WHERE id='".mysql_real_escape_string($idn)."'"); 
            }
            else
            {
            
    $loggedin mysql_fetch_array(mysql_query("SELECT (*) FROM session WHERE uid='".getuid_nick($username)."'"));
            if(
    $loggedin[0]>0)
            {
             
    $xtm time() + (sesext()*60);
             
    $res mysql_query("UPDATE session SET expiretm='".$xtm."' WHERE uid='".getuid_nick($username)."'");
             if(
    $res)
              {
              
    $tologin=true;
              }
              else
              {
              }
              
            }
            
          }
         
        }
      }
      
      if(
    $tologin)

    $_SESSION['ses'] = md5($did);

    $logid getuid_nick($username);
    $ses $_SESSION['ses'];

    header("location: /home/?action=main");

    //echo 'Registration Completed!<br/>';
    //echo '<a href="/login">Click here - [login]</a>
    echo '<div class="footer">
    WEBSITE &copy; 2012
    </div>'
    ;

    exit;
    }
    else
    {
    $error '<strong>ERROR:</strong> <span style="color: red">Something went wrong</span>';
    }
    }
    }
    }
    }
    }
    }
    }
    }


    ?>

    <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

    <head>
        
        <title>Register</title>
        <meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml; charset=utf-8"/>
        <meta http-equiv="Cache-Control" content="no-cache"/>
        <link rel="stylesheet" type="text/css" href="css/default.css"/>

    </head>

    <body>
    <div class="header">
    <b>WEBSITE</b> - <small>TAG LINE</small>
    </div>
    <? echo $error; ?>
    <form action="register.php" method="post">
    <div style="margin-left: 3px;">
    Username: <br/><input type="text" name="username" value="<?if($username){echo $username; }?>" maxlenght="20"/><br/>
    Password: <br/><input type="text" name="password" value="<?if($password){echo $password; }?>" maxlenght="25"/><br/>
    Email: <br/><input type="text" name="email" value="<? if($email){echo $email; } ?>" maxlength="20"/><br/>
    Gender: <br/> 
    <select name="gender"> 
    <option value="Male">Male</option> 
    <option value="Female">Female</option>
    </select>
    <?
    echo '<br/><b>Date of Birth</b><br/>';
    echo dateOfBirth($day,$month,$year);  
    ?>
    Country: <br/><input type="text" name="country" value="<? if($cnt[0]) {echo $cnt;} ?>" maxlength="100"/><br/>
    <br/>
    <? echo ''.$cap.' + '.$cap1.' = '; ?>
    <input type="text" size="6" value="" name="numb" inputmode="user" /><br/>
    <? echo '<input type="hidden" value="'.md5($ans).'" name="numans" inputmode="user" />'; ?>
    <input type="submit" name="submit" class="submitter" value="Create Account"/>
    </div>
    </form>
    <a style="margin-left: 4px" href="index.php">Home</a>

    <div class="footer">
    website &copy; 2012
    </div>

    </body>
    </html>
    <!-- LOGIN PAGE -->

    PHP Code:
    <?php
    session_name
    ("PHPSESSID");
    session_start();
      
    include(
    "includes/config.php");
    include(
    "includes/function.php");

    $ip=$_SERVER['REMOTE_ADDR'];
    $user_agent=$_SERVER['HTTP_USER_AGENT'];

    $email $_POST["e"];
    $password trim($_POST["p"]);

    $email addslashes($email);
    $password addslashes($password);
    $email mysql_real_escape_string($email);
    $password mysql_real_escape_string($password);

    $tologin false;
    if(isset(
    $_POST['submit']))
    {

    $uinf mysql_fetch_array(mysql_query("SELECT * FROM users WHERE email='{$email}'"));
    if(
    $uinf[0]==0)
    {
    $error '<div class="error"><strong>ERROR:</strong> Email address is Incorrect &rsaquo; <a href="/register">[Register]</a></div>';
    }
    else
    {
    $enpwd md5($password);
    $uinf mysql_fetch_array(mysql_query("SELECT * FROM users WHERE email='{$email}' AND password='{$enpwd}'"));
    if(
    $uinf[0]==0)
    {
    $error '<div class="error"><strong>ERROR:</strong> Password is Incorrect</span> <a href="/forgot/">[?]</a></div>';
    }
    else
    {
    $username mysql_fetch_array(mysql_query("SELECT name FROM users WHERE email='{$email}'"));
    $tm time();
    $xtm $tm + (sesext()*60);
    $did $username[0].$tm;
    $login mysql_query("INSERT INTO session SET id='".md5($did)."', uid='".getuid_nick($username[0])."', expiretm='".$xtm."'");
    if(
    $login)
    {
            
    $tologin=true;
            
    $idn getuid_nick($username[0]);
            
                
    $lact mysql_fetch_array(mysql_query("SELECT lastactive, lastvisit FROM users WHERE id='".mysql_real_escape_string($idn)."'")); 
                 
    mysql_query("UPDATE users SET lastvisit='".mysql_real_escape_string($lact[0])."', ip='{$ip}', browser='{$user_agent}' WHERE id='".mysql_real_escape_string($idn)."'"); 
            }
            else
            {
            
    $loggedin mysql_fetch_array(mysql_query("SELECT (*) FROM session WHERE uid='".getuid_nick($username[0])."'"));
            if(
    $loggedin[0]>0)
            {
             
    $xtm time() + (sesext()*60);
             
    $res mysql_query("UPDATE session SET expiretm='".$xtm."' WHERE uid='".getuid_nick($username[0])."'");
             if(
    $res)
              {
              
    $tologin=true;
              }
              else
              {
              }
              
            }
            
          }
         
        }
      }
      
      if(
    $tologin)

    $_SESSION['ses'] = md5($did);
     
    header("location: /home/?action=main");
    exit();

    }
    ?>

    <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
    <title>Login</title>
    <meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml; charset=utf-8"/>
    <meta http-equiv="Cache-Control" content="no-cache"/>
    <link rel="stylesheet" type="text/css" href="/css/default.css"/>
    </head>

    <body>
    <div class="header">Login</div>
    <? echo $error;?>
    <form action="/login/" method="post">
    <div style="margin-left: 3px">
    Email: <br/><input type="text" name="e" value="<?if($email){echo $email; }?>"/><br/>
    Password: <br/><input type="text" name="p" value="<?if($password){echo $password; }?>"/><br/>

    <input type="submit" name="submit" class="submitter" value="Log In"/> - <a href="/forgot/">Forget your password</a>
    </div>
    </form>
    <div style="margin-left: 3px; border-top: 1px solid #e7e7e7;">
    <a href="../">Home</a>
    </div>

    <div class="footer">
    website &copy; 2012
    </div>

    </body>
    </html>

    #2
    Ask them to enable cookies in their browsers or add the constant SID along with yours urls

    for example
    PHP Code:
    header("location: /home/?action=main" SID); 
    I need some facebook likes, can you please help me
    http://facebook.com/softwarefreakin
    I noticed social media is really powerful
    Well DONE is better than well SAID

    Comment


      #3
      yeah looks like cookie issue

      Comment


        #4
        so if i add the SID constant will that work cuz am using md5 hashed session and hiding the session id with $_SESSION

        Added after 3 minutes:

        well i add the SID constant i login it with no prob as usual but idk if it works for them
        Last edited by Pablo; 14.11.12, 06:20.

        Comment


          #5
          but idk if it works for them
          Disable your cookies from the browser settings & check!
          I need some facebook likes, can you please help me
          http://facebook.com/softwarefreakin
          I noticed social media is really powerful
          Well DONE is better than well SAID

          Comment


            #6
            Originally posted by softwarefreak View Post
            Disable your cookies from the browser settings & check!
            i did an it works it shows the PHPSESSID thou...

            Comment

            Working...
            X