[Techtalk] Sigh...I can't win with PHP (fwd)

Lynn Kuhlman lynn at eskimo.com
Wed Aug 8 23:09:46 EST 2001


Please reply to sweetsue at sweethomes if you can help with her PHP problem.


Thanks!



---------- Forwarded message ----------
Well, it's a bit of authentication - I'm working on a support area.  Anyway,
the page is http://support.sweethomes.com - if you type in something in only
one of the boxes, it won't log you in.  If you type in nonsense in both
boxes, it will log you in but you'll see the little error thing I have up
top and there won't be a number there.  If you type in a good log in - say
lynn and yahner, it will log you in and there will still be an error up top
but there is a number.  Here is the coding:

<?

session_start();

if ($login && $passwd)

{

// if the user has just tried to log in

$db_conn = mysql_connect("localhost", "admin", "srb6653");

mysql_select_db("shwsclients", $db_conn);

$query = "select * from clients where login='$login' and passwd='$passwd'";

$result = mysql_query($query, $db_conn);

if (mysql_num_rows($result) >0 )

$foo=mysql_num_rows($result);

echo "$login<BR>$foo<P>\n";

echo "Whoops, someone fscked the data entry! Check the db";

{

// if they are in the database register the user id

$valid_user = $login;

session_register("valid_user");

}

}

?>

<html>

<body>

<?

if (session_is_registered("valid_user"))

{

echo "<HTML><HEAD><TITLE>Sweet Homes Web Services Client Support
Area</TITLE>";

echo "<BODY>";

echo "<P align=center><FONT color=#000000 face=\"Aritus D\"
size=6><STRONG>Members Area</STRONG></FONT></P>";

echo "<p align=center><b><small>Let us know how we can improve this area!
Send suggestions to <a href=\"mailto:sweetsue at sweethomes.com\">the
<mailto:sweetsue at sweethomes.com\> webmistress</a>.</small></b></p>";

echo "<p><strong>There are different levels of support depending on what you
require. Please select from the following:<br>";

echo "Low Level (program inquiries, general questions) - <a
href=mailto:support at sweethomes.com>Support 1</a> (ticket system)<br>";

echo "Medium Level (program debug, account additions) - <a
href=http://admin.sweethomes.com/support>Support 2</a> (live chat - login as
client/yhn495)<br>";

echo "High Level (site down, email not working) - <a
href=mailto:4254228968 at msg.myvzw.com>Support 3</a> (this will send emergency
page)<br>";

echo "<br>You can also get a hold of support from 7 am to 5 pm PST Monday
through Friday at (425)422-8968<br>";

echo "After hours, please use our new board system - <a href=board>Support
Board</a><br><br>";

echo "Also, if you aren't already on it, please subscribe to our <a
href=http://www.sweethomes.com:81/cgi-bin/lyris.pl?site=sweethomes>mailing
list</a>. Periodic announcements are sent out and this is the best way to
keep informed!<br><br>";

echo "<a href=http://www.sweethomes.com/askstu.html>Ask Stu FAQ</a> is also
available to help you help yourself. We're always looking for suggestions on
this so feel free to let us know what you would like to see listed in the
FAQ!</strong>";

echo "<br><br><a href=logout.php>Log Out</a>";

}

else

{

if (isset($login))

{

// if they've tried and failed to log in

echo "<center>Could not log you in - please try again</center>";

}

else

{

// they have not tried to log in yet or have logged out

echo "<center>You are not logged in - use your Plesk username and password
to log in<br></center>";

}

// provide form to log in

echo "<HTML><HEAD><TITLE>Sweet Homes Web Services Support</TITLE>";

echo "<BODY>";

echo "<center>";

echo "<form method=post action=\"index.php\">";

echo "<table>";

echo "<tr><td>User Name:</td>";

echo "<td><input type=text name=login></td></tr>";

echo "<tr><td>Password:</td>";

echo "<td><input type=password name=passwd></td></tr>";

echo "<tr><td colspan=2 align=center>";

echo "<input type=submit value=\"Log in\"></td></tr>";

echo "</table></form>";

echo "</center>";

}

?>

</body>

</html>

I have a sneaky suspicion that it has something to do with the whole
login/$login thing but I can't be sure.

Thanks for any help you can give!

Susanne Bullo
Sweet Homes - http://www.sweethomes.com
www.missionEvitalize.com - "Revitalize Your Mission"
www.needanexpertfast.com - Find an Expert Fast!
k






More information about the Techtalk mailing list