Jump to content

Recommended Posts

// Tests, if logged in
function ssi_dotest($output_method = 'echo')
{
  function curPageName() {
    return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
  }
  global $context, $scripturl;
  $curPageName = curPageName();

if ($context['user']['is_guest']) { echo 'Please <a href="', $scripturl, '?action=login"><span>Login</span></a> or <a href="', $scripturl, '?action=register"><span>Register</span></a> to take this test.'; }
  else { include 'home/lvrcrcom/public_html/tests/', $curPageName, ''; }
}

 

I'm trying to include a page from within the the /tests/ directory of which has the same filename as the one in the current URL. It doesn't seem to work when I use include, but if I echo it, it seems to show the correct path.

 

Parse error: syntax error, unexpected ',' in /home/lvrcrcom/public_html/forum/SSI.php on line 248
Link to comment
https://forums.phpfreaks.com/topic/144929-help-please-php-noob/
Share on other sites

Ehh, well, the actual include sorta works but it's not working as I expected. I basically took a quiz script and included it onto a page, but when I try to answer the questions on the page, the quiz script doesn't go to the next question like it does if I were to go to the quiz script directly. A bit harder to explain, but look at these examples:

 

http://www.lvrcr.com/test.php <-- the page in which I'm including the quiz on

http://www.lvrcr.com/tests/test.php <-- the direct link to the quiz script

 

You'll see that you can actually take the test using the direct link to the quiz, but you cannot on the page that's including the quiz. :/

 

Any suggestions?

Link to comment
https://forums.phpfreaks.com/topic/144929-help-please-php-noob/#findComment-760503
Share on other sites

I looked at http://www.lvrcr.com/tests/test.php

the form action still isn't showing up. Did you implement the change?

I noticed an issue. PHP_SELF gets returns the path from root, so you need

echo "<form action=\"http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."\" method=\"post\">\n";

Link to comment
https://forums.phpfreaks.com/topic/144929-help-please-php-noob/#findComment-760560
Share on other sites

  • 2 months later...
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.