PHP - Active Class Wont Work
Hello,
I'm working on a Class with my CMS and can't get it to work properly. It is the textClass of my cms. You can add and delete text on the website but I want to add an active or non active option. This is de code I got now but it isnt working and I cant find te problem. The radio button in my cms wich shows active or non active works fine and when i change it to non active it changes in the database to 0 so the problem isnt there I think. Can anybody help me out? Tnx:) Code: [Select] public function getTeksten($database, $taal, $actief = NULL, $bladzijde = NULL, $id = NULL) { $sql = "SELECT * FROM ".$database."_teksten WHERE tekst_taal=:taal"; if(!empty($id)) { if(is_numeric($id)) { $sql .= " AND tekst_ID=:id"; } if(!empty($actief) && $actief == 1) { $sql .= " WHERE tekst_actief='1'"; } } else if(!empty($bladzijde)) { if(is_numeric($bladzijde)) { $sql .= " AND tekst_bladzijde=:bladzijde"; } else { return NULL; } } $sql .= " ORDER BY tekst_volgorde ASC"; try { $stmt = $this->db->prepare($sql); $stmt->bindParam(":taal", $taal, PDO::PARAM_STR); if(!empty($id) && is_numeric($id)) { $stmt->bindParam(":id", $id, PDO::PARAM_INT); } else if(!empty($bladzijde) && is_numeric($bladzijde)) { $stmt->bindParam(":bladzijde", $bladzijde, PDO::PARAM_INT); } $stmt->execute(); $result = $stmt->fetchAll(PDO::FETCH_OBJ); $stmt->closeCursor(); return $result; } catch(Exception $e) { die($e->getMessage()); } } I have to text items on my homepage and turned one to non active but what happened now is that is show all of my text items on my homepage. Cant find the problem:( Someone that can help me out here? Similar TutorialsDoesn't change status to expired.
<?php $bannersQuery = 'SELECT * FROM banners WHERE expire > NOW() AND status = "active" ORDER BY RAND() LIMIT 10'; $banners = $db->query($bannersQuery); while($row = $banners->fetch(PDO::FETCH_ASSOC)){ if($row['expire'] <= time()){ $status = 'expired'; }else{ $status = 'active'; } $updateQuery = 'UPDATE banners SET exposures = exposures + 1, status = :status WHERE id = :id'; $update = $db->prepare($updateQuery); $update->bindParam(':status', $status, PDO::PARAM_STR); $update->bindParam(':id', $row['id'], PDO::PARAM_INT); $update->execute(); echo ' <a href="index.php?do=bannerClick&id='.$row['id'].'" target="_BLANK"><img src="'.$row['url'].'" width="'.$row['width'].'" height="'.$row['height'].'" alt="'.$row['title'].'"></a><br>'; } echo ' <a href="index.php?do=buyBanner">Want to advertise your banner? Click here.</a>'; ?> require_once 'includes/upload.class.php'; $upload = new uploads(); $details = $upload->getFileInformation($id); <?php echo $details['upload_desc']; ?> then here the class. require_once 'db.class.php'; class uploads extends database { private $uploadData; function uploadFile() { public function getFileInformation($id) { $this->uploadData = $this->readData("uploadfiles", "upload_id", $id); return $this->uploadData; } But it wont work! Well I have a user profile page with codes written like this: Code: [Select] <?php $filename = "profile"; include("functions/functions.php"); include("functions/functions_users.php"); include("functions/functions_adopts.php"); include("functions/functions_friends.php"); include("inc/lang.php"); include("inc/bbcode.php"); //***************// // START SCRIPT // //***************// // This page handles user profiles and shows the site members... $user = $_GET["user"]; $page = $_GET["page"]; if($user != ""){ // We have specified a specific user who we are showing a profile for... // See if the user exists... $article_title = "{$user}'s Profile"; $query = "SELECT * FROM {$prefix}users, {$prefix}users_contacts, {$prefix}users_options, {$prefix}users_profile, {$prefix}users_status WHERE {$prefix}users.username = '{$user}' AND {$prefix}users_contacts.uid = {$prefix}users.uid AND {$prefix}users_options.uid = {$prefix}users.uid AND {$prefix}users_profile.uid = {$prefix}users.uid AND {$prefix}users_status.uid = {$prefix}users.uid AND {$prefix}users_contacts.username = {$prefix}users.username AND {$prefix}users_options.username = {$prefix}users.username AND {$prefix}users_profile.username = {$prefix}users.username AND {$prefix}users_status.username = {$prefix}users.username"; $result = runquery($query); $row = mysql_fetch_array($result); if($row['username'] == $user){ // First let's initiate tab system! include("inc/tabs.php"); include("css/tabs.css"); $article_content = "<div id='page-wrap'><div id='profile'> <ul class='nav'> <li class='nav0'><a href='#visitormessage'>Visitor Message</a></li> <li class='nav1'><a href='#aboutme' class='current'>About Me</a></li> <li class='nav2'><a href='#adopts'>Adoptables</a></li> <li class='nav3'><a href='#friends'>Friends</a></li> <li class='nav4 last'><a href='#contactinfo' class='last'>Contact Info</a></li> </ul><div class='list-wrap'>"; // Format user profile information... $id = $row['uid']; $ccstat = cancp($row['usergroup']); $website = (empty($row['website']))?"No Website Information Given":"<a href='{$row['website']}' target='_blank'>{$row['website']}</a>"; $facebook = (empty($row['facebook']))?"No Facebook Information Given":"<a href='{$row['facebook']}' target='_blank'>{$row['facebook']}</a>"; $twitter = (empty($row['twitter']))?"No Twitter Information Given":"<a href='{$row['twitter']}' target='_blank'>{$row['twitter']}</a>"; $msn = (empty($row['msn']))?"No MSN Information Given":$row['msn']; $aim = (empty($row['aim']))?"No AIM Information Given":$row['aim']; $yahoo = (empty($row['yahoo']))?"No YIM Information Given":$row['yahoo']; $skype = (empty($row['skype']))?"No YIM Information Given":$row['skype']; $row['username'] = ($ccstat == "yes")?"<img src='templates/icons/star.gif' /> {$row['username']}":$row['username']; $row['favpet'] = ($row['favpet'] == 0)?"None Selected":"<a href='http://www.{$domain}{$scriptpath}/levelup.php?id={$row['favpet']}' target='_blank'><img src='http://www.{$domain}{$scriptpath}/siggy.php?id={$row['favpet']}' border=0></a>"; // Here we go with the first tab content: Visitor Message $article_content .= "<ul id='visitormessage' class='hide'><strong><u>{$user}'s Profile Comments:</u></strong><br /><br /><table>"; $result = runquery("SELECT * FROM {$prefix}visitor_messages WHERE touser = '{$user}' ORDER BY vid DESC LIMIT 0, 10"); while($vmessage = mysql_fetch_array($result)){ $date = substr_replace($vmessage['datesent']," at ",10,1); $query2 = "SELECT * FROM {$prefix}users, {$prefix}users_profile WHERE {$prefix}users.username = '{$vmessage['fromuser']}' AND {$prefix}users_profile.uid = {$prefix}users.uid AND {$prefix}users_profile.username = {$prefix}users.username"; $result2 = runquery($query2); $sender = mysql_fetch_array($result2); $article_content .= "<tr> <td><img src='{$sender['avatar']}' width='40' height='40'></br></td> <td><a href='profile.php?user={$sender['username']}'>{$vmessage['fromuser']}</a> ({$date}) <a href='vmessage.php?act=view&user1={$user}&user2={$vmessage['fromuser']}'> <img src='templates/icons/status.gif'> </a> </br>{$vmessage['vmtext']} </br></td> <td><a href='vmessage.php?act=edit&vid={$vmessage['vid']}'> <img src='templates/icons/cog.gif'> </a> <a href='vmessage.php?act=delete&vid={$vmessage['vid']}'> <img src='templates/icons/delete.gif'> </a></br></td></tr>"; } if($isloggedin == "yes"){ if(isbanned($loggedinname) == 1){ $article_content .= "</table>It seems that you have been banned from this site and thus cannot send profile comment."; } else{ $article_content .= "</table> To Post a profile comment, please write your message in the text area below: <form action='profile.php?user={$user}' method='post'> <textarea rows='10' cols='50' name='vmtext' wrap='physical' ></textarea><br> <input type='submit' name='Submit' value='Submit'></form>"; $vmcontent = $_POST["vmtext"]; // Now check if the two users are friends... if($vmcontent != ""){ $datesent = date("Y-m-d H:i:s"); // $date = "2010-23-03 21:02:35"; $fromuser = $loggedinname; $touser = $user; runquery("INSERT INTO {$prefix}visitor_messages (vid, fromuser, touser, datesent, vmtext) VALUES ('', '$fromuser', '$touser' , '$datesent', '$vmcontent')"); $article_content .= "<p>Your comment for user has been posted. You may now view your conversation with {$user} from <a href='vmessage.php?act=view&user1={$fromuser}&user2={$touser}'>here</a>.</p>"; } } } else{ $article_content .= "</table>Guests cannot post profile comment, sorry..."; } // Now the second tab: About me... $article_content .= "</ul><ul id='aboutme'><li><strong><u>{$lang_basic_info} {$user}</u></strong><br /><br /> <img src='{$row['avatar']}' border=0 width='100' height=100 /><br /> <strong>Member Since:</strong> {$row['membersince']}<br /><br /> Gender: {$row['gender']}<br /> Favorite Color: {$row['color']}<br /> Nickname: {$row['nickname']}<br /> Bio: <br /> {$row['bio']}<br /></li>"; // The third tab: Adopts... $article_content .= "</ul><ul id='adopts' class='hide'><h2>.:AdoptSpotlight:.</h2><br /> {$row['favpet']}<br />{$row['about']}<br /><br /> <strong><u>{$user}'s Pets:</u></strong><br /><br />"; $query = "SELECT COUNT(*) AS pets FROM {$prefix}owned_adoptables WHERE owner = '{$user}'"; $result = runquery($query); $total = mysql_fetch_array($result); if($total['pets'] > 0){ $rowsperpage = 15; $totalpages = ceil($total['pets'] / $rowsperpage); if(is_numeric($page)) $currentpage = $page; else $currentpage = 1; if($currentpage > $totalpages) $currentpage = $totalpages; if($currentpage < 1) $currentpage = 1; $offset = ($currentpage - 1) * $rowsperpage; $query = "SELECT * FROM {$prefix}owned_adoptables WHERE owner = '{$user}' LIMIT {$offset}, {$rowsperpage}"; $result = runquery($query); while($row = mysql_fetch_array($result)){ $image = getcurrentimage($row['aid']); $article_content .= "<a href='levelup.php?id={$row['aid']}'><img src='{$image}' border='0' /></a>"; } $article_content .= "<br />"; if($currentpage > 1){ $newpage = $currentpage - 1; $article_content .= "<strong><a href='profile.php?user={$user}&page={$newpage}'><img src='templates/icons/prev.gif' border=0> Previous Page</a></strong> "; } else $article_content .= "<strong><img src='templates/icons/prev.gif' border=0> Previous Page</strong> "; if($currentpage < $totalpages){ $newpage = $currentpage + 1; $article_content .= " :: <strong><a href='profile.php?user={$user}&page={$newpage}'>Next Page <img src='templates/icons/next.gif' border=0></a></strong> "; } else $article_content .= " :: <strong>Next Page <img src='templates/icons/next.gif' border=0></strong>"; } else{ $article_content .= "This user currently does not have any pets."; } // The fourth tab: Friends... $friendlist = getfriendid($user); $friendnum = getfriendnum($user); $article_content .= "</ul><ul id='friends' class='hide'>{$user} currently have {$friendnum} friends.<br /><table>"; if($friendnum != 0){ foreach($friendlist as $friendid){ $query = "SELECT * FROM {$prefix}users, {$prefix}users_profile WHERE {$prefix}users.uid = '{$friendid}' AND {$prefix}users_profile.uid = {$prefix}users.uid AND {$prefix}users_profile.username = {$prefix}users.username"; $result = runquery($query) ; $friendinfo = mysql_fetch_array($result); $uid = $friendinfo['uid']; $username = $friendinfo['username']; $friendgender = getfriendgender($username); $onlinestatus = getonlinestatus($username); $article_content .= "<tr><td style='text-align: left'><img src='{$friendinfo['avatar']}' border=0 width='60' height =60></td> <td><strong><a href='profile.php?user={$username}'>{$username}</a></strong> {$friendgender}<br />{$friendinfo['nickname']}<br />{$onlinestatus} <a href='{$friendinfo['website']}' target='_blank'><img src='templates/icons/web.gif'></a> <a href='messages.php?act=newpm&user={$username}'><img src='templates/icons/title.gif'></a></td>"; $article_content .= ($user == $loggedinname)?"<td style='text-align: right'><br /><br /><br /><a href='friends.php?act=delete&uid={$uid}'>Break Friendship </td></tr>":"</tr>"; } } $article_content .= "</table>"; // The last tab: Contact Info! $article_content .= "</ul><ul id='contactinfo' class='hide'><img src='templates/icons/web.gif' /> {$website}<br /> <img src='templates/icons/facebook.gif' /> {$facebook}<br /> <img src='templates/icons/twitter.gif' /> {$twitter}<br /> <img src='templates/icons/aim.gif' /> {$aim}<br /> <img src='templates/icons/msn.gif' /> {$msn}<br /> <img src='templates/icons/yahoo.gif' /> {$yahoo}<br /> <img src='templates/icons/skype.gif' /> {$skype}<br /> <img src='templates/icons/title.gif' /> <a href='messages.php?act=newpm&user={$user}'>Send {$user} a Private Message</a><br /> <img src='templates/icons/fr.gif' /><a href='friends.php?act=request&uid={$id}'>Send {$user} a Friend Request</a><br /> <br /></div></div>"; } else{ $article_content .= "Sorry, but we could not find a user in the system with the name {$user}. Please make sure you have the username right. The user's account may also have been deleted by the system admin."; } } else{ // We did not specify a user, so show the memberlist $article_title = "Memberlist"; $article_content = "Here are all of the members of this site, sorted by registration date.<br /><br />"; include("classes/class_pagination.php"); include("css/pagination.css"); $query = "SELECT * FROM {$prefix}users ORDER BY uid ASC"; $result = runquery($query); $rowsperpage = 15; $pagination = new Pagination($query, $rowsperpage, "http://www.{$domain}{$scriptpath}/profile.php"); $pagination->setPage($_GET[page]); $query = "SELECT * FROM {$prefix}users ORDER BY uid ASC LIMIT {$pagination->getLimit()},{$rowsperpage}"; $result = runquery($query); while ($row = mysql_fetch_array($result)){ $status = cancp($row['usergroup']); $star = ($status == "yes")?"<img src='templates/icons/star.gif' border=0' /> ":""; $article_content .= "<strong><a href='profile.php?user={$row['username']}'>{$star}{$row['username']}</a></strong><br />"; } $article_content .= "<br />{$pagination->showPage()}"; } //***************// // OUTPUT PAGE // //***************// echo showpage($article_title, $article_content, $date); ?> In order to improve re-usability of the tabs, I attempted to create a file called class_tabs.php to make it object oriented. It did not work however, as the css is seriously messed up, and I have absolutely no idea why it did not. Here is the class file: Code: [Select] <?php class Tab{ private $t_num; private $t_name = array(); private $t_alias = array(); private $t_content; private $t_default; private $t_hide; private $t_index = array(); private $t_last = array(); public function __construct($num, $tabs, $default=1){ $this->t_num = $num; $this->t_default = $default; $i = 0; foreach ($tabs as $key => $val){ $this->t_name[$i] = $key; $this->t_alias[$i] = $val; $this->t_index[$i] = ($i == $default-1)?" class='current":""; $this->t_index[$i] = ($i == $num-1)?" class='last":$this->t_index[$i]; $this->t_last[$i] = ($i == $num-1)?" last":""; $i++; } } public function createtab(){ if($this->t_num < 2 or $this->t_num > 5) throw new Exception("The number of tabs must be restricted between 2 to 5!",272); $this->t_content = "<div id='page-wrap'><div id='tab'><ul class='nav'>"; for($i=0; $i<$this->t_num; $i++){ $this->t_content .= " <li class='nav{$i}{$this->t_last[$i]}'><a href='#{$this->t_alias[$i]}{$this->t_index[$i]}'>{$this->t_name[$i]}</a></li>"; } $this->t_content .= "</ul><div class='list-wrap'>"; return $this->t_content; } public function starttab($index){ $this->t_hide = ($index == $this->t_default)?"":" class='hide'"; $this->t_content .= "<ul id='{$this->t_alias}'{$this->t_hide}>"; return $this->t_content; } public function endtab($index){ $this->t_content .= "</ul>"; if($index == $this->t_num) $this->t_content .= "</div></div>"; return $this->t_content; } } ?> And this is the modified profile codes with OOP: Code: [Select] <?php $filename = "profile"; include("functions/functions.php"); include("functions/functions_users.php"); include("functions/functions_adopts.php"); include("functions/functions_friends.php"); include("inc/lang.php"); include("inc/bbcode.php"); //***************// // START SCRIPT // //***************// // This page handles user profiles and shows the site members... $user = $_GET["user"]; $page = $_GET["page"]; if($user != ""){ // We have specified a specific user who we are showing a profile for... // See if the user exists... $article_title = "{$user}'s Profile"; $query = "SELECT * FROM {$prefix}users, {$prefix}users_contacts, {$prefix}users_options, {$prefix}users_profile, {$prefix}users_status WHERE {$prefix}users.username = '{$user}' AND {$prefix}users_contacts.uid = {$prefix}users.uid AND {$prefix}users_options.uid = {$prefix}users.uid AND {$prefix}users_profile.uid = {$prefix}users.uid AND {$prefix}users_status.uid = {$prefix}users.uid AND {$prefix}users_contacts.username = {$prefix}users.username AND {$prefix}users_options.username = {$prefix}users.username AND {$prefix}users_profile.username = {$prefix}users.username AND {$prefix}users_status.username = {$prefix}users.username"; $result = runquery($query); $row = mysql_fetch_array($result); if($row['username'] == $user){ // First let's initiate tab system! include("inc/tabs.php"); include("css/tabs.css"); include("classes/class_tabs.css"); $profile_tabs = new Tabs(5, array("Visitor Message" => "visitormessage", "About Me" => "aboutme", "Adoptables" => "adopts", "Friends" => "friends", "Contact Info" => "contactinfo"), 2); $article_content = $profile_tabs -> createtab(); // Format user profile information... $id = $row['uid']; $ccstat = cancp($row['usergroup']); $website = (empty($row['website']))?"No Website Information Given":"<a href='{$row['website']}' target='_blank'>{$row['website']}</a>"; $facebook = (empty($row['facebook']))?"No Facebook Information Given":"<a href='{$row['facebook']}' target='_blank'>{$row['facebook']}</a>"; $twitter = (empty($row['twitter']))?"No Twitter Information Given":"<a href='{$row['twitter']}' target='_blank'>{$row['twitter']}</a>"; $msn = (empty($row['msn']))?"No MSN Information Given":$row['msn']; $aim = (empty($row['aim']))?"No AIM Information Given":$row['aim']; $yahoo = (empty($row['yahoo']))?"No YIM Information Given":$row['yahoo']; $skype = (empty($row['skype']))?"No YIM Information Given":$row['skype']; $row['username'] = ($ccstat == "yes")?"<img src='templates/icons/star.gif' /> {$row['username']}":$row['username']; $row['favpet'] = ($row['favpet'] == 0)?"None Selected":"<a href='http://www.{$domain}{$scriptpath}/levelup.php?id={$row['favpet']}' target='_blank'><img src='http://www.{$domain}{$scriptpath}/siggy.php?id={$row['favpet']}' border=0></a>"; // Here we go with the first tab content: Visitor Message $article_content .= "{$profile_tabs -> starttab(0)}<strong><u>{$user}'s Profile Comments:</u></strong><br /><br /><table>"; $result = runquery("SELECT * FROM {$prefix}visitor_messages WHERE touser = '{$user}' ORDER BY vid DESC LIMIT 0, 10"); while($vmessage = mysql_fetch_array($result)){ $date = substr_replace($vmessage['datesent']," at ",10,1); $query2 = "SELECT * FROM {$prefix}users, {$prefix}users_profile WHERE {$prefix}users.username = '{$vmessage['fromuser']}' AND {$prefix}users_profile.uid = {$prefix}users.uid AND {$prefix}users_profile.username = {$prefix}users.username"; $result2 = runquery($query2); $sender = mysql_fetch_array($result2); $article_content .= "<tr> <td><img src='{$sender['avatar']}' width='40' height='40'></br></td> <td><a href='profile.php?user={$sender['username']}'>{$vmessage['fromuser']}</a> ({$date}) <a href='vmessage.php?act=view&user1={$user}&user2={$vmessage['fromuser']}'> <img src='templates/icons/status.gif'> </a> </br>{$vmessage['vmtext']} </br></td> <td><a href='vmessage.php?act=edit&vid={$vmessage['vid']}'> <img src='templates/icons/cog.gif'> </a> <a href='vmessage.php?act=delete&vid={$vmessage['vid']}'> <img src='templates/icons/delete.gif'> </a></br></td></tr>"; } if($isloggedin == "yes"){ if(isbanned($loggedinname) == 1){ $article_content .= "</table>It seems that you have been banned from this site and thus cannot send profile comment."; } else{ $article_content .= "</table> To Post a profile comment, please write your message in the text area below: <form action='profile.php?user={$user}' method='post'> <textarea rows='10' cols='50' name='vmtext' wrap='physical' ></textarea><br> <input type='submit' name='Submit' value='Submit'></form>"; $vmcontent = $_POST["vmtext"]; // Now check if the two users are friends... if($vmcontent != ""){ $datesent = date("Y-m-d H:i:s"); // $date = "2010-23-03 21:02:35"; $fromuser = $loggedinname; $touser = $user; runquery("INSERT INTO {$prefix}visitor_messages (vid, fromuser, touser, datesent, vmtext) VALUES ('', '$fromuser', '$touser' , '$datesent', '$vmcontent')"); $article_content .= "<p>Your comment for user has been posted. You may now view your conversation with {$user} from <a href='vmessage.php?act=view&user1={$fromuser}&user2={$touser}'>here</a>.</p>"; } } } else{ $article_content .= "</table>Guests cannot post profile comment, sorry..."; } // Now the second tab: About me... $article_content .= "{$profile_tabs -> endtab(0)}{$profile_tabs -> starttab(1)} <li><strong><u>{$lang_basic_info} {$user}</u></strong><br /><br /> <img src='{$row['avatar']}' border=0 width='100' height=100 /><br /> <strong>Member Since:</strong> {$row['membersince']}<br /><br /> Gender: {$row['gender']}<br /> Favorite Color: {$row['color']}<br /> Nickname: {$row['nickname']}<br /> Bio: <br /> {$row['bio']}<br /></li>"; // The third tab: Adopts... $article_content .= {$profile_tabs -> endtab(1)}{$profile_tabs -> starttab(2)}<h2>.:AdoptSpotlight:.</h2><br /> {$row['favpet']}<br />{$row['about']}<br /><br /> <strong><u>{$user}'s Pets:</u></strong><br /><br />"; $query = "SELECT COUNT(*) AS pets FROM {$prefix}owned_adoptables WHERE owner = '{$user}'"; $result = runquery($query); $total = mysql_fetch_array($result); if($total['pets'] > 0){ $rowsperpage = 15; $totalpages = ceil($total['pets'] / $rowsperpage); if(is_numeric($page)) $currentpage = $page; else $currentpage = 1; if($currentpage > $totalpages) $currentpage = $totalpages; if($currentpage < 1) $currentpage = 1; $offset = ($currentpage - 1) * $rowsperpage; $query = "SELECT * FROM {$prefix}owned_adoptables WHERE owner = '{$user}' LIMIT {$offset}, {$rowsperpage}"; $result = runquery($query); while($row = mysql_fetch_array($result)){ $image = getcurrentimage($row['aid']); $article_content .= "<a href='levelup.php?id={$row['aid']}'><img src='{$image}' border='0' /></a>"; } $article_content .= "<br />"; if($currentpage > 1){ $newpage = $currentpage - 1; $article_content .= "<strong><a href='profile.php?user={$user}&page={$newpage}'><img src='templates/icons/prev.gif' border=0> Previous Page</a></strong> "; } else $article_content .= "<strong><img src='templates/icons/prev.gif' border=0> Previous Page</strong> "; if($currentpage < $totalpages){ $newpage = $currentpage + 1; $article_content .= " :: <strong><a href='profile.php?user={$user}&page={$newpage}'>Next Page <img src='templates/icons/next.gif' border=0></a></strong> "; } else $article_content .= " :: <strong>Next Page <img src='templates/icons/next.gif' border=0></strong>"; } else{ $article_content .= "This user currently does not have any pets."; } // The fourth tab: Friends... $friendlist = getfriendid($user); $friendnum = getfriendnum($user); $article_content .= "{$profile_tabs -> endtab(2)}{$profile_tabs -> starttab(3)}{$user} currently have {$friendnum} friends.<br /><table>"; if($friendnum != 0){ foreach($friendlist as $friendid){ $query = "SELECT * FROM {$prefix}users, {$prefix}users_profile WHERE {$prefix}users.uid = '{$friendid}' AND {$prefix}users_profile.uid = {$prefix}users.uid AND {$prefix}users_profile.username = {$prefix}users.username"; $result = runquery($query) ; $friendinfo = mysql_fetch_array($result); $uid = $friendinfo['uid']; $username = $friendinfo['username']; $friendgender = getfriendgender($username); $onlinestatus = getonlinestatus($username); $article_content .= "<tr><td style='text-align: left'><img src='{$friendinfo['avatar']}' border=0 width='60' height =60></td> <td><strong><a href='profile.php?user={$username}'>{$username}</a></strong> {$friendgender}<br />{$friendinfo['nickname']}<br />{$onlinestatus} <a href='{$friendinfo['website']}' target='_blank'><img src='templates/icons/web.gif'></a> <a href='messages.php?act=newpm&user={$username}'><img src='templates/icons/title.gif'></a></td>"; $article_content .= ($user == $loggedinname)?"<td style='text-align: right'><br /><br /><br /><a href='friends.php?act=delete&uid={$uid}'>Break Friendship </td></tr>":"</tr>"; } } $article_content .= "</table>"; // The last tab: Contact Info! $article_content .= "{$profile_tabs -> endtab(3)}{$profile_tabs -> starttab(4)}<img src='templates/icons/web.gif' /> {$website}<br /> <img src='templates/icons/facebook.gif' /> {$facebook}<br /> <img src='templates/icons/twitter.gif' /> {$twitter}<br /> <img src='templates/icons/aim.gif' /> {$aim}<br /> <img src='templates/icons/msn.gif' /> {$msn}<br /> <img src='templates/icons/yahoo.gif' /> {$yahoo}<br /> <img src='templates/icons/skype.gif' /> {$skype}<br /> <img src='templates/icons/title.gif' /> <a href='messages.php?act=newpm&user={$user}'>Send {$user} a Private Message</a><br /> <img src='templates/icons/fr.gif' /><a href='friends.php?act=request&uid={$id}'>Send {$user} a Friend Request</a><br /> <br />{$profile_tabs -> endtab(4)}"; } else{ $article_content .= "Sorry, but we could not find a user in the system with the name {$user}. Please make sure you have the username right. The user's account may also have been deleted by the system admin."; } } else{ // We did not specify a user, so show the memberlist $article_title = "Memberlist"; $article_content = "Here are all of the members of this site, sorted by registration date.<br /><br />"; include("classes/class_pagination.php"); include("css/pagination.css"); $query = "SELECT * FROM {$prefix}users ORDER BY uid ASC"; $result = runquery($query); $rowsperpage = 15; $pagination = new Pagination($query, $rowsperpage, "http://www.{$domain}{$scriptpath}/profile.php"); $pagination->setPage($_GET[page]); $query = "SELECT * FROM {$prefix}users ORDER BY uid ASC LIMIT {$pagination->getLimit()},{$rowsperpage}"; $result = runquery($query); while ($row = mysql_fetch_array($result)){ $status = cancp($row['usergroup']); $star = ($status == "yes")?"<img src='templates/icons/star.gif' border=0' /> ":""; $article_content .= "<strong><a href='profile.php?user={$row['username']}'>{$star}{$row['username']}</a></strong><br />"; } $article_content .= "<br />{$pagination->showPage()}"; } //***************// // OUTPUT PAGE // //***************// echo showpage($article_title, $article_content, $date); ?> Incase you find it necessary, the css/tabs.css and inc/tabs.php files are provided below. They should be irrelevant to this problem though, but just incase.. css/tabs.css Code: [Select] <style type="text/css"> * body { font: 12px Georgia, serif; } html { overflow-y: scroll; } a { text-decoration: none; } a:focus { outline: 0; } p { font-size: 15px; margin: 0 0 20px 0; } #page-wrap { width: 640px; margin: 30px;} h1 { font: bold 40px Sans-Serif; margin: 0 0 20px 0; } /* Generic Utility */ .hide { position: absolute; top: -9999px; left: -9999px; } /* Specific to example one */ #profile { background: #eee; padding: 10px; margin: 0 0 20px 0; -moz-box-shadow: 0 0 5px #666; -webkit-box-shadow: 0 0 5px #666; } #profile .nav { overflow: hidden; margin: 0 0 10px 0; } #profile .nav li { width: 97px; float: left; margin: 0 10px 0 0; } #profile .nav li.last { margin-right: 0; } #profile .nav li a { display: block; padding: 5px; background: #959290; color: white; font-size: 10px; text-align: center; border: 0; } #profile .nav li a:hover { background-color: #111; } #profile ul { list-style: none; } #profile ul li a { display: block; border-bottom: 1px solid #666; padding: 4px; color: #666; } #profile ul li a:hover { background: #fe4902; color: white; } #profile ul li:last-child a { border: none; } #profile ul li.nav0 a.current, #profile ul.visitormessage li a:hover { background-color: #0575f4; color: white; } #profile ul li.nav1 a.current, #profile ul.aboutme li a:hover { background-color: #d30000; color: white; } #profile ul li.nav2 a.current, #profile ul.adopts li a:hover { background-color: #8d01b0; color: white; } #profile ul li.nav3 a.current, #profile ul.friends li a:hover { background-color: #FE4902; color: white; } #profile ul li.nav4 a.current, #profile ul.contactinfo li a:hover { background-color: #Eac117; color: white; } </style> Code: [Select] <?php if($filename == "profile"){ ?> <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js'></script> <script src="js/tabs.js"></script> <script> $(function() { $("#profile").organicTabs(); }); </script> <? } ?> Please help... i need help trying to get this delete feature to work its not deleting from the database (by the way i took out my database names and passwords at the top of the file) is it possible someone could help me, ive been working on this for like a week and cant figure out the problem. thanks! you can email me at spr_spng@yahoo.com picture 2.png is showing what it looks like Code: [Select] <?php $host="localhost"; // Host name $username="username"; // Mysql username $password="password"; // Mysql password $db_name="database_name"; // Database name $tbl_name="table_name"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name"; $result=mysql_query($sql); $count=mysql_num_rows($result); ?> <style> /*table affects look of the whole table look */ table { margin-left: auto; margin-right: auto; border: 1px solid #330000; border-collapse:collapse; width:70%; border-width: 5px 5px 5px 5px; border-spacing: 1px; border-style: outset outset outset outset; border-color: #330000 #330000 #330000 #330000; border-collapse: separate; background-color: #330000; #800517 f535aa #330000 school color #9A0000 school color2 #991B1E school color3 #CCCC99 school color4 #9A0000 } /*th is table header */ th { text-align: left; height: 2.5em; background-color: #330000; color: #FC0; font-size:1.5em; } /*td is table data or the cells below the header*/ td { text-align: left; height:1.0em; font-size:1.0em; vertical-align:bottom; padding:10px; border-width: 5px 5px 5px 5px; padding: 8px 8px 8px 8px; border-style: outset outset outset outset; border-color: #9A0000 #9A0000 #9A0000 #9A0000; background-color: #CCCC99; -moz-border-radius: 0px 0px 0px 0px; } </style> <table width="400" border="0" cellspacing="1" cellpadding="0"> <tr> <td><form name="form1" method="post" action=""> <table width="400" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td bgcolor="#FFFFFF"> </td> <td colspan="4" bgcolor="#FFFFFF"><strong>Pick Which Rows you want to delete, Then press delete.</strong> </td> </tr> <tr> <td align="center" bgcolor="#FFFFFF"><strong>Id</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>Name</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>Lastname</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>Email</strong></td> <td align="center" bgcolor="#FFFFFF">delete</td></tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td bgcolor="#FFFFFF"><? echo $rows['id']; ?></td> <td bgcolor="#FFFFFF"><? echo $rows['name']; ?></td> <td bgcolor="#FFFFFF"><? echo $rows['lastname']; ?></td> <td bgcolor="#FFFFFF"><? echo $rows['email']; ?></td> <td align="center" bgcolor="#FFFFFF"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $rows['id']; ?>"></td> </tr> <?php } ?> <tr> <td colspan="5" align="center" bgcolor="#FFFFFF"><input name="delete" type="submit" id="delete" value="Delete"></td> </tr> <? // Check if delete button active, start this // edited if($delete){ for($i=0;$i<$count;$i++){ $del_id = $checkbox[$i]; $sql = "DELETE FROM $tbl_name WHERE id='$del_id'"; $result = mysql_query($sql); } // if successful redirect to delete_multiple.php if($result){ echo "<meta http-equiv=\"refresh\" content=\"0;URL=delete_multiple.php\">"; } } mysql_close(); ?> </table> </form> </td> </tr> </table> Hi, I am adding "active_filter", "passive_filter" classes to links based on regex pattern coming from the URL: Line 46: https://github.com/laanes/product_filtering/blob/master/APF_URL.php The function gets called on line 89 in he https://github.com/laanes/product_filtering/blob/master/boxes/advanced_product_filtering_box.inc.php You can see it in action he http://www.swanseatimber.co.uk/shop/hafele/brand_281.html by clicking on a category on the left, under the heading "Filter Your Results". The clicked category gets a green background because of the added "active_filter" class. When you click again, it will get "passive_filter" class and the products are not filtered any more. The problem: When moving to other pages by using the pagination at the top of the product results, the class doesn't get added. Therefore, you can't remove the filter because function creating the href on line 72 in he https://github.com/laanes/product_filtering/blob/master/APF_URL.php and the function clearing all filters on line 100 in he https://github.com/laanes/product_filtering/blob/master/APF_URL.php both fail. What's interesting - when selecting a filter, moving to the next page, clicking in the browser url bar and hiting enter(hard reload i think?), the problem disappears and you can play with the filters again. I really hope you find a minute to look into it and help me. Ok, I am a complete noob when it comes to php. I am slowly learning it but I turned to youtube for a tutorial on a registration/login page. I found a good tutorial http://www.youtube.com/watch?v=ngqeWUIDlnk&feature=channel but for some reason my php is NOT working. I have it exactly the way he does but it wont echo anything or work at all. The login page worked great in his tutorial. What do I have wrong? I cant figure it out. Please help! echo "<h1>Register</h1>"; $submit = $_POST['submit']; $fullname = strip_tags($_POST['name']); $username = strip_tags($_POST['user']); $password = strip_tags($_POST['password']); $verifypassword = strip_tags($_POST['verifypassword']); $date = date("Y-m-d"); if ($submit) { if($fullname&&$username&&$password&&$verifypassword) { password = md5($password); verifypassword= = md5($verifypassword); } else echo "Please fill in all fields!"; } Code: [Select] <html> <form action='register.php' method='POST'> <table> <tr> <td>Full Name:</td> <td><input type='text' name='name'></td> </tr> <tr> <td>Username:</td> <td><input type='text' name='user'></td> </tr> <tr> <td>Password:</td> <td><input type='password' name='password'></td> </tr> <tr> <td>Verify Password:</td> <td><input type='password' name='verifypassword'></td> </tr> </table> <p><input type='submit' name='submit' value='Submit'></p> </form> </html> $last = mysql_query("SELECT MAX('id') FROM comments WHERE submittedby='$username'"); can any1 help me? Hi guys, I have an update page where users can update their information, i have a different update page which works fine with almost the same code, but this one wont update anything. it does show the data but it wont update it, can u help please? <?php session_start(); include ("../../global.php"); //welcome messaage $username=$_SESSION['username']; echo "$username"; $query=mysql_query("SELECT id FROM users WHERE username='$username'"); while($row = mysql_fetch_assoc($query)) { $user_id = $row['id']; } $ref=$_GET['reference']; if (isset($_POST['register']) && $_POST['register']){ $title = addslashes(strip_tags($_POST['title'])); $update=mysql_query("UPDATE msg SET title ='$title' WHERE reference='$ref'"); } ?> <html> <head> </head> <body> <form action='edit-msgs.php' method='POST' enctype='multipart/form-data'> Title:<br /> <input type='text' name='title' id='title' value='<?php $getdata = "SELECT title FROM msg WHERE reference='$ref' AND referal_id='$user_id'"; $result = mysql_query($getdata); $row = mysql_fetch_assoc($result); echo $row['title'];?>'><p /> <input type='submit' name='register' value='Update'> </form> </body> </html> For some reason this wont work.. Index is jsut returned blank ... Hmm Index.php : <?php include("http://www.website.com/cookie.php"); ?> Cookie.php: <?php if (isset($_COOKIE["background"])) $background = $_COOKIE['background']; else $background = " bgcolor='#FFFFFF'"; ?> It works perfectly if I just enter the code without using a include ... Any idea why I cant get the order by to work? $res = mysql_query ("SELECT COUNT(*), LEFT(`comment`, 3) AS truncated from comments where navn='$rows[navn]' AND adresse='$rows[adresse]' ORDER BY time desc" ) or die(mysql_error()); why cant I get this to echo? something so simple i dont understand what im doing wrong. can i simply not beable to display a sql timestamp with out converting 2011-12-19 14:57:45 Code: [Select] <?php $ban3 = "SELECT date FROM banned WHERE id = '".mysql_real_escape_string($_SESSION['user_id'])."'"; $ban2 = mysql_query($ban3) or die(mysql_error()); $ban1 = mysql_fetch_array($ban2); $pop = $ban1['date']; echo $pop; ?> Test code test.php Code: [Select] <script type="text/javascript"> $(document).ready(function(){ $("#sub").click(function(){ $("#test").load("sub.php"); $.get("sub.php", { uid: $("#sub").attr('uid') }); }); }); </script> <a href="#" id="sub" uid="1">Sub</a> <div id="test"> </div> sub.php Code: [Select] <?php $id = $_GET['uid']; echo $id; ?> I am trying to load a file after clicking the href which has an extra attribute so i can query the database with it, however the get method seems to be not working, it works on other pages though. Error message i get Quote Notice: Undefined index: uid in C:\xampp\htdocs\sub.php on line 2 I have a php page which is ran after a form is posted from the previous page. I am having trouble getting the SQL strings to work. When the page is ran online there is no WSOD or error message but the tables in my database are not being updated. Any help with this would be greatly appreciated.
Attached Files
payment.php 1.79KB
4 downloads well, i have a hosting site and i enter via cpanel,(just in case it matters) and i am trying to use the mai() function but it won't work.. :S this is my code Code: [Select] <?php $to = "pato.llaguno@gmail.com"; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; if (mail($to, $subject, $body)) { echo("<p>Message successfully sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); } ?> the output is Message successfully sent! but i don't get any mail in the adress specified :S It works other then the fact it won't go to another page to see results. <?php // Get the search variable from URL $var = @$_GET['q'] ; $trimmed = trim($var); //trim whitespace from the stored variable // rows to return $limit=10; // check for an empty string and display a message. if ($trimmed == "") { echo "<p>Please enter a search...</p>"; exit; } // check for a search parameter if (!isset($var)) { echo "<p>We dont seem to have a search parameter!</p>"; exit; } //connect to your database ** EDIT REQUIRED HERE ** mysql_connect("localhost","username","password"); //(host, username, password) //specify database ** EDIT REQUIRED HERE ** mysql_select_db("database") or die("Unable to select database"); //select which database we're using // Build SQL Query $query = "select * from the_table where 1st_field like \"%$trimmed%\" order by 1st_field"; // EDIT HERE and specify your table and field names for the SQL query $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); // If we have no results, offer a google search as an alternative if ($numrows == 0) { echo "<h4>Results</h4>"; echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>"; echo "<p><a href=\"http://www.google.com/search?q=" . $trimmed . "\" target=\"_blank\" title=\"Look up " . $trimmed . " on Google\">Click here</a> to try the search on google</p>"; } // next determine if s has been passed to script, if not use 0 if (empty($s)) { $s=0; } // get results $query .= " limit $s,$limit"; $result = mysql_query($query) or die("Couldn't execute query"); // display what the person searched for echo "<p>You searched for: "" . $var . ""</p>"; // begin to show results set echo "Results"; $count = 1 + $s ; // now you can display the results returned while ($row= mysql_fetch_array($result)) { $title = $row["1st_field"]; echo "$count.) $title" ; $count++ ; } $currPage = (($s/$limit) + 1); //break before paging echo "<br />"; // next we need to do the links to other results if ($s>=1) { // bypass PREV link if s is 0 $prevs=($s-$limit); print " <a href=\"$PHP_SELF?s=$prevs&q=$var\"><< Prev 10</a>  "; } // calculate number of pages needing links $pages=intval($numrows/$limit); // $pages now contains int of pages needed unless there is a remainder from division if ($numrows%$limit) { // has remainder so add one page $pages++; } // check to see if last page if (!((($s+$limit)/$limit)==$pages) && $pages!=1) { // not last page so give NEXT link $news=$s+$limit; echo " <a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 >></a>"; } $a = $s + ($limit) ; if ($a > $numrows) { $a = $numrows ; } $b = $s + 1 ; echo "<p>Showing results $b to $a of $numrows</p>"; ?> Hi, I am not sure why but my script is not working. Choose a post is not working http://beta.cwuforum.com/stock/tech.php Code: [Select] <?PHP $idofp = $_REQUEST['bida']; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Ryan Weekly</title> <style type="text/css"> body { background-color: #E3E5E2; } </style> </head> <style type="text/css"> <!-- body { font-size:12px; font-family:Verdana, Arial, Helvetica, sans-serif; } div#wrapper { width: 80%; background-color:#FFFFFF; margin-top: 50px; margin-bottom: 50px; margin-left: auto; margin-right: auto; padding: 0px; border: thin solid #000000; } div#header { padding: 15px; margin: 0px; text-align: center; } div#nav { width: 25%; padding: 10px; margin-top: 1px; float: left; border: thin solid #000000; } div#main { margin-left: 30%; margin-top: 1px; padding: 10px; border: thin solid #000000; } div#underhead { padding: 15px; margin: 0px; border-top: thin solid #000000; } { ul.nav a:hover, ul.nav a:active, ul.nav a:focus { /* this changes the background and text color for both mouse and keyboard navigators */ background: #6F7D94; color: #FFF; } .content ul, .content ol { padding: 0 15px 15px 40px; /* this padding mirrors the right padding in the headings and paragraph rule above. Padding was placed on the bottom for space between other elements on the lists and on the left to create the indention. These may be adjusted as you wish. */ } /* ~~ The navigation list styles (can be removed if you choose to use a premade flyout menu like Spry) ~~ */ ul.nav { list-style: none; /* this removes the list marker */ border-top: 1px solid #666; /* this creates the top border for the links - all others are placed using a bottom border on the LI */ margin-bottom: 15px; /* this creates the space between the navigation on the content below */ } ul.nav li { border-bottom: 1px solid #666; /* this creates the button separation */ } ul.nav a, ul.nav a:visited { /* grouping these selectors makes sure that your links retain their button look even after being visited */ padding: 5px 5px 5px 15px; display: block; /* this gives the link block properties causing it to fill the whole LI containing it. This causes the entire area to react to a mouse click. */ text-decoration: none; background: #8090AB; color: #000; } ul.nav a:hover, ul.nav a:active, ul.nav a:focus { /* this changes the background and text color for both mouse and keyboard navigators */ background: #6F7D94; color: #FFF; } /* ~~ The footer ~~ */ .footer { padding: 10px 0; background: #6F7D94; position: relative;/* this gives IE6 hasLayout to properly clear */ clear: both; /* this clear property forces the .container to understand where the columns end and contain them */ } /* ~~ miscellaneous float/clear classes ~~ */ .fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */ float: right; margin-left: 8px; } .fltlft { /* this class can be used to float an element left in your page. The floated element must precede the element it should be next to on the page. */ float: left; margin-right: 8px; } .clearfloat { /* this class can be placed on a <br /> or empty div as the final element following the last floated div (within the #container) if the #footer is removed or taken out of the #container */ clear:both; height:0; font-size: 1px; line-height: 0px; } --> </style> <body> <div align="Left"> <p><img src="indexp.png" width="728" height="90" /></p> </div> <div id="underhead"> <form id="bida2" name="form1" method="post" action="tech.php"> Choose Post: <label for="id"></label> <select name="id" id="bida"> <option value="ad1">Google Chrome Netbook </option> </select> <input type="submit" name="send" id="send" value="View" /> </form> </div> <?php include("menu.php"); ?> <div id="main"> <?PHP if (empty($idofp)) include ("canoncamera1.php"); if ($idofp == ad1) include ("chromenetbook.php"); ?> </div> Ryan Weekly 2009 - 2011 (May 11, 2011 at 6:00PM Is our 3 Year anniversary!) </body> </html> Hi guys I have this code, where it gets clicked from an email and then compares the tmp password etc and updates the new password in md5 format. I have been trying to find the issue why it doesnt update the password but i couldn't can u help me to find out why? Please note all the db field names are correct in the code below. thanks in advance <?php include ("include/global.php"); include ("include/function.php"); $code = $_GET['code']; if (!$code){ Header("Location: forgotpassword.php"); } else { if (isset($_POST['reset']) && $_POST['reset']) { $myemail=$row['email']; $mycurrentpass=$row['currentpass']; $mynewpass=$row['newpassword']; $myrepass=$row['repassword']; // $getcurrentinfo=mysql_query("SELECT email,password FROM users WHERE email='$myemail'"); while($row = mysql_fetch_array($getcurrentinfo)) { $currentemail=$row['email']; $currentpass=$row['password']; } // $newpassword = md5($mynewpass); $repeatpassword = md5($myrepass); if($myemail==$currentemail&& $currentpass==$mycurrentpass) { if($newpassword==$repeatpassword) { $updatepass=mysql_query("UPDATE users SET password='$newpassword' WHERE email='$myemail'"); } else {echo "Information provided are not correct, please try again with correct information";} } else {echo "Information provided are not correct, please try again with correct information";} } } ?> <html> <head> <script type="text/javascript" src="/js/jquery.js"></script> <script type="text/javascript" src="/js/jquery.validate.js"></script> <script type="text/javascript" src="/js/jquery.pstrength-min.1.2.js"></script> <script type="text/javascript"> $(function() { $('.password').pstrength(); }); $(document).ready(function(){ $("#form").validate({ rules: { email: { required: true, email: true } } }); }); </script> </head> <body> <fieldset> <form action='' method='POST' id='form'> <p>Enter Your Email: </p> <p> <input type='text' name='email' class="required"></td> <p>Enter Your Temporary Password: </p> <p> <input type='text' name='currentpass' class="required"></td> <p>Enter Your New Password: </p> <p> <input type='text' name='newpassword' class="password"></td> <p>Repeat Your New Password: </p> <p> <input type='text' name='repassword' class="required"></td> </table> </p> <p> <input type='submit' name='reset' value='Submit' id='form'> </form> </fieldset> </body> </html> Hi I have the code below when users firget their password, they fill forrgot password form and an email will be sent to them which directs them to a page where (code below) they can reset their password. When i fill the form I get the msg it says password has been changed however it wont change it in database. I have checked the code, current entries in database etc but still it wont change the password. Can u please what im doing wrong? <?php include 'global.php'; $account_reference = $_GET['code']; echo "$account_reference"; if (isset($_POST['resetpassword']) && $_POST['resetpassword']) { $email = addslashes(strip_tags($_POST['email'])); $username = addslashes(strip_tags($_POST['username'])); $password = addslashes(strip_tags($_POST['password'])); $newpasswordnomd = addslashes(strip_tags($_POST['newpassword'])); $repasswordnomd = addslashes(strip_tags($_POST['repassword'])); $code = addslashes(strip_tags($_POST['code'])); $getdata=mysql_query("SELECT * FROM users WHERE username='$username' AND email='$email' AND code='$code'"); while($row = mysql_fetch_array($getdata)) { $got_username=$row['username']; $got_email=$row['email']; $got_ref=$row['code']; $got_pass=$row['password']; } $newpassword = md5($newpasswordnomd); $repassword = md5($repasswordnomd); if($password==$got_pass) { if ($email==$got_email) { if ($username==$got_username) { if($newpassword==$repassword) { $resetpass=mysql_query("UPDATE users SET password='$repassword' WHERE email=='$email' AND username=='$username'"); echo "Your Password has been reset"; } else {echo "Your New Password and Repeat Password do not match";} } else {echo "Your Username does not match our records";} } else {echo "Your Email does not match our records";} } } ?> <form action='' method='POST' enctype='multipart/form-data'> <input type="hidden" name='code' value="<?php echo "$account_reference";?>"><p /> Email: <br/> <input type="email" name='email'><p /> Username: <br/> <input type='text' name='username'><p /> Password: <br/> <input type='text' name='password'><p /> New Password: <br/> <input type='text' name='newpassword'><p /> Repeat New Password: <br/> <input type='text' name='repassword'><p /> <input type='submit' name='resetpassword' value='Update'> |