Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. Yep, definitely. You could write a C extension to use raw sockets and construct whatever packets you wanted. I was interpreting the original post as asking if there was already an extension to do it. Though now that I read again, I think he was asking for ANY way. While looking on google I noticed that perl has an extension for raw sockets, using the C functions. Actually it's relevant here whether it's windows or linux .. given that this post is from february, i'm not expecting clarification from the original poster all that soon
  2. Er, I don't know of any either Ones that don't demand money, that is. Some things in life just aren't free. The approach at my workplace is just to buy more hardware to make the scripts go faster..
  3. The other thing you can do is to echo out the query before executing. It's likely that the problem is not with mysql syntax, but rather with differing php configurations causing the query to be corrupted.
  4. How do you define "symbol" ? Everything visible on the keyboard that is not alpha or numeric?
  5. What error message does mysql_error() show you?
  6. What if you disable it in php.ini? Apache may be too late.
  7. I doubt it will help much. Checking for errors occurs naturally as a by-product of parsing. If you want to avoid parsing overhead, I would go with a PHP compiler.
  8. Just to clarify a few things - Yes, SYN is part of TCP. UDP is stateless - To forge your ip address you need root access I don't think there's any existing API in php for doing this. At the C level, you need to use a raw socket to construct your UDP packet with a fake source address.
  9. You'll need to remember the image somehow. Do you want a random image per user per hour? If so, use sessions to remember the image. If you want a random image to be the same for all users for an hour, you will need to store the selected image elsewhere, perhaps in a file or a database.
  10. This will give you matching output: function comfibonacci2($limit, &$fib){ //using recursive function if ($limit <= 1){ $fib[] = 1; $fib[] = 1; return 1; } $result = (comfibonacci2($limit-1, &$fib) + comfibonacci2($limit-2, &$dummy)); $fib[] = $result; return $result; } I'm using a dummy accumulator for the second argument, as we only need one copy of the array. Not the neatest solution but it works.
  11. To sort character column foo as an integer ORDER BY foo + 0 DESC ought to work.. You can also use CAST(foo AS UNSIGNED)
  12. Hmm, my suggestion was for avoiding browser timeout. It's difficult to tell which problem you have, browser timeout or server timeout. Which browser are you using?
  13. SELECT 'foo' AS tablename, foo.* FROM foo UNION ALL SELECT 'bar' AS tablename, bar.* FROM bar Normally union will eliminate table names, so you need to record them yourself. UNION ALL does not eliminate duplicates, which is what you want in this case, because duplicates cannot exist when you've added the "foo" and "bar" column.
  14. Here's one solution: set_time_limit(0); ob_implicit_flush(); for ($i = 0; $i < 100; $i++) { print "$i seconds<br>"; sleep(1); } Try that out .. if it works, you can similarly print out messages to avoid browser timeout. Keep in mind that it's not very efficient to send individual messages like this (it takes more network bandwith this way). It may not work if you have mod_gzip active.
  15. Change your queries to look like this: $result = mysql_query("SELECT ...") or die(mysql_error()); That will give you an error message if your query fails.
  16. It IS in compliance, because php code is not part of the document. It's part of the php source script.
  17. Is it this ? If it is, just use $_POST instead of $HTTP_POST_VARS. $_POST is the new, hip and stylish variable anyway, so you might as well switch over.
  18. Fenway is saying that join and inner join are identical. The reason he said "implies" is because JOIN means INNER JOIN, and never any other type of join. You've probably noticed that the results are identical for every example you try. That's because they ARE identical for every example in the universe
  19. That depends on your site. If you have a lot of traffic on pages that don't use sessions, then you're probably better off starting them explicitly on those pages which do need them.
  20. Have you tried printing out your queries? Instead of $query = mysql_query("INSERT INTO $table1 (userName,userPassword,userMail,userQuestion,userAnswer) VALUES " ."('$username','$pass','$email','$question','$answer')"); use $sql = "INSERT INTO $table1 (userName,userPassword,userMail,userQuestion,userAnswer) VALUES " ."('$username','$pass','$email','$question','$answer')"; print "About to execute $sql<br>"; $query = mysql_query($sql);
  21. Log files are faster and easier to write to the end of, and to read in their entirety. But databases are faster and easier to query, and to write anywhere except the end. So it depends on what you want to do with the data. If you intend to query it on various conditions, you should probably use mysql. If you intend to just write to the end and read it as a text file, you should use a log file.
  22. There is probably some other hidden character that trim() doesn't deal with. Try this diagnostic script: <?php $file = fopen($p.".txt", "r"); $j = 0; while(!feof($file)) { $j++; print "Line $j: " . urlencode(fgets($file)) . "<br>"; } ?> What that will do is it will show you the ascii values of any invisible characters. After running this, post an extract of the output (or full output if it's small) and we can see what needs doing. For this script, don't use trim().
  23. Have you tried printing out your query from the php script (after all variable substitutions are done), copy and paste and run it manually?
×
×
  • 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.