Configure PHP server for IIS

Forum for you who has PHP installation issues

Moderators: macek, egami, gesf

Ilya
New php-forum User
New php-forum User
Posts: 17
Joined: Sat Aug 02, 2003 4:47 am
Location: Saransk, Russia
Contact:

Configure PHP server for IIS

Postby Ilya » Mon Mar 28, 2005 6:45 am

I use PHP server that connetcs with IIS, the 3d version. I've debugged scrpits that uses session and reciving get and post varibales directly using the names of variables as names of fields. But in with server default configuration doesn't accept using the sended variables directly, only using $POST array. It's the first problem, and I woludn't like to rewrite all the script. The second problem is bigger. I can't configure it so it'll support session. Tell me please how to configure the PHP server properly.

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Mon Mar 28, 2005 7:07 am

due to your register_globals set to off (the best configuration) --you will need to use $_POST, $_GET, $_SESSION, $_SERVER, $_ENV variables to access those values...

this means that you will actuialy have to rewrite your scripts... and its best to use register_globals off...

However you can turn them on to slip rewriting them... not recommended thou...

If i missunderstood your probelm -- tell so ;)

Ilya
New php-forum User
New php-forum User
Posts: 17
Joined: Sat Aug 02, 2003 4:47 am
Location: Saransk, Russia
Contact:

Postby Ilya » Mon Mar 28, 2005 11:52 pm

May be I'll rewrite it, really the advantage of its using are not critical. But temporary it's better to test as it is now. Also a question how can I make working sessions.

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Tue Mar 29, 2005 12:01 am

session_start(); //Starting a session handler before ANY headers are sent
$_SESSION['name_or_something'] = "value"; //SEtting some values
echo $_SESSION['name_or_something']; // Outputing
session_destroy(); //Destroying a session handler and therefore no work with sessions could be done later -- works good for logout ;)

Ilya
New php-forum User
New php-forum User
Posts: 17
Joined: Sat Aug 02, 2003 4:47 am
Location: Saransk, Russia
Contact:

Postby Ilya » Tue Mar 29, 2005 10:59 pm

Thank you, it works. I've missed session_start operator. But rewrite all the script will take too much time. To start it testing already now I need do configure PHP to make working instructions like
$objU->CheckPassword ($login, md5 ($password));
session_register ("lgnrights");
$lgnrights = $objU->rights;
Tell me please how I can make working such scripts before I'll rewrite it completely.

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Wed Mar 30, 2005 12:53 am

You wats to work with classes then..

here is one very simply class:

Code: Select all

<?php

class Checky{
  var rights;
  var password;
  var username;

  function Checky(){
     //Some inits if needed
  }

  function CheckPassword($username, $password){ 
    $this->username = $username;
    $this->password = md5($password);
   
     //Check fot the password using $this->username and $this->password
     $sql = "SELECT id, rights FROM users WHERE username='".$this->username."' AND password='".$this-password."' LIMIT 1";
     $result = @mysql_query($sql);
     if(@mysql_num_rows($result)>0){
        $row = mysql_fetch_assoc($result);
        $this->rights = $row['rights'];
        return true;
     }else{
        return false;
     }
  }
}

?>

the way you will use the following class will be:

Code: Select all

<?php
session_start();
require_once("./myclass.php"); //If thats where you hold your class above
$objU =& new Checky();

if($objU->CheckPassword($login, $password)){
  session_register ("lgnrights");  //Hate this line... never register sessions... use $_SESSION instead..
  $lgnrights = $objU->rights;
}else{
  echo("No login!");
}
?>


However this is just one of the ways of writing it... I would've constructed everything another way thou..

Ilya
New php-forum User
New php-forum User
Posts: 17
Joined: Sat Aug 02, 2003 4:47 am
Location: Saransk, Russia
Contact:

Postby Ilya » Thu Mar 31, 2005 3:18 am

I've solved this problem, I've needed only reconfigure data handling section but I've got another problem: only part of the page loads and then loading breaks. Tell me please how to configure the server so it'll load pages competely.


Return to “PHP Installation”

Who is online

Users browsing this forum: No registered users and 0 guests