# Solved: Help Please



## bob121 (Sep 10, 2006)

I have wrote this php script below and when it mets the "if" i would like it to carry on loading the html below how do i get this to do it.


```
<?php
if (user_enabled()) {
if ( 'totalgames' == 50>= )



else if ($params[2] == "Sorry") {
echo "You can not access this page unless you are logged in and have 50 game plays. check back later when you reach 50 game plays.";
?>

<html>
<head>
<title>Ultimate-fun ! - Media Player</title>
</head>
<body bgcolor="000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="middle">
<!-- START WIMPY PLAYER CODE -->
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,47,0" width="234" height="306" id="wimpy" align="center">
<param name="allowScriptAccess" value="always" />
<param name="movie" value="http://www.ultimate-fun.logical-host.com/plugins/media%20player/wimpy.swf" />
<param name="loop" value="false" />
<param name="menu" value="false" />
<param name="quality" value="high" />
<param name="scale" value="noscale" />
<param name="salign" value="lt" />
<param name="bgcolor" value="000000" />
<param name="flashvars" value="wimpyApp=http://www.ultimate-fun.logical-host.com/plugins/media%20player/wimpy.php&wimpySkin=http://www.ultimate-fun.logical-host.com/plugins/media%20player/skins/skin_neon_arcade.xml&startPlayingOnload=yes&popUpHelp=no" />
<embed src="http://www.ultimate-fun.logical-host.com/plugins/media%20player/wimpy.swf" flashvars="wimpyApp=http://www.ultimate-fun.logical-host.com/plugins/media%20player/wimpy.php&wimpySkin=http://www.ultimate-fun.logical-host.com/plugins/media%20player/skins/skin_neon_arcade.xml&startPlayingOnload=yes&popUpHelp=no" loop="false" menu="false" quality="high" width="234" height="306" scale="noscale" salign="lt" name="wimpy" align="center" bgcolor="000000" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
<!-- END WIMPY PLAYER CODE -->
	</td>
  </tr>
</table>
</body>
</html>
```


----------



## brendandonhu (Jul 8, 2002)

It's not really clear what you're trying to do. The string 'totalgames' will never equal 50. Also, if() statements need to have closing } brackets.


----------



## bob121 (Sep 10, 2006)

My site is www.ultimate-fun.logical-host.com and if you log in it displays your game plays and that 'totalgames' is what displays and i need to set it so when you have 50 or more game plays you can access a certain page. if not it redirects you to a error page.


----------



## bob121 (Sep 10, 2006)

This May Help You People, I Am Still Trying To Write It My Self This Is What I Have Now.


```
<?php
if (user_enabled()) {
if ( $user 'totalgames' == 67 )
}
<html>
<head>
<title>Ultimate-fun ! - Media Player</title>
</head>
<body bgcolor="000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="middle">
<!-- START WIMPY PLAYER CODE -->
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,47,0" width="234" height="306" id="wimpy" align="center">
<param name="allowScriptAccess" value="always" />
<param name="movie" value="http://www.ultimate-fun.logical-host.com/plugins/media%20player/wimpy.swf" />
<param name="loop" value="false" />
<param name="menu" value="false" />
<param name="quality" value="high" />
<param name="scale" value="noscale" />
<param name="salign" value="lt" />
<param name="bgcolor" value="000000" />
<param name="flashvars" value="wimpyApp=http://www.ultimate-fun.logical-host.com/plugins/media%20player/wimpy.php&wimpySkin=http://www.ultimate-fun.logical-host.com/plugins/media%20player/skins/skin_neon_arcade.xml&startPlayingOnload=yes&popUpHelp=no" />
<embed src="http://www.ultimate-fun.logical-host.com/plugins/media%20player/wimpy.swf" flashvars="wimpyApp=http://www.ultimate-fun.logical-host.com/plugins/media%20player/wimpy.php&wimpySkin=http://www.ultimate-fun.logical-host.com/plugins/media%20player/skins/skin_neon_arcade.xml&startPlayingOnload=yes&popUpHelp=no" loop="false" menu="false" quality="high" width="234" height="306" scale="noscale" salign="lt" name="wimpy" align="center" bgcolor="000000" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
<!-- END WIMPY PLAYER CODE -->
	</td>
  </tr>
</table>
</body>
</html>
else if ($params[1] == "Sorry") {
echo "You can not access this page unless you are logged in and have 50 game plays. check back later when you reach 50 game plays.";
}


?>
```


----------



## MMJ (Oct 15, 2006)

Can you put in php tags


----------



## bob121 (Sep 10, 2006)

i dont understand what you mean by that but here is the full theme i have ill give you it in rar n zip i think everything you will need will be in here. sorry about not knowing.

