vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   ibProArcade Archive (https://vborg.vbsupport.ru/forumdisplay.php?f=174)
-   -   Get rid of "Notice" messages after changing index.php (https://vborg.vbsupport.ru/showthread.php?t=243256)

jonty 05-25-2010 02:36 PM

Get rid of "Notice" messages after changing index.php
 
After altering index.php to enable scores to be saved, we had an issue with 'notice' messages appearing at the top of the index.php page.
From what i can make out, this is just a warning that variables havent been set or don't exist.
The reason some sites get it and others dont, is that you can turn this off in php.ini if you have access.

I didn't really want to mess about with the .ini file, so I've set a few checks in the script for index.php.

Works for us, hope it works for you too.
This is replacement code for the code in the "INFO - vbadvanced or another Portal.txt" document

PHP Code:

// ibProArcade
if(isset($POST['module']) && $_POST['module'] == "pnFlashGames")
{
    require_once(
'./global.php');

    switch(
$_POST['func'])
    {
        case 
"storeScore":
        
$_GET['act'] = "Arcade";
        
$_GET['module'] = "arcade";
        
$_GET['do'] = "pnFStoreScore";
        break;

        case 
"saveGame":
        
$_GET['do'] = "pnFSaveGame";
        break;

        case 
"loadGame":
        
$_GET['do'] = "pnFLoadGame";
        break;

        case 
"loadGameScores":
        
$gid $vbulletin->input->clean_gpc('p''gid'TYPE_INT);
        
$uid$vbulletin->userinfo['userid'];
        
$game $db->query_first("SELECT * FROM " TABLE_PREFIX "games_scores WHERE mid=$uid AND gid = $gid ORDER BY score DESC LIMIT 0,1");
        
$scores $game[score];

        if(
$scores != false)
        {
            
//Return true
            
print "&opSuccess=true&gameScores=$scores&endvar=1"//send endvar to keep opSuccess separate from all other output from PostNuke
        
}
        else
        {
            print 
"&opSuccess=false&error=Error&endvar=1";
        }
        break;
    }
}

if(isset(
$_GET['act']))
{
        
$act $_GET['act'];
}
if(isset(
$_GET['act']) && isset($_GET['autocom']))
{
        
$autocom $_GET['autocom'];
}
if(isset(
$_GET['act']) && isset($_GET['showuser']))
{
        
$showuser$_GET['showuser'];
}

if((isset(
$act) && $act == "Arcade") || (isset($autocom) && $autocom=="arcade")) {  
        include 
"arcade.php";
        exit();
    }
    if(!empty(
$showuser) && $showuser >= 1) {
        
$u $showuser;
        
$_GET[u] = $showuser;
        include 
"member.php";
    exit();
    }

// end of ibProArcade 

There's probably a neater way of doing it, but it works for us :D

TriAxis 05-25-2010 10:37 PM

Well this helped quite a bit. I am getting this same situation.

Once I put your code in place only one "Notice: Undefined variable:" remained.

It is the one referencing this line.

Code:

if($act == "Arcade" || $autocom=="arcade") {
Otherwise this is the best fix so far for the notification at the top of the index file and the score posting page.

Any ideas about that one line?

Thank you for your efforts!

jonty 05-26-2010 06:39 AM

Quote:

Originally Posted by TriAxis (Post 2043392)
Well this helped quite a bit. I am getting this same situation.

Once I put your code in place only one "Notice: Undefined variable:" remained.

It is the one referencing this line.

Code:

if($act == "Arcade" || $autocom=="arcade") {
Otherwise this is the best fix so far for the notification at the top of the index file and the score posting page.

Any ideas about that one line?

Thank you for your efforts!

You're welcome :up:
I cant replicate that error on our test system, but changing the line to
PHP Code:

if((isset($act) && $act == "Arcade") || (isset($autocom) && $autocom=="arcade")) { 

might do the trick
(I'm not sure if php processes the whole conditional (in which case it might fail) or if it just process the first part (in which case it should work).

Alternatively changing the 3 if statement before
PHP Code:

if(isset($_GET['act'])) 

        
$act $_GET['act']; 

if(isset(
$_GET['act']) && isset($_GET['autocom'])) 

        
$autocom $_GET['autocom']; 

if(isset(
$_GET['act']) && isset($_GET['showuser'])) 

        
$showuser$_GET['showuser']; 


to
PHP Code:

if(isset($_GET['act'])) {$act $_GET['act'];} else {$act="";}
if(isset(
$_GET['act']) && isset($_GET['autocom'])) {$autocom $_GET['autocom'];} else {$autocom="";}
if(isset(
$_GET['act']) && isset($_GET['showuser'])) {$showuser$_GET['showuser'];} else {$showuser="";} 


TriAxis 05-27-2010 03:55 AM

Quote:

Originally Posted by jonty (Post 2043519)
You're welcome :up:
I cant replicate that error on our test system, but changing the line to
PHP Code:

if((isset($act) && $act == "Arcade") || (isset($autocom) && $autocom=="arcade")) { 

might do the trick

Yes! This worked! You are a gentleman and a scholar!


Quote:

Originally Posted by jonty (Post 2043519)
PHP Code:

if(isset($_GET['act'])) {$act $_GET['act'];} else {$act="";}
if(isset(
$_GET['act']) && isset($_GET['autocom'])) {$autocom $_GET['autocom'];} else {$autocom="";}
if(isset(
$_GET['act']) && isset($_GET['showuser'])) {$showuser$_GET['showuser'];} else {$showuser="";} 


I did do this code replacement trying to fix the problem below with no luck.

What is interesting is that the error messages have disappeared and I don't get the security token error...but... the only games on my arcade that save their score are the ones that come with the mod. Every other game I have loaded... 52 at the moment... will play and seem to work, but when you finish the game and submit the score, the screen just stays blank and the screen never changes.

I will investigate this new issue and see what I can find.

But again... thank you very much for your work. :up:

jonty 05-27-2010 04:28 AM

Quote:

Originally Posted by TriAxis (Post 2043926)
Yes! This worked! You are a gentleman and a scholar!




I did do this code replacement trying to fix the problem below with no luck.

What is interesting is that the error messages have disappeared and I don't get the security token error...but... the only games on my arcade that save their score are the ones that come with the mod. Every other game I have loaded... 52 at the moment... will play and seem to work, but when you finish the game and submit the score, the screen just stays blank and the screen never changes.

I will investigate this new issue and see what I can find.

But again... thank you very much for your work. :up:

i got that and discovered it was the v32 versions of the games that froze, but the v2 games were ok.

I'll amend the first script with the changes that worked. :up:


All times are GMT. The time now is 10:28 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01547 seconds
  • Memory Usage 1,773KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (6)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete