Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

This is my registration php page..!

when i get registered on localhost it works fine and redirect me to feedsomeinfo.php

but in server

it is redirecting me on login_attempt.php

any clue why it is happening?

 <?php

    // Report runtime errors
    error_reporting(E_ERROR | E_WARNING | E_PARSE);

    // Report all errors
    error_reporting(E_ALL);

    // Same as error_reporting(E_ALL);
    ini_set("error_reporting", E_ALL);

    // Report all errors except E_NOTICE
    error_reporting(E_ALL & ~E_NOTICE);

    session_start();
    include("config.php");
    function clean($str) {
    $str = @trim($str);
    if(get_magic_quotes_gpc()) {
    $str = stripslashes($str);
    }
            return mysql_real_escape_string($str);
        }
    $user=$_SESSION['SESS_MEMBER_ID'];
    $invitecount=5;
    $fname=ucfirst(clean($_POST['fname']));
    $lname=ucfirst(clean($_POST['lname']));

    $usern=clean($_POST['usern']);
    $emailadd=clean($_POST['emailadd']);
    $password=mysql_real_escape_string($_POST['password']);
     $password= sha1($password); 


    $num='1';
    mysql_query("INSERT INTO members(fname, lname, invitecount, usern, email, password,  profilepic, coverphoto,number)
    VALUES('$fname', '$lname', '$invitecount', '$usern', '$emailadd', '$password', 'profilepic/friends.png', 'coverphotos/cover.png', '$num')");



         //Create query
        $result=mysql_query("SELECT * FROM members WHERE email = '$emailadd' AND password = '$password'");

            if(mysql_num_rows($result) > 0) {
                //Login Successful
                session_regenerate_id();
                $member = mysql_fetch_assoc($result);
                $_SESSION['SESS_MEMBER_ID'] = $member['id'];
                $_SESSION['SESS_FIRST_NAME'] = $member['fname'];
                $id=$member['id'];
                $name=$member['fname'];
                $number=$member['number'];
                $expires = 1 * 1000 * 60 * 60 * 24;
              setcookie("email", $emailadd, time()+$expires);
        setcookie("password", $password, time()+$expires);
                mysql_query("insert into logged(logid,logdin) VALUES('$id', '$name') ");
                if($number=='1')
                { header("location: feedsomeinfo.php");

                }
                else
                { header("location: timewall.php");

                }

            }
            else{
                header("location: login_attempt.php");
                exit();
            }



    mysql_close($bd);
    ?>
share|improve this question
    
Is there a difference between the versions of PHP on your localhost and the server? And did you change your config so the script uses the correct database? –  Marc 28 mins ago
    
$passwordx that's undefined as is $a. Plus, storing passwords in cookies is not a very good idea. Plus, mysql_close($bd); which API are you using to connect with? –  Fred -ii- 27 mins ago
    
@Fred-ii- removed setcookie("password", $passwordx, time()+$expires); but same problem :( –  Riya 23 mins ago
    
Reload my comment above; there were a few edits made to it. –  Fred -ii- 22 mins ago
    
Check the db info in your config.php file, is the credentials on the live server valid? Is your database created on live server? And are the tables created on the live server? –  mike O. 20 mins ago

1 Answer 1

In your case I would check:

  • if the database connection is working
  • if the database rows are this same
  • add or die(mysql_error()); to yours queries and check if there are some errors
  • install extension to your browser firebug and check consol log while you submit your register form. Look for POST data and your response.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.