Help...Am a complete newbie to programming so my code is prolly quite long. Am trying to verify a users details entered into a login form against details stored in an existing flat file.
No matter what I input, I get "not registered", even if it does match.
What have I done wrong? I have spent 3 LOOng afternoons trying to nut this out..now am going nuts....
<?php
if ($_POST['submit']=="submit")
{
$errormessage = "";
if (empty($_POST['userName']) ||empty($_POST['password']))
{
$errormessage = "<p>Please enter a user name and password</p>";
}
else
{
$userName=trim($_POST['userName']);
$password=trim($_POST['password']);
// check user name and password
$nameFlag=false;
$passwordFlag=false;
$fp = fopen($_SERVER['DOCUMENT_ROOT']."/toys/users.txt","r" );
while (!feof($fp))
{
$line=fgets($fp,100);
($userName== $line? $nameFlag=true : $nameFlag=false);
($password==$line? $passwordFlag=true : $passwordFlag=false);
}
fclose($fp);
if($nameFlag && $passwordFlag==true)
{
$foundFlag= true;
}
else
{
$foundFlag=false;
}
($foundFlag==true?$welcome= "Welcome ".$userName." you are now logged in":$sorry= "Sorry you are not registered");
}
}
?>
// my html form below
<form method="post" action="<?=$_SERVER['PHP_SELF']?>" >
<fieldset class="outline">
<h3>Registered customers</h3>
<label>User Name:</label>
<input type="text" class="login" value="" name="userName" id="userName" />
<label>Password:</label>
<input type="text" class="login" value="" name="password" id="password"/>
<br />
<br />
<input type="submit" value="submit" name="submit" id="submit"/>
<br />
<?=$errormessage?>
<br />
</fieldset>
</form>
Re-Order by ID Number
I have a cms set up for inputting an image, thumb, title, pdf, and eps. When input the database assigns an ID number. The front end displays each upload by ID number. I'm trying to set up the back
Upload, SSL and more php help
I recently just installed a ssl cert and do i use https for the whole site or just for the checkout.php and cart.php and login.php files?whats the proper way to use https?I have 2 more questions, when
How could I combine these arrays??
Hello.. I'm trying to figure out a way to combine these first two arrays to get the last array.. 1st array:Code: Array( [0] => zero [1] => one [2] => two)2nd array:Code:
Need help-Error istream header declaration
Hi Everyone ,I am having issue with istream declaration. I am new to C programming.can any one please help me ?I am getting error in getNameValuePair.h and getNameValuePair.C code.Here below the
Casting Decimals in Oracle
This code worked as a query in DB2, but I am not sure what the syntax is for casting decimals in Oracle:
Posting to another Site?
I have software that people install.When they install it, is there a way to make it post their domain name to my website?I know I could do a header('location: http//www.mysite.com/id=?domain.com');
exclude characters from counting?
Hello, I wanted to ask if you have a string like:Code: $my_s='ASRGREGTGTR----REGREGRE+++RRRRRR....';is there a way to count the length of the string, excluding non-word characters (+,- or .)?thank you
ImageCreate()
When I create an image and add text to it I want my text to be replaced with a PNG image, because the PNG image has text effects. I have an image of every letter I just don't know if this is possible
PHP MySQL Return Results Issue
Hi guys,I'm running joomla and made a module which is using ajax.Basically i just have an html input textbox which i put a SQL statement in and then onblur it does the ajax script which returns the
Parse Error
Hi Guys,I have a function in my class which returns a string link variable. The problem is it keeps giving me a parse error. See code below followed by error message:Code: function