Jump to content

Recommended Posts

I am wanting to do something with server side javascript running in Firefox POW that is related to php as it seems I cant get php to work in POW anymore.

 

here is the php code:

<?php
$show = (!isset($_GET['show'])) ? 'main' : $_GET['show'];

// start
include('header.php');
switch($show) { 
  case 'fight_failure':
  include('dungeon1/fight_failure.php');
  break;
  case 'fight_failure2':
  include('dungeon1/fight_failure2.php');
  break;
  case 'fight_failure3':
  include('dungeon1/fight_failure3.php');
  break;
  case 'fight_success':
  include('dungeon1/fight_success.php');
  break;
   case 'fight_success2':
  include('dungeon1/fight_success2.php');
  break;
  case 'main':
  default:
  include('dungeon1/room1.php');
  break;
}
// End
include('footer.php');
?>

 

Can this be done with sjs or not was just wondering and where can I find reliable sjs websites the one I went to tried to put a trojan on my machine.

 

Thanks in advance,

Link to comment
https://forums.phpfreaks.com/topic/191991-is-this-allowed-here/
Share on other sites

acronyms are good only for a community that uses them.  POW? SJS?.. You can't just put an acroynm out there and expect people to know what is it.. 

 

For example: My first vision when I see POW is .. Prisoner of War.

 

..and for SJS,...mmm.. idk I'd just assume it was some sort of CMS :P (acronym drop,  Content Management System; I can't be hypocritical).  Super Javascript Server?.. i don't know, I haven't googled it yet.

 

 

As for your code?  are you getting errors; is it "not working";... What's the problem?

Sorry I didnt make myself more clear I am wanting to use that php code but with server side javascript "sjs". And Firefox POW is a Firefox extension for Plain Old Webserver. Its supposed to run php however I am having problems so I thought if I could convert some php code to sjs that would be better. Hope that helps??

 

https://addons.mozilla.org/en-US/firefox/addon/3002

The SJS that you want to use is just plain old JavaScript (with a few variables/objects pre-defined to make life easier[1]).  You just need to use:

  • pow_server.GET in place of $_GET
  • A regular JS switch statement just like PHP
  • pow_include() in place of include()

 

 

[1] http://davidkellogg.com/wiki/Main_Page

Well I tried this little piece of code and it says it can find index.sjs?

 

<?sjs
$show = pow_server.GET['show'];

// start
pow_include('content/header.html');
// content below
switch($show) { 
  case 'family':
  pow_include('content/family.html');
  break;
  case 'mach12':
  pow_include('content/mach12.html');
  break;
  case 'links':
  pow_include('content/links.html');
  break;
  case 'interests':
  pow_include('content/interests.html');
  break;
   case 'hawkspirit':
  pow_include('content/hawkspirit.html');
  break;
  case 'strack':
  pow_include('content/strack.html');
  break;
  case 'main':
  default:
  pow_include('content/main.html');
  break;
}

// End
pow_include('content/footer.html');
?>

 

Any references on the net about this other than what was posted Im looking but can;t find anything?

 

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.