*

Recent

Author Topic: Editing Games on the fly  (Read 14346 times)

Frank

  • Sr. Member
  • ****
  • Posts: 257
  • Force: +4/-0
Editing Games on the fly
« on: March 24, 2011, 12:49:39 AM »
I added this to what I'm playing with and it allows admin "ONLY" to edit or delete games without going to the Admin to do it - It's also makes it a lot easier. ;)

The code is added to all .php files that call games. Search included.

If it isn't included in the next release, I'll probably make a MOD out out it.

One other thing - I've made so many changes - The included script is only a guide.

Edit: 17th Oct 2011.

Changed the script for the default FAS script.


Code: [Select]
Sample one. with $in

';
if($usrdata['user_level'] == 2){
echo '
<div style="float: right; vertical-align: top; padding-right: 20px;">
<a href=\''.$domain.'/index.php?action=admin&amp;case=managegames&amp;cmd=edit&amp;ID='.$in[ID].'\' onclick="return confirm(\'Are you sure you want to edit the game '.$in['name'].'?\')"><img src=\''.$domain.'/templates/'.$template.'/images/icons/icon-editbtn.png\' title=\'edit game\' alt=\'edit game\' border=\'0\' /></a>
<a href=\''.$domain.'/index.php?action=admin&amp;case=managegames&amp;cmd=delete&amp;ID='.$in[ID].'\' onclick="return confirm(\'Are you sure you want to delete the game '.$in['name'].'?\')"><img src=\''.$domain.'/templates/'.$template.'/images/icons/icon-deletebtn.png\' title=\'delete game\' alt=\'delete game\' border=\'0\' /></a></div>';
}

echo '


____________________________________________________

Sample 2. with $row

';
if($usrdata['user_level'] == 2){
echo '
<div style="float: right; vertical-align: top; padding-right: 20px;">
<a href=\''.$domain.'/index.php?action=admin&amp;case=managegames&amp;cmd=edit&amp;ID='.$row[ID].'\' onclick="return confirm(\'Are you sure you want to edit the game '.$row['name'].'?\')"><img src=\''.$domain.'/templates/'.$template.'/images/icons/icon-editbtn.png\' title=\'edit game\' alt=\'edit game\' border=\'0\' /></a>
<a href=\''.$domain.'/index.php?action=admin&amp;case=managegames&amp;cmd=delete&amp;ID='.$row[ID].'\' onclick="return confirm(\'Are you sure you want to delete the game '.$row['name'].'?\')"><img src=\''.$domain.'/templates/'.$template.'/images/icons/icon-deletebtn.png\' title=\'delete game\' alt=\'delete game\' border=\'0\' /></a></div>';
}
echo '

___________________________________________________

Play.php

';
if($usrdata['user_level'] == 2){
echo '
<div style="float: right; vertical-align: top; padding-right: 20px;">
<a href=\''.$domain.'/index.php?action=admin&amp;case=managegames&amp;cmd=edit&amp;ID='.$r[ID].'\' onclick="return confirm(\'Are you sure you want to edit the game '.$r['name'].'?\')"><img src=\''.$domain.'/templates/'.$template.'/images/icons/icon-editbtn.png\' title=\'edit game\' alt=\'edit game\' border=\'0\' /></a>
<a href=\''.$domain.'/index.php?action=admin&amp;case=managegames&amp;cmd=delete&amp;ID='.$r[ID].'\' onclick="return confirm(\'Are you sure you want to delete the game '.$r['name'].'?\')"><img src=\''.$domain.'/templates/'.$template.'/images/icons/icon-deletebtn.png\' title=\'delete game\' alt=\'delete game\' border=\'0\' /></a></div><br />
'.$r['description'].'
';
}
echo '

Ah! The pic and what it does. :P
« Last Edit: October 17, 2011, 02:37:41 AM by mort »

kurt

  • Developer
  • Hero Member
  • ******
  • Posts: 634
  • Force: +16/-1
Re: Editing Games on the fly
« Reply #1 on: March 25, 2011, 07:42:44 PM »
This is also something needed. Thanks!

Sorry been so hard to reach this last week, had government paperwork spread out through out the flat here, filling it out. Haven't gotten a whole lot done on anything.

Frank

  • Sr. Member
  • ****
  • Posts: 257
  • Force: +4/-0
Re: Editing Games on the fly
« Reply #2 on: March 26, 2011, 06:57:46 AM »
This is also something needed. Thanks!

You're welcome! ;)

Just one thing - I inadvertently added '.$r['description'].' into the Admin function for play.php - Good if you're an admin - Not much use if you're not.  ;D

So it needs to moved out of the function. - Just thought I'd mention it. :P

Azedbutt

  • Newbie
  • *
  • Posts: 38
  • Force: +0/-0
    • Loose Game
Re: Editing Games on the fly
« Reply #3 on: October 15, 2011, 09:53:36 AM »
Sorry to bump an old thread  :(

Can someone clarify in what php files do we need to add the code and where in those files?

Thanks

Dillon

  • Developer
  • Sr. Member
  • ******
  • Posts: 340
  • Force: +3/-0
    • Arcade Freak
Re: Editing Games on the fly
« Reply #4 on: October 15, 2011, 12:27:58 PM »
Its on play.php if u read the code he has 3 different blocks of code he says hes not sure which will work since his code is edited i cant confirm which i used on my site since im not home but you will also need to remove the $domain from the links aswell to get it to work from what i remember. Just try to three blocks of code until 1 works. Also i put it in the description area on the play.php

Azedbutt

  • Newbie
  • *
  • Posts: 38
  • Force: +0/-0
    • Loose Game
Re: Editing Games on the fly
« Reply #5 on: October 16, 2011, 09:34:24 AM »
Okay I am not sure from where to remove the $domain from? from the code above to from somewhere in my script? I have $domain all over my play.php script.

I have tried the third one, without the removing the '$domain' and when it shows the edit buttons but however when i click on them it goes 'page cannot be found'

I genuinely appreciate you are helping me :)

Dillon

  • Developer
  • Sr. Member
  • ******
  • Posts: 340
  • Force: +3/-0
    • Arcade Freak
Re: Editing Games on the fly
« Reply #6 on: October 16, 2011, 10:44:57 AM »
Code: [Select]
Sample one. with $in

';
if($usrdata['user_level'] == 2){
echo '
<div style="float: right; vertical-align: top; padding-right: 20px;">
<a href=\''.$domain.'/index.php?action=admin&amp;case=managegames&amp;cmd=edit&amp;ID='.$in[ID].'\' onclick="return confirm(\'Are you sure you want to edit the game '.$in['name'].'?\')"><img src=\''.$domain.'/'.$directorypath.'/templates/'.$template.'/images/icons/icon-editbtn.png\' title=\'edit game\' alt=\'edit game\' border=\'0\' /></a>
<a href=\''.$domain.'/index.php?action=admin&amp;case=managegames&amp;cmd=delete&amp;ID='.$in[ID].'\' onclick="return confirm(\'Are you sure you want to delete the game '.$in['name'].'?\')"><img src=\''.$domain.'/'.$directorypath.'/templates/'.$template.'/images/icons/icon-deletebtn.png\' title=\'delete game\' alt=\'delete game\' border=\'0\' /></a></div>';
}

echo '


____________________________________________________

Sample 2. with $row

';
if($usrdata['user_level'] == 2){
echo '
<div style="float: right; vertical-align: top; padding-right: 20px;">
<a href=\''.$domain.'/index.php?action=admin&amp;case=managegames&amp;cmd=edit&amp;ID='.$row[ID].'\' onclick="return confirm(\'Are you sure you want to edit the game '.$row['name'].'?\')"><img src=\''.$domain.'/'.$directorypath.'/templates/'.$template.'/images/icons/icon-editbtn.png\' title=\'edit game\' alt=\'edit game\' border=\'0\' /></a>
<a href=\''.$domain.'/index.php?action=admin&amp;case=managegames&amp;cmd=delete&amp;ID='.$row[ID].'\' onclick="return confirm(\'Are you sure you want to delete the game '.$row['name'].'?\')"><img src=\''.$domain.'/'.$directorypath.'/templates/'.$template.'/images/icons/icon-deletebtn.png\' title=\'delete game\' alt=\'delete game\' border=\'0\' /></a></div>';
}
echo '

___________________________________________________

Play.php

