Posted: Fri Sep 09, 2005 6:01 pm Post subject: No high scores recorded
Hello,
Well, I just installed pnflashgames 0.6b (free) and no high scores are being recorded. I do have the required code inserted into my index.php
Code:
require_once("mainfile.php");
// Save Score for Old pnFlashGames Component
include("modules/Flash_Games/includes/oldcomponent.php");
Everything installed fine and the games play but no highscores. I am using PHP-Nuke 7.7 with chatserv security patch installed. Any ideas?? Thanks!
Rob
forahobby Administrator
Joined: May 22, 2003 Posts: 23945 Location: NSW, Australia
Posted: Sun Sep 11, 2005 5:40 am Post subject:
more then likely you will find because you are using a security patch it is not accepting the scores via the POST COMMAND..
I know it works fine on the normal phpnuke 7.7 but havent tested with your version.. Do you want to send me the version you have in FULL so i can test for you and get it working??
Im sure it will be benficial for more then just the two of us anyway..
Let me know how you go.. Try different games.. Some older ones and some newer ones to see if they work..
Maybe only the older hiscores wont be working.. then we can see whats going on there.
Joined: May 22, 2003 Posts: 23945 Location: NSW, Australia
Posted: Tue Sep 27, 2005 1:57 am Post subject:
Hi guys,
I can get the scores working for you but someone will have to give me a full version already patched and working for me to help.
I dont have the time to download only the patched files and go through it all espeically when im not using it myself.
Basically i believe in the MAINFILE.PHP there is some new code which stops your phpnuke site from being able to receive POSTS.. Without the full code i cant really test so someone will have to get back to me.
l8r all and sorry i couldnt find the fix soon.
another tip: Make a topic in the chatservs forums.. Hopefully somneone will know exactly what is wrong.
if ($_SERVER['REQUEST_METHOD'] == "POST") {
if (isset($_SERVER['HTTP_REFERER'])) {
if (!stripos_clone($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])) {
die('Posting from another server not allowed!');
}
} else {
die($posttags);
}
}
If I comment this lines like this:
Code:
/*
if ($_SERVER['REQUEST_METHOD'] == "POST") {
if (isset($_SERVER['HTTP_REFERER'])) {
if (!stripos_clone($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])) {
die('Posting from another server not allowed!');
}
} else {
die($posttags);
}
}
*/
All works, but it's not recomended by security reasons.
Maybe with some
Code:
IF ELSE
statement it will be work?...
forahobby Administrator
Joined: May 22, 2003 Posts: 23945 Location: NSW, Australia
Posted: Sun Oct 02, 2005 2:13 am Post subject:
i dont have that code in my phpnuke install. lol
Do you see XBOX-HQ.Com getting hacked??
NOPE!!!!
I think you are all OVERKILLING it.. Totally.
Xbox-Hq.Com is one of the worlds largest PHPNUKE websites and even we dont run chatserv patches.. There is just no need.. Why not setup your website and add your own custom protection..
anyway, what a joke.. I cant believe chatserv thinks this helps against hackers. Really there is only one line of code you should have as security against posts and that is the domain naim security..
Posted: Tue Nov 29, 2005 4:28 am Post subject: My 2 cents
I tried commenting out the _POST filtering as above and it had no effect on my standard phpnuke 7.9 install with old or new games high score recording.
I think there are additional issues between the games module and phpnuke > 7.7. I have poked around the phpnuke 7.9 code and have not been able to isolate where the high scores are falling out.
Looking forward to someone with greater understanding of phpnuke to figure this one out. Not man enough here ...
keg01 Xbox-HQ Newbie
Joined: Nov 28, 2005 Posts: 2
Posted: Tue Nov 29, 2005 2:06 pm Post subject: CORRECTION
I took another look at this in the light of day and, in fact, the old style high score games will post results in phpnuke 7.9 if you comment out the statement above. So, testing games like frogger and ms. pacman produced high scores stored but trying pingu failed. Just for those who come after ...
forahobby Administrator
Joined: May 22, 2003 Posts: 23945 Location: NSW, Australia
Posted: Tue Nov 29, 2005 2:27 pm Post subject:
Hi keg01,
I must have missed your post..
Thanks for the info.
Open your ROOT/PHPNUKE/index.php file (not the flashgames index.php) and double check that you have the include file from the flashagems readme.txt file.. Or open the index.php which is in the pnFlashGames for PHPNUKE package and copy and paste the 2 x lines from the top.
Heres the code you need anyway in your main PHPNUKE index.php:
Code:
// Save Score for Old pnFlashGames Component
include("modules/Flash_Games/includes/oldcomponent.php");
If you have that in place everything should work fine..
Also, Im going to tidy up soon and hopefully fix any of these little bugs for each version.. The pnFlashGames will even carry more stats soon on how many games you have played, 1st postions etc etc.
im using the latest version of php nuke, i can get the games working but not the high scores
here is what my index.php looks like
Code:
<?php
/************************************************************************/
/* PHP-NUKE: Advanced Content Management System */
/* ============================================ */
/* */
/* Copyright (c) 2005 by Francisco Burzi */
/* http://phpnuke.org */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
require_once("mainfile.php");
global $prefix, $db, $admin_file;
if (isset($op) AND ($op == "ad_click") AND isset($bid)) {
$bid = intval($bid);
$sql = "SELECT clickurl FROM ".$prefix."_banner WHERE bid='$bid'";
$result = $db->sql_query($sql);
list($clickurl) = $db->sql_fetchrow($result);
$db->sql_query("UPDATE ".$prefix."_banner SET clicks=clicks+1 WHERE bid='$bid'");
update_points(21);
Header("Location: ".htmlentities($clickurl));
die();
}
if (isset($url) AND is_admin($admin)) {
Header("Location: $url");
die();
}
if ($httpref == 1) {
if (isset($_SERVER['HTTP_REFERER'])) {
$referer = $_SERVER['HTTP_REFERER'];
$referer = check_html($referer, "nohtml");
}
if (!empty($referer) && !stripos_clone($referer, "unknown") && !stripos_clone($referer, "bookmark") && !stripos_clone($referer, $_SERVER['HTTP_HOST'])) {
$result = $db->sql_query("INSERT INTO ".$prefix."_referer VALUES (NULL, '".$referer."')");
}
$numrows = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_referer"));
if($numrows>=$httprefmax) {
$result2 = $db->sql_query("DELETE FROM ".$prefix."_referer");
}
}
if (!isset($mop)) { $mop="modload"; }
if (!isset($mod_file)) { $mod_file="index"; }
$name = trim($name);
if (isset($file)) { $file = trim($file); }
$mod_file = trim($mod_file);
$mop = trim($mop);
if (stripos_clone($name,"..") || (isset($file) && stripos_clone($file,"..")) || stripos_clone($mod_file,"..") || stripos_clone($mop,"..")) {
die("You are so cool...");
} else {
$ThemeSel = get_theme();
if (file_exists("themes/$ThemeSel/module.php")) {
include("themes/$ThemeSel/module.php");
if (is_active("$default_module") AND file_exists("modules/$default_module/".$mod_file.".php")) {
$name = $default_module;
}
}
if (file_exists("themes/$ThemeSel/modules/$name/".$mod_file.".php")) {
$modpath = "themes/$ThemeSel/";
}
$modpath .= "modules/$name/".$mod_file.".php";
if (file_exists($modpath)) {
include($modpath);
} else {
define('INDEX_FILE', true);
include("header.php");
OpenTable();
if (is_admin($admin)) {
echo "<center><font class=\"\"><b>"._HOMEPROBLEM."</b></font><br><br>[ <a href=\"".$admin_file.".php?op=modules\">"._ADDAHOME."</a> ]</center>";
} else {
echo "<center>"._HOMEPROBLEMUSER."</center>";
}
CloseTable();
include("footer.php");
}
}
/************************************************************************/
/* PHP-NUKE: Advanced Content Management System */
/* ============================================ */
/* */
/* Copyright (c) 2002 by Francisco Burzi */
/* http://phpnuke.org */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/* */
/************************************************************************/
/* Additional security checking code 2003 by chatserv */
/* http://www.nukefixes.com -- http://www.nukeresources.com */
/************************************************************************/
require_once("mainfile.php");
// Save Score for Old pnFlashGames Component
include("modules/Flash_Games/includes/oldcomponent.php");
$_SERVER['PHP_SELF'] = "modules.php";
$row = $db->sql_fetchrow($db->sql_query("SELECT main_module from ".$prefix."_main"));
$name = $row['main_module'];
$home = 1;
if ($httpref==1) {
$referer = $_SERVER["HTTP_REFERER"];
$referer = check_html($referer, nohtml);
if ($referer=="" OR eregi("^unknown", $referer) OR substr("$referer",0,strlen($nukeurl))==$nukeurl OR eregi("^bookmark",$referer)) {
} else {
$result = $db->sql_query("INSERT INTO ".$prefix."_referer VALUES (NULL, '$referer')");
}
$numrows = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_referer"));
if($numrows>=$httprefmax) {
$result2 = $db->sql_query("DELETE FROM ".$prefix."_referer");
}
}
if (!isset($mop)) { $mop="modload"; }
if (!isset($mod_file)) { $mod_file="index"; }
$name = trim($name);
$file = trim($file);
$mod_file = trim($mod_file);
$mop = trim($mop);
if (ereg("\.\.",$name) || ereg("\.\.",$file) || ereg("\.\.",$mod_file) || ereg("\.\.",$mop)) {
echo "You are so cool...";
} else {
$ThemeSel = get_theme();
if (file_exists("themes/$ThemeSel/module.php")) {
include("themes/$ThemeSel/module.php");
if (is_active("$default_module") AND file_exists("modules/$default_module/".$mod_file.".php")) {
$name = $default_module;
}
}
if (file_exists("themes/$ThemeSel/modules/$name/".$mod_file.".php")) {
$modpath = "themes/$ThemeSel/";
}
$modpath .= "modules/$name/".$mod_file.".php";
if (file_exists($modpath)) {
include($modpath);
} else {
$index = 1;
include("header.php");
OpenTable();
if (is_admin($admin)) {
echo "<center><font class=\"\"><b>"._HOMEPROBLEM."</b></font><br><br>[ <a href=\"admin.php?op=modules\">"._ADDAHOME."</a> ]</center>";
} else {
echo "<center>"._HOMEPROBLEMUSER."</center>";
}
CloseTable();
include("footer.php");
}
}
?>
wibbers Xbox-HQ Newbie
Joined: Jan 15, 2006 Posts: 6
Posted: Mon Jan 16, 2006 1:59 am Post subject:
ok i changed that and my index.php now looks like this
(high scores still arnt working with any games )
Code:
<?php
/************************************************************************/
/* PHP-NUKE: Advanced Content Management System */
/* ============================================ */
/* */
/* Copyright (c) 2005 by Francisco Burzi */
/* http://phpnuke.org */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
require_once("mainfile.php");
global $prefix, $db, $admin_file;
// Save Score for Old pnFlashGames Component
include("modules/Flash_Games/includes/oldcomponent.php");
if (isset($op) AND ($op == "ad_click") AND isset($bid)) {
$bid = intval($bid);
$sql = "SELECT clickurl FROM ".$prefix."_banner WHERE bid='$bid'";
$result = $db->sql_query($sql);
list($clickurl) = $db->sql_fetchrow($result);
$db->sql_query("UPDATE ".$prefix."_banner SET clicks=clicks+1 WHERE bid='$bid'");
update_points(21);
Header("Location: ".htmlentities($clickurl));
die();
}
if (isset($url) AND is_admin($admin)) {
Header("Location: $url");
die();
}
if ($httpref == 1) {
if (isset($_SERVER['HTTP_REFERER'])) {
$referer = $_SERVER['HTTP_REFERER'];
$referer = check_html($referer, "nohtml");
}
if (!empty($referer) && !stripos_clone($referer, "unknown") && !stripos_clone($referer, "bookmark") && !stripos_clone($referer, $_SERVER['HTTP_HOST'])) {
$result = $db->sql_query("INSERT INTO ".$prefix."_referer VALUES (NULL, '".$referer."')");
}
$numrows = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_referer"));
if($numrows>=$httprefmax) {
$result2 = $db->sql_query("DELETE FROM ".$prefix."_referer");
}
}
if (!isset($mop)) { $mop="modload"; }
if (!isset($mod_file)) { $mod_file="index"; }
$name = trim($name);
if (isset($file)) { $file = trim($file); }
$mod_file = trim($mod_file);
$mop = trim($mop);
if (stripos_clone($name,"..") || (isset($file) && stripos_clone($file,"..")) || stripos_clone($mod_file,"..") || stripos_clone($mop,"..")) {
die("You are so cool...");
} else {
$ThemeSel = get_theme();
if (file_exists("themes/$ThemeSel/module.php")) {
include("themes/$ThemeSel/module.php");
if (is_active("$default_module") AND file_exists("modules/$default_module/".$mod_file.".php")) {
$name = $default_module;
}
}
if (file_exists("themes/$ThemeSel/modules/$name/".$mod_file.".php")) {
$modpath = "themes/$ThemeSel/";
}
$modpath .= "modules/$name/".$mod_file.".php";
if (file_exists($modpath)) {
include($modpath);
} else {
define('INDEX_FILE', true);
include("header.php");
OpenTable();
if (is_admin($admin)) {
echo "<center><font class=\"\"><b>"._HOMEPROBLEM."</b></font><br><br>[ <a href=\"".$admin_file.".php?op=modules\">"._ADDAHOME."</a> ]</center>";
} else {
echo "<center>"._HOMEPROBLEMUSER."</center>";
}
CloseTable();
include("footer.php");
}
}
?>
wibbers Xbox-HQ Newbie
Joined: Jan 15, 2006 Posts: 6
Posted: Mon Jan 16, 2006 1:16 pm Post subject:
can anyone see anything wrong with that code?
forahobby Administrator
Joined: May 22, 2003 Posts: 23945 Location: NSW, Australia
Posted: Tue Jan 17, 2006 3:41 am Post subject:
hi wibbers,
That code looks fine to me mate..
Its good to see you added the code to your index.php like the instructions state..
Quote:
// Save Score for Old pnFlashGames Component
include("modules/Flash_Games/includes/oldcomponent.php");
Now i believe the thing that is causing your probs is a update to the phpnuke mainfile.php.. Thats just my first guess.
Can you paste the top portion of your mainfile.php here for me.
I want to see the POST CODE.. It must be stopping all POST COMMANDS to the index.php file to stop hacking for somereason..
anyway, keep at it.. Im sure you will get it.. Your site is coming along nicely too.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum