Hi All,
The orginal code is below:
<?
class jobs extends generic_module
{
var $allowed = Array( '1', '5', '6' );
}
?>
And the constructor of class is:
<?php
class generic_module
{
var $company_id = 0;
var $allowed = Array();
function __construct( $company_id=0 ) {
$this->company_id = $company_id;
}
function valid() {
return in_array( $this->company_id, $this->allowed );
}
function buffer() {
ob_start();
$this->render();
$contents = ob_get_contents();
ob_end_clean();
return $contents;
}
function admin_only() {
global $admin;
if ( !$admin['admin'] )
die('Insufficent Privliages');
}
}
?>
The New Code we have tried is below put it does not work any help would be great.
class jobs extends generic_module
{
public function __construct()
{
$root = $_SERVER['DOCUMENT_ROOT'];
require_once( $root . "/classes/config.php" );
require_once( $root . "/classes/mysql.php" );
$mysql = new mysql();
$mysql->connect();
$query = 'SELECT * FROM Company WHERE `jobs` = 1';
$results = $mysql->query( $query ) or die( mysql_error() );
while( $row = mysql_fetch_array( $results ) ) {
var $allowed[] = $row["company_id"];
}
}
}
Thanks in advance for your help.