Jump to content

Making a community script and i found an error i can`t soulve


sanmagician

Recommended Posts

The php code won`t redirect to user/member.php need some help ;)

 

<?php
session_start();
include 'includes/database.php';

if(isset($_POST['login']))
{

$username = trim(addslashes($_POST['username']));
$password = md5(trim($_POST['password']));

$query = mysql_query("SELECT * FROM Users WHERE Username = '$username' AND Password = '$password' LIMIT 1") or
die(mysql_error());

$row = mysql_fetch_array($query);

if(mysql_num_rows($query) > 0)
{

if($row['Activated'] > 0)
{

$_SESSION['s_logged_n'] = 'true';
$_SESSION['s_username'] = $username;
$_SESSION['s_name'] = $row['Name'];

header("Location: user/member.php");


} else {

echo "You have to activate your account!";
}

}

}

else
{
echo "You have to fill out the login form!";
}

?>

do you get any errors? anything from the mysql_error() does the page re-direct to the wrong page or not at all?

 

Just a white page

 

stops here http://localhost/login_process.php <- white page

 

and no errors

 

does not redirect :S

so the white page is not the page with the code, or the page it is supposed to redirect to? is one of your links wrong?

 

i was writing this but you posted before if finished writing --->>

 

at the top of the page add

 

print_r($_Request)

 

then you will see if you are getting the $_POST['login']

I would over type the user name with valid text, the same for the password and just see if it branches in the correct direction

 

-->

so the white page is not the page with the code, or the page it is supposed to redirect to? is one of your links wrong?

 

i was writing this but you posted before if finished writing --->>

 

at the top of the page add

 

print_r($_Request)

 

then you will see if you are getting the $_POST['login']

I would over type the user name with valid text, the same for the password and just see if it branches in the correct direction

 

-->

 

 

But when i was thinking over it can i use a html redirect can u show me in the code?

not sure what you mean but this will redirect a page

 

<script language="javascript" type="text/javascript">

    window.location.href = "http://programming.top54u.com";

</script>

 

 

we should start at the beginning,

the page with the faulty code, have you typed that URL into the browser, are there any errors or nothing?

not sure what you mean but this will redirect a page

 

<script language="javascript" type="text/javascript">

    window.location.href = "http://programming.top54u.com";

</script>

 

 

we should start at the beginning,

the page with the faulty code, have you typed that URL into the browser, are there any errors or nothing?

 

Just getting sytax error in dw cs5

 

header("Location: user/member.php");

<- it shud redirect but does not

 

replace it with

 

header("location:http://www.google.com");

 

if it redirects to google, maybe you had spelling error, wrong page or folder or something

 

Will not redirect :S  maybe u want to see the login.php

 

<html>
<body>
<div>
<p>You must login to view this page. Enter your username and password below and hit submit:</p>
<form method="post" action="../login_process.php">
<p>Username:<br>
<input name="username" type="text" Cid="username">

<p>Password:<br>
<input name="password" type="password" id="password">
</p>
<p>
<input name="login" type="submit" id="login" value="Submit">
</p>
</form>
<p>Didn't get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p>
<p>Need an account? <a href="/register.php">Click here</a> to register, it's completely free! </p>
</div>

</div>

</body>
</html>

straign away i can see an error with

 

<input name="username" type="text" Cid="username">

 

What was the error if u can wriite the fix please :)

 

 

should be

 

<input name="username" type="text" id="username">

 

 

which is why at the top of the processing page you should write

 

<?php
print_r($_REQUEST);
?>

 

it will show you all of the reqest var's sent to the page

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.