Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. 500 error means there was an error. Check your logs for an indication why. You can also set error_reporting = -1 display_errors = onin your php.ini. Restart IIS after you do.
  2. The function you want is header. Make sure you don't output anything before you use it.
  3. UPDATE `games` SET ($fields) VALUES ($data) WHERE `app_id` = '$id'There are a couple ways of doing an UPDATE. That there is not one of them.
  4. C#'s static works in the application pool, which PHP does not have. PHP does have sessions, however, so you can put the value in there instead.
  5. Then check your code: you're counting one too far than you're supposed to.
  6. I would expect that you're supposed to put a page number somewhere in your API call. Probably in the URL.
  7. Are you supposed to be using $connect instead?
  8. As you've shown, compound tax is simply applying a tax to an already-taxed number. It can be simplified to just 3.99 * 1.18 * 1.15 = 5.41443 $price * $tax1 * $tax2
  9. Do it in your code instead. [edit] Well, this is in MySQL after all... You use a variable, then select and increment in the same operation. Like SELECT @var := @var + 1, ...
  10. Which web server? IIS runs as an IUSR something account (varies), Apache is probably running as LOCAL SERVICE (if configured as a service) or your user account (if not and thus you have to run it yourself every time you need it). Whichever account it is needs delete permissions on the parent folder. Are you sure it has that?
  11. The a href values are missing the ending quotes.
  12. Sure doesn't look like a blank page to me: it's giving you the access denied message. I still haven't gotten a straight answer on whether you added the stuff I told you to. So, what does the code for login_check() look like now? And have. you. checked. the. error. log. lately?
  13. So you know the symptom but do you know the actual cause? Or are you just guessing that someone gained shell access? Can't fix what you haven't identified. While you're looking, shut down the mail service and change all your passwords.
  14. Did you add those messages to all four locations? A blank page now when you weren't getting it earlier sounds like a parse error. Check your error log. trigger_error error_log
  15. You can't trust the values in cookies but that in no way whatsoever means you shouldn't use them. Sessions are safe, given a typical PHP setup. Your opinion is incorrect. Oh, by the way, sessions use cookies. IP addresses aren't unique.
  16. $slave_sql = mysql_query("SELECT * FROM popular_screamer_archive1 WHERE email = " . $row['email'],$slave);That won't create valid SQL because strings need quotes. Add quotes and use mysql_real_escape_string() on the email address. And I don't think array_combine() is what you want to use. Not really sure what you're trying to do with it in the first place. And don't use persistent connections unless you know all about their problems and don't mind suffering for it. And please stop using the mysql extension and its mysql_* functions. It's old, slow, and deprecated. Switch to PDO or mysqli.
  17. You need to put that inside login_check(). Like in the places where it returns false: just before each, log why. For example, if ($login_check == $login_string) { // Logged In!!!! return true; } else { // Not logged in error_log("Not logged in: password hashes do not match"); return false; }
  18. If simply pasting a URL into a browser is enough, file_get_contents() and cURL should totally do it. If they don't then there is some other requirement, such as cookies, or a set of prohibitions, like sniffing for bot user-agent strings. What was the code? And how did it "not work"?
  19. Rather than SUM+IF, I'd use COUNT which will only count non-null values. SELECT COUNT(`submitdate`) AS 'Survey Started But Not Completed' FROM `survey_$surveyid` Side comment: tsk tsk for using multiple tables for multiple surveys. Should be just one table for everything.
  20. login_check() is returning false, however function login_check($mysqli) { // Check if all session variables are set if (isset($_SESSION['user_id'], $_SESSION['username'], $_SESSION['login_string'])) { $user_id = $_SESSION['user_id']; $login_string = $_SESSION['login_string']; $username = $_SESSION['username']; // Get the user-agent string of the user. $user_browser = $_SERVER['HTTP_USER_AGENT']; if ($stmt = $mysqli->prepare("SELECT password FROM members WHERE id = ? LIMIT 1")) { // Bind "$user_id" to parameter. $stmt->bind_param('i', $user_id); $stmt->execute(); // Execute the prepared query. $stmt->store_result(); if ($stmt->num_rows == 1) { // If the user exists get variables from result. $stmt->bind_result($password); $stmt->fetch(); $login_check = hash('sha512', $password . $user_browser); if ($login_check == $login_string) { // Logged In!!!! return true; } else { // Not logged in return false; } } else { // Not logged in return false; } } else { // Not logged in return false; } } else { // Not logged in return false; } }there are four different reasons it might do that. Insert some debugging code (like using error_log() or trigger_error()) in there to see what it is doing. Then you'll know why it's failing and thus what needs to be fixed.
  21. It works the same way as assignment: scalars and arrays are deep-copied while objects and resources (even within arrays) get "references". Not real references but copies of the class/resource pointer, if you will. Technically they're all "references" to start with but PHP does a real copy when you attempt to change the value, so practically speaking it's a copy.
  22. Recursive acronyms are kinda popular in software development: GNU, LAME, and WINE to name a few. PHP joined in on the fun.
  23. C returns -1 because it can't return a mixed boolean/integer (putting aside the fact that it doesn't have actual booleans in the first place). PHP can so it returns false. Frankly I'd rather it returns false: I see false == 0 being a better situation than -1 == true.
  24. The main drive for my attempt was query building. This kind of approach would make it very easy to build a query dynamically, like for an advanced search form: may need to add criteria, sometimes those criteria involve other tables, sometimes those JOIN conditions vary based on other criteria... The best way (IMO) to approach that normally is a set of arrays that you append to, and that happens to be half of this Lisp-y thing already. Personally I think it's a good idea - I just couldn't come up with a practical and satisfactory implementation. (I actually had a fully functional implementation but as I said I really didn't like the "syntax".)
  25. whyyyyyyyyy I have attempted this exact same thing before and I gave up. It's clean but still gets so ugly and confusing, what with supporting all the things you will realistically need to use in SQL, that I decided it wasn't worth it. Let's say you're working with a SELECT, with one JOIN, and two conditions. SELECT t1.a, t1.b, t2.c FROM table1 AS t1 JOIN table2 AS t2 ON t1.x = t2.x AND t1.y = t2.y WHERE (t1.a > 0 AND t1.b > 0) OR (t1.a = 0 AND t1.b = 0)Using roughly the syntax I arrived at, [ "select", [ ["t1", "a"], ["t1", "b"], ["t2", "c"] ], ["t1" => "table1"], [ "join" => [ "t2" => ["table2", "and", ["=", ["t1", "x"], ["t2", "y"]], ["=", ["t1", "y"], ["t2", "y"]] ] ] ], "where" => ["or", ["and", [">", ["t1", "a"], 0], [">", ["t1", "b"], 0] ], ["and", ["=", ["t1", "a"], 0], ["=", ["t1", "b"], 0] ] ] ] ][edit] It uses a few more []s than you might expect but that's how the system differentiates names from literal values: ["a"] is a column name and "a" is a string. [/edit] Now add to that support for: - SELECTs with UNIONs - SELECTs as subqueries - HAVING - GROUP BY - ORDER BY - LIMIT and it gets even worse. And that's just SELECTs. So then you think about taking the easy way out and not deliberately handling operators like "or" and "=" - just using them verbatim in the query. But then you've basically just rearranged the original SQL statement into another form. One that's much harder to read.
×
×
  • 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.