You are here: Sessions and Objects using PHP4 « PHP « IT news, forums, messages
Sessions and Objects using PHP4

Posted by David OBrien on 01/14/05 20:24

I have RTFM and TTFE and still am having a heck of a time getting my
objects to play well between pages
The only real examples are in the notes for classes & objects
http://us2.php.net/manual/en/language.oop.php

Basic usage
<?
include_once("config.inc");
include_once("class.php");
$songbook = new songbook(); // defined in the class.php
session_register('songbook');
$songbook->get_stats();
$songbook->populate_manu();
$songbook->populate_series();
if (!isset($songbook->userid) || $songbook->userid == "") {
header("Location: login.php");
}

Now the login.php is basically the same but if the login correctly it
should set $songbook->userid to the username

require('common.php');
session_start();
include_once("class.php");
$songbook = new songbook();
session_register('songbook');
include("newheader.php");
if ( isset($_POST['submitit'])) {
$link = dbconnector();
$sql = "select * from userinfo where
lower(username)=lower('".$_POST['user']."') and
lower(password)=lower('".$_POST['pass']."')";
$result = mysql_query($sql);
if( mysql_num_rows($result) > 0 ) {
$songbook->userid = strtolower($_POST['user']);
header("Location: green.php");
} else {
$errormsg = "<font size=3>Invalid Username or Password.<br>\nPlease Try
Again.</font>";
}
}

So I guess what I am asking is how DO you make objects work across pages?
-Dave

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация