Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. http://www.robotstxt.org/wc/faq.html#nosecurity The above basically says what genericnumber1 says..
  2. Hmm.. can you clarify the sequence of events? Does it go like this: 1. Clear cookies 2. Verify that you are logged out 3. Click "Remember Me", but don't enter username and password. Click Submit 4. I am logged in! (As which user?)
  3. I suspect the problem is with your logout script. Does it clear the "remember me" cookies?
  4. There's actually a function specifically for that http://sg.php.net/manual/en/function.dirname.php Edit: In your case, it looks like you want to go 2 levels up. So just call the function twice if that's what you want. Things are messier if you want a trailing slash to be dealt with differently..
  5. If you display your queries that your script runs, then copy and paste them into phpmyadmin (or another mysql interface), do you get the output you expect? And are the queries what you expect them to be?
  6. Try looking for "geolocation" in google.
  7. The syntax is: if ($searchdata <> $w1 && $searchdata <> $w2 && $searchdata <> $w3) Computers are not that smart, so you need to specify $searchdata three times to compare it to three different things.
  8. Some examples: '|^[0-9]+|' => Match 1 or more digits (Doesn't match empty string) '|^[0-9]*|' => Match 0 or more digits (DOES match empty string) '|^[0-9]{5}|' => Match exactly 5 digits '|^[0-9]{3,5}|' => Match 3, 4 or 5 digits. '|^[0-9]?|' => Match 0 or 1 digits. Usually used to say "This character can be there or it can be missing, I don't care". Equivalent to {0,1}
  9. "I want to filter out the lowest scored item of the duplicate items" <- That's what I was looking for What you need is this, wrapped around your entire query: SELECT col1, col2, col3, max(score) AS max_score FROM (your query herhe) GROUP BY col1, col2, col3 Replace col1, col2, col3 with all the columns you want to be unique. They aren't specified in your query so I don't know what they are. You must specify them in the outer query. The column you leave out of the "group by" is score, because you're taking the maximum score. After that you can order by max_score desc, if you want the highest score first.
  10. If it's a different set in a different table, then you need a new mysql_query(). You can't use mysql_fetch_array() until you've called mysql_query()
  11. I'm not sure I understand what you need. Does your query produce something like this: id score 1 5 2 10 1 15 That is, you have the same id with different scores? And what kind of output do you expect instead of the output you are getting?
  12. Here's a bit more explanation for your original example 1. "hi" 2. "3bi" (h => 3b) 3. "3b3a" (i => 3a) 4. "60b60a" (3 => 60) 5. "650b650a" (6 => 65) 6. "6563b6563a" (0 => 63) You see, each rule is being applied in turn, not all at the same time. So you are getting multiple encryptions applied, resulting in the strange result string.
  13. I think you need to use a form rather than an href. An href will not pass on any information in input tags.
  14. That sounds like a job for "GROUP BY". Here's an example: SELECT name, sum(score) as sum_score FROM scores GROUP BY name That query will give you the sum of the scores for each name. For your situation, do you want the sum of the scores? You need to decide what "apply a score to all of those on a global level" means. You could also take the average score. The basic approach is that you "GROUP BY" the columns which are unique, and then you use an "aggregate" on the columns which are NOT unique, which is score in your case. Aggregates include sum(), avg(), count(), and many more.
  15. That's because he's exploting the fact that the encoded characters are all 2 characters long, but the decoded ones are all one character. That means that the single decoded characters will never match on one of the later runs. That's why he used chunk_pslit(). In your case, you are encoding one character into 2 chracters, so your encoded characters WILL match decoded characters. You can't use his method. You can fix it by reading the manual for strtr() and having your code use that. You will have to convert the decryption table though. $strtr_table = array(); $len = count($nec); for ($i = 0; $i < $len; $i++) { $strtr_table[$ec[$i]] = $nec[$i]; } That ought to work (not tested)
  16. str_replace() called with an array calls each substitution in sequence. Here's an example $input = '1'; $search = array( '1', '2', ); $replace = array( '2', '3', ); $output = str_replace($search, $replace, $input); print "$output\n"; Notice that the 1 gets replaced by 2, and then replaced again by 3. That's because the second replace is applied to the output of the first replace. You might want to try strtr() instead. From the manual: "strtr() will always look for the longest possible match first and will *NOT* try to replace stuff that it has already worked on."
  17. If you configure php to use that much memory, and configure your operating system to use disk when memory runs out, then you can do the processing. It may be slow, but as long as fpdf doesn't need to use all 1400M at once, it ought to work. Btw, you can configure the memory limit on one script only, either by setting it on the command line ( -dmemory_limit=1400M ) or by setting it at the start of your script ( ini_set('memory_limit', '1400M'); )
  18. A quick look on google indicates corrupted tables. Either restore from backup or use phpmyadmin to fix them. See for example: http://www.vbulletin.com/forum/showthread.php?s=776092d9c39dbef621303282096c6a59&t=87903
  19. Try this on for size.. it doesn't generate them in the order you expect though. function make_list($array, $length) { return make_list_rec('', $array, $length); } function make_list_rec($prefix, $array, $length) { $ret = array(); $append = array(); foreach ($array as $a) { $ret[] = "$prefix$a\n"; if ($length === 1) continue; # Recurse $new_length = $length - 1; $new_prefix = $prefix . $a; $append = array_merge($append, make_list_rec($new_prefix, $array, $new_length)); } return array_merge($ret, $append); } $array = array('a', 'b', 'c'); var_dump(make_list($array, 3));
  20. SELECT column, count(*) FROM table GROUP BY column ORDER BY count(*) DESC The ordering is optional of course, but that's usually the order you want. You can also add "HAVING count(*) > 1" if you want to display only values which appear more than once.
  21. unset() will free memory associated with a variable. It's only useful if you want to re-use that memory in the same request. The memory will be freed when the script finishes anyway. As for mysql_close(), again it's closed at the end of the request. You only need to close it if you have a reason to close it before the request is finished.
  22. What happens when you click the update button?
  23. If the numbers are unimportant, you can group by Value, FirstName, Surname, and simply not select the Number. The right query really depends on what you want to do with the Number column, which appears for each duplicate.
  24. Here's the very basic form: <? while (!feof(STDIN)) { $buf = fgets(STDIN); print $buf; } ?> Don't ask me about character at a time input.. I'm sure it's possible, but I don't know how to enable it
  25. If you're dealing with datetimes, you can use these: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-add
×
×
  • 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.