http://www.ultimate-fun.logical-host.com/hosted/Theme.zip

http://www.ultimate-fun.logical-host.com/hosted/gss.rar

Please could you help as soon as possible

Thanks James

Please Contact Me If You Have Any Further Questions


----------



## ferrija1 (Apr 11, 2006)

What he means is that he is too lazy to copy/paste it into a PHP editor with highlighting.  


```
<?php
if (user_enabled()) {
if ( $user 'totalgames' == 67 )
}

Ultimate-fun ! - Media Player

[TABLE]
  [TR]
    [TD]

[URL=http://www.ultimate-fun.logical-host.com/plugins/media%20player/wimpy.swf]http://www.ultimate-fun.logical-host.com/plugins/media%20player/wimpy.swf[/URL]

	[/TD]
  [/TR]
[/TABLE]

else if ($params[1] == "Sorry") {
echo "You can not access this page unless you are logged in and have 50 game plays. check back later when you reach 50 game plays.";
}

?>
```
That better?


----------



## bob121 (Sep 10, 2006)

Thanks For Your Reply But When I Use It I Get Error Message. http://www.ultimate-fun.logical-host.com/plugins/site/themes/gss/Media Player.php

i believe it could just be some simple mistake


----------



## Michael Wright (Dec 25, 2006)

What are the If parts meant to be working out...

Firstly you need to say something like... "I want the HTML to be displayed if ... " (Make sure you put it in basic terms then we can translate it for you!)


----------



## bob121 (Sep 10, 2006)

Im a every basic php user i understand html but thats simple im starting to understand php. 

What i want it to is check that they have "50 >=" in php and then if they do make it carry on loading the html below and else load up the custom error message, im sorry im a poor php scripter but im learning.

Thanks James


----------



## Michael Wright (Dec 25, 2006)

```
<?php
if (user_enabled()) {
if ( $user 'totalgames' >=  50 ){
echo "

Ultimate-fun ! - Media Player

<table width=\"100%\" height=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
  [TR]
    <td align=\"center\" valign=\"middle\">



    [/TD]
  [/TR]
[/TABLE]

";
}
else if ($params[1] == "Sorry") {
echo "You can not access this page unless you are logged in and have 50 game plays. check back later when you reach 50 game plays.";
}
}

?>
```
Try that....


----------



## bob121 (Sep 10, 2006)

We have another error now i think http://www.ultimate-fun.logical-host.com/plugins/site/themes/gss/Media Player.php its seems to be more tricky than i throught

still it looks the best and most promising so far just a little bit of tweaking should fix the problems i hope

please could you have a go.

Thanks James And Thanks For Time To Help Me.


----------



## Michael Wright (Dec 25, 2006)

try removing the space after: $user & before 'totalgames'

From: $user 'totalgames'
To: $user'totalgames'

If that doesn't work then you need to check that that variable is the same as the one that you have predefined elsewhere!


----------



## bob121 (Sep 10, 2006)

Still No Luck 

Here is the members user pannel script witch displays there amout of game plays


```
<?php


if (user_enabled()) {
	?>
 <div class='bcontentsection'>
  <div class='bcontenthead'>
   Top Players
  </div>
  <div class='contenttext'>

<?php

$users = get_users("order=totalgames&sort=DESC&limitstart=0&limitnum=".$themecfg['topplayersnumber']);

$i = 0;
foreach ($users as $user) {
	++$i;
	if ($i < 10) {
		echo "<b class='leftnum'>0".$i.".</b>&nbsp;";
	} else {
		echo "<b class='leftnum'>".$i.".</b>&nbsp;";
	}

	echo "<a class='contentlink' href='".get_profile_link("id="._sp($user['id']))."'>{$user['username']}</a>";
	echo " - ";
	echo $user['totalgames']."<br />";
}

?>
</div>
</div>
<?php
}
?>
```


----------



## Michael Wright (Dec 25, 2006)

replace

$user 'totalgames'

with

$user['totalgames']


----------



## bob121 (Sep 10, 2006)

Never seen this error before "Fatal error: Call to undefined function: user_enabled() in /home/ultimate/public_html/plugins/site/themes/gss/Media Player.php on line 2
"

i have made you a picture see the members pannel to check i have the correct thing saying 'totalgames'


----------



## Michael Wright (Dec 25, 2006)

ok so the number 67 is stored in an array ... that is $user['totalgames'] (yes?)

Then you want to see if the user has more than 50 of them, and if they do then print the HTML...

Is that the right array?


----------



## bob121 (Sep 10, 2006)

ooooooops sorry when i posted that script saying it was the members section it was the top plays here is the members script


