trying to view a game on website but comes up with error 'ERROR gc_g2 - Game not availible!' the PHP code that launches the game is as follows

<?
/***********************************************************************
Jackpotsoft GamingCenter™
GAME LAUNCHER v1.0
************************************************************************/
Error_Reporting(0);
unset($l);
session_start();
session_register($l);
include ("includes/config.php");
include ("dbcon.php");
if(isset($l)){
if ($mode=="fun" && $l!="guestlogin")
{
$loginkey=md5(rand(00000000000000000,999999999999999999));
$loginkey=strtoupper($loginkey);
$js_username="$l";
$js_password="$p";
mysql_query("INSERT INTO `jsgamingcenter_loginkeys` VALUES('$loginkey', 'PLAY FOR FUN RELOGIN', '$js_username', '$js_password')", $casdb);
$relogin="1";
} }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <title><? echo "$casinoname"; ?> Casino/Games</title>
  <style type="text/css">
<!--
.style1 {
    font-size: x-small;
    font-weight: bold;
}
-->
</style>
  <script language="javascript">
  function openerRefresh(){
    //allow refresh of parent window unless parent is closed, if any exception if caught (by changing parent window domain) then do not refresh and close popup
    try {
        if (!window.opener.closed) {
            openerUrl=window.opener.location.href;
            //no need to add refresh=true to the url if its already there
            if (!(openerUrl.indexOf("refresh=true") > -1)) {
                if (openerUrl.indexOf("#") > -1) {
                    openerUrl = openerUrl.replace("#","?refresh=true&relogin=<? echo "$relogin"; ?>&loginkey=<? echo "$loginkey"; ?>");
                } else {
                    if(openerUrl.indexOf("?") == -1) {
                        openerUrl += "?refresh=true";
                    } else {
                        openerUrl += "&refresh=true";
                    }
                }
            }
            window.opener.location.href=openerUrl;
        } 
    } catch(e) {   
        self.close();
    } 
}
  </script>
<SCRIPT language="javascript">
// writes the flash embedding tags using javascript, as required by MS's patent-busting IE "update"
function embedSwf(target, swf, base, width, height) {
    d = document.getElementById( target );
    d.innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + width + '" height="' + height + '" id="mapcontrols">' +
            '<param name="movie" value="' + swf + '">' +
            '<param name="quality" value="high">' +
            '<param name="menu" value="false">' +
            '<param name="base" value="' + base + '">' +
            '<embed src="' + swf + '" menu="false" swLiveConnect="true" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" name="mapcontrols" base="' + base + '">' +
            '</embed>' +
            '</object>';
}
</SCRIPT>
    <script type="text/javascript" language="JavaScript">
        function resizeTo(w,h) {
          if (parseInt(navigator.appVersion)>3) {
            if (navigator.appName=="Netscape") {
              window.innerWidth=w;
              window.innerHeight=h;
            } else {
              window.resizeBy(w-document.body.clientWidth, h-document.body.clientHeight);
            }
            self.focus();
          }
        }
      </script>
  </head>
<?
$gamedet=mysql_fetch_array(mysql_query("select * from jsgamingcenter_games where id='$game'", $casdb)); 
$game_status=$gamedet["status"];
$game_id=$gamedet["id"];
$game_name=$gamedet["name"];
$game_width=$gamedet["width"];
$game_height=$gamedet["height"];
$game_location=$gamedet["location"];
$game_basedir=$gamedet["base_directory"];
if($game_id!=$game){
echo "ERROR gc_g1 - Game does not exist!";
exit;
}
if($game_status!="1"){
echo "ERROR gc_g2 - Game not availible!";
exit;
}
if(isset($l)){
$luserdet=mysql_fetch_array(mysql_query("select * from jsgamingcenter_users where login='$l'", $casdb)); 
if ($mode=="real" && $luserdet[24]!="1"){
echo "<div align=\"center\" class=\"style1\">You cannot &quot;Play For Real&quot; because your account is not currently in an active state! </div>";
exit;}}
if(!isset($l)){
if ($mode=="real") {
echo "<div align=\"center\" class=\"style1\">Please log into your $casinoname account in order to start a &quot;Play For Real&quot; Game! </div>";
exit;
}
}
if(isset($l)){
if ($mode=="fun") {
unset($l);
session_destroy();
session_start();
mysql_query("UPDATE jsgamingcenter_users set cash='5000' where login='guestlogin'", $casdb);
$HTTP_SESSION_VARS['l']=guestlogin;
$HTTP_SESSION_VARS['p']=guestlogin;
}
}
if(!isset($l)){
if ($mode=="fun") {
session_start();
mysql_query("UPDATE jsgamingcenter_users set cash='5000' where login='guestlogin'", $casdb);
$HTTP_SESSION_VARS['l']=guestlogin;
$HTTP_SESSION_VARS['p']=guestlogin;
}
}
if(isset($l)){
if ($mode=="real" && $l=="guestlogin") {
echo "<div align=\"center\" class=\"style1\">Please log into your $casinoname account in order to start a &quot;Play For Real&quot; Game! </div>";
exit;
}
}
echo "
<body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" scroll=\"no\" onUnload=\"openerRefresh()\">
<script language=\"javascript\">
        top.resizeTo($game_width, $game_height);
</script>
<span id=\"swfTarget\">
    <script>embedSwf( \"swfTarget\",
                      \"$game_location\",
                      \"$game_basedir\",
                      \"100%\",
                      \"100%\" );
    </script></span>
</body>
";
?>

Do not know why i getting error for and where should i be looking...have imported the SQL data , and database names and passwords correct to the correct database

I suggest you start with adding error checking on your mysql queries.

Create a PHP.INI file on your Public_html folder
Include this two lines :
date.timezone = "America/New_York"
register_globals = On

After that, include this line on your .htaccess file, that should be on your public_html folder :
suPHP_ConfigPath /home/Yourusername/public_html

"Yourusername" must be changed for what is usually the username of webhost .

Save it, and try it .
It will work .

David Augustus

You will not be sucessful because of this line too :
session_register($l);

This is depracated because its unsafe .
So, you should comment it, and insert another one :

//session_register($l);
$_SESSION['$l'] = array();

Do that on all files that have this line .
You should find it on arround 5 - 6 files .

David Augustus

You can contact me on facebook, so we can work on this script together .
The nulled version sux, and have a lot more issues .

After making those 3 changes, the script will work, but the e-mail for verify the registration will not work, and that's where i am .

I'm editing CSS too, removing image buttons and i will try to include more games .

By the way, if you have the config.php file content, please share .
My config.php is an empty file .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.