Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. dunno what your intentions are, but it would be a lot easier to just do : foreach($_GET as $key => $val) { echo "$key : $val <br/>"; } Though you should definitely sanitize your vars no matter what (your method or mine or any).
  2. the target host needs to be set to allow outside connections, as well. You have to specify the allowed host's IP through cpanel or on command line or wherever.
  3. That's because you forgot the .com on the other urls. Also, are you wanting to record only those 3 pages, or any page= ? Or anywhere on your site? because depending on the answer to those questions, you can reduce that down to one LIKE or even take them all out and just use the last condition (the timestamp)
  4. WHERE file LIKE WHERE to WHERE
  5. ermm...either you misunderstand me or else I misunderstand you. Okay for example, if I were to click on the following link: http://www.somesite.com/index.php?page=blah Inside index.php I could then do this: echo $_GET['page']; and it would echo 'blah'. Variables passed through the url are accessed through the $_GET array. You are already making use of the $_GET array in your script, based on what you said in your OP. So I don't really understand why I'm explaining this to you...unless that isn't your script and you're tryin' to mess around with it.
  6. Maybe he only has trouble understanding Indians. Or more likely, he was just giving an example. I don't think he was being rude at all. People are way too sensitive these days. Anyways, wrong forum. Moved.
  7. Why not make a column in your user's table called currentlyAt or something and whenever a user loads a page, it takes the $_GET['page'] var and puts that value in their row and then base your query to show where users are, off currentlyAt?
  8. last post 09.09.07. today is 10.23.08. That's over a year.
  9. well you wanted pointing in a direction to start. I think you should start with writing the script so that you have something to actually run every 2 hours. Once you have your script, google how to run a cron job.
  10. Sure, start off with some basic database handling.
  11. die("Goodbye, cruel world!");
  12. Well it sounds like you have a solid battle plan. Break it down and do it step by step. Basic database handling, logging time last logged in, run a cron job on the script to execute every 2 hours. So hop to it sir. If you get stuck on some coding let us know, we'll try to help you out. If you are wanting someone to write it for you, make a post in the freelance forum making an offer.
  13. You have a while loop that assigns results to a var and you have for loop that displays it. While you will need to assign the results to a var if you want to use it somewhere else, there's no reason not to get rid of the for loop and echo out the data there. As far as accessing the data in your $dataArray array: since you used a mysql_fetch_assoc, you would use the column names from your db table as the keys in your array. For example, you would do this: echo $dataArray[0]['User']; // user in first row echo $dataArray[0]['Email']; // email in first row echo $dataArray[1]['User']; // user in 2nd row echo $dataArray[1]['Email']; // email in 2nd row Or you could loop through it or whatever. What needs to be put in your value='' in your form really depends on how you run your loop and what exactly you're wanting to put in your form.
  14. Umm, no...he wanted to know how to track threads he did NOT post in. And anyways, if you want to track the topics you HAVE posted in, instead of going to your profile and clicking on all your posts, just click on the Show new replies to your posts. link at the top of the page.
  15. An employee at the data center that houses the servers went crazy and destroyed all the servers and then committed suicide. Freaky stuff. Anyways, so we lost everything and had to start over.
  16. Well...mysql_real_escape_string will prevent most sql injection attacks, yes. But it is just as effective if not better to specifically filter your data by using your own conditions and regexes. For instance, if you have this: $allowed = array('red','yellow','blue','green'); $color = (in_array($_GET['color'], $allowed))? $_GET['color'] : 'red'; $sql = "select * from table where color = '$color'"; using mysql_real_escape_string or trim or any other thing would be superfluous. If the user tries to enter in something besides the values in the $allowed array, it will simply assign the default. Same principle as with the pagination. You are expecting a valid integer in a certain range. If you make sure it's a valid integer within a certain range, doing anything else is not needed. But on the other hand, if you rely solely on built-in functions to do things, you are putting your trust in things that could have bugs found in them that may not yet be known. As a matter of fact, I a while back found this article that shows how sql injection is, in fact, possible, even if you use mysql_real_escape_string.
  17. Script also makes sure you don't try to enter non-existent pages. I am kind of interested to know what "they" say about it being vulnerable. I'm not a security expert, but I'm pretty sure it should hold up, as is.
  18. Pass it as a session variable.
  19. $_GET['currentpage'] is the only outside variable the script does anything with, and this code validates it: // get the current page or set a default if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) { // cast var as int $currentpage = (int) $_GET['currentpage']; } else { // default page num $currentpage = 1; } // end if It checks if it's there. It checks if it's numeric. It even casts it as an integer. This will make any injection or xss attack through it impossible. If someone told you the script is vulnerable, it's not from the pagination.
  20. oh. So then you're probably assigning imagecreatefrompng or something to $im, which creates an image resource. You would then normally do something with that resource and eventually use other functions to actually output an image to the browser or to a file or whatever. So I guess you need to explain what it is you're trying to pass through the url and what it is you're trying to do overall, and show some code. As far as your actual question earlier about the difference between resource id and resource id #2: there is none. When you echo it, it shows the label for what $im is: a graphic resource, and it's id number. But when you pass it through the url, #2 gets parsed. That is,, through the url, # is looked at as an html anchor tag.
  21. Okay first off, you should not be basing your outer loop off a solid number like 14, because if your query returns less than 14 you will end up getting errors from your fetch_object. Whatever limit you want to set on the results should be in the query string itself, and you should put your fetch_object inside the outer loop like so: while($row=mysql_fetch_object($result)) { // rest of code here } Also, you have your table tag inside the loop. That's sure to cause you some aesthetic troubles. As far as your actual problem: Your infinite loop is being caused by using the same variable $i for your inner loop as you are in your outer loop.
  22. It's because you queried your database and the results were returned to $im. $im is the result source for your query. You have to actually pull the data out of the result source, using one of several functions, such as mysql_fetch_array.
  23. Just pass the array as an argument... $array = array (1,2,3,4,5); function something($array) { print_r($array); } something($array);
  24. GET method is where you pass a var=value through the URL like so: page1.php echo "<a href = 'page2.php?foo=bar'>page2</a>"; page2.php <?php echo $_GET['foo']; // output: bar ?>
×
×
  • 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.