```
<?php



if (user_enabled()) {
	?>
 <div class='bcontentsection'>
  <div class='bcontenthead'>
   Members
  </div>
  <div class='contenttext'>

	  <?php

	   if (!is_logged_in()) {
		   do_event("user_login_form");

		   if (get_user_config('name=regrequire')==1) {
			   $arr = guest_get_plays();
			   $cleft = $arr['maxplays']-$arr['numplays'];
			   if ($cleft <= 0) {
				   echo "You are out of credits and must <a href='".get_register_link()."' class='cmenulink'><b>register</b></a> to continue playing.";
			   } else if ($cleft == 1) {
				   echo "You have ".($cleft)." credit left before you must <a href='".get_register_link()."' class='cmenulink'><b>register</b></a>.";
			   } else {
				   echo "You have ".($cleft)." credits left before you must <a href='".get_register_link()."' class='cmenulink'><b>register</b></a>.";
			   }

		   } else {
			   echo "Not yet a [sitetitle] member? <a href='".get_register_link()."' class='cmenulink'><b>Register now.</b></a>";
		   }


	   } else {
		   $user = get_logged_in_user();
		   echo "<b>Welcome, ".$user['username'].".</b><br /><br />";
	  if ($user['avatarurl']!='') {

		  echo "
		  	  	   <img src='http://".$user['avatarurl']."' width='80' height='80' /> <br>
		  	  
		  	  ";
	  }
		   ?>
		   Games Played: <?php echo $user['totalgames']; ?><br />
		   Comments Added: <?php echo $user['totalcomments']; ?><br /><br />

		   <?php

			$unreadpms = get_pms("unread=yes&user=".$user['id']);

			if ($unreadpms!=0) {
				echo "<b>";
			}

			echo "<a class='cmenulink' href='".get_pm_link()."'>PM Box (";
			echo $unreadpms;
			echo ")</a>";

			if ($unreadpms!=0) {
				echo "</b>";
			}

			echo "<br />";

		   if ($user['admin'] == "Yes") {
			   echo "<a href='".get_admin_link()."' class='cmenulink'>Admin Area</a> - ";
			   echo "<a href='".get_adminize_link()."' class='cmenulink'>Adminize&#153;</a><br />";
		   }

		   ?>
		   <a href='<?php echo get_profile_link("id="._sp($user["id"])); ?>' class='cmenulink'>My Profile</a> - <a href='<?php echo get_editprofile_link(); ?>' class='cmenulink'>Edit</a><br />
		   <a href='<?php echo get_logout_link(); ?>' class='cmenulink'>Logout</a>
		   <?php
	   }

	   ?>
  </div>
 </div>
 <?php
}

?>
```
im so sorry about that

also reply to your message, yes that is right

Thanks For The Help


----------



## Michael Wright (Dec 25, 2006)

should it be $user_enabled? Try that....!


----------



## bob121 (Sep 10, 2006)

Still no luck.

This is the top part of the script just incase you notice something wrong.


```
<?php 
if ( $user_enabled()) { 
if ( $user['totalgames'] >=  50 ){ 
echo " 
 . . . . . . . and it carries on
[code]
```


----------



## Michael Wright (Dec 25, 2006)

wont help (but might) but try this code:

<?php 
if(user_enabled()) { 
if($user['totalgames']>=50){

Just those 3 lines...


----------



## bob121 (Sep 10, 2006)

Fatal error: Call to undefined function: user_enabled() in /home/ultimate/public_html/plugins/site/themes/gss/Media Player.php on line 2.


That Message Again. do we need the user enabled fuction because i was reading the scripts and what i gathered was that it just checks that i have user loggins enabled on my site ... i could be wrong.

James


----------



## Michael Wright (Dec 25, 2006)

remove it... and then remove one { from the very bottom just before the ?>


----------



## bob121 (Sep 10, 2006)

here is the code i have now, its complaining about the { but its gettin down to the high 30's in the errors so i think were getting some were. so could you so wots up with the {'s


```
<?php 
if ( $user['totalgames'] >=  50 ){ 
echo "<html> 
<head> 
<title>Ultimate-fun ! - Media Player</title> 
</head> 
<body bgcolor=\"000000\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\"> 
<table width=\"100%\" height=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"> 
  <tr> 
    <td align=\"center\" valign=\"middle\"> 
<!-- START WIMPY PLAYER CODE --> 
<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,47,0\" width=\"234\" height=\"306\" id=\"wimpy\" align=\"center\"> 
<param name=\"allowScriptAccess\" value=\"always\" /> 
<param name=\"movie\" value=\"http://www.ultimate-fun.logical-host.com/plugins/media%20player/wimpy.swf\" /> 
<param name=\"loop\" value=\"false\" /> 
<param name=\"menu\" value=\"false\" /> 
<param name=\"quality\" value=\"high\" /> 
<param name=\"scale\" value=\"noscale\" /> 
<param name=\"salign\" value=\"lt\" /> 
<param name=\"bgcolor\" value=\"000000\" /> 
<param name=\"flashvars\" value=\"wimpyApp=http://www.ultimate-fun.logical-host.com/plugins/media%20player/wimpy.php&wimpySkin=http://www.ultimate-fun.logical-host.com/plugins/media%20player/skins/skin_neon_arcade.xml&startPlayingOnload=yes&popUpHelp=no\" /> 
<embed src=\"http://www.ultimate-fun.logical-host.com/plugins/media%20player/wimpy.swf\" flashvars=\"wimpyApp=http://www.ultimate-fun.logical-host.com/plugins/media%20player/wimpy.php&wimpySkin=http://www.ultimate-fun.logical-host.com/plugins/media%20player/skins/skin_neon_arcade.xml&startPlayingOnload=yes&popUpHelp=no\" loop=\"false\" menu=\"false\" quality=\"high\" width=\"234\" height=\"306\" scale=\"noscale\" salign=\"lt\" name=\"wimpy\" align=\"center\" bgcolor=\"000000\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /> 
</object> 
<!-- END WIMPY PLAYER CODE --> 
    </td> 
  </tr> 
</table> 
</body> 
</html>"; 
} 
else if ($params[1] == "Sorry") { 
echo "You can not access this page unless you are logged in and have 50 game plays. check back later when you reach 50 game plays."; 
} 
} 

{
?>
```


----------



## Michael Wright (Dec 25, 2006)

else if ($params[1] == "Sorry") { 
echo "You can not access this page unless you are logged in and have 50 game plays. check back later when you reach 50 game plays."; 
} 
}

{
?>

replace the above with:

else if($params[1] == "Sorry"){ 
echo "You can not access this page unless you are logged in and have 50 game plays. check back later when you reach 50 game plays."; 
} 
?>


----------



## bob121 (Sep 10, 2006)

now that is a weird error all it displayed now was

?>

James


----------



## bob121 (Sep 10, 2006)

Oh thats why because the ?> had gone in twice when i replaced it but now all i get is a blank page.


----------



## Michael Wright (Dec 25, 2006)

right then... now you need to test the code... keep a copy of the code & replace the bit that is the SWF file with some simple text. This way you can see if the code is working. If it works without the SWF part then you know that it is the SWF part that is causing the trouble!


----------



## bob121 (Sep 10, 2006)

Nope, still a blank page so that tells the that it must the the script is set to display the html if the if command is all okay.

so maybe the one we are using now is all okay with some scripts but not with others is there an a differnet script with the same fuction
James


----------



## Michael Wright (Dec 25, 2006)

so you have editted the script to display some text instead of the flash?

If so post what you have got as the alternative here... then I will read through it.


----------



## bob121 (Sep 10, 2006)

Here you go


```
<?php 
if ( $user['totalgames'] >=  50 ){ 
echo "<html> 
<head> 
<title>Ultimate-fun ! - Media Player</title> 
</head> 
<body>
Hello My Name Is James
</body> 
</html>"; 
} 
else if($params[2] == "Sorry"){ 
echo "You can not access this page unless you are logged in and have 50 game plays. check back later when you reach 50 game plays."; 
} 
?>
```


----------



## Michael Wright (Dec 25, 2006)

<?php 
if($user['totalgames']>=50){ 
echo "

Ultimate-fun ! - Media Player

Hello My Name Is James

"; 
} 
else if($params[2] == "Sorry"){ 
echo "You can not access this page unless you are logged in and have 50 game plays. check back later when you reach 50 game plays."; 
} 
?>


----------



## Michael Wright (Dec 25, 2006)

Sorry... try that... I have just removed the spaces, don't know if it will make a difference. Is the $params[2] array predefined anywhere?


----------



## bob121 (Sep 10, 2006)

i think the params could be a mistake i made how about we change that to display a html error message like the one above
James


----------



## Michael Wright (Dec 25, 2006)

ok just remove the part: if($params[2]=="sorry")

Leave the { and then the } and also leave in Else.


----------



## bob121 (Sep 10, 2006)

that creates a error


----------



## Michael Wright (Dec 25, 2006)

<?php 
if($user['totalgames']>=50){ 
echo "

Ultimate-fun ! - Media Player

Hello My Name Is James

"; 
}else{
echo "You can not access this page unless you are logged in and have 50 game plays. check back later when you reach 50 game plays."; 
} 
?>

try that?


----------



## bob121 (Sep 10, 2006)

you get the error message at least the script has some action. i have tryed pasteing to the url in a loaded verison of my site and logged in to see if that made any differnce


----------



## Michael Wright (Dec 25, 2006)

ok so that means that the script is working, however you need to now test it with an account that has either over or equal to 50 point things...


----------



## bob121 (Sep 10, 2006)

my account is it has 67 game plays, but we have changed the way of scripting the checking method. with out the sqaure backets ect. so maybe it just needs to be changed something like that


----------



## bob121 (Sep 10, 2006)

i have just tryed it with the spaced script and the exact amout of game plays i have and still no luck.


----------



## Michael Wright (Dec 25, 2006)

It should still check to see if you have more than 50. and if you have it should say the "Hello my name is james" part. try removing the equals sign in the 2nd line.


----------



## bob121 (Sep 10, 2006)

Here Is My Code


```
<?php 
if ( $user['totalgames'] >=  50 ){
echo "<html> 
<head> 
<title>Ultimate-fun ! - Media Player</title> 
</head> 
<body>
Hello My Name Is James
</body> 
</html>"; 
}else{
echo "You can not access this page unless you are logged in and have 50 game plays. check back later when you reach 50 game plays."; 
} 
?>
```
Can anyone think of a reason why its displaying the error message, i think its reading the game plays right because you not getting a error message about it i think it could be the process or even the cookie access that page has because if you close down the site and open it back up you still logged in so i think this is going to need some sort of cookie access or something to check it .... just a throught

James


----------



## Michael Wright (Dec 25, 2006)

right before put this at the very top before the code:

<?PHP
echo $user['totalgames'];
?>

try that... if not... add double quotes (" and then ") around the $user['totalgames'] part.

This should then show the number of games that the user has.


----------



## brendandonhu (Jul 8, 2002)

Where is the $user array coming from? It's not defined in your script.


----------



## bob121 (Sep 10, 2006)

im not sure Michael May have some idea.

or if you tell me what im looking for i maybe able to tell you
James


----------



## Michael Wright (Dec 25, 2006)

that is true.. I thought he was just posting the troublesome part of the script... :S ... You need to make sure that the $user['totalgames'] is defined


----------



## bob121 (Sep 10, 2006)

Michael i tryed what you said had no luck.


----------



## Michael Wright (Dec 25, 2006)

Can you send us a link to the site where this is running? Also the $user array. Which other pages is that used on?


----------



## bob121 (Sep 10, 2006)

www.ultimate-fun.logical-host.com until my .com is ready


----------



## Michael Wright (Dec 25, 2006)

good stuff.. Where did you get the code from... if you made it yourself well done... If not where did you get it from so that I can take a look at all of the code & see if there is something that we should be including in the page. Is this seperate page that you are adding something that you have come up with?


----------



## bob121 (Sep 10, 2006)

its a GameSiteScript that is the name of it.


----------



## bob121 (Sep 10, 2006)

If You Want i can PM you a copy of it to take a look


----------



## Michael Wright (Dec 25, 2006)

that would be greatly appreciated... A copy of the version you are using at the moment would be better... An exact copy of the one on your server!


----------



## bob121 (Sep 10, 2006)

I have pmed you the main do u realy need the server one because its going to take a while to download


----------



## Michael Wright (Dec 25, 2006)

No, I have what I need... What I need from you now though, is to know the exact location of this file that we are trying to code.. Which directories is it in?


----------



## bob121 (Sep 10, 2006)

i have placed it in plugins/site/themes/gss/ ( gss is my theme if you need access to that there is a copy posted earlier in this forum


----------



## Michael Wright (Dec 25, 2006)

Nope... don't need access to that... there is a file called: functions.php that I think we should include in this file... it is stored in the "Plugins\users" file... so add this code at the very top:

<?PHP
include ("../../../users/functions.php");
?>

Post here the new code that you have...


----------



## bob121 (Sep 10, 2006)

do you mean enter it like that

<?PHP
include ("../../../users/functions.php");
?>

or add like this

<?PHP
include ("plugins/users//functions.php");
?>


----------



## Michael Wright (Dec 25, 2006)

exactly as I did it, the 1st one


----------



## bob121 (Sep 10, 2006)

i have done it, but no change


----------



## Michael Wright (Dec 25, 2006)

can you post the code that you are using here please


----------



## bob121 (Sep 10, 2006)

```
<?PHP
include ("../../../users/functions.php");
?>
<?php 
if ( $user['totalgames'] >=  50 ){
echo "<html> 
<head> 
<title>Ultimate-fun ! - Media Player</title> 
</head> 
<body>
Hello My Name Is James
</body> 
</html>"; 
}else{
echo "You can not access this page unless you are logged in and have 50 game plays. check back later when you reach 50 game plays."; 
} 
?>
```


----------



## Michael Wright (Dec 25, 2006)

<?PHP
include ("../../../users/functions.php");
echo $user['totalgames'];
if ( $user['totalgames'] >= 50 ){
echo "

Ultimate-fun ! - Media Player

Hello My Name Is James

"; 
}else{
echo "You can not access this page unless you are logged in and have 50 game plays. check back later when you reach 50 game plays."; 
} 
?>

Try that.... it should show the number of games they have played too...


----------



## bob121 (Sep 10, 2006)

still no look


----------



## Michael Wright (Dec 25, 2006)

<?PHP
include ("../../../users/functions.php");
echo "$user['totalgames']";
if ( $user['totalgames'] >= 50 ){
echo "

Ultimate-fun ! - Media Player

Hello My Name Is James

"; 
}else{
echo "You can not access this page unless you are logged in and have 50 game plays. check back later when you reach 50 game plays."; 
} 
?>

that??


----------



## bob121 (Sep 10, 2006)

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/ultimate/public_html/plugins/site/themes/gss/Media Player.php on line 3


----------



## bob121 (Sep 10, 2006)

i tryed removing the " and got back the you require the 50 game plays


----------



## Michael Wright (Dec 25, 2006)

ok try changing the file from funtion.php to admin.php


----------



## Michael Wright (Dec 25, 2006)

No wait.. put this instead...

include ("../../../users/functions.php");
include ("../../../users/admin.php");
include ("../../../users/exec.php");

That should replace the include ("../../../users/functions.php");


----------



## bob121 (Sep 10, 2006)

same error message about 50 posts


----------



## bob121 (Sep 10, 2006)

How about you sleep on it and come back on here at about 8ish in the morning if thats not possible we can keep trying now


----------



## bob121 (Sep 10, 2006)

with the
include ("../../../users/functions.php");
include ("../../../users/admin.php");
include ("../../../users/exec.php");

one it took a little longer to load i thought we had hope but still no luck


----------



## bob121 (Sep 10, 2006)

Have AnyOne Had Any Ideas.

James


----------



## MMJ (Oct 15, 2006)

So whats the final result?


----------



## bob121 (Sep 10, 2006)

well this is what we have. but its not picking up the game plays i think we need to tell it to access somewere. it just displays the error message saying you need 50posts to access whitch we set


```
<?php 
if ( $user['totalgames'] >=  50 ){
echo "

Ultimate-fun ! - Media Player

Hello My Name Is James

"; 
}else{
echo "You can not access this page unless you are logged in and have 50 game plays. check back later when you reach 50 game plays."; 
} 
?>
[code]
```


----------



## bob121 (Sep 10, 2006)

Do you think we should try and write a script to get it to display the game plays and then use that to help use make the proper thing ... Just a thought

James

I tryed just this out of the membersmenu all it displayed was the names before so therefore it needs some extra infomation to display it and thats why the script wont be working.


```
Games Played: <?php echo $user['totalgames']; ?><br />
		   Comments Added: <?php echo $user['totalcomments']; ?><br /><br />
```
here is the full membersmeu script you might be able to find that little peice of script we need.


```
<?php



if (user_enabled()) {
	?>
 <div class='bcontentsection'>
  <div class='bcontenthead'>
   Members
  </div>
  <div class='contenttext'>

	  <?php

	   if (!is_logged_in()) {
		   do_event("user_login_form");

		   if (get_user_config('name=regrequire')==1) {
			   $arr = guest_get_plays();
			   $cleft = $arr['maxplays']-$arr['numplays'];
			   if ($cleft <= 0) {
				   echo "You are out of credits and must <a href='".get_register_link()."' class='cmenulink'><b>register</b></a> to continue playing.";
			   } else if ($cleft == 1) {
				   echo "You have ".($cleft)." credit left before you must <a href='".get_register_link()."' class='cmenulink'><b>register</b></a>.";
			   } else {
				   echo "You have ".($cleft)." credits left before you must <a href='".get_register_link()."' class='cmenulink'><b>register</b></a>.";
			   }

		   } else {
			   echo "Not yet a [sitetitle] member? <a href='".get_register_link()."' class='cmenulink'><b>Register now.</b></a>";
		   }


	   } else {
		   $user = get_logged_in_user();
		   echo "<b>Welcome, ".$user['username'].".</b><br /><br />";
	  if ($user['avatarurl']!='') {

		  echo "
		  	  	   <img src='http://".$user['avatarurl']."' width='80' height='80' /> <br>
		  	  
		  	  ";
	  }
		   ?>
		   Games Played: <?php echo $user['totalgames']; ?><br />
		   Comments Added: <?php echo $user['totalcomments']; ?><br /><br />

		   <?php

			$unreadpms = get_pms("unread=yes&user=".$user['id']);

			if ($unreadpms!=0) {
				echo "<b>";
			}

			echo "<a class='cmenulink' href='".get_pm_link()."'>PM Box (";
			echo $unreadpms;
			echo ")</a>";

			if ($unreadpms!=0) {
				echo "</b>";
			}

			echo "<br />";

		   if ($user['admin'] == "Yes") {
			   echo "<a href='".get_admin_link()."' class='cmenulink'>Admin Area</a> - ";
			   echo "<a href='".get_adminize_link()."' class='cmenulink'>Adminize&#153;</a><br />";
		   }

		   ?>
		   <a href='<?php echo get_profile_link("id="._sp($user["id"])); ?>' class='cmenulink'>My Profile</a> - <a href='<?php echo get_editprofile_link(); ?>' class='cmenulink'>Edit</a><br />
		   <a href='<?php echo get_logout_link(); ?>' class='cmenulink'>Logout</a>
		   <?php
	   }

	   ?>
  </div>
 </div>
 <?php
}

?>
```


----------



## MMJ (Oct 15, 2006)

bob121 said:


> well this is what we have. but its not picking up the game plays i think we need to tell it to access somewere. it just displays the error message saying you need 50posts to access whitch we set
> 
> 
> ```
> ...


----------



## bob121 (Sep 10, 2006)

its all okay the code expect it isnt reading the gameplays so it gets the error message, it needs to access somewere else i think to get the info i can pm you gamesitescript if you would have ago at doing it.


----------



## MMJ (Oct 15, 2006)

I am no php expert but why do you have this?

<?php
}

?>


```
<?php



if (user_enabled()) {
	?>
 <div class='bcontentsection'>
  <div class='bcontenthead'>
   Members
  </div>
  <div class='contenttext'>

	  <?php

	   if (!is_logged_in()) {
		   do_event("user_login_form");

		   if (get_user_config('name=regrequire')==1) {
			   $arr = guest_get_plays();
			   $cleft = $arr['maxplays']-$arr['numplays'];
			   if ($cleft <= 0) {
				   echo "You are out of credits and must <a href='".get_register_link()."' class='cmenulink'><b>register</b></a> to continue playing.";
			   } else if ($cleft == 1) {
				   echo "You have ".($cleft)." credit left before you must <a href='".get_register_link()."' class='cmenulink'><b>register</b></a>.";
			   } else {
				   echo "You have ".($cleft)." credits left before you must <a href='".get_register_link()."' class='cmenulink'><b>register</b></a>.";
			   }

		   } else {
			   echo "Not yet a [sitetitle] member? <a href='".get_register_link()."' class='cmenulink'><b>Register now.</b></a>";
		   }


	   } else {
		   $user = get_logged_in_user();
		   echo "<b>Welcome, ".$user['username'].".</b><br /><br />";
	  if ($user['avatarurl']!='') {

		  echo "
		  	  	   <img src='http://".$user['avatarurl']."' width='80' height='80' /> <br>
		  	  
		  	  ";
	  }
		   ?>
		   Games Played: <?php echo $user['totalgames']; ?><br />
		   Comments Added: <?php echo $user['totalcomments']; ?><br /><br />

		   <?php

			$unreadpms = get_pms("unread=yes&user=".$user['id']);

			if ($unreadpms!=0) {
				echo "<b>";
			}

			echo "<a class='cmenulink' href='".get_pm_link()."'>PM Box (";
			echo $unreadpms;
			echo ")</a>";

			if ($unreadpms!=0) {
				echo "</b>";
			}

			echo "<br />";

		   if ($user['admin'] == "Yes") {
			   echo "<a href='".get_admin_link()."' class='cmenulink'>Admin Area</a> - ";
			   echo "<a href='".get_adminize_link()."' class='cmenulink'>Adminize&#8482;</a><br />";
		   }

		   ?>
		   <a href='<?php echo get_profile_link("id="._sp($user["id"])); ?>' class='cmenulink'>My Profile</a> - <a href='<?php echo get_editprofile_link(); ?>' class='cmenulink'>Edit</a><br />
		   <a href='<?php echo get_logout_link(); ?>' class='cmenulink'>Logout</a>
[COLOR="Red"]		   <?php
	   }

	   ?>
[/COLOR]  </div>
 </div>
[COLOR="Red"] <?php
}

?>[/COLOR]
```


----------



## bob121 (Sep 10, 2006)

not sure. i didnt write that. it all works that script execpt we need to find a location it needs to read. so the script we have up to now is okay just needs adding to


----------



## MMJ (Oct 15, 2006)

if you can register at xenweb.net cuz there is a php genius there.


----------



## bob121 (Sep 10, 2006)

i am a member of xenweb  i no you name for there. would you send him a link to this forum thread and try and get him to help


----------



## MMJ (Oct 15, 2006)

You are? 

No, I would create a new thread in the php forum. He should have it solved for you in a matter of minutes.


----------



## bob121 (Sep 10, 2006)

well....if he on now


----------



## MMJ (Oct 15, 2006)

bob121 said:


> not sure. i didnt write that.





bob121 said:


> I have wrote this php script below


So which one is it?


----------



## bob121 (Sep 10, 2006)

i started of writing it but then failed and people helped me and i am keeping on trying


----------



## bob121 (Sep 10, 2006)

basicly what it needs adding to it is were to find the user info as far as i know and someone must no how to script that.


----------



## brendandonhu (Jul 8, 2002)

This doesn't sound too hard, do you want to just send me the code and database and I should be able to write this later today.


----------



## bob121 (Sep 10, 2006)

You May Also Need My Theme Whitch I Posted Earlier In This Thread.

http://www.ultimate-fun.logical-host.com/hosted/GameSiteScript.zip

Thanks James.


----------



## brendandonhu (Jul 8, 2002)

Just save this in a new file to your main folder (same folder where index.php is located.)

```
<?php
$adminarea = true;
require_once('cfg.php');
require_once('api.php');
require_once('plugins/users/functions.php');
$user = get_logged_in_user();
if(!$user)
{
  echo 'You are not logged in.';
}
elseif($user['totalgames'] >= 50)
{
  echo 'You have at least 50 total games played.';
}
else
{
  echo 'You have not played 50 games.';
}
?>
```


----------



## bob121 (Sep 10, 2006)

Warning: main(cfg.php) [function.main]: failed to open stream: No such file or directory in /home/ultimate/public_html/plugins/site/themes/gss/Media Player.php on line 3

Fatal error: main() [function.require]: Failed opening required 'cfg.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ultimate/public_html/plugins/site/themes/gss/Media Player.php on line 3



that is the page
http://www.ultimate-fun.logical-host.com/plugins/site/themes/gss/Media Player.php


----------



## brendandonhu (Jul 8, 2002)

It's not in the same folder as your main index.php


----------



## brendandonhu (Jul 8, 2002)

Or change it to this if you want to use it from that folder

```
<?php
$adminarea = true;
require_once('../../../../cfg.php');
require_once('../../../../api.php');
require_once('../../../../plugins/users/functions.php');
$user = get_logged_in_user();
if(!$user)
{
  echo 'You are not logged in.';
}
elseif($user['totalgames'] >= 50)
{
  echo 'You have at least 50 total games played.';
}
else
{
  echo 'You have not played 50 games.';
}
?>
```


----------



## bob121 (Sep 10, 2006)

still no luck mate
Just displaying the you need 50 game plays
James

Also why have you put in adminarea= true


----------



## brendandonhu (Jul 8, 2002)

It seems to be working fine for me. I got my account up to 49 plays and it said this:
You have not played 50 games.
And I played a 50th game and now it says: You have at least 50 total games played.
That's on this page: http://www.ultimate-fun.logical-host.com/plugins/site/themes/gss/Media Player.php

$adminarea = true stops it from using output buffering.


----------



## bob121 (Sep 10, 2006)

is that using my site


----------



## brendandonhu (Jul 8, 2002)

Yes, that's on your site.


----------



## bob121 (Sep 10, 2006)

Well How Come It Wont Work For Me I Have Tryed It On Both Computers And even Tryed To Make Tester Account


----------



## brendandonhu (Jul 8, 2002)

What do you mean it won't work? Log into an account with over 50 plays and go here: http://www.ultimate-fun.logical-host.com/plugins/site/themes/gss/Media Player.php


----------



## bob121 (Sep 10, 2006)

Sorry my mistake it is working


----------



## bob121 (Sep 10, 2006)

Thanks So Much and also to the other helpers who helped build this site up over time should i mark this thread solved


----------



## brendandonhu (Jul 8, 2002)

Ok then, you can mark this Solved under Thread Tools


----------



## bob121 (Sep 10, 2006)

Okay Thanks Again top quility help


----------



## brendandonhu (Jul 8, 2002)

[tsg=yourewelcome]yourewelcome[/tsg]


----------

