Hash-Op Posted October 29, 2008 Share Posted October 29, 2008 Well how would I enable the script to run both v1 & v2? Something like: <?php session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm); $h->menuarea(); { else } include "globals.php"; [rest of script] ?> Something like that? Quote Link to comment Share on other sites More sharing options...
Floydian Posted October 29, 2008 Share Posted October 29, 2008 Re: McCodes in one This part of the forum is -> + Webdev and programming (Non Game related) Specifically, that means that if there is a sub forum relating to a particular game engine already, then the post should go there. Thanks What's your reasoning behind wanting to do what you're trying to do? Quote Link to comment Share on other sites More sharing options...
Hash-Op Posted October 29, 2008 Author Share Posted October 29, 2008 Re: McCodes in one Just want to make a modification which can be used in v1&v2 without conversion and was wondering if that is corrrect. Quote Link to comment Share on other sites More sharing options...
AlabamaHit Posted October 29, 2008 Share Posted October 29, 2008 Re: McCodes in one no thats not right... I think.. if (!File.Exists(globals.php) { session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm); $h->menuarea(); } else { require "globals.php"; } Quote Link to comment Share on other sites More sharing options...
Hash-Op Posted October 29, 2008 Author Share Posted October 29, 2008 Re: McCodes in one Thanks very much AlabamaHit, a confirmation from someone please? I'm not doing this on cpanel, as I've not got access to one at the moment. INfact I'm doing all this on notepad xD I'm also still learning PHP, started just a few days ago... Would it effect the script if I use mysql_query / $db->query ? Thanks in advance Quote Link to comment Share on other sites More sharing options...
AlabamaHit Posted October 29, 2008 Share Posted October 29, 2008 Re: McCodes in one You are making for v1 and v2.. You have to use myqsl_query Version 1 dont know what $db-> is....so use mysql_query Quote Link to comment Share on other sites More sharing options...
Hash-Op Posted October 29, 2008 Author Share Posted October 29, 2008 Re: McCodes in one Ah thought so. THanks Quote Link to comment Share on other sites More sharing options...
Floydian Posted October 29, 2008 Share Posted October 29, 2008 Re: McCodes in one Nice one AlabamaHit. You could add in a bit more "protection" by checking if the database class exists as well. globals.php isn't quite as obscure as I'd like it to be if I were counting on someone not having made a file named that on a vs1 game. The database class files though are a bit more obscure and would give extra protection. Quote Link to comment Share on other sites More sharing options...
AlabamaHit Posted October 29, 2008 Share Posted October 29, 2008 Re: McCodes in one Thanks Floydian...that was really just something to help him in right directino :-D Quote Link to comment Share on other sites More sharing options...
Hash-Op Posted October 30, 2008 Author Share Posted October 30, 2008 Re: McCodes in one Cheers guys! I'm not working with McCodes, I just wanted to contribute something for the kids making sites these days... :lol: Thanks again Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.