Login Issue's


Posted on 16th Feb 2014 07:03 pm by admin

Code: <?php
$file = fopen('user.txt', 'r');

/* Set login to false initially */
Did you know?Explore Trending and Topic pages for more stories like this.
$login = false

/* Break out of loop if login becomes true OR EOF is encountered */
while(($login == false) && (!eof($file)))
{
$data = explode(":", fgets($file));

/* assume field 0 is username, field 1 is password */
if( ($data['0'] == $username) && ($data['1'] == $password)
{
/* login is true, so will break out of loop after this iteration */
$login = true;
}
}
if $login = true
{
echo 'hi there user';
} else {echo 'nope';}
fclose($file);

?>
<html>
<body>
<form action="login4.php" method="post">
<ul>
<li><label for="username">
USERNAME: </label><input type="text"
name="username" id="username"/></li>
<li><label for="password">
PASSWORD: </label><input type="password"
name="password" id="password"/></li>
</ul>
<input name="login" type="submit" value="Login"/
</form>
</body>
</html>
Parse error: syntax error, unexpected T_WHILE in C:xampplitehtdocslogin testslogin4.php on line 8

having trouble writing a login script that uses .txt files.
No comments posted yet

Your Answer:

Login to answer
313 Like 30 Dislike
Previous forums Next forums
Other forums

Help with PHP Calendar code...
Hello, I'm new to this forum and I'm glad I found it.
I wrote this code for a PHP calendar as an

mySQL and PHP search
Hello,
I am trying to code a project and ran into a brick wall with one of my pages. I am pretty

sendmail code suddenly not working
Hi Guys, I maintain 3 sites (including my own) I use the following code from a french webmaster that

file_put_contents and createimagefromjpeg
All,
I do somethings and then I have the following code:
file_put_contents('./test/'.$filename

need help about
i store the value of my select statement result to an array and stored it to a variable named $fname

Setting/Modify Headers using mail() function
I have a question about setting email headers when using mail() in a php script.

When I send

if php cookie set, show code...
Hi all.. I need to figure out this little snippet right quick.. seems like it should be easy enough

php - xml what is the best way to do this.
IN essence I want to have a script calling the info from the database.. I have no problem thus far,

parsing error
can anyone explain this syntax error:

Parse error: syntax error, unexpected T_IF

The e

Loops and Classes
I am making a template system and everything seems to be going well up until I have to loop in a var

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash