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]
|