Software Design
 
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 Languages - MoreSoftware Design

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 April 17th, 2010, 12:19 PM
Dameon51 Dameon51 is offline
http://stealthwd.ca
Dev Shed Novice (500 - 999 posts)
 
Join Date: Dec 2005
Posts: 683 Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 5 Days 23 h 19 m 57 sec
Reputation Power: 199
Send a message via ICQ to Dameon51
Function called before all class functions.

Hey everyone. In the CMS I've built I have an abstract class that is the parent to all the classes of the modules of my cms. So for example I have functions like this in it...

Code:
		function getAllRecords(){
	
			
			parent::openConn();
						
			$result = mysql_query("SELECT * FROM " . $this->getTable());

			parent::closeConn();
											
			if($this->ajax == true){
				echo $this->phpMySQLtoJavascriptArray($result);
			}
			else{
				return $result;
			}	
		}
		
		function getRecordByID($recordID){
		
			parent::openConn();
						
			$result = mysql_query("SELECT * FROM " . $this->getTable() . " WHERE " . $this->getPriKey() . " = '" . mysql_real_escape_string($recordID) . "'");
			
			parent::closeConn();
											
			return $result;
			
		}



What I want to do now is add an extra level of security. I want all the functions in the abstract class to run function checkSecurityLevel at the begining, or before they're called or something along those lines. I was probably, and will probably just call that function manually first thing in all the functions, but was wondering if there was a better way to do this using some technique I'm unaware of.

To sum it up, I want function checkSecurityLevel top be called prior to any function in my abstract doing anything.

Thanks!

Reply With Quote
  #2  
Old April 17th, 2010, 01:47 PM
requinix's Avatar
requinix requinix is offline
Still alive
Dev Shed God 16th Plane (12500 - 12999 posts)
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,869 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 5 Days 6 h 19 m 22 sec
Reputation Power: 8977
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
The best way would be to put a call to it manually in each function.
Comments on this post
Dameon51 agrees!

Reply With Quote
  #3  
Old April 17th, 2010, 08:42 PM
Dameon51 Dameon51 is offline
http://stealthwd.ca
Dev Shed Novice (500 - 999 posts)
 
Join Date: Dec 2005
Posts: 683 Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level)Dameon51 User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 5 Days 23 h 19 m 57 sec
Reputation Power: 199
Send a message via ICQ to Dameon51
Quote:
Originally Posted by requinix
The best way would be to put a call to it manually in each function.


Cool man, thanks. I thought I would have to do it that way, but its always good to get second opinions too.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreSoftware Design > Function called before all class functions.

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