From 3762d60441255f64dca71c2f82df4493eb8f91f2 Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Wed, 12 Dec 2012 19:33:07 -0800 Subject: Bug fixes: Fixed bug where scores were being loaded twice. Moved GZIP Compression to index.php Updated login.php to call an error on empty email addresses. --- pages/feedback.php | 2 +- pages/home.php | 1 - pages/login.php | 48 +++++++++++++++++++++++++++++------------------- 3 files changed, 30 insertions(+), 21 deletions(-) (limited to 'pages') diff --git a/pages/feedback.php b/pages/feedback.php index 3e10cef..b98cba0 100644 --- a/pages/feedback.php +++ b/pages/feedback.php @@ -41,7 +41,7 @@ if (!$accepted) { echo "
Sorry, you must be logged in to use this. -
Please email us instead @ snap@pathery.com +
Please email us instead @ snap@pathery.com
"; exit; } diff --git a/pages/home.php b/pages/home.php index a9c6b36..ac2518f 100644 --- a/pages/home.php +++ b/pages/home.php @@ -1,5 +1,4 @@ validate()) { - //echo 'User has logged in.'; - //What's in the goodie bag labeled "personal information"... hmmm $tmp = $openid->getAttributes(); $display = $tmp['namePerson/first']; @@ -40,6 +38,11 @@ try { $display = 'noname'; } $email = $tmp['contact/email']; + + if ($email == '') { + $tmp['op'] = $_GET['op']; + die(throwLoginError($tmp, "No email provided from OpenID Provider")); + } //print_r ($tmp); //exit; $claimedid = $openid->__get('identity'); @@ -65,7 +68,6 @@ try { $display = mysql_result($result, 0, 'displayName'); $dateJoined = mysql_result($result, 0, 'dateJoined'); - // //Multiple accounts found? if (mysql_num_rows($result) > 1) { $d['page'] = "Login"; @@ -78,7 +80,7 @@ try { $d['display'] = $display; EmailError($d); } - // + // Continue Loging in; should be fine. //TEMPORARY CODE //Check openID; and update it if necessary @@ -110,9 +112,8 @@ try { '".sql_clean($display)."', '".sql_clean($email)."', NOW(), NOW())"; - $result = mysql_query($sql) or die(mysql_error()); + $result = mysql_query($sql); //Allright, all set. - //echo "$sql

"; if ($result) { $userID = mysql_insert_id(); $dateJoined = date(DateTime::ISO8601); @@ -124,19 +125,11 @@ try { onCompletedTutorial($userID); } } - - } //Oh crap? - else { - $errortext = "
new-user db register failure of unknown cause.\n -
Also, there were no monkeys trained or otherwise sent to resolve this problem.\n -
Sorry. youtube offered them more.\n -
Is this issue repeating? Please email me: snap@pathery.com \n -
Debug data:\n -
Result: $result\n -
SQL Used: $sql\n -
MySQL Error:\n"; - $errortext .= mysql_error(); - DoRedirect($errortext, NULL, 10); + //Oh crap? + } else { + $d['sqlError'] = mysql_error(); + $d['result'] = $result; + throwLoginError($d, "Unknown DB Registration failure"); exit; } } @@ -175,4 +168,21 @@ try { } catch(ErrorException $e) { echo $e->getMessage(); } + +function throwLoginError($data, $explination) { + $randCode = rand(10000, 99999); + $errortext = "
Error; $explination \n +
The error details have been emailed to the administrator. +
If this problem continues; please email me: + + snap@pathery.com + +
Your error code is: $randCode +
"; + $errortext .= mysql_error(); + DoRedirect($errortext, NULL, 500); + $data['explination'] = $explination; + $data['randCode'] = $randCode; + EmailError($data); +} ?> -- cgit v1.2.3