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 */
$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

Multidimensional Array into an Html table, help!
Hello all, I am new to HTML/PHP so any help would be great.

I have a multidimensional array f

Mysql query, two times?
Hello to all,

I'm new to php coding and i like it alot. I need help with some noob stuff.

Displaying values from a SQL count...
Hi,
Easy enough question i just forget the exact method ..
I have ...

Code: //count win

Scene graph using Direct3D?
There are several C++ scene graph based packages available for OpenGl, like say OSG,

http://w

Array disappearing in foreach loop
Okay, I have this problem where an array will become undefined in a foreach loop.

Here is the

tell csv import script to ignore blank rows?
Hi i have the below script but i get an error if a row is blank ie a return in the csv file at the e

multiple recipients + dbuser mail recall
Hello,

I am building a php login script.

When the user registers the script will send

Why doesn't this work? (SSH2)
This is my script:

Code: <?php
$connection = ssh2_connect('213.251.167.109', 22);

Please help - should be a simple fix.. driving me nuts
Everything seemed to be working fine. I have a table, it alphabetically lists a bunch of cities and

Need help to identify this error please
:confused:Can anyone help me tell what this error message means? Maybe tell me where to look to fix

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