Jump to content


Photo

help with simple php


  • Please log in to reply
5 replies to this topic

#1 perezf

perezf
  • Members
  • PipPipPip
  • Advanced Member
  • 301 posts
  • LocationFort Lauderdale

Posted 10 September 2006 - 12:22 PM

:-\
what is wrong with the following code
i am getting an  error

Parse error: parse error, unexpected T_BOOLEAN_AND in /hsphere/local/home/way2fr3s/2fr3sh.com/userlogin.php on line 15

<?php 
$username = "admin";
$password = "password";

$user = $_POST['user'];
$pass = $_POST['pass'];

if($user == $username) && if($pass == $password) {//line 15
echo "Welcome to our site $user.";
} else { ?>
<form name="form1" method="post" action="">
  <p>
    UserName:<br>
    <input type="text" name="user">
    <br>
  Password:<br>
  <input type="text" name="pass">
  <br>
  <input type="submit" name="Submit" value="Submit">
</p>
</form><?php } ?>


#2 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 10 September 2006 - 12:30 PM

try this

if ($user == $username && $pass == $password) {

Hope this helps,
Tom

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#3 ahmed17

ahmed17
  • Members
  • PipPipPip
  • Advanced Member
  • 59 posts

Posted 10 September 2006 - 12:54 PM

if($user == $username) && if($pass == $password)
using $$ for not tie two if statment by using for tie its contents

if ($user == $username && $pass == $password)

#4 perezf

perezf
  • Members
  • PipPipPip
  • Advanced Member
  • 301 posts
  • LocationFort Lauderdale

Posted 10 September 2006 - 01:05 PM

it works thank you to all

#5 perezf

perezf
  • Members
  • PipPipPip
  • Advanced Member
  • 301 posts
  • LocationFort Lauderdale

Posted 10 September 2006 - 01:06 PM

i could i read the username and password from a database

#6 perezf

perezf
  • Members
  • PipPipPip
  • Advanced Member
  • 301 posts
  • LocationFort Lauderdale

Posted 10 September 2006 - 01:12 PM

how could i i meant to say




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users