-
Bravo81 changed their profile photo
-
Small MySQL Error
Just to let you know how I display the $message arrays: index.php <? if ($message['error'] == true){ echo 'Error!<br>'; echo $message['content']; }else{ echo 'No Error.'; } ?>
-
Small MySQL Error
Your kidding, I had a typo .. Haha! OK, thats fixed. Thank you. Its working, but..(sorry) when you submit the form and get an error..all you get is the error? Just the return json_encode results are shown: {"error":true,"message":"You have entered an incorrect login credentials."} Not too sure why..the form action="" so it should return to index.php..? Dam it.
-
germanicus777 reacted to a post in a topic:
easier way to make images into links? WARNING: LONG READ :)
-
Small MySQL Error
Thank you, that error has been fixed. But, I have an issue with Json? http://linkthemup.com/ltusupport/LinkThemUp%20Support%20Centre/ Notice: Undefined index: attempts in /home/ltu/public_html/ltusupport/LinkThemUp Support Centre/inc/functions.php on line 65 Fatal error: Call to undefined function json_enconde() in /home/ltu/public_html/ltusupport/LinkThemUp Support Centre/inc/functions.php on line 68 The Notice is OK I think? As all error reoprting is on. Line 68 is the last few lines of code where we have the wrong username/password else. Any ideas?
-
Small MySQL Error
That makes perfect sense, thank you. I will fix it now.
-
Small MySQL Error
Trying your method failed like this, might be wrong: class UsrLogin { protected $dbconn; public function setupdbconn (){ /** $this->dbconn = new mysqli(DB_HOST,DB_USER,DB_PASS,DB_NAME) or die('Uh-Oh! Sorry, but it seems the server has died. Please check connection details.'); */ $conn = new PDO('mysql:host=localhost;dbname=ltu_sc', USER, PASSWORD); $conn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); } /** DB Connection is now setup, move onto Login Checks */ public function checkUsrLogin ($email, $password){ $details = 'SELECT client_name, client_level, client_location, client_email FROM clients WHERE client_email = ? and client_password = ?'; /** Check users login attempts */ if (isset($_SESSION['attempts']) && $_SESSION['attempts'] >= LOGIN_ATTEMPTS){ $message['error'] = true; $message['content'] = "Uh-Oh! You have failed to login too many times. You have been locked out for 30 minutes."; return json_encode ($message); }else{ /** Login attempts OK, check login details */ /** if ($stmt = $this->dbconn->prepare($details)){*/ if ($stmt = conn($details)){
-
Small MySQL Error
Hey, Regarding the PDO, what is this? Last time I used was PHP last year and I could do MySQL connections fine. Has PHP changed or something? I've never heard of PDO. It's not the first time someone has mentioned it too me now either. No it is still in the main class. I will post the whole page: <?php // Coded by Dean Day 09/2012 // dean@linkthemup.com // Coded by Dean Day, for Link Them Up Enterprise // Property of Dean Day & LTU Enterprise require_once ('config.php'); /** Start of functions.php */ /** Reset Errors */ $message['error'] = false; class UsrLogin { protected $dbconn; public function setupdbconn (){ $this->dbconn = new mysqli(DB_HOST,DB_USER,DB_PASS,DB_NAME) or die('Uh-Oh! Sorry, but it seems the server has died. Please check connection details.'); } /** DB Connection is now setup, move onto Login Checks */ public function checkUsrLogin ($email, $password){ $details = 'SELECT client_name, client_level, client_location, client_email FROM clients WHERE client_email = ? and client_password = ?'; /** Check users login attempts */ if (isset($_SESSION['attempts']) && $_SESSION['attempts'] >= LOGIN_ATTEMPTS){ $message['error'] = true; $message['content'] = "Uh-Oh! You have failed to login too many times. You have been locked out for 30 minutes."; return json_encode ($message); }else{ /** Login attempts OK, check login details */ if ($stmt = $this->dbconn->prepare($details)){ $stmt->bind_param ('ss', $email, $password); $stmt->execute(); $stmt->bind_result ($name, $lvl, $location, $email); if($stmt->fetch()){ /** Set the Session Info */ $_SESSION['client_logged_in'] = true; $_SESSION['client_name'] = $name; $_SESSION['client_email'] = $email; $_SESSION['client_level'] = $lvl; $_SESSION['attempts'] = 0; /** Login successful, continue.. */ $message['error'] = false; $message['redirect'] = $location; return json_encode ($message); }else{ /** Login failed, send message. */ $_SESSION['attempts'] = $_SESSION['attempts'] + 1; $message['error'] = true; $message['content'] = "You have entered an incorrect email/password."; return json_enconde ($message); } } } } }
-
Small MySQL Error
Hi all, can someone explain this error to me please? Fatal error: Call to a member function prepare() on a non-object in /home/ltu/public_html/ltusupport/LinkThemUp Support Centre/inc/functions.php on line 40 class UsrLogin { protected $dbconn; public function setupdbconn (){ $this->dbconn = new mysqli(DB_HOST,DB_USER,DB_PASS,DB_NAME) or die('Uh-Oh! Sorry, but it seems the server has died. Please check connection details.'); } That sets the $dbconn and $this-dbconn. Sets SQL: $details = 'SELECT client_name, client_level, client_location, client_email FROM clients WHERE client_email = ? and client_password = ?'; Line 40: if ($stmt = $this->dbconn->prepare($details)){ Thanks in adavanced guys.
-
easier way to make images into links? WARNING: LONG READ :)
From what I can tell, you want a system that will create an Archive for you with a paging system. Your best bet might be to use a CMS (Content Management System) such as: Wordpress Joomla You could create a blog, which would do this and it would create pages 1 - to the end. You could also make the pages you want very quickly, also uploading media is easy. Good luck.
-
-
Little help on While Loops with an Array.
Hi Jock, thank you for your'e reply. Sorry to drag this out, but the code you offered has created an error: /** Check users Tickets. */ public function checkUserTicket() { $sql = "SELECT * FROM tickets WHERE member_email = '$this->email'"; if ($sth = $this->db->query($sql)){ print_r($sth->fetchAll()); } } Parse error: syntax error, unexpected T_STRING in /home/ltusupport/public_html/ltusupport/lib/core.php on line 109 Line 109 is the print_r I'm going to Google it, attempt to fix it myself as I don't wish to just leach from you. Thanks for your help so far.
-
Little help on While Loops with an Array.
Thank you Jock, I put two var_dumps in: public function checkUserTicket() { $sql = "SELECT * FROM tickets WHERE member_email = '$this->email'"; if ($sth = $this->db->query($sql)) { $count = $sth->fetchColumn(); if ($count >= 1) { echo 'Var-Dump Count:<br>'; var_dump($count); while($i1 = $sth->fetch(PDO::FETCH_OBJ)) {echo 'Subject: $i1->ticket_subject - $i1->ticket_date - Status: $i1->ticket_responded - View Ticket.<br>';} echo '<br><br>Var-dump $sth->fetch(PDO::FETCH_OBJ):<br>'; var_dump($sth->fetch(PDO::FETCH_OBJ)); echo '<br><br>Picked up a Ticket, should var_dump $count and $sth->fetch.'; } Result is: Var-Dump Count: string(1) "1" Var-dump $sth->fetch(PDO::FETCH_OBJ): bool(false) So the $count does pick up the the one ticket. Its just the while loop :/
-
CSS Horizontal nav bar position help!
Sorry, I read that post twice. Still don't understand what you wanted.
-
Pricing Table Template
Table? We no longer use 'Tables'. A great template using divs is what your after.. http://www.dreamtemplate.com/dreamcodes/documentation/pricingtables.html Enjoy!
-
a simple zoom feature
What about Lightbox or Shadowbox? Lightbox: http://visuallightbox.com/js-jquery-cloud-demo.html Click the images for examples. Shadow: http://www.shadowbox-js.com/index.html Scroll down.
-
-
Little help on While Loops with an Array.
Hmm, OK..first time I've ever heard of PDO. Thanks Jock, I put that in: if ($count >= 1) { while($i1 = $sth->fetch(PDO::FETCH_OBJ)) {echo 'Subject: $i1->ticket_subject - $i1->ticket_date - Status: $i1->ticket_responded - View Ticket.<br>';} echo 'test'; } It has fixed the error ,but does not display anything else I'm afraid. Added the test echo to make sure the if was being called.
-
-
Little help on While Loops with an Array.
I have added the Var Dump. I have no idea what that means.. object(PDOStatement)#4 (1) { ["queryString"]=> string(64) "SELECT * FROM tickets WHERE member_email = 'dean@linkthemup.com'" } What would be my object? the $this? or the $sth? My standard function being mysql_fetch_array? Soory for being a noob, but like I said only PHP I know is what I got from Google haha! Thank you for trying to help me..