Jump to content

requinix

Administrators
  • Posts

    15,067
  • Joined

  • Last visited

  • Days Won

    414

Everything posted by requinix

  1. What is the name of the actual file containing the code? And did the .htaccess thing work for you or not?
  2. ... 1. salesperson_delete.php has nothing to do with admin_subfile_delete.php. Just because "id" in one file means a salesperson doesn't mean "id" anywhere must only be a salesperson. 2. You know you can put whatever you want in the query string, right? You could call the sales ID "sales_id" or "sid" or "potato", it doesn't matter.
  3. Most people don't want to download attachments and fire up a PHP editor to read someone's code online. In the future, help us all out by posting the code right in the post itself. (I've done it for you this time.) // if not set, send back to agreement echo ' <a href="https://www.macreon.com.au/WholesaleAgree.php"></a>';All you're doing here is outputting a link to the agreement page. You have to actually force the user to go back to it, and you do that with code like // if not set, send back to agreement header('Location: WholesaleAgree.php', true, 307); exit;This tells the browser to redirect, the 307 means it's only a temporary redirect, and the exit prevents the rest of the code from executing. Keep in mind that code that uses header() like this must happen before there is any output whatsoever. [edit] Oh. You're also missing a check for the acceptance flag in the session. All you look at now is the form - gotta check both of them.
  4. I take it your example desired output is demonstrating the total_population_change value and should show that for all dates (except the first per player) and not just those two? There's a pure SQL solution to this, and I think it would work more nicely than the PHP alternative, so I'll move the thread over there.
  5. Is awr100-1322.php an actual PHP file? Or what? What is the file with this $CODE stuff?
  6. You get the values from AJAX and then put them into the , right? Or something like that? Somehow you start with the array like you first posted and then turn it into the list. Whatever the method is, you do have both the label and the value so you should be producing list items like label
  7. The value of that metals thing is the value of the selected option. So "-" or "bronze" or "silver" or "gold". If you want the value to be a number then make the value be a number. <option value="0">-</option> <option value="5">bronze</option> <option value="10">silver</option> <option value="15">gold</option>
  8. You would test it by... putting the stuff in place, writing code, and seeing if it works. Did you put that stuff in a .htaccess file in your website directory? Is your local setup and your web host configured to allow using .htaccess files at all? Easy way to check that second question is to put asdfstuff in the .htaccess and seeing what happens to your site: if your site loads then .htaccess isn't being used and you need to deal with that, and if not then remove that stuff because it is being used.
  9. If you have Apache and shared hosting (ie, you don't control the system) then yes, you'd use a .htaccess with mod_rewrite rules. Looks like RewriteEngine on # only match if the requested file doesn't exist RewriteCond %{REQUEST_FILENAME} !-f # only match if the requested directory doesn't exist RewriteCond %{REQUEST_FILENAME} !-d # rewrite 123.php to page.php?id=123 and stop processing RewriteRule ^(\d+)\.php$ page.php?id=$1 [L]Though the two RewriteConds probably aren't even necessary.
  10. So you're doing 400+ API calls on this page? It's going to be slow - no way around that. Even if each call took only 100ms (which includes sending the request, the server processing data, and then it sending the response back), that's 40 seconds to do all of them. Why do you need so many galleries' data at once?
  11. Well, I can't speak to WordPress stuff (I hate it) so... Use your browser to find out what is happening when that AJAX request gets fired off. For example, Chrome has a Network tab in the inspector/console thing (hit F12) that can show you not just that the request was sent, but what data was sent and what the server returned. Odds are you're getting a 403 Forbidden (may be a WP configuration issue) or a 404 Not Found (using the wrong URL) response from the server, and neither of those will trigger the success callback.
  12. Sure. It's called URL rewriting. What actually happens is requests for /654321.php transparently (user doesn't know) get rewritten to something like /page.php?code=654321. Then you can get your $CODE from the $_GET array.
  13. "Can't get" what? Does the AJAX not happen? Does it happen but the data doesn't get deleted in the database?
  14. Your input is named "user_file" but your code (which I'm sure has other problems besides this) is looking for "uploadedfile".
  15. $zooelements is an array. You can't just stick an array into a string like that. Do you mean to store the JSON? Use json_encode() to turn the modified array back into a JSON string, then escape it (with mysql_real_escape_string()) before sticking it, quoted, into the SQL.
  16. foreach ($output['data'] as $item){
  17. "Perfectly" spaced how? 20 isn't a nice number like 19 (hexagonal) or 25 (square).
  18. As the error message says, you still have a duplicate. You added a "1" to the ID but somehow there's another element that got the change. Is the XML being generated dynamically? Have you checked the XML in string form to see where "timesheet-wrapper1" appears?
  19. Forms can't natively do that. 1. Put a redirect in picture.php so people accidentally going to that URL get redirected to the correct one automatically. (Which only works for GET requests.) 2. Put some Javascript in your form that will alter the form information as it gets submitted. As in you can set the target to /album/picture.php normally in the HTML, then use Javascript to change the action to /lang/album/picture (getting the lang from the form data) when it's submitted. My take on the second half: <form action="/album/picture.php" method="get" data-rewrite-action="/:lang/album/picture"> $(function() { $(document).on("submit", "form[data-rewrite-action]", function() { var elements = this.elements; this.action = $(this).data("rewrite-action").replace(/:([a-z-]+)/i, function($0, $1) { return encodeURIComponent(elements[$1] ? $(elements[$1]).val() : $1); }); }); }); POC For the www thing, RewriteCond %{HTTP_HOST} !=example.com RewriteRule ^ http://www.example.com%{REQUEST_URI} [L,R=301](replacing example.com with your domain)
  20. An addon for Visual Studio to support PHP? VS.PHP is the best one I've seen, but when I checked it a couple years ago it didn't work very well. If you mean IDEs in general and not just Visual Studio then yeah, there are many.
  21. Whatever XML you're transforming, or maybe the XSLT you're using, has some duplicate ids in it. That is not allowed. Each ID must be unique in the entire XML document.
  22. So being able to handle white makes things awkward: it's not a hue range but both a saturation (how much color bleeds in) and lightness (grayscale) range. Playing around, it looks like good ranges are - White is S=[0.0,0.1] L=[0.9,1.0] - Gray is S=[0.0,0.1] L=[0.1,0.9] - Black is S=[0.0,0.1] L=[0.0,0.1] I figure* the best approach would be deciding what HSL ranges constitute each color, then doing some quick math to convert each component between the current color's ranges and the desired color's ranges. For example, you might say that red is H=[330,15] (meaning both [330,360] and [0,15]) S=[0.1,1.0] (so not to overlap with the grayscale) L=[0.1,1.0]; mapping a value which you've determined to qualify as "red" onto "white" could be h[white] = h[red] // hue unchanged s[white] = (s[red] - S[red,min]) / (S[red,max] - S[red,min]) * (S[white,max] - S[white,min]) + S[white,min] // convert 0.1<s[red]<1.0 to 0.0<s[white]<0.1 l[white] = (l[red] - L[red,min]) / (L[red,max] - L[red,min]) * (L[white,max] - L[white,min]) + L[white,min] // convert 0.1<l[red]<1.0 to 0.9<l[white]<1.0 That's a linear transformation - something polynomial (eg, bell curve, sigmoid) would get different results but it would take more planning and math. * I know math and the RGB and HSL colorspaces, but beyond that it's just educated guesswork.
  23. Well, the class name is "row" + number, right? So "row" + numberThen use jQuery to do the search. Remember to put a period before the class name, otherwise you'll be telling it to look for a element.
  24. That technique works well (for images that aren't too large, at least) but only works because it recolors by shifting the hue of each relevant pixel (it being much easier to do this using HSL than with RGB). It's not so much a mapping of blue to green but a mapping of a range of green colors of some size to a range of blue colors of the same size. So you have to figure out two ranges: what you want to recolor from and what you want to recolor to. If all you have to work with is "blue" or "green" then you can guess by picking the midpoint of the hue range for that color and adding/subtracting roughly 60° *. Those will affect the if condition and the colorshift value, so it's probably best to make those all parameters. function recolorPants(hueStart, hueEnd, colorshift) { // correct hueStart and hueEnd for out-of-range values, both <0 and >=360 hueStart = (360 + (hueStart % 360)) % 360; hueEnd = (360 + (hueEnd % 360)) % 360; if (hueStart < hueEnd && hue > hueStart && hue < hueEnd || hueStart > hueEnd && (hue > hueStart || hue < hueEnd)) {- If the color you're starting with is RGB, convert it to HSL and use the hue value.- I suggest "bold" colors for the color choices; you can convert hue=0..360°, saturation=100%, lightness=50% to get them. * Hue ranges from 0 to 360°, and with 6 basic colors that's 60° per color and ±30°. But there's also overlap - consider how teal is greenish and blueish. So you bump that limit out to, say, 50-60° instead.
  25. Cool. Are you storing them as strings or numbers? Or to be more clear, is the data type for the column in the table a string type or a number type?
×
×
  • 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.