Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. You can sort using helper functions, like this: function cmp_name($a, $b) { return stricmp($a['name'], $b['name']); } usort($array, 'cmp_name'); This particular comparison function does a case insensitive comparison of the names in the array, and sorts in that order.
  2. btherl

    "Flipping"

    Sounds like your requirements are quite tight. It is 100% not possible in php, as php runs on the server. What you want (flipping an image) must be done in the client's browser. The only way I can imagine it could be done without javascript is to have an iframe that constantly refreshes itself, each time refreshing to the other image. The iframe and the image itself could be set as cacheable, so hopefully the browser would not be making http requests every time. Other than that, javascript, flash, java, activex can all do it on the client side.
  3. select * from subscribers left join sub_lists on subscribers.id = sub_lists.subscribers_id where sub_lists.subscriber_id is null There you go You can use any column from the right table when checking for null from a left join .. I use the joining column for convenience. The reason is that the left join fills in nulls for all columns of the right table when there is no match.
  4. You can do this: if ( (isset($_POST['submit']) && $_POST['zipd']!="") || $something_else) {} The new lines are not necessary, I just added them for clarity. I also removed some unnecessary brackets. PHP knows that && and || should always seperate comparisons.
  5. IMHO, specifying things which are the default anyway (such as public) is good practice. It adds to the documentation, and ensures your code will run correctly even if the defaults change. It also helps catch bugs, as you may not always be correct in what you assume the default to be.
  6. What is the intention of the double ?? and the *? in your regexp? I tried your regexp without and I get this: $regexp = "<a\s[^>]*href=(\"?)([^\" >]*)\\1[^>]*>(.*)<\/a>"; $str = "<a href=\"blah.html\"></a>"; print "<pre>"; if (preg_match("|$regexp|", $str, &$matches)) { var_dump($matches); } Output: array(4) { [0]=> string(24) "<a href="blah.html"></a>" [1]=> string(1) """ [2]=> string(9) "blah.html" [3]=> string(0) "" }
  7. Well, even though this is a php help forum, you can post your java code here and we can take a look.. don't expect too much though
  8. Then you have two options: 1. Keep your ftp files and script files totally seperate. Use a script to create new directories, instead of using ftp. If the script creates a directory, then it will have full permissions in that directory. 2. Ask your hosting provider how you can change permissions on your files.
  9. Not 100% sure what you want here.. but maybe something like this: $state_arr = explode("|\n", $state); # if "|\n" is the delimineter $lookup_tab = array(); $i = 0; foreach ($state_arr as $s) { list($country, $code, $name) = explode(':', $s); print "$i, $country, $code, $name\n"; $lookup_tab[$code] = $name; $i++; } print_r($lookup_tab); I haven't actually stored the numerical index because I'm not sure where you want it. But that code should demonstrate how to make it available.
  10. Does the browser report any javascript errors? If you post the full HTML for the page with the problem (or give us a link) I'm sure someone can work out what's wrong. The fact that the window never opens makes me think it's a syntax error with the javascript, triggered by certain characters.
  11. Something like this? $name = state_to_name($state); if ($name === null) { $name = $state; } Assuming your state_to_name() returns null if no match is found
  12. This sounds like a java issue to me.. if you can view your php script in a browser, then it's definitely a java issue.
  13. The website you linked to uses two divs side by side for the columns. You can copy from their source to do it the same way. Is it the formatting you are more interested in, or the SQL to fetch the data?
  14. The SCRIPT user is 99.. the FTP user is 32149. As long as you do not mix ftp and script data together, you will have no problem. If you have shell access, you can use that to change permissions on your files so that user 99 can modify user 32149's files.
  15. What happens if you try to view an image directly, rather than through the script? Also, it might be a good sanity check to test that $files is not empty.
  16. You can use sessions. Then the data is stored on the server, and tracked using a cookie. Nothing is visible in the URL. Another option is using post instead of get. Post data is also not visible in the url.
  17. Is it anything to do with case? You can use ILIKE for case-insensitive matching.
  18. Whether or not you need shell access depends on what you are trying to do.
  19. If you have shell access, login and type "id" (without the quotes), then hit enter. Then post the output here. I am guessing you will be userid 32149
  20. Try adding name="submit" to your submit control. If that doesn't work, add var_dump($_POST) before your if statement, so you can see exactly what is being posted.
  21. There is your problem. The directory you are trying to write to is owned by user id 32149, but your script is running as user id 99. Your script does not have permission to write to that directory. Do you have shell access on that machine?
  22. Please post the full output
  23. Can you run the following script: print "<pre>"; print "I am user id " . posix_getuid() . "\n"; $cwd = getcwd(); print "I am in $cwd\n"; $stats = stat($cwd); printf("$cwd is mode %o, owned by {$stats['uid']}, group {$stats['gid']}\n", $stats['mode']);
  24. What directory are you trying to make?
×
×
  • 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.