PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 6th, 2000, 03:37 PM
Represser Represser is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 6 Represser User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi,

Maybe you guys can help you!?

I have a small website, and I initialize a class on the front page and stored it in a session, and everything works fine, including the class's functions. After passing the class in a session, and recall it on a different page. Thats when I run into problems. When i try to echo the variables, that works. BUT when I try to access a function, it tells me "Call to undefined function"

Help!

Reply With Quote
  #2  
Old June 6th, 2000, 03:48 PM
scollo scollo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 1999
Posts: 114 scollo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 42 m 44 sec
Reputation Power: 15
1) Are you using PHP4?


2) Could you provide the code?

Reply With Quote
  #3  
Old June 6th, 2000, 04:30 PM
Represser Represser is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 6 Represser User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
1) yes i am using PHP4

2) The SIMPLE version of the code is as follows:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>
//class.inc
class user{
var $user_connection;
var $username;
var $fullname;
var $perms;

function user(){
/* establishes all connections and initializes the class */
}

function verify_user(){
//just stuff that verifies the user
}
function log_user($action = 'null'){
//log a user
}
} [/quote]

Then on my index.php page:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>
session_start();

if (!isset($session)){
$session = new user();
$session->verify_user();
session_register("session");
}


$session->log_user("Action is bla");

[/quote]
That works. As you can see I store the session, and i recall it on another page and the session is there. Here is the code for the page:

<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>


session_start();
if (!isset($session))
{
echo "Error: You are not logged in!";
exit();
}
else
require('class_admin.inc'); //thats the name of the script, still get hte same message with or without it.

<?

echo session->fullname; //this line works
$session->log_user("Action is bnl"); //this line doesnt


[/quote]


Please get back to me, this is important thank you!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Functions within classes

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap