Help
Search
Login
Register
Home
Forum: web design and graphics community
Celestial Star Forum
>
Web Development
>
Coding
>
Ok, i dont usually ask for help
Pages: [
1
]
« previous
next »
Print
Author
Topic: Ok, i dont usually ask for help (Read 622 times)
DaviDJ
Angeling
Posts: 8
Ok, i dont usually ask for help
«
on:
May 14, 2005, 07:37:31 AM »
I'm having trouble with Classes in PHP... I am new to them so i dont get how they work as of yet... here is my code...
Code:
<?php
include&
#40;"Functions.global.php");
class
Security
&
#123;
function
getPriv
&
#40;$id,$page)
&
#123;
global
$gGlobal
;
# Connect to the database via another class
$gGlobal
->
Connect
&
#40;);
$pl
=
mysql_query
&
#40;"SELECT id,user,rank,ip FROM `players` WHERE id='$id'");
$pl
=
mysql_fetch_array
&
#40;$pl);
# Get Privileges for page
$priv
=
mysql_query
&
#40;"SELECT * FROM page_privileges WHERE global_setting='$page'");
if &
#40;!$priv)
&
#123;
$msg
=
"No Privileges set for this page."
;
$end
=
1
;
&
#125;
else
&
#123;
$priv
=
mysql_fetch_array
&
#40;$priv);
&
#125;
if &
#40;$end != "1" && $priv)
&
#123;
$plrank
=
$pl
[
rank
&
#93;;
if &
#40;$priv[$plrank] == "0")
&
#123;
$msg
=
"<b>Error:</b> You do not have permission to be here."
;
$end
=
1
;
&
#125; else {
$msg
=
"You have permission to access this page."
;
&
#125;
&
#125;
else
&
#123;
$msg
=
"No Privileges set for this page."
;
$end
=
1
;
&
#125;
if &
#40;$msg)
&
#123;
$errmsg
->
Message
&
#40;$msg);
&
#125;
return
$end
;
&
#125;
&
#125;
$admin
= new
Security
;
class
ErrMessage
extends
Security
&
#123;
function
Message
&
#40;$msg)
&
#123;
global
$smarty
;
#$msg = "<div align=center>" . $msg . "</div>";
$msg
.=
"<br>"
;
echo
$msg
;
$smarty
->
display
&
#40;'footer.tpl');
exit;
&
#125;
&
#125;
$errmsg
= new
ErrMessage
;
?>
I get the error message:
Code:
Fatal error: Call to a member function on a non-object in /home/public_html/Functions.admin.php on line 42
That is the line:
$errmsg->Message($msg);
I'm not sure how I can get that to work...
This class is basically a privilege thing for my game so i can set the ranks allowed to visit certain pages... Any questions about certain bits you can ask me... if you know whats wrong or what im doing wrong your help will be much appreciated... :D :D [/code]
Logged
color=red]Davi
DJ
[/color]
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> General
=> New Members
=> Announcements
=> Support / Suggestions
-----------------------------
Contests
-----------------------------
=> Archive
===> Contests
===> Blend Challenges
===> SOTW
-----------------------------
Art Boards
-----------------------------
=> Creative mediums
=> Requests & offers
=> Tutorials
===> Celestial Star Tutorials
-----------------------------
Web Development
-----------------------------
=> Coding
=> Web Design
=> Advertisements / Affiliation
-----------------------------
Off-topic
-----------------------------
=> Entertainment
-----------------------------
Español (Spanish Only)
-----------------------------
=> General / Bienvenida
=> Anuncios / Ayuda
=> Código / Desarrollo web
Welcome,
Guest
Members login
Register for free
General
General
New members
Announcements
Support / Suggestions
Art boards
Creative mediums
Requests and offers
Tutorials
Celestial Star tutorials
Web development
Coding
Web design
Advertisements / affiliation
Off-topic
The non-sense
Ententainment
Loading...