I have a script that I am trying to add some hacks. At the moment I am trying to add a new function for users to delete movies. However I keep getting this Call to undefined method error message on line 97.
Here is the class and where I am having the issue.
<?php
class K_System
{
var $membership;
var $isplayer;
var $player= FALSE;
var $mod = FALSE;
var $id;
var $ext;
var $actionset = FALSE;
var $action;
var $dual = FALSE;
var $message;
var $delete_movie;
function K_System()
{
if (is_player())
{
$res = $db->sql_query("SELECT is_player, is_mod FROM ".$prefix."_K_account WHERE userid = '".$userinfo['user_id']."'");
list($is_player, $is_mod) = $db->sql_fetchrow($res);
# Player check
if ($is_player == 1)
{
$this->player = TRUE;
}
# Mod check
if ($is_mod == 1)
{
$this->mod = TRUE;
}
if (($is_player == 1) && ($is_mod == 1))
{
$this->dual = TRUE;
}
}
$ismod = FALSE;
if (isset($_GET['id']))
{
$this->id = $_GET['id'];
}
if (isset($_GET['ext']))
{
$this->extension = Fix_Quotes($_GET['ext']);
}
if (isset($_GET['action']))
{
$this->actionset = TRUE;
$this->action = Fix_Quotes($_GET['action']);
}
}
function index()
{
$this->loadExtension('main');
$extension = new main;
$extension->showPage();
}
function view()
{
$this->loadExt($this->ext);
$ext = new $this->ext;
if ($this->actionset)
{
$a = $this->action;
$extension->$a(); [COLOR="Red"]--------------LINE 97[/COLOR]
$b = $this->action; // I added this but still get an error.
$delete_movie->$b(); // I added this but still get an error.
}
else
{
$ext->showPage();
}
}
function loadExt($file)
{
require('temp/'.$drags_name.'/ext/'.$file.'.php');
}
function loadtemp($file)
{
require('temp/'.$drags_name.'/supe/'.$file.'.php');
}
function userMenu()
{
//$pageMessage = '';
if (!$this->player && !$this->mod)
{
$menu = '<fieldset><div class="cattitle" width="100%" align="left"><a href="'http://('gameplay').'">Main</a> <a href=http://('gameplay&do=view&ext=account&action=get_info').'">Set up your account</a>';
}
else
{
$menu = '<fieldset><div class="cattitle" width="100%" align="left"><a href="'.getlink('freelance').'">Main</a> <a href=http://('gameplay&do=view&ext=account').'">My gameroom</a> <a href=http://('Private_Mess').'">My Mail</a> <a href="http://('Phtocase').'">My Photo Gallery</a> <a href="http://('Movie&cid=1').'">Movies</a>';
}
if (!$this->player && !$this->mod)
{
$menu .= ' <a href=http://('gameplay&do=view&ext=option&action=get_started').'">Start a game</a>';
}
if ($_GET['ext'] == 'account')
{
if ($this->player || $this->mod)
{
$warnings = 0;
$warningsmessage = '';
if ($MAIN_CFG['gameplay']['playerssub'] == '1' || $MAIN_CFG['gameplay']['modsub'] == '1')
{
if ($this->player && $MAIN_CFG['gameplay']['modsub'] == '1')
{
list($subscribedp) = $db->sql_ufetchrow("SELECT COUNT(*) FROM k_subscriptions WHERE user_id = '".$user_id."' && active = '1' && type = 'player'", SQL_NUM);
if ($subscribedp == 0)
{
$warnings ++;
$warningsmessage .= 'Your game Subscription is expired! You need to <a href=http://('gameplay&do=view&ext=account&action=upgrade&grade=player').'">upgrade your account</a><br />';
}
}
if ($this->buyer && $MAIN_CFG['gameplay']['modsub'] == '1')
{
list($subscribedb) = $db->sql_ufetchrow("SELECT COUNT(*) FROM k_subscriptions WHERE user_id = '".$user_id."' && active = '1' && type = 'mod'", SQL_NUM);
if ($subscribedb == 0)
{
$warnings ++;
$warningsmessage .= 'Your modified player Subscription is expired! You need to <a href=http://('gameplay&do=view&ext=account&action=upgrade&grade=mod').'">upgrade your account</a><br />';
}
}
if ($warnings > 0)
{
$menu .= '<br /><div style="text-align:center; font-weight:bold; color:#ff0000;">Warning: Your account is limited!</div><div style="text-align:center; font-weight:bold;">'.$warningsmessage.'</div><br />';
}
}
}
}
return $menu;
}
function checkPermission($checker)
{
switch($checker)
{
case "play":
if (!is_user())
{
$this->message = 'You need to be logged in to play.';
return FALSE;
}
$res = $db->sql_query("SELECT expires_on, tmstat FROM k_projects WHERE id = '".$this->id."'");
$row = $db->sql_fetchrow($res);
$db->sql_freeresult($res);
if ($row['tmstat'] != '1')
{
$this->message = 'Sorry but your game time has ended for this session.';
return FALSE;
}
if (!$this->mod)
{
$this->message = 'Only modified players can access this mode.';
return FALSE;
}
else
{
if ($MAIN_CFG['gameplay']['modsub'] == '1')
{
list($subscribed) = $db->sql_ufetchrow("SELECT COUNT(*) FROM k_subscriptions WHERE user_id = '".user_id."' && active = '1' && type = 'mod'", SQL_NUM);
if ($subscribed > 0)
{
return TRUE;
}
else
{
$this->message = 'Your Subscription is currently not active!<br />Please upgrade your account <a href=http://('gameplay&do=view&ext=account&action=upgrade&grade=mode').'">here</a>.';
return FALSE;
}
}
else
{
return TRUE;
}
break;
}
}
}
Here is the delete function.
function delete_movie()
{
list($check) = $db->sql_ufetchrow("SELECT COUNT(*) FROM k_gamesets WHERE id = '".$user_id."' && userid = '".$userinfo['user_id']."'", SQL_NUM);
if ($check > 0)
{
$mmov = $db->sql_query("SELECT m.mid, m.cid, m.uid, m.datetime, m.mtitle, m.mimage, m.mshort, m.mextend, m.mlink, m.mviews, m.mscore, m.mvotes, m.mapprove, m.mtags, m.himage, m.lastview, m.mcomment, m.membed, m.pid, c.cimage, t.timage, t.tdefault FROM k_movie_inst AS m LEFT JOIN k_movie_inst_cat AS c ON (c.cid=m.cid) LEFT JOIN k_movie_inst_type AS t ON (t.tid=m.tid) WHERE m.uid = '".$userid."' AND m.mapprove=1 ORDER BY m.datetime");
$row33 = $db->sql_fetchrow($mmov);
$mid =$row33['mid'];
$pid =$row33['pid'];
}
if ($mmov > 0)
{
if (!isset($_GET['accept']))
{
OpenTable();
echo '<div align="center">Are you sure you want to delete this movie?<br /><a href=http://('gameplay&do=view&ext=account&action=delete_movie&mid='.$row33['mid'].'&accept=yes').'">Yes</a> <a href=http://('gameplay&do=view&ext=account').'">No</a></di
}
elseif ($_GET['accept'] == 'yes')
{
$db->sql_query("UPDATE k_movie_inst SET mtitle ='', mlink='', mapprove='' WHERE '".$row33['pid']."' = '".$game_id."'");
url_redirect(getlink('gameplay&do=view&ext=account'));
}
else
{
url_rev>';
CloseTable();direct(getlink('gameplay&do=view&ext=account'));
}
}
else
{
url_redirect(getlink('gameplay'));
}
}
I have been working on this for the last two weeks and still lost. Where am I going wrong with this? Any help will be greatly appreciative. I know its something simple but just not seeing it.