Jump to content

Zane

Administrators
  • Posts

    4,362
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Zane

  1. } else { echo "Incorrect Password! "; echo "The Password you typed came back as: $user_input_crypt it should have been: $password"; } } else { unexpected $end almost..pretty much always means you're either missing a bracket or have an unnecessary one someowhere EDIT: now that I look back..you have quite a few missing brackets..
  2. put this line here while ($vbulletin->db->fetch_array($stats)) { echo "", print_r($stats), "\n"; switch ($stats['feedback_rating']) { If the array is empty it's because your MySQL statement isn't retrieving anything, which is why I moved this to MySQL...because most likely you have something wrong with your SQL EDIT: then again..this is vbulletin code and you may just have the API usage wrong. You probably have to attach the vbulletin_fetch_array to a variable the same as you do mysql_fetch_array so something like while ($row = $vbulletin->db->fetch_array($stats)) { switch ($row['feedback_rating']) {
  3. When you get that error it means you need to do this $result=mysql_query($query) or die(mysql_error()); it will tell you why $result is not a valid mysql result resource
  4. well that part was also running your loop $num=mysql_numrows($result); [...] while ($i now you don't have a $num to be greater than $i Also..there is a tag for displaying code
  5. mysql_numrows should be mysql_num_rows
  6. $sql = "DELETE FROM pins WHERE id = {$row['id']}";
  7. $result = mysql_query("SELECT pin FROM pins ORDER by id DESC") or die(mysql_error()); // You echo it once by not using a loop in the first place //while($row = mysql_fetch_array($result)) // { echo $row['pin']; echo " "; // }
  8. You already have a thread on this here http://www.phpfreaks.com/forums/index.php/topic,270770.msg1277702.html#msg1277702
  9. then why would you loop through all of them? just echo it once.
  10. SELECT pin FROM pins ORDER by id DESC
  11. SELECT MAX(id) as highest FROM pins
  12. (.*)\s ???
  13. UPDATE la_items SET cost = 1 Also, wrong board.
  14. It's not that you HAVE to use ids...I'm just saying that it is the best route to go. There are 80,000 users or more here do you think we query the database by name? No..we'd be idiots to do that. You set the id in your table to autoincrement for a reason. Say in your table you have row 539... this is user John. Imagine you had 2000 users and you want to ban John for some particular reason. Well what do you do if there are 28 more users with the same username...I guess they're all screwed huh. You can put the same scenario into perspective when you're changing the stats for people. The proper way to do it is to say...user 539 is banned...doesn't matter what his name is. And no you wouldn't have all these numbers memorized or anything because you have PHP, HTML and CSS to thank for making these aesthetically pleasing buttons for deleting/banning/editing users at a mouse click. I'm done ranting now..I guess I'll post you something useful. $sql = "update mdark_warrior SET active = 0 WHERE username = '{$_SESSION['userName']}';"; $sql .= "update scouts SET active = 0 WHERE username = '{$_SESSION['userName']}';"; $sql .= "update knights SET active = 0 WHERE username = '{$_SESSION['userName']}';"; $sql .= "update fdark_warrior SET active = 0 WHERE username = '{$_SESSION['userName']}';"; $result = mysql_query($sql); //Poof...characters disabled This should work for you.. but if it's the ID route you're looking for I would just get this project working for now the way you have planned and you will soon realize what I was talking about...at which point you can start a new topic.
  15. pretty much your entire solution will revolve around this function http://us2.php.net/file_exists you may even possibly find a copy and paste answer in the comments area EDIT: If not that function, then this one will be it http://us2.php.net/manual/en/function.is-dir.php
  16. Problem one: put the script at the top of page Problem two: it's $_SERVER['REMOTE_ADDR'] not $REMOTE_ADDR
  17. well first of all..you actually have to be storing the userID in those tables to begin with. from what I understood to begin with you have the usernames themselves in the table. So querying the table for characters where the userID .. is whatever...will give you nothing. Also you are searching in the wrong column anyway...assuming you actually did have the userID in there update mdark_warrior SET active = 0 WHERE id = '$_SESSION[userID]' that will search for the character id NOT the userID..should be like it was update mdark_warrior SET active = 0 WHERE username = '$_SESSION[userID]' and the username column should hold nothing but IDs... if you'd checked out that normalization article that redarrow pointed out you'd be pretty well informed already. and Thirdly, it's $_SESSION['userID'] not $_SESSION[userID]
  18. right here in your login page it's that easy
  19. yes..you have it correct although instead of using the username itself as a clause..I would use the id of the user...that keeps things from exploding like say if two users had the same username.. I don't know what's in your $_SESSION array so I just made up a random number. I recommend putting the id of the user in the $_SESSION and doing everything off of that instead of the verbatim TEXT username...but it's your project
  20. case 'logoff': unset($_SESSION['loggedIn']); array_push($error, 'You were logged off.'); //Right here..... // // / // // // ///////// break;
  21. Yeah.. you'd have to re-write your whole project probably to fix it up the way I described. (Perhaps wait until version 2) But the active column is still doable..you'll just have to issue 4 update queries on log out rather than 1. update mdark_warrior SET active = 0 WHERE user = 56 update scouts SET active = 0 WHERE user = 56 update knights SET active = 0 WHERE user = 56 update fdark_warrior SET active = 0 WHERE user = 56 you can do it all in one query too so. no need calling mysql_query four times something like $sql = "update mdark_warrior SET active = 0 WHERE user = 56;"; $sql .= "update scouts SET active = 0 WHERE user = 56;"; $sql .= "update knights SET active = 0 WHERE user = 56;"; $sql .= "update fdark_warrior SET active = 0 WHERE user = 56;"; $result = mysql_query($sql); //Poof...characters disabled note the double semicolons .... 56;"; yes..they are necessary
  22. That's why it would be best to have another character type table... how different can the fields be for 4 types? post the schema's for them for the hell of it. You can always program in scripts that will check to see whether or not so many characters are active..like I said before. Logically you'd query the database like this SELECT * from characters WHERE user = 39 //For user number 39 you could even GROUP BY type and you probably have to join in the types table to get all the other stuff too. INNER JOIN types ON characters.type = types.id so that when you're looping through mysql_fetch_array...everything is already organized the way you need it to be. To disable all the active characters you'd just send an update query on logoff..something like this UPDATE characters SET active = 0 WHERE user = 39 just add that somewhere along with everything else that happens whenever the user clicks "Log out" it would be a little different doing it on browser closing because you'd be at the mercy of people having Javascript enabled..although you seem to be relying on JS alot anyway so that point doesn't really hold water. But to do it you'd have another AJAX script that runs of of onUnLoad() and you'd put it in the body tag. Read up http://www.livelearncode.com/archives/11 http://www.zachleat.com/web/2008/04/22/dont-let-the-door-hit-you-onunload-and-onbeforeunload/
  23. gloating (about nothing) isn't going to help anyone redarrow
  24. You've got four tables doing the job of 1...or 2 maybe select id, identity, username from scouts where username select id, identity, username from knights where username select id, identity, username from fdark_warrior where username select id, identity, username from mdark_warrior where username If it were me doing this project I would have one characters table with---- -id -identity -username -type -active Now you could also add another table for your character types just in case you ever decide to add more types..then you'd store the character type id in the above table schema .. under type So your character types table would be -- -id -type Now I haven't read through all your code, but hopefully I'll explain this well enough for you to figure it out. Or maybe you've already caught my idea when I introduced the 'active' column in the characters table. Using this simple binary data you can select all of a particular user's active characters...their types..and anything else you want to put in there. Just have the database updated when they select that Choose button. Create another AJAX function to do it.
×
×
  • 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.