Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. Cool.. if you want to make it releaseable, go ahead :)  c_array.php is the test script I used.  It runs through each of the features and most of the combinations in which they can be used (I'm sure I missed out some edge cases). I've run it with memory debugging on and it doesn't leak .. but I still don't fully understand all those zend macros for freeing zvals :)  I just copied from other code and kept trying different combinations until it worked. I notice that I have broken the rule of placing the prototype on a single line in the function comment .. I just read about that the other day. And I hope you enjoy interpreting my pointer casts as much as I enjoyed writing them :P
  2. [url=http://www.dynamicdiscord.com/BrianStuff/c_array.tgz]Here[/url] it is .. I included everything in the archive so it's rather large.  The .so file is in there.
  3. I can send you the code if you want.  I've been devloping it in a php-5.2.4 source tree, so I'm not sure if it'll work with php 4 as well.  It doesn't use any php 5 features but maybe it uses some internal macros not available in php 4 or something like that. The odds of it getting packaged are slim .. there's a whole lot of standards you have to meet to get into PEAR.  PECL might be easier though.. hmm.  They look more forgiving :)
  4. It's been followed and it works (without leaking memory and without seg faulting).  But it has not been packaged as an extension.  I haven't got time to do that part of it.
  5. Oh .. take a close look at this line: $ouput = base64_encode($input); Step 1 was working fine, that's what I tested .. I did not test steps 2, 3 and 4 beacuse you said those were ok.
  6. It works fine for me here, using linux and "PHP 4.4.4-8+etch4 (cli) (built: Jun 30 2007 21:02:54)" What OS and php version are you using?
  7. I think you need this query: $query = "SELECT OrderNum, Status, OrderStam, OrderAgil, OrderSpellDmg, OrderHeal, OrderScrollAgil, OrderScrollStr, OrderStamBad FROM orders WHERE ID = '".$ID."' AND OrderNum = '".$myrow['OrderNum']."'"; Doesn't it strike you as odd that you never use $myrow? Actually you could simplify it all by making that query above your query for the while loop itself. But for now I would get it working as it is first. All of it can be done in a single query (the counting, the looping and the fetching of data).
  8. Can you post your current code with the modifications?
  9. You are re-using the $result variable inside the while loop.
  10. Can you post the rest of the script?
  11. The advice you have there is for 3xx redirects using a Location: header, not for links. All browsers can handle relative links, but there may be some which cannot handle relative Location: headers (though I have never come across one that doesn't). In other words, there's no need to use absolute URIs in your code. You only need it when you call header("Location: ..."), and even then you don't need it for the major browsers.
  12. I rather suspect that when you try to remove the it has already been converted to another encoding. Otherwise the str_replace() would pick it up. That fits in with seeing a funny character in the database. In which case you either need to know what that funny character is so you can remove it (try printing urlencode($txt) to see the value in hex) or you need to remove it while it's still encoded as the string " ". Or alternatively, you can tell whichever process is converting the entities that you don't want it to convert them. I would guess it's SimpleXML converting them, as XML parsing typically involves entity conversion. I don't know how (or if you can) to do that with SimpleXML.
  13. How about this: $str = str_replace(' ', '', $str); $str = trim($str); Then you've removed all nbsp, and also any spaces from the start and end. Another approach is $str = preg_replace('|[^0-9]|', '', $str); That removes anything that is not a digit.
  14. Can you post the script? Or a smaller script that replicates the problem.
  15. If you're splitting on '"' only, you might want to try explode() instead. I don't know why split() isn't working there.
  16. Try calling trim() on your password value to remove any newline at the end. To check for such invisible characters you can do print urlencode($line[1]) . "<br>"; A hidden character such as newline will show up url encoded, like "%0a"
  17. The simplest way would be to use sessions. session_start(); if (empty($_SESSION['lock'])) { $lock = randStr(); $_SESSION['lock'] = $lock; } Then $_SESSION['lock'] will retain its value throughout multiple calls to your script.
  18. You could do worse than wikipedia. That article explains just about everything you need - the SYN, SYN/ACK, ACK sequence for establishing a session, how to calculate the checksum, and the header structure. As for how to do the generation in php, I would start with an empty string and add the fields in order. The checksum calculation is where you're most likely to slip up I would imagine. The wikipedia article links to the RFC which explains the checksum in detail. If you're not sure on what goes into particular spots in the header, you really should read more about how TCP works until it's clear. I can answer specific questions.
  19. Is it the interface with the OS or the actualy generation of packet data you need help with? There's a good example for how to interface with the OS here[/code], as well as generation of a simple UDP packet. If it's generation of the packet, then pack is a useful function. It'll translate your integers into bytes. PHP strings can contain arbitrary binary data, so you can put everything into a simple string.
  20. Do you have some kind of ordering on "Regional", "Long Haul", "Medium Haul" and "Short Haul"? If so make an associative array like this: $rank_order = array( 'Regional' => 0, 'Long Haul' => 1, 'Medium Haul' => 2, 'Short Haul' => 3, ); Then your comparisons are just numerical comparisons instead of listing out all the cases. Does that fit or do I misunderstand what your code is doing?
  21. I'm still seeing that some of your included files are in the "includes" folder, but others are not. This is likely to cause trouble. It's also likely to be a problem that config.php is included from each file. You can replace it with this: require_once('include.php'); That will include the file once only, no matter how many times it is run from different places. It will also stop the script if the file cannot be found ("include" will continue on failure, but "require" will stop). It's very rare that you actually want your script to continue running if it can't find an included file.
  22. Try including a different file that does something simple, like an echo. If that works, then it's something that your specific included script is doing. And it could be the multiple session_start() or database connections. You can try commenting out pieces of code until you find what is the problem.
  23. The answer is here. So no that is not correct, static methods can be accessed through an instance.
  24. Try `read` instead of read (add backticks around 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.