Re: Sometimes I wonder why I even started programming...
| From: | Jason Pruim | Date: | Wed, 27 Feb 2008 22:16:32 +0000 |
| Subject: | Re: Sometimes I wonder why I even started programming... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-270459@lists.php.net to get a copy of this message | ||
On Feb 27, 2008, at 5:12 PM, Daniel Brown wrote:
On Wed, Feb 27, 2008 at 4:55 PM, Jason Pruim <japruim@raoset.com> wrote:I know... But I get good answers when I do :PSo I was supposed to go home a half hour ago but that didn't happen... I hate deadlines! :PYou whine like a mule.
[snip!]As well you should!I recognize that code, Jason! At least the base of it (and the comments). ;-Pfunction authentication($user, $pass, $authenticated, $table){// Keep in mind, PASSWORD has meaning in MySQL // Do your string sanitizing here // (e.g. - $user = mysql_real_escape_string($_POST['user']);) $salt = "salt"; $salt1 = $salt; $salt1 .= $pass;$password = md5("$salt1"); $loginQuery = "SELECT * FROM current WHERE loginName='".$user."'AND loginPassword='".$password."' LIMIT 0,1;";$loginResult = mysql_query($loginQuery) or die("Wrong data suppliedor database error" .mysql_error());while($row1 = mysql_fetch_array($loginResult)) { $_SESSION['user'] = $row1['loginName']; $_SESSION['loggedin'] = "YES"; $authenticated = "true"; $table = $row1['tableName'];} return $table; return $authenticated; } \
See in the first block how you're using $_SESSION? That's why you're able to read it later.... because you have two return $xxx lines in each function. As soon as a function reaches aso the "return $table;" line doesn't ever get processed? Is there anyway to make it get processed? :) I'm attempting to rewrite code so I don't HAVE to use session variables... Hoping I can make it work :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com japruim@raoset.comreturnstatement, it returns that data and exits, so the secondreturnis never processed.