Jump to content

Jessica

Staff Alumni
  • Posts

    8,968
  • Joined

  • Last visited

  • Days Won

    41

Everything posted by Jessica

  1. I think you need to use == not ===. I think that is why it is always doing the second one. Can you echo the value of radio right before the loop and make sure it's set correctly?
  2. $value = $value-($value*.02);
  3. I always have a seperate config file which has all of my settings, domain name, mysql passwords, file paths, etc.
  4. In your SQL , do NOT include ANYTHING about the password UNLESS they have entered a password. if (empty($_POST['password'])) {   $sql = "UPDATE users SET username = $username"; //EVERYTHING BUT PASSWORD } else {   $password = base64_encode($_POST['password']);   $sql = "UPDATE users SET username = $username, password = $password"; //EVERYTHING INCLUDING PASSWORD } The above SQL is NOT complete - don't just copy and paste it. Adapt it to your tables.
  5. Okay ignore that. When you $_GET the id, before you display stuff, check if the user has access to that record. What makes you say User X doesn't have access to record 21? That's what you use to validate it.
  6. This was posted just the other day. Look for that thread.
  7. Use a config file to set the names of the tables. IE, $table1 = "myTable". When you move the code, you only have to update that one variable. $table1 = "YourTable". Then in your SQL do "SELECT * FROM $table1", etc.
  8. You're setting the password to false. Instead of that, if they didn't enter a new password make the query string reflect that, don't set the variable to false. That is why it is blank. if (empty($_POST['password'])) {   //Do nothing } else {   $password = base64_encode($_POST['password']);   // SQL to update here. }
  9. Okay, that isn't really anything to do with encryption. You could use session variables instead of url & GET, and also VALIDATE it. If they're not allowed to have access to 23, when they try to do that, print an error. You have to check for that stuff.
  10. Ah, in Perl I think @ means an array, like how $ means a variable in PHP.
  11. This is a vague question. You want it decryptable? Why are you trying to do this anyway?
  12. if (trim($radio) == 'number') { Two == not three === What's with the @ signs? I thought that was only in Perl. PHP does this too? Also, this is superfluous $field_to_search = "site"; $field_to_search1 = "work"; $field_to_search = mysql_real_escape_string($field_to_search); $field_to_search1 = mysql_real_escape_string($field_to_search1); You defined them, you don't need to escape them. I don't know why it doesn't work, I hate ternary operators. But you should just be able to do $radio = mysql_real_escape_string($_POST['RadioGroup1']); if($radio == 'number'){ }
  13. What errors do you get? If the values in the arrays are strings you need to put '' around them, so you'll have to do a lot of fancy quote marking to get it to work.
  14. Jessica

    OOP PHP

    I have enjoyed switching to classes. I used the tutorial on phpfreaks to figure it out. It has made everything much easier.
  15. You may want to make it use an array as you have a large list and I bet you will add more. use in_array to check. Good luck.
  16. It says $conn is not an object. mysql_connect returns a resource. It's not an object that you call a method on, it's a resource you use in a function like http://us2.php.net/mysql_query
  17. See my additions to the above comment. Plus, that isn't the SAME error, it's a new one. Before it was ; and now it is , My comment should explain why it was an unexpected , - you can't use that syntax.
  18. OR is mysql. || is PHP. Also, the rest of that line is wrong. isset will return a bool value (true or false, and will never equal those strings), PLUS You can't check for multiple values that way. You could make an array of those values and check if the "g" is in the array, or you would have to do this: [code]if (empty($_GET["g"]) || ($_GET["g"] != "index" && $_GET["g"] != "subpage1")){ echo "Invalid Request."; }[/code]
  19. to get the interget value of something use intval(); But, since PHP uses weak typing, I would think it would only give that error if there was no value at all, or a value which was not a number. intval on a string produces 0, so I don't think that will help. Could you try adding print_r($js_date_trans); to make sure all the values are set?
  20. I wrote mine while he was writing his. There isn't anything wrong with it, but I posted another way. The construction is a personal preference for the author.
  21. Maybe don't give them the option to upload it till the form is completed - have a second page. As you said, you don't want them to upload until the form is complete, so don't even give them the opportunity.
  22. You might also think about using POST instead of GET.
  23. Well, you can't do that... That means key => value. Maybe make a class, then an array of instances of it and loop through there. Or for a simpler version, [code] $person = ('name'=>'andrew', 'age'=>21, 'loc'=>'UK'); $people[] = $person; $person = ('name'=>'joe', 'age'=>23, 'loc'=>'USA'); $people[] = $person; foreach($people AS $person){   $age = $person['age'];   $name = $person['name'];   //etc... } [/code]
  24. Sounds like the problem is on their end. If it suddenly stopped being able to connect...maybe you should contact them?
  25. Can you post some code?
×
×
  • 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.