Litle problem with do statement !
Moderator: General Moderators
Litle problem with do statement !
Hey how can you make a do statement when something is even or the samen. for example, to be more clear.
if $Name = $Username & $Password = Pass {
then do (GO TO URL)
} else {
echo ("Enter wrong password/username");
}
THX
if $Name = $Username & $Password = Pass {
then do (GO TO URL)
} else {
echo ("Enter wrong password/username");
}
THX
try this...
Try also to make your variable names more meaningful or else your gonna be scratching your head as to what is what
Code: Select all
<?php
if ($Name = $Username && $Password = $Pass) {
//CODE
} else {
echo ("Enter wrong password/username");
}
?>I have now this, the recodset are from out of the database what the users are posting has to match with on of the record in the table. If not then erro login or what ever.
<?php
$Password = $_POST['Password'];
$Username = $_POST['Username'];
If($Login) {
$Password = $row_recordset1['Password'] & $Username = $row_recordset1['Username'];
echo ("Login gegevens zijn corect <META HTTP-EQUIV=\"refresh\" content=\"4;URL=product-list.php\">\n");
} else {
echo ("Login gegevens zijn niet corect <META HTTP-EQUIV=\"refresh\" content=\"5;URL=login.php\">\n");
?>
<?php
$Password = $_POST['Password'];
$Username = $_POST['Username'];
If($Login) {
$Password = $row_recordset1['Password'] & $Username = $row_recordset1['Username'];
echo ("Login gegevens zijn corect <META HTTP-EQUIV=\"refresh\" content=\"4;URL=product-list.php\">\n");
} else {
echo ("Login gegevens zijn niet corect <META HTTP-EQUIV=\"refresh\" content=\"5;URL=login.php\">\n");
?>
you need && for your and statement not &, and = should be ==...
your logic statement is in the wrong place too....
it doesnt do anything much where it is... it should be either an argument for your if or it should be outside it....
ie...
or
hope this helps
your logic statement is in the wrong place too....
it doesnt do anything much where it is... it should be either an argument for your if or it should be outside it....
ie...
Code: Select all
<?php
$Password = $_POSTї'Password'];
$Username = $_POSTї'Username'];
If(($Password == $row_recordset1ї'Password']) && ($Username == $row_recordset1ї'Username'])) {
echo ("Login gegevens zijn corect <META HTTP-EQUIV="refresh" content="4;URL=product-list.php">\n");
} else {
echo ("Login gegevens zijn niet corect <META HTTP-EQUIV="refresh" content="5;URL=login.php">\n");
?>Code: Select all
<?php
$Password = $_POSTї'Password'];
$Username = $_POSTї'Username'];
$login = (($Password == $row_recordset1ї'Password']) && ($Username == $row_recordset1ї'Username']));
If($Login) {
echo ("Login gegevens zijn corect <META HTTP-EQUIV="refresh" content="4;URL=product-list.php">\n");
} else {
echo ("Login gegevens zijn niet corect <META HTTP-EQUIV="refresh" content="5;URL=login.php">\n");
?>
Last edited by Coco on Mon Sep 09, 2002 3:30 am, edited 1 time in total.
im not sure.... but why you dont try this:
Code: Select all
<?php
$Password = $_POSTї'Password'];
$Username = $_POSTї'Username'];
If($Password == $row_recordset1ї'Password'] &&$Username == $row_recordset1ї'Username']) {
echo ("Login gegevens zijn corect <META HTTP-EQUIV="refresh" content="4;URL=product-list.php">\n");
} else {
echo ("Login gegevens zijn niet corect <META HTTP-EQUIV="refresh" content="5;URL=login.php">\n");
}
?>The script isn't giving eny erro enymore, but it is still not good, because it is send al the time back login incorect but the username and password was fild in corect? What the hell is wrong with this script?
can somebody tel me please getting nuts over here.
<?php require_once('../Connections/Verbinding.php'); ?>
<?php
mysql_select_db($database_Verbinding, $Verbinding);
$query_Recordset1 = "SELECT * FROM user";
$Recordset1 = mysql_query($query_Recordset1, $Verbinding) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$Password = $_POST['Password'];
$Username = $_POST['Username'];
If($Password == $row_recordset1['Password'] && $Username == $row_recordset1['Username']) {
echo ("Login gegevens zijn corect <META HTTP-EQUIV=\"refresh\" content=\"4;URL=product-list.php\">\n");
} else {
echo ("Login gegevens zijn niet corect <META HTTP-EQUIV=\"refresh\" content=\"5;URL=login.php\">\n");
}
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
can somebody tel me please getting nuts over here.
<?php require_once('../Connections/Verbinding.php'); ?>
<?php
mysql_select_db($database_Verbinding, $Verbinding);
$query_Recordset1 = "SELECT * FROM user";
$Recordset1 = mysql_query($query_Recordset1, $Verbinding) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$Password = $_POST['Password'];
$Username = $_POST['Username'];
If($Password == $row_recordset1['Password'] && $Username == $row_recordset1['Username']) {
echo ("Login gegevens zijn corect <META HTTP-EQUIV=\"refresh\" content=\"4;URL=product-list.php\">\n");
} else {
echo ("Login gegevens zijn niet corect <META HTTP-EQUIV=\"refresh\" content=\"5;URL=login.php\">\n");
}
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
?? Type it correct!Skywalker wrote:The script isn't giving eny erro enymore, but it is still not good, because it is send al the time back login incorect but the username and password was fild in corect? What the hell is wrong with this script?
can somebody tel me please getting nuts over here.
By the way there is a major security issue here, if you don't type in your password and username it will say "Login Success"
Php Manual wrote:Variables in PHP are represented by a dollar sign followed by the name of the variable. The variable name is case-sensitive.
Skywalker wrote:
<?php
mysql_select_db($database_Verbinding, $Verbinding);
$query_Recordset1 = "SELECT * FROM user";
$Recordset1 = mysql_query($query_Recordset1, $Verbinding) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$Password = $_POST['Password'];
$Username = $_POST['Username'];
If($Password == $row_recordset1['Password'] && $Username == $row_recordset1['Username']) {
echo ("Login gegevens zijn corect <META HTTP-EQUIV="refresh" content="4;URL=product-list.php">\n");
} else {
echo ("Login gegevens zijn niet corect <META HTTP-EQUIV="refresh" content="5;URL=login.php">\n");
}
?>
get the impression im used to staring at code looking for bad syntax?