';
if($usrdata['user_level'] == 2){
echo '
<div style="float: right; vertical-align: top; padding-right: 20px;">
<a href=\''.$domain.'/index.php?action=admin&amp;case=managegames&amp;cmd=edit&amp;ID='.$r[ID].'\' onclick="return confirm(\'Are you sure you want to edit the game '.$r['name'].'?\')"><img src=\''.$domain.'/'.$directorypath.'/templates/'.$template.'/images/icons/icon-editbtn.png\' title=\'edit game\' alt=\'edit game\' border=\'0\' /></a>
<a href=\''.$domain.'/index.php?action=admin&amp;case=managegames&amp;cmd=delete&amp;ID='.$r[ID].'\' onclick="return confirm(\'Are you sure you want to delete the game '.$r['name'].'?\')"><img src=\''.$domain.'/'.$directorypath.'/templates/'.$template.'/images/icons/icon-deletebtn.png\' title=\'delete game\' alt=\'delete game\' border=\'0\' /></a></div><br />
'.$r['description'].'
';
}
echo '

That should be the correct code the reason it says it not there is because it www.yourdomain.comyourdomain.com/path/.....
instead of
www.yourdomain.com/path/.....
Or something to that effect. That code should work now
« Last Edit: October 16, 2011, 09:09:03 PM by spagetiokillers »

Azedbutt

  • Newbie
  • *
  • Posts: 38
  • Force: +0/-0
    • Loose Game
Re: Editing Games on the fly
« Reply #7 on: October 16, 2011, 01:17:34 PM »
I understand what you are saying - However i have tried the code above and it still does not work, it says 'home cannot be found' as when i click on the edit game bit the url in the browser is

Home/Loo****/public_html//index.php?action=admin&case=managegames&cmd=edit&ID=3614


Adam LaCombe

  • Sr. Member
  • ****
  • Posts: 433
  • Force: +17/-0
    • My Blog
Re: Editing Games on the fly
« Reply #8 on: October 16, 2011, 02:11:12 PM »
wait, why $directorypath in a url?
It should just be $domain/index.php?action=blahblahblah...

Dillon

  • Developer
  • Sr. Member
  • ******
  • Posts: 340
  • Force: +3/-0
    • Arcade Freak
Re: Editing Games on the fly
« Reply #9 on: October 16, 2011, 08:12:06 PM »
wait, why $directorypath in a url?
It should just be $domain/index.php?action=blahblahblah...

Woops thats what you had to remove not domain

Adam LaCombe

  • Sr. Member
  • ****
  • Posts: 433
  • Force: +17/-0
    • My Blog
Re: Editing Games on the fly
« Reply #10 on: October 16, 2011, 08:42:37 PM »
Update the code in the first post if you could, thanks!

Dillon

  • Developer
  • Sr. Member
  • ******
  • Posts: 340
  • Force: +3/-0
    • Arcade Freak
Re: Editing Games on the fly
« Reply #11 on: October 16, 2011, 09:09:39 PM »
Update the code in the first post if you could, thanks!
I fixed my code but the OP is mort not me :)

Adam LaCombe

  • Sr. Member
  • ****
  • Posts: 433
  • Force: +17/-0
    • My Blog
Re: Editing Games on the fly
« Reply #12 on: October 16, 2011, 09:18:29 PM »
Oh yeahhh haha sorry about that. I think sometimes I am going blind.  :D
So yeah, Mort when ya read this, if ya could just edit the code for us.
Thanks!

Frank

  • Sr. Member
  • ****
  • Posts: 257
  • Force: +4/-0
Re: Editing Games on the fly
« Reply #13 on: October 17, 2011, 02:50:05 AM »
OK, So I just changed it. :)

But I did say when I posted it ->

One other thing - I've made so many changes - The included script is only a guide.

It only goes to highlight the problem with FAS being "Stuck" in the root of the website.

And that's another reason I'm not posting just about everything else that I do because I have to rewrite it all to be backward compatible with FAS's somewhat useless url structure. And I have gone to the trouble to Path this whole thing to work in any folder level. :P

Viz:

http://ozigames.net/arcade/index.php

And something that I'm working on - - - - BOOM!

http://ozigames.net/test/index.php

I don't mind helping if you want the next release out of the root, as I just about remember every place where the qualifiers are missing from. ?
« Last Edit: October 17, 2011, 02:54:40 AM by mort »

Adam LaCombe

  • Sr. Member
  • ****
  • Posts: 433
  • Force: +17/-0
    • My Blog
Re: Editing Games on the fly
« Reply #14 on: October 17, 2011, 01:47:43 PM »
umm all you have to do is edit your $domain which is in your settings in the db.
It probably is.. http://ozigames.net
sooo just change it to http://ozigames.net/arcade

$directorypath should be something like /var/www/website/htdocs/

Soo why would you want to put the directory path inside of a url? It wouldn't lead to anywhere..

I'm confused lol