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.
Warning: Cannot modify header information - headers already sent by (output sta
Warning: Cannot modify header information - headers already sent by (output started at /home/praylife/public_html/index.php:29) in /home/praylife/public_html/index.php on line 188Warning: Cannot
Unable to display contents in Second Drop Down Box
Hi All, What I am trying to do is 2 dependent drop down boxes and when user selects submit button the values are to be passed to the database to run a insert query. Right now, I am stuck
image upload, resize THEN submit form
Ok so I have a form that requires the user to upload an image, and then do something with that image (using some ajax scripts), then fill out the rest of the form and submit. I have the upload script
Email/MMS to Site
Hey guys. I'm looking for a way for a user to upload images and/or text via their cell phones. It could be MMS but since most phones have email these days, maybe just a way to process email. I've
How many users online in the last 24-hours using time()?
I'm fairly new to PHP. I have a MySQL table called 'users' and a field called 'loggedin' which is in time() format.I need a query that'll check how many players have logged in within the last
use an array from 1 class in a second class
I have a class that adds data to an arrayThen I have a second class and I need to check if the data it returns is in the array created in the first class.But I get undefined variable: Array
Can I use a loop
Hi buddies!
Typing math
I've added support for typesetting math using LaTeX on the forums.Example:Code: [Select][tex]\sum_{n = 0}^\infty \frac{1}{n!} = \lim_{n\to\infty} \left(1+\frac{1}{n}\right)^n = e[/tex]Outputs:Just in
Transform value 0 in no and 1 in yes help needed
Hello,I have this in the table: "value" type int 0 to represent false and 1 to represent true. everything works great in display to the user end it sees 0 or 1 i want to replace the 0 to
The page should be expire when cilck back button
hi,i'm new to php world.i create user registration page.when i submit it,data goes to mysql.but when i click back button of browser it shows previous page.i need a code that perform session expirewhen