Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. We ARE not worried about 'logging in'. We are worried about ANY error that may be happening. I gave you the code to turn on error reporting. Did you put it at the top of the script right after you ran your session_start?
  2. Ok - after 4 hours we finally found out that your setcookie statement is NOT setting the cookie. I think you may need to add some more of the parms that the manual showed you. Never mind. I'm going to shovel snow and may not be back.
  3. It should only be in the ONE script that we are working to fix. I don't need the confusion of you dealing with 2 scripts. And what happened when you ran this code? In fact add this to the above: else echo "Setcookie ran ok";
  4. I don't know what your last post is talking about. Go to the code that is making the header call to the login script. Add a line exit(); after that. Be sure that the 2 lines are wrapped in {} to include them within the if statement.
  5. Where is the code you modified to do as I asked????? That is what I wanted to see.
  6. Could I see that GD code? AND - I am trying to verify that the setcookie runs ok and not looking for something being set. There's a big difference between the two things. When working with someone on one's code changes it usually works better if you POST the new code so that we can agree on what we've done. Not show me some garbage from something else.
  7. If you don't want to work with me I guess we are done. I'm giving ou some coding tips in order to debug your problem and you don't want to try it because you "see" something. I thought the issue was the cookie wasn't being set and I wanted PHP to tell me that, but you don't want to follow my lead. oh well.....
  8. Add an exit to to follow that header call to the login script. That s/b obvious from what I told you and if it's not you have a whole lot to learn.
  9. Huh? What looks "optional" to you? You don't see what as being necessary? You may not need all those settings but if you at least write the statement so that you can get a result from it you may find out something. Just try what I recommended if (!setcookie("token", $token, $expirationDate, "/")) { echo "Could not set cookie for $token using $expirationDate - aborting"; exit(); }
  10. Ok - your author seems to be sloppy or just not well trained. When one does a header to leave the current script one needs to do an exit or else the execution just keeps going.
  11. And no I cannot write it up for you if you don't understand what I'm telling you. Thought you knew how to code but apparently you don't.
  12. Here is the manual's intro page: setcookie (PHP 4, PHP 5, PHP 7, PHP 8) setcookie — Send a cookie Description ¶ setcookie( string $name, string $value = "", int $expires_or_options = 0, string $path = "", string $domain = "", bool $secure = false, bool $httponly = false ): bool See how the definition of the function includes the output at the end showing it is giving you a boolean result?
  13. That code is totally incorrect. Use the setcookie statement that you had, just wrap it in the if statement.
  14. Big thing, as you have been told, is to change the code. The person who wrote it may not have been the best. Stop entering and leaving php mode. That means forget the ?> tag. Don't ever use it. Never. Not recommended, even at the end of a script. Show us this "session.php" module. I'd like to see what something with that name is doing for you. PS - going to have to go do some snow removal soon so if you want to continue this conv you'll have to keep up with your responses or I'll have to leave you hanging for a few
  15. Standard php usage starts the session first thing and headers are output before any other output is sent to the client. Re-sequence your code and eliminate some of your errors right away. FWIW - every single one of my scripts starts like this: <?php session_start(); Scripts mind you. Not modules that are included.
  16. If you looked at the Official PHP Manual you would get the true way to use it. W3schools? Nah... You should be using: if (setcookie(.......)) ok else not ok
  17. The proper way to test is to evaluate the result of the call like it shows in the manual. It is a boolean function
  18. Don't understand but I have to ask. How do you know the cookie was actually set? Have you looked up the function in the PHP manual to see that you are using it properly? I don't see where your code verifies that it was set.
  19. So - now what is the error you are getting or exactly what is not working? I don't see any use of the cookie you set.
  20. Show us the updated code that you first posted
  21. the ini file is probably maintained by your host. If you ask they might give you a copy Or you could just set the error settings yourself. error_reporting(E_ALL); ini_set('display_errors', '1'); Put these lines at the start of our php script. Turn off the 2nd line once you are done developing so that any errors don't pop up on your user's screen.
  22. What is this line of code supposed to do for you? echo $_COOKIE["token"] = $token; 1 - AFAIK a cookie is not available until your page is refreshed. 2 - you are making an assignment into the cookie array which would wipe out what your setcookie call just did.
  23. If your users are doing uploads (that you have to setup btw) then those files will be on the server not on your device. What you have to do is decide on where you will store them and how you will point to them for your app.
  24. Fix What you ask. Correct that error message as it tells you. You are referencing an element named 'test' in an array somewhere. It says line 271 so find that line and make a change and that will stop that message. Then see how far your code makes it before it shows us any other error. It's called debugging. Try this out too. Find the spot in your code where you think that some SESSION values should be getting used. Add an echo statement or two to display the values you think are being missed and see what comes out. At least you will know that the code is being hit.
  25. All inputs (except checkboxes) are 'set' in the POST array. You need to validate the Name value by checking if it is empty or not.
×
×
  • 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.