Jump to content

LostAndConfused

Members
  • Posts

    34
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

LostAndConfused's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. right, it's checking the sessions.php file to see if your an admin or not. So how do I do it inside this page's function?
  2. Hi i'm working on one long script for a discussion forum which has functions at the bottom. At the top of the page i'm including a file called sessions.php but when I use "$session->isAdmin()" inside the functions at the bottom it gives me this error... Fatal error: Call to a member function on a non-object in /hsphere/local/home/newppg/pdo.newppg.com/MsgBoard/mboard.php on line 657 So my question is, how can i find out if the person is an admin (by assessing sessions.php) from inside one the functions on that page?
  3. anybody on right now that can check this out for me?
  4. http://NewPPG.com/temp%20files/my%20site%20files.zip There's a zip with all the relevant files inside... i really hope somebody can get it solved for me cause it's a little important. Not to mention i'm dieing to know what i'm doing wrong. EDIT: ive included the useredit.php file which works 100% but shows it's using the same functions and setup, just without the use of a form.
  5. nope I just recenty made the whole updateAvatar function but like i said before, It's basically the same as the last parts of the editAccount function. ??? i'm so confused... ???
  6. yes that is part of the account edit page which allows members to edit their account info. all of that stuff works perfectly which uses the same basic functions. I just showed it to show everything from there on works so when I made the updateAvatar function, I just used the same basic setup from that page. Thats why i'm confused at why it's not working the same way. Oh by the way using that database echo edit you guys recommended, when updating my account info, it shows this instead now... Query was: UPDATE users SET email = 'OutlawCecil@gmail.com' WHERE username = 'General_Leo' Query was: UPDATE users SET class = 'Paladin' WHERE username = 'General_Leo' Query was: UPDATE users SET major = 'Earth' WHERE username = 'General_Leo' Query was: UPDATE users SET minor = 'Wood' WHERE username = 'General_Leo' Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/newppg/pdo.newppg.com/include/database.php:158) in /hsphere/local/home/newppg/pdo.newppg.com/process.php on line 186
  7. // The Upload Part if(is_uploaded_file($_FILES['file']['tmp_name'])) { $session->updateAvatar[$_FILES['file']['name']]; move_uploaded_file($_FILES['file']['tmp_name'],$uploaddir.'/'.$_FILES['file']['name']); } print "Your file <b>".$_FILES['file']['name']."</b> has been uploaded successfully. [<a href=\"useredit.php\">My Account</a>]"; } else { print "Your file <b>".$_FILES['file']['name']."</b> is not one of the aloud filetypes. [<a href=\"Upload.php\">Back</a>]"; } ?> That's the part on my upload page where it uploads it. You can see where i'm trying to update the mysql string. Then sessions reads that function which is where this part comes in... function updateAvatar($subavatar){ global $database; //The database connection $database->updateUserField($this->username,"avatar",$subavatar); }
  8. what do you mean show you? you want me to send you the php pages involved? EDIT: Just double checked all names and everything. spelling is all correct.
  9. ok if i include it on the upload page, it gives me this error so i'm assuming that means it's being ran twice thus not needed on the upload page. Fatal error: Cannot redeclare class mysqldb in /hsphere/local/home/newppg/pdo.newppg.com/include/database.php on line 14
  10. yeah it doesn't show any text that didn't used to be there... if it helps any, this is using the same database function to edit other areas of the mysql database and the edit form does work. (sorry it's a little long) function editAccount($subcurpass, $subnewpass, $subemail, $subclass, $submajor, $subminor, $subavatar){ global $database, $form; //The database and form object /* New password entered */ if($subnewpass){ /* Current Password error checking */ $field = "curpass"; //Use field name for current password if(!$subcurpass){ $form->setError($field, "* Current Password not entered"); } else{ /* Check if password too short or is not alphanumeric */ $subcurpass = stripslashes($subcurpass); if(strlen($subcurpass) < 4 || !eregi("^([0-9a-z])+$", ($subcurpass = trim($subcurpass)))){ $form->setError($field, "* Current Password incorrect"); } /* Password entered is incorrect */ if($database->confirmUserPass($this->username,md5($subcurpass)) != 0){ $form->setError($field, "* Current Password incorrect"); } } /* New Password error checking */ $field = "newpass"; //Use field name for new password /* Spruce up password and check length*/ $subpass = stripslashes($subnewpass); if(strlen($subnewpass) < 4){ $form->setError($field, "* New Password too short"); } /* Check if password is not alphanumeric */ else if(!eregi("^([0-9a-z])+$", ($subnewpass = trim($subnewpass)))){ $form->setError($field, "* New Password not alphanumeric"); } } /* Change password attempted */ else if($subcurpass){ /* New Password error reporting */ $field = "newpass"; //Use field name for new password $form->setError($field, "* New Password not entered"); } /* Email error checking */ $field = "email"; //Use field name for email if($subemail && strlen($subemail = trim($subemail)) > 0){ /* Check if valid email address */ $regex = "^[_+a-z0-9-]+(\.[_+a-z0-9-]+)*" ."@[a-z0-9-]+(\.[a-z0-9-]{1,})*" ."\.([a-z]{2,}){1}$"; if(!eregi($regex,$subemail)){ $form->setError($field, "* Email invalid"); } $subemail = stripslashes($subemail); } $field = "class"; //Use field name for class if(!$subclass || strlen($subclass = trim($subclass)) == 0){ $form->setError($field, "* class not entered"); } else{ /* check class names*/ $subclass = stripslashes($subclass); $subclass = strtolower($subclass); if(($subclass != "paladin") && ($subclass != "wizard") && ($subclass != "assassin") && ($subclass != "priest")){ $form->setError($field, "* Must be paladin, wizard, assassin, or priest"); } else { if($subclass == "paladin") $subclass = "Paladin"; if($subclass == "wizard") $subclass = "Wizard"; if($subclass == "assassin") $subclass = "Assassin"; if($subclass == "priest") $subclass = "Priest"; } } $field = "major"; //Use field name for major element if(!$submajor || strlen($submajor = trim($submajor)) == 0){ $form->setError($field, "* major element not entered. use none if you have none."); } else{ /* check element names*/ $submajor = stripslashes($submajor); $submajor = strtolower($submajor); if(($submajor != "metal") && ($submajor != "wood") && ($submajor != "water") && ($submajor != "fire") && ($submajor != "earth") && ($submajor != "none") && ($subminor != "-none-")){ $form->setError($field, "* Must be metal, wood, water, fire, earth, or none"); } else { if($submajor == "metal") $submajor = "Metal"; if($submajor == "wood") $submajor = "Wood"; if($submajor == "water") $submajor = "Water"; if($submajor == "fire") $submajor = "Fire"; if($submajor == "earth") $submajor = "Earth"; if($submajor == "none") $submajor = "-None-"; } } $field = "minor"; //Use field name for minor element if(!$subminor || strlen($subminor = trim($subminor)) == 0){ $form->setError($field, "* minor element not entered. use none if you have none."); } else{ /* check element names*/ $subminor = stripslashes($subminor); $subminor = strtolower($subminor); if(($subminor != "metal") && ($subminor != "wood") && ($subminor != "water") && ($subminor != "fire") && ($subminor != "earth") && ($subminor != "none") && ($subminor != "-none-")){ $form->setError($field, "* Must be metal, wood, water, fire, earth, or none"); } else { if($subminor == "metal") $subminor = "Metal"; if($subminor == "wood") $subminor = "Wood"; if($subminor == "water") $subminor = "Water"; if($subminor == "fire") $subminor = "Fire"; if($subminor == "earth") $subminor = "Earth"; if($subminor == "none") $subminor = "-None-"; } } if(($submajor == "-None-") && ($subminor != "-None-")){ $form->setError($field, "* you cannot have a minor without a major");} /* Errors exist, have user correct them */ if($form->num_errors > 0){ return false; //Errors with form } /* Update password since there were no errors */ if($subcurpass && $subnewpass){ $database->updateUserField($this->username,"password",md5($subnewpass)); } /* Change Email */ if($subemail){ $database->updateUserField($this->username,"email",$subemail); } /* Change Class */ if($subclass){ $database->updateUserField($this->username,"class",$subclass); } /* Change Major */ if($submajor){ $database->updateUserField($this->username,"major",$submajor); } /* Change Minor */ if($subminor){ $database->updateUserField($this->username,"minor",$subminor); } /* Change Avatar link if($subminor){ $database->updateUserField($this->username,"minor",$subminor); }*/ /* Success! */ return true; } on the upload page, it includes sessions.php and on the sessions.php page it includes database.php so is that correct or should I be calling database.php on the upload page as well?
  11. function updateUserField($username, $field, $value){ $q = "UPDATE ".TBL_USERS." SET ".$field." = '$value' WHERE username = '$username'"; echo 'Query was: '.$q.'<br />'; //<<< show us this? return mysql_query($q, $this->connection) or trigger_error(mysql_error(),E_USER_ERROR); exit; } Still no change, just saying file was uploaded successfully.
  12. you mean what GingerRobot recommended? I changed to that code and nothing happened any differently when I uploaded the file. Was it suppose to show something? EDIT : ah, let me try that real quick EDIT2: yeah nothing different...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.