Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. Then the .htaccess isn't being parsed. You sure you found the right AllowOverride? The vhost definition might have one of its own.
  2. The stuff you have there is completely path-agnostic. Are you sure your WAMP setup allows for .htaccess files? It may have a AllowOverride directive which tells Apache to ignore .htaccess files. Easiest way to check for this is to put random nonsense in the .htaccess and see if you get a 500 error browsing the site.
  3. In order of importance, 1. You really, really need to decide if the running time is a problem. Is this something that can run via cron instead? Can you send the email first and do the updates second? 2. Why are there 13 fields for the "pdf_url"? That screams of a poor database design and I bet you fixing that would eliminate the time problem. 3. Is this script running from a web page or the command line? It dictates what method(s) to use to run a script in the background. 4. Can the 13 potential updates be run independently of each other? Seems like it. 5. Assuming $db->VeriCek() does nothing more complicated than a SELECT you can probably run all these updates, either together or individually, with a single query. No PHP code required.
  4. The only way you could merge them into one single-dimension array would be if the texts or urls were unique, in which case you make one be the array key and the other be the value. What's wrong with a multidimensional array? It's not like they're hard to use or anything, just need another set of []s or a second loop. Actually in your case there's no need for a second loop because the inner array is a collection of individual pieces of data. foreach ($array as $id => $data) { echo "text={$data["text"]} url={$data["url"]}"; }
  5. Functions do not run in the background. You can run an entire script in the background but then you have to manage the various instances of the scripts and get them to communicate with each other.
  6. Yeah, in the actual HTML.
  7. Yes. Do you actually want the values? They don't matter if all you want to do is select them. Give this a shot yourself and see how far you get and we can help you fix any problems you come across. An easy method would be to use a selector to find all checkboxes, .each() over them, and make each one checked if it's named "customers[]".
  8. You should fix the links. The actual links themselves. In fact you must for any forms that have action=post. Otherwise you can look at the REQUEST_URI to determine if the URL they're trying has an extension. # remove .php and .html extensions RewriteCond %{REQUEST_URI} ^([^?]+)\.(php|html)($|\?.*) RewriteRule ^ %1%3 [L] # make extensions optional for any file type recognized by Apache Options +MultiViews # if the Options doesn't work then you're stuck with mod_rewrite #RewriteCond %{REQUEST_FILENAME} !-f #RewriteCond %{REQUEST_FILENAME} !-d #RewriteCond %{REQUEST_FILENAME}.php -f #RewriteRule .* $0.php [L] #RewriteCond %{REQUEST_FILENAME} !-f #RewriteCond %{REQUEST_FILENAME} !-d #RewriteCond %{REQUEST_FILENAME}.html -f #RewriteRule .* $0.html [L]
  9. PHP does not do asynchronous code. If you want to add that the complexity of this script will skyrocket. It looks like your database is very much not normalized. Are you able to change the schema?
  10. Anchors will work on anything that has an ID - doesn't have to be an element.
  11. Output the checkbox wherever you want it to be. Then attach some Javascript to its onclick so that all the name=customers[] checkboxes are checked. Are you using any Javascript framework, like jQuery or whatever else is still popular these days that isn't jQuery?
  12. Well, as far as I can tell you expect the $a=true you have at the bottom of the script to affect the if($a) you have at the top of the script. Causality doesn't work that way: define the variable first, use the variable second.
  13. The only thing possibly resembling a question that you've said is about how to redirect to the top of the page. To do that... redirect to the page. Don't do anything special. It's just a normal redirect.
  14. You could just stick the ID on the H1...
  15. If I had to choose between PixelMEDIA and PixleMedia... [edit] You best hope they don't discover you: they have a trademark on their name and could sue you for infringement.
  16. Kinda depends on those errors... If you've been upgraded from 4.x to 5.x then you might see some strict warnings - they're generally easy to fix. From 5.x to 5.3 or (gasp) 5.4 then you may see warnings about deprecated functions or settings. If the version didn't change much then it may be that the script always had errors but they were hidden from you.
  17. Use mysql_error to find out why the query you just executed failed (because that's what it did).
  18. You set $sql and then you overwrite it on the very next line.
  19. Are you allowed .htaccess files at all? If you're not sure then put random nonsense in there and see if you get a 500 trying to browse anything in the folder.
  20. chmod won't prevent this: changing the directory doesn't matter because it's just the directory and changing files doesn't matter because they're not executed (literally speaking) (probably). A few options: * Assuming you're using Apache, use a .htaccess in the folder to 403 anything that isn't an image. You can then look through access logs to find any requests for a file that 403s. <FilesMatch "\.(?!gif|jpe?g|png|other file extensions)$"> Order allow,deny Deny from all </FilesMatch> * Or you can serve up non-images as plain text (or something else) <FilesMatch "\.(?!gif|jpe?g|png|other file extensions)$"> ForceType text/plain </FilesMatch> * Other options include fixing the upload script to as to not allow non-images to be uploaded...
  21. What have you done so far? Even if it doesn't work it's better than nothing.
  22. You'd use a recursive function to turn that array into something easier to manage. Recursion isn't suitable for actually creating that output. Function takes one $argument in the form of the array you have there. It returns two pieces of information: an array with the parts of the title (ie, ["Sizes", "Colors", "Types"]) and an array of arrays containing the individual values. 0. If the $argument is empty then abort 1. If the $argument has one items then 1. Make the sole item in the $argument be the $current array 2. Make $title and $values both empty arrays Else it has more than one item so 1. Pop off the first one as the $current array 2. Call the function recursively with what is left 3. Grab the $title and $values the function returned 2. Put the $current title at the beginning of the $title array 3. Set up a $new empty array 4. Loop through each $child in the $current array 1. Loop through each $value in the array of $values 1. Since $value is just a copy, put $child at the beginning of it 2. Add the entire modified $value to the $new array 5. Return the $new array To print it out, 1. Grab the $title and $values array that the function returned 2. Because there is no comma before the & you need some special treatment to display the $title properly: 1. If there is one item then 1. Display it as is Else if there are two items then 1. Display them as "First & Second" Else there are more than two items so [*] 1. Display everything except the last two items in the array as "Item, " 2. Display the second-to-last item as "Item & " 3. Display the last item 3. Loop through each $value in the $values array 1. Display each item in $value as "[item]" with spaces between them [**] * array_slice and implode may be handy here ** implode() will make this much easier
  23. What I didn't mention was that I assume you used DES on whatever site you tried getting the real password on. Because your code will use DES. What password did you try, what did your script output, and what did the site say?
  24. If $products is an actual array (and not a Traversable object) then you can array_shift to get the first and array_pop to get the last. <?php $first = array_shift($products); $last = array_pop($products); ?> <?php if ($first): ?> <li>First: <a href="product_details.php?product_id=<?php echo $first['product_id']; ?>"><?php echo $first['product_name']; ?></a></li> <?php endif; ?> <?php foreach ($products as $row): ?> <li><a href="product_details.php?product_id=<?php echo $row['product_id']; ?>"><?php echo $row['product_name']; ?></a></li> <?php endforeach; ?> <?php if ($last): ?> <li>Last: <a href="product_details.php?product_id=<?php echo $last['product_id']; ?>"><?php echo $last['product_name']; ?></a></li> <?php endif; ?>
  25. Not really. How did the correct crypt()ed password compare with the one your script generated? Also, crypt($clearTextPassword, base64_encode($clearTextPassword)) 1. Insecure. Under normal circumstances the first two characters will be used from the base 64-encoded password as the salt, which is prepended to the output. That exposes a little more than the first character from the password. The salt should be random. 2. Buggy. Base 64 encoding results in a string consisting of characters from the alphabet a-z A-Z 0-9 plus slash equals. This guarantees that the only hash type possibly used is CRYPT_STD_DES but that type only accepts salts consisting of a-z A-Z 0-9 period slash. If the encoding produces a plus or equals in the first two characters then the salt is invalid and crypt() should (but apparently doesn't?) fail.
×
×
  • 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.