Jump to content
MakeWebGames

McCodes in one


Hash-Op
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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";
}

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...