Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. Yes you can use & in front of a function. But very few people do because it usually doesn't make sense. The only situation I can think of when return by reference makes sense is when dealing with arrays. The examples in Drezard's post, there seems to be no reason why you would return a mysql result be reference.
  2. The solution is to move the "$state = $_REQUEST['state']" line to BEFORE where you include the state list. That will make the variable available for use by state_list Edit: And remove $state2 = $_REQUEST['state2']. It's not needed, as $state2 comes from the included file, not from data received by the script.
  3. There's an official guide here The most common problem is that OO code has had some big changes. Traditional style code will work fine from php 4 to php 5 as long as it does not rely on any libraries that became obsolete. You should also make sure the new php installation has any libraries you need.
  4. Do you have a new php installation now with register_globals set to off? If so, you will need to either set register_globals on, or add the following line at the top of get_members.php: $state = $_REQUEST['state']; You may need to modify other scripts in a similar way. The rule is that data coming from get or post must be accessed by either $_GET['varname'], $_POST['varname'] or $_REQUEST['varname'] ($_REQUEST contains both $_GET and $_POST data).
  5. Are you looking for a bit array or byte array? The value is probably shorter because the result is not fixed width. Eg, if you convert hex "10" then you will get binary "10000", not binary "00010000". You can pad it afterwards. Also heed the warning on the base_convert() description - if you use this function for values greater than your int size (probably 32 bit) then it will use floating point, and you will lose precision. So you must do the conversion in small enough chunks.
  6. You'll need to use ajax .. basically, you can have javascript call another php script to execute the code. You can find quite a few tutorials in google. Edit: Or if you don't mind losing the current page, you can redirect the page with javascript. That's simpler.
  7. You need the encode() function mentioned here. You will need to choose how to encode the bytea data, as bytea has a greater range of characters than text.
  8. It's done by this function. There's some examples in the comments on that page.
  9. A few things - You don't unset mysql query results, you call mysql_free_result() on them. You can unset them as well but that won't really affect memory usage. - Your function is quite long A simple way to save memory is to put more work into functions. A nice side-effect of this is that function local variables are freed automatically when the function finishes. - Are you using memory_get_usage() or the windows alternative for measuring? It makes a difference, as memory_get_usage() only tells you memory allocated by php itself and not by C extensions. The alternative method tells you ALL allocated memory.
  10. Try this: $hex = $argv[1]; function hex_to_bytes($hex) { $intval = base_convert($hex, 16, 10); $mult = 1; $bytes = array(); while ($intval > 0) { $bytes[] = $intval % 256; $intval = floor($intval / 256); } $bytes = array_reverse($bytes); return $bytes; } $bytes = hex_to_bytes($hex); print "{$argv[1]} => " . implode(',', $bytes) . "\n"; It's written to run as a CLI script, but you can extract the function.
  11. Can you show us the script that doesn't work? In any case, it's better that you use CURL to do your requests if you simply want to ping. Curl lets you set a timeout as well.
  12. How does it not work correctly? It tells me the current season is fall, which sounds about right for the northern hemisphere.
  13. Ok. Keep in mind that what I'm about to say is based on my experience with Debian, not Ubuntu. It may work, it may not. Anyway, this package is the one that in debian links php to apache: ii php4-cgi 4.3.10-19 server-side, HTML-embedded scripting languag There is a similar php5 version, php5-cgi. But looking at your original post, the error was triggered in mod_auth_digest.so. That's not part of php. You could try just commenting out that line and see what happens ..
  14. Does your html pass validation? There's no need to pass a super strict validation, just enough to ensure that there's no unmatched tags or similar problems. The reason I suspect this is that firefox and IE have different algorithms for dealing with invalid HTML. It's possible that firefox fixed broken html in one way, and IE fixed it in another way.
  15. It's not the combination that matters. The problem you're having is a parse error, meaning that your code doesn't make sense to php. That's what I fixed in the code I posted. Once the parse error is fixed, then you can look at fixing the logic. In other words, the error you're seeing is php saying "Sorry, I can't understand your script, I'm not even going to TRY running it"
  16. Try this: mail("myemail@myemail.com.com", $subject, $message, $from, $organization_name); mail($email,$confirmationSubject,$confirmationBody.$body,"From: myemail@myemail.com\r\n");
  17. Youko's right, it's just not possible with today's technology. If he challenged you to decode it then he either doesn't know that, or he's playing around Given that he made an md5 hash of a randomly generated string, I would guess he doesn't know how difficult it is to decode ..
  18. There may be another package like php5-cgi or similar. Can you run "dpkg --list | grep php" and show the output? Here's what I get on my system (which is debian, but probably has similar packages): $ dpkg -l|grep php ii php4 4.3.10-19 server-side, HTML-embedded scripting languag ii php4-apd 0.4p2-5 PHP code execution profiler and debugger ii php4-cgi 4.3.10-19 server-side, HTML-embedded scripting languag ii php4-cli 4.3.10-19 command-line interpreter for the php4 script ii php4-common 4.3.10-19 Common files for packages built from the php ii php4-curl 4.3.10-19 CURL module for php4 ii php4-dev 4.3.10-19 Files for PHP4 module development ii php4-domxml 4.3.10-19 XMLv2 module for php4 rc php4-gd 4.3.10-16 GD module for php4 ii php4-imap 4.3.10-19 IMAP module for php4 ii php4-ldap 4.3.10-19 LDAP module for php4 ii php4-mcal 4.3.10-19 MCAL calendar module for php4 ii php4-mcrypt 4.3.10-1 MCrypt module for php4 ii php4-mhash 4.3.10-19 MHASH module for php4 ii php4-mysql 4.3.10-19 MySQL module for php4 ii php4-pear 4.3.10-19 PEAR - PHP Extension and Application Reposit ii php4-pgsql 4.3.10-4 PostgreSQL module for php4 ii php4-recode 4.3.10-19 Character recoding module for php4 ii php4-snmp 4.3.10-19 SNMP module for php4 ii php4-xslt 4.3.10-19 XSLT module for php4
  19. You could do the check every time someone makes a new post. And the check only needs to be done for one user if you use that approach.
  20. Was there anything else you changed around that time that could have caused the ISE (internal server error) ? It's very unlikely that creating a cron job would have that effect.
  21. There are two ways to do this. One is to have one loop using mysql_fetch_array(), and to detect when cust_id changes. When it changes, you print out the new one and continue printing files. The other way is to have one query that fetches cust_id only, and an inner loop with a second query fetching that user's files. The first way should be faster, the second more memory efficient (if memory is an issue). In either case, you can't do a second loop inside another loop using the same query result. That is what is causing the problem.
  22. Please provide your test code as well.
  23. Do you see it in the HTML source when viewed in the browser? If so, it's a problem in your page.php script. FYI, your description is a little vague. What does "does not pull it up" mean? Do you see nothing in the iframe? Do you see the wrong content?
  24. Here is the solution: \pset pager always This line can go in .psqlrc if you want it all the time.
×
×
  • 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.