Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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