Problem with class
Posted: Fri Aug 16, 2002 10:54 am
Hi Forum,
I need your help first I'm from Tarija-Bolivia and my enghish isn't good I hope that undestand and can help me
I'm developer a site using Linux-SuSE, Apache web SErver with PHP 4.0.4pl1 and PostgreSQL 7.0.3.
With PHP I began to create my class for my page html.
I resume my definition for this class:
I like that you see my variable $user name for this file is page.class
<?
class page{
//varibles
var $user;
//methods
function header(){}
function navigator(){
//here go a link to login.php but I don't put
//and when the session is registered a put this message
echo "welcome to the system:".$this->user;
}
funtion footer(){}
}
?>
in my index page I have this
index.php
<?
include ("page.class");
$p = new page();
$p->header();
$p->navigator();
$p->footer();
?>
Now, from another file with the name login.php, I put this:
login.php
<?
include ("page.class");
$p = new page();
//here I have my form, insert nick and password
//all it is ok, the user exist in my data base
//now i like to register my session
session_start();
session_register("miusuario");
//In the variable $nick I have the nick for this user
$p->user=$nick;
//I can print this message
echo "welcome to the system :".$pa->user;
?>
My problem is when I call again the index.php, It doesn't apper this varible $this->user with the name of user. It doesn't update.
I probe maybe with this form, when i register my session in login.php
login.php
<?
include ("page.class");
$p = new page();
//here I have my form, insert nick and password
//all it is ok, the user exist in my data base
//now i like to register my session
session_start();
$miusuario=array("nick" => $nick,"session" => session_id());
session_register("miusuario");
//In the variable $nick I have the nick for this user
//I can print this message
echo "welcome to the system :".$miusuario["login"];
?>
but when I call index.php, it doesn't apper the nick for the user
and modify maybe in the page.class
in the function navigator, I put this
function navigator(){
if (!(session_is_registered("miusuario"))){
echo "you aren't connect to the system";
}
else{
echo ("welcome to the system:".$miusuario["login"])
}
}
Maybe the same problem Don't apper the nick of the user, I saw the result and it is void if somebody have how I can to do a script login using class please help me
I need your help first I'm from Tarija-Bolivia and my enghish isn't good I hope that undestand and can help me
I'm developer a site using Linux-SuSE, Apache web SErver with PHP 4.0.4pl1 and PostgreSQL 7.0.3.
With PHP I began to create my class for my page html.
I resume my definition for this class:
I like that you see my variable $user name for this file is page.class
<?
class page{
//varibles
var $user;
//methods
function header(){}
function navigator(){
//here go a link to login.php but I don't put
//and when the session is registered a put this message
echo "welcome to the system:".$this->user;
}
funtion footer(){}
}
?>
in my index page I have this
index.php
<?
include ("page.class");
$p = new page();
$p->header();
$p->navigator();
$p->footer();
?>
Now, from another file with the name login.php, I put this:
login.php
<?
include ("page.class");
$p = new page();
//here I have my form, insert nick and password
//all it is ok, the user exist in my data base
//now i like to register my session
session_start();
session_register("miusuario");
//In the variable $nick I have the nick for this user
$p->user=$nick;
//I can print this message
echo "welcome to the system :".$pa->user;
?>
My problem is when I call again the index.php, It doesn't apper this varible $this->user with the name of user. It doesn't update.
I probe maybe with this form, when i register my session in login.php
login.php
<?
include ("page.class");
$p = new page();
//here I have my form, insert nick and password
//all it is ok, the user exist in my data base
//now i like to register my session
session_start();
$miusuario=array("nick" => $nick,"session" => session_id());
session_register("miusuario");
//In the variable $nick I have the nick for this user
//I can print this message
echo "welcome to the system :".$miusuario["login"];
?>
but when I call index.php, it doesn't apper the nick for the user
and modify maybe in the page.class
in the function navigator, I put this
function navigator(){
if (!(session_is_registered("miusuario"))){
echo "you aren't connect to the system";
}
else{
echo ("welcome to the system:".$miusuario["login"])
}
}
Maybe the same problem Don't apper the nick of the user, I saw the result and it is void if somebody have how I can to do a script login using class please help me