Jump to content

setcookie help!


pcw

Recommended Posts

I am just trying to convert this script from Perl to PHP, but cant seem to get the syntax correct.

 

It doesnt seem to like => but cant work out what this is in PHP

 

if($input{'setcookie'} == 1){

      $packed_cookie = $req->cookie( "sbadmin", "$input{'password'}", time()+3600, "/" );

    print $req->header(-COOKIE => $packed_cookie);

    $header_set = 1;

}

 

}

 

 

if($input{'action'} == ""){

 

if( !(file_exists("$data_dir/status.OK"))) {

$input{'action'} = "install";

if($input{'install_post'} == "password"){

  use CGI;

  $req = new CGI;

  $packed_cookie = $req->cookie( "sbadmin", "$input{'password'}", time()+3600, "/" );

    print $req->header(-COOKIE => $packed_cookie);

    $header_set = 1;

}

}

}

 

Any help is much appreciated

Link to comment
https://forums.phpfreaks.com/topic/146281-setcookie-help/
Share on other sites

Dodgy isnt the word lol. I have been working on it for the past 2 hours and now I cant think anymore.

 

header is a function that is defined in another file. This script is over 5000 lines long, so at the moment I am just trying to get the syntax correct.

 

As for use CGI; and new CGI; I dont know what they do, or if there is a PHP equivalent.

 

I am really new to PHP, but understand it a little better than perl so am really determined to complete this script. Help is always appreciated :-)

Link to comment
https://forums.phpfreaks.com/topic/146281-setcookie-help/#findComment-767995
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.