Archive for December, 2003
One of the Ensight readers recently submitted this in a comment, wondering if there was a better way to do it / way to fix it. I’m not a real deep PHP guy, but hopefully one of the readers can give him a hand.
Here’s the code in question:
function verify_login ($csLogin,$csPassword,$csSA,$csPwd) ( echo (“database.php – trace #1 “); @ $db = mysql_connect (‘localhost’,$csSA,$csPwd) or die (“Error: Could not connect to database”); echo (“database.php – trace #2 “);
if (!$db) ( echo (“Could not connect to database”); exit; }
echo (“database.php – trace #3 “);
$sql = “SELECT * FROM TBL_CLIENT WHERE csLogin=’”.$csLogin.”‘ AND csPswd=’”.$csPassword.”‘”; echo ($sql);
@ $result = mysql_query ($sql);
if ($result) ( $num_results = mysql_num_rows ($result); if ($num_results > 0) ( $row = mysql_fetch_row ($result); session_register (‘csUid’,'csPwd’,'csLname’,'csFname’,'csMname’,'csCompany’); $_SESSION['csCompany'] = $row; $_SESSIONS['csLname'] = $row; $_SESSIONS['csFname'] = $row; $_SESSIONS['csMname'] = $row; $_SESSIONS['csUid'] = $row; $_SESSIONS['csPwd'] = $row; mysql_close ($db); return true; } else ( echo (“No rows returned”); mysql_close ($db); return false; } } else ( echo (“No result returned”); mysql_close ($db); return false; } mysql_close ($db); return false; }
I only just discovered this blog. It is really rather new, but the maturity displayed, and the quality of the posts are fantastic. Hopefully the writer will begin contributing to the Carnival of the Capitalists so that the world can see more of what he has to say.
It’s amazing how much getting a new machine will throw off your week. I’m 3 hours in and I haven’t even installed Visual Studio, Photoshop or Quark.
Ah well, at least I still have Wi-Fi access.