i am using this script for register login on my website but its not working properly its not posting any of the echo's after the script is run
can anione help me plz
Code:<?php
session_start();
// Check if he wants to login:
if (!empty($_POST[username]))
{
require_once("connect.php");
// Check if he has the right info.
$query = mysql_query("SELECT * FROM members
WHERE username = '$_POST[username]'
AND password = '$_POST[password]'")
or die ("Error - Couldn't login user.");
$row = mysql_fetch_array($query)
or die ("Error - Couldn't login user.");
if (!empty($row[username])) // he got it.
{
$_SESSION[username] = $row[username];
echo "Welcome $_POST[username]! You've been successfully logged in.";
exit();
}
else // bad info.
{
echo "Error - Couldn't login user.<br /><br />
Please try again.";
exit();
}
}
?>
Last edited by Orjan; 02-13-2010 at 05:28 AM. Reason: Please use code tags when posting code
Are you talking about the actual "Welcome $_POST[username]" echo? or anything after that?Code:<?php
session_start();
// Check if he wants to login:
if (!empty($_POST[username]))
{
require_once("connect.php");
// Check if he has the right info.
$query = mysql_query("SELECT * FROM members
WHERE username = '$_POST[username]'
AND password = '$_POST[password]'")
or die ("Error - Couldn't login user.");
$row = mysql_fetch_array($query)
or die ("Error - Couldn't login user.");
if (!empty($row[username])) // he got it.
{
$_SESSION[username] = $row[username];
echo "Welcome $_POST[username]! You've been successfully logged in.";
exit();
}
else // bad info.
{
echo "Error - Couldn't login user.<br /><br />
Please try again.";
exit();
}
}
?>
hi yeah the welcome or the bad login
and if you can show me how to do the 5 sec redirect id realy apreciate it
Gotcha, for the refresh, try
And that should be your 5 second refresh..Code:<meta http-equiv=refresh content=5; URL=YOURURLHERE>
and for the issue..
take out the exit(); and then anything after those should work.. so if you are posting any extra text after that, it will actually load. The "exit();" completely drops the page, so unless you do an include you aren't going to have anything after it.. Make it look like:Code:<?php
session_start();
// Check if he wants to login:
if (!empty($_POST[username]))
{
require_once("connect.php");
// Check if he has the right info.
$query = mysql_query("SELECT * FROM members
WHERE username = '$_POST[username]'
AND password = '$_POST[password]'")
or die ("Error - Couldn't login user.");
$row = mysql_fetch_array($query)
or die ("Error - Couldn't login user.");
if (!empty($row[username])) // he got it.
{
$_SESSION[username] = $row[username];
echo "Welcome $_POST[username]! You've been successfully logged in.";
exit();
}
else // bad info.
{
echo "Error - Couldn't login user.<br /><br />
Please try again.";
exit();
}
}
?>
Hopefully that resolves the issue, and if not, try explaining it to me a little differentlyCode:<?php
session_start();
// Check if he wants to login:
if (!empty($_POST[username]))
{
require_once("connect.php");
// Check if he has the right info.
$query = mysql_query("SELECT * FROM members
WHERE username = '$_POST[username]'
AND password = '$_POST[password]'")
or die ("Error - Couldn't login user.");
$row = mysql_fetch_array($query)
or die ("Error - Couldn't login user.");
if (!empty($row[username])) // he got it.
{
$_SESSION[username] = $row[username];
echo "Welcome $_POST[username]! You've been successfully logged in.";
}
else // bad info.
{
echo "Error - Couldn't login user.<br /><br />
Please try again.";
}
}
?>
Oh.. and do you have this posted on the internet?
thanx it still not working
and no it isnt posted yet im building a cheat website il post the address when i open it
yur welcome to help with some scripts if you want
Dammit,
I will research this when I get on my laptop. It is impossible to work through unless I have access to a server. Haha![]()
000webhost.com
ha ha ha free hosting try it
that just the hosting im using
my website is cheatsrus.info
hey all i changed that script with a more complicated and secure script but now im getting a bunch of warnings when the registration is complete
can someone help ??
im new to php
Warning: Missing argument 3 for checkUnique(), called in /home/a3445793/public_html/registration.php on line 16 and defined in /home/a3445793/public_html/functions.php on line 17
this is my script on line 16 :
if($_POST['username']!='' && $_POST['password']!='' && $_POST['password']==$_POST['password_confirmed'] && $_POST['email']!='' && valid_email($_POST['email'])==TRUE && checkUnique('Username', $_POST['username'])==TRUE && checkUnique('Email', $_POST['email'])==TRUE)
and on line 17 :
function checkUnique($table, $field, $compared)
next warning :
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a3445793/public_html/functions.php on line 20
and the script :
if(mysql_num_rows($query)==0)
plz help
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks