help on SSI

Started by barry1947, March 23, 2017, 03:55:17 PM

Previous topic - Next topic

barry1947

Hi to all,
I am using SSI which is working well.
It is however giving me a problem with filenames further down the line.
It appears that I am unable to process and file names with a quote in it.
i.e. rename("file'1.mp3","archive/file'1.mp3) will not work.
any help would be greatly appreciated.
Many thanks in advance
Barry

Arantor

Not sure how this is an SSI problem?

barry1947

Hi There,
I felt this may be the best place, but of course I am probably wrong.
If I remove SSI, the functions in question work. It seems as though it changes the value of strings.
Best regards
Barry

Illori

what function did you add?

barry1947

Hi Illori,
this is all that is used.
   // Check If Logged On User
   require_once('../SSI.php');
   global $context;
   if ($context['user']['is_logged'])
   {
      $_SESSION['ADMIN']="ADMIN";
      $_SESSION['performer']=$context['user']['username'];
   }
further on down the line I may load an mp3 file to be played. or do some file maintenance etc. all attempts to process any file then fail.
If I do not include the above fragment, the same procedures appear to work.
I had a quick look at the SSI code. Is it possibly anything to do with magic_quotes somehow?
Many thanks
Barry

Arantor

Magic quotes have been removed from modern PHP versions, what version of PHP do you have?

barry1947

Hi Arantor,
Many thanks for your reply.
The version appears to be PHP 5.6
The site is hosted.
This approach seems to be helping.

<?php
error_reporting(E_STRICT);
session_start();
if(!isset($_SESSION['runonce'])) {
   require_once('../SSI.php');
   global $context;
   $_SESSION['loggedin']=$context['user']['is_logged'];
   $_SESSION['runonce']=true;
   $_SESSION['username']=$context['user']['username'];
   $SQ=str_replace ("&cls","",$_SERVER["QUERY_STRING"]);
   header( 'Location: index.php?'.$SQ) ;
   die("Failed To Redirect From Publication Test<br>");
}

barry1947

Sorry I should have also said that I am on version SMF 2.0.13 running on linux
I am afraid my brain is slightly frazzled lol.

barry1947

Hi Guys,
Well sadly my idea did not work for either.
I have discovered that the inclusion of SSI has changed the way that strings are handled. I have sorted one of the errors by doing a str_replace('&#039;',"'",$MP3)
prior to including SSI that was not needed.
if you have anything to add in the way ef encoding/decoding tips specific to the use of SSI i would be grateful.
Another possible approach may be for me not to included SSI and go direct to the database/cookie etc.
Again any suggestions will be welcome.
Best regards
Barry

Arantor

If you're doing that change before SSI, it's not SSI's problem...

barry1947

Hi Arantor,
This is the start of index php

<?php
require_once('../SSI.php');
global $context;
session_start();
$_SESSION['loggedin']=$context['user']['is_logged'];
$_SESSION['runonce']=true;
$_SESSION['username']=$context['user']['username'];   $SQ=str_replace ("&cls","",$_SERVER["QUERY_STRING"]);
//print_r($_SERVER);
error_reporting(E_STRICT);

So as you can see from this fragment eveything comes after.
If I remove the SSI functions they work.

Arantor

That's not what you said before. Also, it would still be very weird for SMF to autoescape everything as you describe.

And you're starting a session inside a session, which probably doesn't help - you can just use $_SESSION once you include SSI.php - that's where $context['user'] ultimately comes from anyway.

barry1947

Hi,
What I said in the post after that was "Well sadly my idea did not work for either."
that means I had to change it!
What you are now seeing is the result of changing code again so that SSI is back at the top of the page again. I am now back to the start again.
Your point of the session already being started is useful. Thank you.
I will try removing the call to start another session again makes a difference although the session variables always seemed to be there.



Advertisement: