Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9

Thread: $cookies_string

  1. #1
    New to the CF scene
    Join Date
    Mar 2013
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    $cookies_string

    Im trying to add this
    Code:
    user_num=IfGbCpoFsKHZCnJy4RObEw%3D%3D; has_creator_assets=1;
    Cookie to my script

    I tried this

    Code:
    $cookies_string = "user_num"; user_num=IfGbCpoFsKHZCnJy4RObEw%3D%3D; has_creator_assets=1;
    and re-uploaded the script to my webhost it gives this error : HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.


    will somebody fix this cookie for me?
    Last edited by Fou-Lu; 03-27-2013 at 03:54 PM.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    You can't use cookie strings like this in PHP. You need to use setcookie() and add each item individually. If you have a string already, you can explode it and assign.
    PHP Code:
    $aParts explode('; '$cookies_string);
    foreach (
    $aParts AS $cookie)
    {
        list(
    $key$val) = explode('='$cookie);
        
    setcookie($key$val);  // see the setcookie documentation for other optional parameters

    Although with a server side language, it'd probably be easier to pass data around with sessions. Cookies are client controlled, so they are not the most reliable method of passing data.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • Users who have thanked Fou-Lu for this post:

    xs0h4x (03-27-2013)

  • #3
    New to the CF scene
    Join Date
    Mar 2013
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    my script is client sided not server sided, thanks this was helpful;3

  • #4
    New to the CF scene
    Join Date
    Mar 2013
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Moderator, please delete this thread becuz it has a personal details in the cookies that I dont want specific peoples in this forum to see ;3

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Than you are posting in the wrong forum. PHP is a server side language, not a client side one, so you'll need to post in javascript. I don't know if $cookie_string is a valid variable name in JS (base JS it isn't, but with all the frameworks nowadays it may be).
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Quote Originally Posted by xs0h4x View Post
    Moderator, please delete this thread becuz it has a personal details in the cookies that I dont want specific peoples in this forum to see ;3
    Tell me what the replace it with instead, keeping the same logical format as you have in the original.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #7
    New to the CF scene
    Join Date
    Mar 2013
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Just this

    $cookies_string = "user_num";

  • #8
    New to the CF scene
    Join Date
    Mar 2013
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Fou how do I send you a private message ;o

    sorry for double posting i just dont know where to go ;3

  • #9
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    I'll take it down to the above as that still keeps the logic yet removes anything useful.
    You can send PM's from your usercp, but I don't reply to personal requests for help.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •