Register  |  Login




Advertisement

Start Your Own Q&A Site

Create your own Q&A site easily, allowing you to quickly grow a new community around any subject matter or generate new organic traffic for your existing website.

Question

Status: Open Points: 200 Time: 19:58 - Aug 26, 2008  

gloria_g

php, session variable not passed

Hi, Dude,

Here is my website:
http://cookword.com

Problem:

When the user login, ( login page: http://cookword.com/index.php, username: gloria, password: 123456789) user data is transfered to:
http://recipeyeh.com/users/users_login_c...
for validation. Upon success, the page is redirected to original page: http://cookword.com/index.php.

However, the username and other info variables are not passed to http://cookword.com/index.php.

Could you login to my website and have a look if something is wrong? I will you give you login info if you are willing to help. Thanks.

Sincerely,

Gloria

Answer Discussion
Tutorials

 

shashi.programmer

Date:: Aug 27, 2008

Time:: 01:56

<?
// this is for login verification page

session_start(); // start session here
include "connection.php"; // connection file include for database
$username=$_REQUEST['username']; // username pass from username textbox
$password=$_REQUEST['password']; //password pass from password textbox
$sql="select * from tablename where username='$username' and password='$password'"; // query from registration table where user data is available
$result=mysql_query($sql);
mysql_num_rows($result);
if(mysql_num_rows($result)>0)
{
 $row=mysql_fetch_array($result);
 $_SESSION['id']=$row['id'];
 echo "<script>location.href='success.php'</script>"; // redirect the browser after successful login
 
}
else
{
 echo "<script>location.href='login.php?Err=Incorrect Username or Password'</script>"; // redirect the browser after invliad login or password insert
}

// end of the login verification page





// start of the each and every page you have to put up following information

session_start(); // start the session
$id=$_SESSION['id']; // this will carry the particular user's id

?>

gloria_g

Date:: Aug 27, 2008

Time:: 13:43

Hi, Shashi,

Would you like to login into my web site server and have a look what is wrong. If yes, please send me an email or post your email address here, I will give you the username and password. Thanks,

My email: gloriabai@yahoo.com

Sincerely,

Gloria

manofcentury

Date:: Oct 24, 2009

Time:: 14:17

Dear Shashi,

Plz try to use following code after horizontal line,

if(mysql_num_rows($result)>0)
{
$row=mysql_fetch_array($result);
session_register("id"); // shashi u have to add this line to pass session value, how can u register without telling to it?

$_SESSION['id']=$row['id'];
header("location:success.php"); //if php already granted u "header" command why u use script?

}
else
{
echo "<script>location.href='login.php?Err=Incorrect Username or Password'</script>"; // redirect the browser after invliad login or password insert
}

admin

Date:: Nov 27, 2009

Time:: 09:15

The question looks to be abandoned by the user who asked it. If no action is taken within 2 days, a Quomon Moderator will consider closing the question and distributing the points.

The Quomon Team

Answer this Question

New User

Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:

Forgot Your Password?

Tutorials cannot be submitted until the Answer Discussion is complete.

Submit answers in the Answer Discussion area

Ask a Question

Have a new question? Ask!

You have 100 characters to use



Top Experts

View More

Rank

Expert

Points

1.

nidhi

10279

2.

oracleofDelphi

6493

3.

rcastagna

5596

4.

LAGM

4848

5.

PeterNZ

3487

6.

gonzalo

2840

7.

Mason

2770

8.

jgivoni

2303

9.

xarcus

1820

10.

Anpanman

917

Become an Expert

Register today to share your knowledge with the community and be recognized and rewarded for your contributions.


Register Here




"Psst, Quomon is a great site. Pass it on."     Tell a Friend  |   Link To Us  |   Save to Delicious  |   Digg! Digg it



Language Options

English:

www.quomon.com

Español:

www.quomon.es