Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. Why go through GD? 1. Make a 1x1 transparent pixel in MS Paint or whatever, save as GIF for the small size. 2. Do echo base64_encode(file_get_contents("/path/to/pixel.gif")) and copy that. 3. Paste it in code as header("Content-Type: image/gif"); echo base64_decode("base64 encoded stuff here");
  2. mysqli_query("$conn, $deleteQuery, ");Not sure why those quotes are there, but they shouldn't be.
  3. Not sure what to say. Looks like you're doing everything right and IE is pulling the underscore out of nowhere... It still has the underscore when you save the file, right? Tried another browser?
  4. $_GET won't do that. Which is an array, by the way, not a function. You need two functions: rawurlencode and htmlspecialchars(). Applied to $file in that order. And htmlspecialchars() alone for the second $file. echo " ", htmlspecialchars($file, ENT_QUOTES), " ";That's because the filename is going into a URL, and you're putting that URL within HTML. When the browser figures out what to do when you click the link, it will HTML-decode the URL first (because it's in HTML) and then verify it is an acceptable URL (and if not, URL-encode it automatically because it's nice like that). In download.php you only look in $_GET: there will be no HTML encoding and the URL decoding happened earlier (since, being in a URL, PHP knew it must necessarily happen at some point anyways).
  5. Simply accessing a non-existent property will not fatal code unless (a) access goes through __get which fatals by itself or (b) you try to do certain types of actions with that value, such as call a method on it. Your live website should keep those 500 errors in place: displaying error messages to the user is not a good thing. Instead, check your error log, be that the Apache log or a dedicated PHP error log.
  6. I was saying that because of: (your application doesn't know the columns in the table so it has to query the metadata for them) (you say you're copying tables) (creating tables) ("many tables" and you're copying them around) (tables are changing schema on a regular basis)
  7. My first reaction is "Why are you creating so many tables?", followed by "Why doesn't your application know the table structures already?"
  8. Like a regular user. It is impossible to tell if a request comes from a real person.
  9. 1. You can start at $i=3 and skip even numbers. 2. You can stop at sqrt($num). 3. Make your function return true/false instead of outputting a string. 4. There's absolutely no need to keep track of all those $numbers: if it's divisible by $i then false, and make it return true after the loop finishes. 5. Research other methods of determining primes.
  10. As your jquery_test.php code shows, there needs to be an X-Requested-With HTTP header with the value "XMLHttpRequest". Add a curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-Requested-With: XMLHttpRequest"));
  11. They're gone. You can't get them back. Consider hiding the elements instead of completely removing them.
  12. PHP_SELF contains a portion of the URL that is pretty much exactly as the user entered it in their browser. Most of the time someone can enter in something you didn't expect and still execute your script. For example, "script.php" may be triggered with "script/foo/bar": the web server sees "script", realizes there's a matching file "script.php", and then executes it.
  13. Nah, I sighed because this question comes up a lot but it's not the easiest thing to Google for. Problem is the symptoms vary, like broken links or losing form data. And just given those symptoms it's not necessarily obvious what's wrong, and the first place you'd check (the PHP code) isn't actually where the true problem is. Just one of those things where you know the answer from experience, not from raw PHP knowledge.
  14. (sigh) You should always put quotes around attributes in HTML. If you don't do that then spaces will mess it up and you'll lose stuff. Also, PHP_SELF is not safe to use unless you wrap it in a function like htmlspecialchars(). echo "<form method='post' action='"?><?php echo htmlspecialchars($_SERVER['PHP_SELF']).'?delete=true&recordid='.$doc_folder.'&deletefile='.$file;?> <?php echo"' ><a href='/pages/download.php?file=$file'> $file </a> <input type='submit' value='delete'></form>";And what's with your opening and closing tags? You've gone crazy with them.
  15. There's only one place in your code that updates the CurrentPoints and that's in the import script. if (strtotime($date) > strtotime('2009-09-20')) { echo "-------------------------------DATE FOUND-------------------------------"; // PLAYER ONE $query = "SELECT CurrentPoints From Players WHERE PlayerID = $playerIdOne"; $result = $mysqli->query($query); $resultRow = $result->fetch_array(MYSQLI_BOTH); $currentPoints = $resultRow['CurrentPoints']; //$pointsEarned = CalculatePoints($numberOfTeams, $finish); $pointsEarned = CalculatePoints($genderId, $divisionId, $numberOfTeams, $finish); $currentPoints += $pointsEarned; $query = "UPDATE Players SET CurrentPoints = $currentPoints WHERE PlayerID = $playerIdOne"; $result = $mysqli->query($query); // PLAYER TWO $query = "SELECT CurrentPoints From Players WHERE PlayerID = $playerIdTwo"; $result = $mysqli->query($query); $resultRow = $result->fetch_array(MYSQLI_BOTH); $currentPoints = $resultRow['CurrentPoints']; //$pointsEarned = CalculatePoints($numberOfTeams, $finish); $pointsEarned = CalculatePoints($genderId, $divisionId, $numberOfTeams, $finish); $currentPoints += $pointsEarned; $query = "UPDATE Players SET CurrentPoints = $currentPoints WHERE PlayerID = $playerIdTwo"; $result = $mysqli->query($query); }(most of the interesting variables came from a row of the CSV file that the script is loading) However what you sent me doesn't have any recent CSV files to look at. I assume you have them around somewhere? Also, loading the Matt Mueller page you linked earlier gives different results than before: now it's 154 points vs 179 actual, which is a 25 point difference and points to either the June 14th or August 23rd tournament. So what has changed with the site and/or data in the last couple days?
  16. It's not a static method so you'll need an instance of the class. $myclass = new MyClass();Then use the -> arrow operator. $myclass->repairCategories(/* whatever value for $parent_id you want here */);
  17. if(sqrt($hold) % 1 == 0){It's not safe to use modulus with non-integer numbers. Try something more like if(floor(sqrt($hold)) == ceil(sqrt($hold))){[edit] But you have another problem: sqrt(1) == 1.
  18. I'm alright with you PMing me a link to download the code. I'll be looking to see how and when that CurrentPoints gets updated, then for a reason why that might not have happened. But I'm also working so it won't be very quick.
  19. It doesn't know the dates: CurrentPoints is just a number and it seems it wasn't updated properly when those September 6th figures were entered into the database or whatever. Were there any other dates after that? The question goes to whether updating stopped working entirely or whether it was just that one date that had problems.
  20. You have points being tracked in two different locations and they've started disagreeing with each other: Players.CurrentPoints (163) and the individual points per game (179). That's a 16 point difference, which happens to be the number of points scored on September 6th. Coincidence? I don't know. Do any other players have a similar discrepancy?
  21. Not there. I think Players.class.php has a class named Players and in there a method named GetPlayerPreviews. That's what I'm interested in. Let's see how far we can get without that.
  22. Nothing useful in there. How about the code for Player::GetPlayerPreviews()?
  23. You need a for loop and a while loop? One for loop is plenty for this. You can do a for loop or a while loop, though... [edit] Anyways, with just a for loop, you're close. for (first statement; condition to keep executing; statement to execute at the end of the loop's body) {What you have: start with $random=0, keep executing as long as $random is less than 10, and every time at the end of the loop's body (that is, after the echo) it will increment $random by $number. What that should be: start with $random=0 (although a better variable name would be nice), keep executing as long as $random is less than $number, and every time it increments $random by one.
  24. Please use a more descriptive title than "PHP help". You're posting a question here. We know you need help And please use tags around your code. Makes it much easier to read that way. $points = $playerPreviewCollection[$key]->GetCurrentPoints();That's where the points are coming from so we'll need to see the code for that. And can you describe what you mean by "not adding the points correctly"? How is it wrong? What is it supposed to be?
  25. SimpleXML is a bit picky about what it shows when you print_r() or var_dump() it. Namespaces can make it look like there's no data when there is. Fact is that trying to get data out of it is the easiest way to see if it's working. Try echo $in0 = $xml->Body->children("http://ws.configureone.com")->fireOrder->in0;or if not that, echo $in0 = $xml->children("http://schemas.xmlsoap.org/soap/envelope/")->Body->children("http://ws.configureone.com")->fireOrder->in0;
×
×
  • 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.