Jump to content

Recommended Posts

Hi all, I have a script for my game website witch is just showing a white page. The idea of the code is so the user can race against the computer and win or lose. Ive tryed looking for ways to sort this but I just carnt see why it isnt showing the code.

 

Heres the code:

<?php
session_start();
include_once ("includes/config.php");
include_once ("includes/functions.php");
include_once ("scheck.php");

// Login check
if(!isset($_SESSION['username']) || !isset($_SESSION['password'])){
header("Location: index.php");
}else{
$fetch_users_data = mysql_fetch_object(mysql_query("SELECT * FROM `users` WHERE username='".$_SESSION['username']."'"));
}

// Error Check
ini_set ('display_errors', 1);
error_reporting (E_ALL);

// -------------------------------------------------------------------------

$username = $_SESSION['username'];
$location = $fetch_users_data->location;
$carin = mysql_query("SELECT carin FROM users WHERE username = '$username'"); // not sure about
$car1 = mysql_query("SELECT * FROM garage WHERE username = '$username' AND carin = '$carin'"); // not sure about
$car = mysql_fetch_object($car1);

// The locations...
$england = England;
$japan = Japan;
$colombia = Colombia;
$usa = Usa;
$south = South Africa;
$mexico = Mexico;

// Check if the user has done them lately
if ($fetch_users_data->lasthts > time()){
$time = $fetch_users_data->lasthts - time();
echo ("<table width='30%' class='table' cellpadding='0' cellspacing='0'><tr><td class='header'><center>Sorry...</center></td></tr><tr>You carnt do any more Hit The Streets yet, please wait $time seconds.</td></tr></table>");
exit();
}

// If the user is in England...
if ($fetch_users_data->carin == 0){
echo ("Please Get In A Car First <br /> <a href='garage.php' target='mainFrame'>Garage</a>");
}
elseif ($fetch_users_data->location == $england){

// Name of the racers in England
$racername = "Ben";
$racername1 = "Josh";
$racername2 = "Amy";
$racername3 = "Jess";

// The random rep
$minrep = "500";
$maxrep = "1200";
$howmuch = rand ($minrep, $maxrep);

// The random money
$minmoney = "1000";
$maxmoney = "5000";
$moneymade = rand ($minmoney, $maxmoney);

// Make sure they can win all races in that country.
if ($car->speed <= 39){
echo ("Your car must be 40mph or faster to win any races.");
elseif ($car->speed >=40){

// what it will look like if they can win all races
echo ("<table width='40%' cellpadding='0' cellspacing='0' class='table'>
	<tr>
		<td class=header><center>HTS In England</center></td>
	</tr>
		<td><a href='?racer=$racername&location=$location&race=0' onClick='Well done, you won, $howmuch rep and $moneymade money.'>$racername</a></td>
		<td><a href='?racer=$racername1&location=$location&race=1' onClick='Well done, you won, $howmuch rep and $moneymade money.'>$racername1</a></td>
		<td><a href='?racer=$racername2&location=$location&race=2' onClick='Well done, you won, $howmuch rep and $moneymade money.'>$racername2</a></td>
		<td><a href='?racer=$racername3&location=$location&race=3' onClick='Well done, you won, $howmuch rep and $moneymade money.'>$racername3</a></td>
	</tr>
</table>");	
}
mysql_query("UPDATE users SET money='money+$moneymade', rep='rep+$howmuch' WHERE username='$username'") or die ("Couldnt update money/rep. <br /> mysql_error()");
}
}

 

Some of the things in the code might not work, but im still learning about somethings.

 

Thanks for your help.

Link to comment
https://forums.phpfreaks.com/topic/204495-not-showing-code/
Share on other sites

Your code is producing php syntax errors because there are no quotes around the string values in the // The locations... section of code.

 

You should have error_reporting set to E_ALL and display_errors set to ON in your master php.ini on your development system so that ALL the php errors will be reported and displayed. Putting those two settings in your script won't cause fatal parse errors to be displayed.

Link to comment
https://forums.phpfreaks.com/topic/204495-not-showing-code/#findComment-1070829
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.