News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

SSI Causing me some problems

Started by StormFire, February 05, 2006, 06:58:41 AM

Previous topic - Next topic

StormFire

I am trying to use the SSI to restrict a downloads script to specific forum members so have used the following code:

<?php
require("/home/nemecom/public_html/forum/SSI.php");
if (
$context['user']['is_guest'])
{
  echo
  include(
"http://www.*.co.uk/403.shtml");
}
else
{
if (
in_array(13, $user_info['groups']))
   {
      echo
  include("http://www.*.co.uk/403.shtml");
  }
else
  {
if (
in_array(4, $user_info['groups']))
   {
      echo
'Please do at least one post on the forum to be able to access the client.';
  }
else
  {


and closed it with three } so that it parses correctly.

I use opera and it works perfectly for me but I have had people saying that they cannot access the downloads because they are being redirected to the Forbidden 403 page.
They say that they are logged in on the forum when trying to access the page and they are not in group 4 or 13, but are still being redirected.

Can anyone shed some light on this for me?

Also for some reason, the above script puts a "1" at the bottom of my 403 page which is not there in the original coding and i can only determine it is being caused by the above script. Any thoughts there?

Thanks

StormFire


kegobeer

Is that the entire code?  It is incomplete.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

StormFire

ive put code after the last {  from the quote, so that it runs that if they dont login,

ie:

Quote
<?php
require("/home/nemecom/public_html/forum/SSI.php");
if ($context['user']['is_guest'])
{
   echo
   include("http://www.*.co.uk/403.shtml");
}
else
{
if (in_array(13, $user_info['groups']))
    {
       echo
      include("http://www.*.co.uk/403.shtml");
   }
else
   {
if (in_array(4, $user_info['groups']))
    {
       echo 'Please do at least one post on the forum to be able to access the client.';
   }
else
   {
/**********************************
* Olate Download 3.4.0
* http://www.olate.co.uk/od3
**********************************
* Copyright Olate Ltd 2005
......

And it continues after that copyright, regarding the 1 issue it does that on more than just 1 page, but all of them that run that SSI script.

Thanks

kegobeer

This is not correct:


   echo
   include("http://www.*.co.uk/403.shtml");


If you want to redirect to the 403 page, then use a redirect, not an include.


redirect("http://www.*.co.uk/403.shtml");


It would also be more efficient to do this:


if ($context['user']['is_guest'] || in_array(13, $user_info['groups']))
{
  redirect("http://www.*.co.uk/403.shtml");
}

if (in_array(4, $user_info['groups']))
{
  echo 'Please do at least one post on the forum to be able to access the client.';
  die();
}
... the rest of your code ...


I don't know about the "1" issue - you'd have to attach your entire file, or put a link to the file (convert to a text file, otherwise the PHP will be parsed) so I can download it and examine the file.  A link to your site would also help.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

StormFire

thanks, the 1 issue seems to be fixed, ill ask the people who experienced the problem to check now.

Thanks for your help

StormFire

some people are still being redirected to the 403 page. They are in the correct membergroup's to be allowed in, but for some reason they dont pass the first guest & banned check I believe.

The problem is is that there appears to be no common cause, and they have apparently logged out and cleared their cache and logged back in again.

Has anyone got any ideas left?

Thanks

kegobeer

Create a test user that should be able to access that page.  Send me the URL to your forum and to this download script, the username and password.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

kegobeer

It works for me, in FF and IE, both on the same Windows XP Pro PC.  I did notice Javascript errors on your forum - is that theme designed for RC2?

I haven't looked thru your modified files yet.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

StormFire

Quote from: kegobeer on February 20, 2006, 08:11:54 PM
It works for me, in FF and IE, both on the same Windows XP Pro PC.  I did notice Javascript errors on your forum - is that theme designed for RC2?

I haven't looked thru your modified files yet.

the theme was made by bloc for RC2, the javascript may be the menu be doesnt really cause errors elsewhere.

This is why I cannot work out what is wrong, because for me it works as well on Opera, IE and FF on XP Pro as well.

Advertisement: