NameSilo

Need help on arcade site - PHP/MySQL

Spaceship Spaceship
Watch
Impact
20
EDIT: Problem number 1,2 and 4 are solved.
I thank alegend for number 1 and dgaussin for number 4. Number 2 I just now managed to solve myself. I am heading for number 3 right now, if I don't make it dgaussin will help me.



NEW EDIT: Number 3 is now also finished thanks to dgaussin. The thread is closed.


Hi,

I am very new in PHP/MySQL and I am starting to learn with the means of trial and error :laugh:

I have bought one of these arcade sites about two weeks ago that was for sale here and have improved the site since then (ArcadeShack.com).

I solved many things myself but now I have 4 problems or improvements I want to make.

For anyone helping me to solve problem #1 I will give 10NP$ and problem #2 23NP$. For problem #3 and #4 I will give a non-reciprocal recommended link for one month on the site.

To explain a little bit, the site is using GameScript (hope somone is familiar with it) and for mine non-PHP-technical understanding I can say that the script is using a system file in which everything is defined and then a template file that calls some code depending on the action of the visitor.

Now to the problems:

Problem #1:

When clicked to play a game the category name and then the game name is supposed to be viewed but the category name is only "Other Games" on all the games.

This is the from the system file:

PHP:
	function loadPlay($gid,$cId){
		if($cId == 0){
			$load = "SELECT g.gId,g.gSwfFile,g.gName,g.gInCategory,g.gDescription,g.gWidth,g.gHeight FROM
			games as g WHERE g.gId='".$gid."'";
		} else {
			$load = "SELECT g.gId,g.gSwfFile,g.gName,g.gInCategory,g.gDescription,g.gWidth,g.gHeight,c.cName FROM
			games as g, categories as c WHERE g.gId='".$gid."' AND g.gInCategory = c.cId";
		}
		if($data = @mysql_query($load)){
			$data = @mysql_fetch_assoc($data);
			if($cId == 0){
				$data['cName'] = 'Other Games';
			}
			return $data;
		} else {
			return false;
		}
	}

I noticed that this line from the above code always gets executed as if I change 'Other Games' I will see the change on all the games.

PHP:
if($cId == 0){
	$data['cName'] = 'Other Games';
Problem #2:

I want to add the following line in the template file:

PHP:
<strong>Highscore: </strong> The highscore for {$game[\'gName\']} is {$game[\'gHscorepoints\']} by <A HREF=\"{$game[\'gHscoreURL\']}\">{$game[\'gHscorename\']}</A><br /><br />
Then I have to create the "gHscorepoints", "gHscoreURL" "gHscorename" to the MySQL database but I don't know how to do that. And if I get it into the MySQL database would it work or do I have to add something to the above code from the system file? If I could know the PHP needed for a form like an highscoreadminform that feeds the data to the MySQL you get a link as well to the site.

Problem #3:

I have currently the following URLs for my games:

http://www.arcadeshack.com/index.php?act=play&id=324

What are the exact code lines needed in the .htaccess or in some httpd.conf to change the URLs to:

http://www.arcadeshack.com/play/heli-attack-3.html

Is it possible? If yes, please make it simple for me.

Problem #4:

To have the game name of the URL of that game I tried the following:

<title>Arcade Shack - Free Online Flash Games & Movies! <?php echo $game['gName'] ?></title>

But it didn't work. Is it possible? And in that case what are the correct way to do it?




Thank you so much for the help on this and if you want more exchange for the help I can see what I can do.
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
theres a simple error on the 4th one.

you put:
PHP:
<?php echo $game['gName'] ?>

should be :

PHP:
<?php echo $game['gName']; ?>

(you missed off a " ; ")

hope it works

good luckwith your site!

-ed
 
0
•••
you dont actually need a ; on the last line of a php script although of course it is better to put it.
 
0
•••
I tried it but it didn't change anything. I assume that the $game['gName']; only works in the template file in which that action is triggered or something.

Anybody who could help with the rest of the points? #1 shuld not be that hard, probably just some error in the code that I cannot see as I don't understand it.

Thanks in advance.
 
0
•••
I remembered fixing the problem with it showing "Other Games", I can't remember exactly what I did since it was over 3 months ago, but it has something to do with adding ['cID'] and something else after index.php?act=play&id=324 making it index.php?act=play&id=324&cid=1

You should email the owner of gamescript, I am sure he can help you out ;)

Good luck!
 
0
•••
Just sent them an e-mail. But the same error is on their "Live Demo" so we will see if they can handle it.

Thanks.
 
0
•••
Had correspondence with them and they are fixing it. That would be #1 solved.

This makes it possible for me to give all my NP$ to solver of #2.
 
0
•••
I'm not sure to understand your highscore stuff. What do you want to do ? A free form where user could type his highscore ? I guess you'll have a lot of fake score, so it could be useless. But maybe I didn't understand..

Anyway, I could do the #3 and #4 if you're interested, even it's not a lot of NP$ ;)
 
0
•••
Wow, the angel found me :wave:

Ok, the highscore stuff. I have installed a tailermade guestbook in which they claim their highscore and upload a screenshot as evidence, I then got a notice on e-mail and verify the highscore as being correct. Then what I wanted to have is a simple password protected form in which I can fill out the scores and these values gets into the MySQL database. Once in the databse I can display the highscore with the code I wrote above. The problem is that I don't know how to create this into the MySQL and get it called and so on.

I would be very happy if you helped on what you could do and I give you my NP$ and text links if needed.

Remember that as somebody wrote before the URLs could become index.php?act=play&id=324&cid=1 but I don't know yet.

Thanks!
 
0
•••
Ok, for problem #1..

I bought a copy of gamescript a few hours ago and just installed it.. open up templates.tpl.php then look for

Code:
<strong><a href=\"{$_SERVER[\'PHP_SELF\']}?act=play&id={$game[\'gId\']}\">Play</a></strong>

replace that with

Code:
<strong><a href=\"{$_SERVER[\'PHP_SELF\']}?act=play&id={$game[\'gId\']}&cid={$category[\'cId\']}\">Play</a></strong>

That should work ;)

Oops, forgot about the stats part.

Find

Code:
$templates['list_repeat_all'] = '<a href=\"{$_SERVER[\'PHP_SELF\']}?act=play&id={$stat[\'gId\']}\">{$stat[\'gName\']}</a><em>{$extra}</em><br />';

Replace with

Code:
$templates['list_repeat_all'] = '<a href=\"{$_SERVER[\'PHP_SELF\']}?act=play&id={$stat[\'gId\']}&cid={$stat[\'gInCategory\']}\">{$stat[\'gName\']}</a><em>{$extra}</em><br />';

Works perfectly for me :D
 
Last edited:
0
•••
It works! You are faster than the support!

I am only a bit concerned how Google will spider this. If I solve problem #3 it should then not be a problem.

I give you 10NP$ as promised in the thread.

Oops, forgot about the stats part.

Did that as well.
 
Last edited:
0
•••
for #3 do you have .htaccess ?

as far as i know you can do this with somcode in a .htaccess file :gl:
 
0
•••
Problem number 1,2 and 4 are solved.
I thank alegend for number 1 and dgaussin for number 4. Number 2 I just now managed to solve myself. I am heading for number 3 right now, if I don't make it dgaussin will help me.

Thanks a lot.
 
0
•••
0
•••
1
•••
Thanks Jim, but it's not exact to say 10X better, it's just another way to do that ;) But thanks anyway ;)
 
0
•••
Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back