Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. header('Content-Length:'.filesize($path));strlen instead of filesize.
  2. You don't have to use Beanstalk. You don't have to use S3. At the very least you can use one EC2 box for your stuff, keep all the files there, do whatever like it's just a regular server. If you need unlimited/shared storage then you can migrate to S3. If you need deployment services then you can set up Beanstalk. If you need to maintain a number of EC2 instances, like I think is what you're imagining, then you can add autoscaling and load balancing. ...no. Where did you hear that?
  3. Check the AJAX response headers to see if the cookie was actually set. If not, and you're sure that the setcookie() was executed (code is simple enough to be sure it was) then there may have been output at some point preventing the cookie from being set. Check your error log for any indication of that.
  4. Can't do a conditional JOIN like that. Join the tables regardless. Keep in mind that making categories an inner join that a matching row will be required, even if you're JOINing it against a table which is an outer join, so it should probably be a LEFT JOIN as well. If that doesn't do it, what problem are you trying to fix or what are you trying to accomplish?
  5. Does it happen every time you try to download a file? What browser?
  6. There's still something missing: code (on 1242, even) tries to use values in $q but with what you've posted nothing gets into that array. Here's what I'm thinking. $formbit should definitely be an array, that's what the documentation says. So it must be $q. I'm guessing the-- Oh, the eval...? ($hook = vBulletinHook::fetch_hook('easy_forms_view_question_start')) ? eval($hook) : false;What is the value (output it or whatever) of that $hook?
  7. Can you find the code that defines $q?
  8. What is saying that what is undefined? In your original code $this was the only thing that was actually undefined. Speaking of, what's your current code? I lost track of your changes.
  9. $c{$numero}=$_POST['c']; $m{$numero}=$_POST['m']; $b{$numero}=$_POST['b']; $n{$numero}=$_POST['n'];That doesn't match up with what you're trying to do later. Fortunately you shouldn't even be doing this in the first place: variable variables (the name of the feature you're trying to use) are almost always the wrong solution to a problem. PHP supports arrays really well in HTML. If you were to change it to while ($numberoffields < $numberofseals) { $numberoffields++; echo "<h3>SEAL $numberoffields : <input type=\"text\" name=\"seal[$numberoffields][name]\" placeholder=\"SEAL Name\"/></h3> <div style=\"margin-left: 20px;\"> Behavior :<input type=\"text\" name=\"seal[$numberoffields][behavior]\" placeholder=\"Behavior Mark\"/><br> Skills: <input type=\"text\" name=\"seal[$numberoffields][skills]\" placeholder=\"Skills Mark\"/><br> Comments: <textarea name=\"seal[$numberoffields][comments]\" rows=\"1\" placeholder=\"Comments\"></textarea></div> <br><br>";} echo "<input type=\"submit\" name=\"submit\" value=\"Submit\" />";}then you would have $_POST['seal'] as an array, and each item in the array would be another array with the name, behavior, skills, and comments as items. Get rid of the $n, $c, $b, and $m variables, use $seals=$_POST['seal'];instead, then do while($numero < $noofseals) { $numero++; echo "[li][b][color=blue]Seal [$seals[$numero][name]]:[/color][/b] [b]Behavior:[/b] [b]Skills:[/b] [b]Comments:[/b] [/li]"; }}(and you'd continue using $seals[$numero][behavior, skills, comments] however you'd like to)
  10. Type hinting. blmg2009, keep it there. It's a good thing.
  11. output started at /home/content/04/12746204/html/Digital/core/inc/init.inc.php:6Whatever is there created output and you cannot use header() if there has been output.
  12. You didn't define $this.
  13. I'm wondering if you've given a complicated description of the following: shapes = { round, cubic, cylindrical } textures = { solid, squishy } colors = { red, orange, yellow, green, blue, purple, black, white } items = { { round, solid, blue }, { cubic, squishy, white }, { round, solid, orange }, { round, solid, white } } unused shapes = { round, cubic, cylindrical } - { round, cubic, round, round } = { cylindrical } unused textures = { solid, squishy } - { solid, squishy, solid, solid } = { } unused colors = { red, orange, yellow, green, blue, purple, black, white } - { blue, white, orange, white } = { red, yellow, green, purple, black }That's just a 2D array (1D is property, 2D is value) and you can get the "unused" values with array_diff.
  14. Two separate problems. First one: use absolute paths whenever possible and reserve the include_path for external code (not bundled with the website's code). - It'd be great if you could have the URLs mirror the final, production URLs. So if the correct production path to the image is "/images/abc.png" then you should have that happening in your dev environment as well. - If you have just the one project then move all the project-name/ files into the htdocs folder and do away with the subdirectory. - If you have more than one, use separate domain names and separate VirtualHost entries for each. Then the full URLs would be (example:) http://project-name.localhost/images/abc.png. You'll need to edit your Windows hosts file for that to work, creating an entry inside it for each subdomain, but it's worth it. - In your code, $_SERVER["DOCUMENT_ROOT"] will now always point to the root of your website. You can then create absolute paths with code like require_once($_SERVER["DOCUMENT_ROOT"] . "/classes/Core.php"); The second one: it would be solved with the stuff above regarding the URLs and such. If you can't do that then it gets complicated and you have to deal with relative paths in CSS and such; right now you're using "/images/abc.png" with a leading slash and instead you'd have to do "images/abc.png" without the slash. It gets worse when you need to go up a directory or two because you'd have to use URLs like "../../images/abc.png".
  15. Is that INI file syntax? How about using something that already exists? .* would be right. How is it not working?
  16. The preg_match() will fail because the expression has an error (there's an unbalanced closing parenthesis). You should actually be getting warnings about that, and if you aren't then it means you're not set up to see error messages. Which is very bad.
  17. True, but the only way to keep that behavior is to list out every single class being used. Get the typehinting involved as soon as possible to mitigate that, but in my experience as long as you name the classes well it's not a big problem. And that's coming from someone who totally agrees with your concern about not having IDE support: with very few exceptions, like this naming convention thing, I don't write something if it can't be supported by the IDE.
  18. It's not so bad. It tries to be good. But there's an (exploitable) bug in how it deals with filenames. And checking that the file doesn't include itself is often overlooked in code like this. Yes. An array would be easiest. Code looks like <?php $files = array( 'file1', 'file2', 'dir1/file', 'dir2/file' ); if (isset($_GET['nav'])) { if (in_array($_GET['nav', $files)) { require $_GET['nav'] . '.php'; } else { require 'error.php'; } } else { require 'links.php'; }If keeping the list of valid files isn't a problem then this is the best solution: the code is only capable of including files that you allow. Without the array (or something equivalent, like filenames in a database) you have put logic into the code to make sure it only works on the right files. But if there's a bug in the logic then the security goes out the window.
  19. The nice thing about Psycho's solution is that you have a record of logins, and you can refer to that both for administrative/auditing purposes, as well as present it to the user so they can monitor their own account.
  20. 1. Depends how you generate the unique name. Should be guaranteed to be unique, not something almost unique like random numbers. 2. I wouldn't bother tracking aborted uploads or whether you were able to generate the thumbnail. If there's a problem then abort the process. 3. Don't delete stuff. Leave the image in the folder and use a column in the table to indicate live/deleted status (you could repurpose "image_status" for that). A more detailed explanation, like the actual code, database schema, and queries, can get you more detailed answers.
  21. If you used double quotes then it would have conflicted with the quotes used for the style's value. So single quotes. Or you could be clever and use " (a double quote escaped for HTML).
  22. Quickly? Maybe global. I'd probably just pass it into the function though.
  23. I'm inclined to think you're using DTB and DTB\Base incorrectly, but whatever. Since Silver is in a different namespace than DataType, you need to use either \DTB\DataType or a use to that extent. If you're still getting errors, are you sure your autoloader is set up correctly? Well, since you're putting many classes into one single file (bad practice, by the way), it's more likely that you're require_once()ing the right file(s)?
  24. It's not safe. With some trial and error and a fair bit of effort, I can construct a nav value that will include any PHP file I want. If I don't want to expend that effort, I can simply pass nav=index (or whatever name) and crash your code because the file will keep including itself until PHP runs out of stack space. I'm sure there's a simpler way. What files do you need to support? Just the current directory? Any directory? Will keeping a list of valid filenames be a problem?
×
×
  • 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.