mariovaldez.net

MV.net forums
It is currently 14 Jul 2016, 00:33

All times are UTC - 7 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 
Author Message
PostPosted: 30 Nov 2004, 00:56 
I am working on my site and everything works like a charm, thanks for a great script!

I have created a subfolder in the main one and I managed to also get these protected by changing the header and footer parts from

include_once ("slogin_lib.inc.php");
include_once ("header.inc.php");

to

include_once ("../slogin_lib.inc.php");
include_once ("../header.inc.php");

Then found the userlogin errored for those pages and made the .txt file locations where the passes are stored have the ../ thing as well. All works fine :)

I have seen one thing happen though, and that is the adminlog. The file created: slog_200411_log.txt

It is now also appearing in my subfolder, and I want it in the main folder only (or not even see it being created at all, that will be fine with me too).

I have searched, but I couldn't find the spot in the script where I can put my magical ../ thingamajig.


Can you point me in the right direction?

Thanks!
Eadwine Rose


Report this post
Top
  
Reply with quote  
PostPosted: 30 Nov 2004, 01:04 
Eadwine wrote:
include_once ("slogin_lib.inc.php");
include_once ("header.inc.php");

to

include_once ("../slogin_lib.inc.php");
include_once ("../header.inc.php");

Then found the userlogin errored for those pages and made the .txt file locations where the passes are stored have the ../ thing as well. All works fine :)


And of course the main folder's login then stopped working. Urgh *laughs* I changed the handy ../ things to /var/www/html/etcetera and now it works again.


So, the question now is: where do I put my /var/www/html/etc line for the slog_200411_log.txt to appear in only the main folder :)


Report this post
Top
  
Reply with quote  
PostPosted: 30 Nov 2004, 01:15 
Eadwine wrote:
or not even see it being created at all, that will be fine with me too


Three's the charm, they say. :)

I just looked at my logs and now that I see that not only the admin is logged, which I thought happened, but all the users.

Scratch what I said in the quote. I want them to stay.


Report this post
Top
  
Reply with quote  
PostPosted: 06 Dec 2004, 22:38 
User avatar

Joined: 06 Mar 2003, 03:21
Posts: 447
Location: Monterrey, NL, Mexico
Eadwine:

> I am working on my site and everything works like
> a charm, thanks for a great script! I have created
> a subfolder in the main one and I managed to also
> get these protected by changing the header and
> footer parts from
> include_once ("slogin_lib.inc.php"); include_once ("header.inc.php"); to
> include_once ("../slogin_lib.inc.php"); include_once ("../header.inc.php");
> Then found the userlogin errored for those pages and
> made the .txt file locations where the passes are
> stored have the ../ thing as well. All works fine...

Hi. Sorry for this late response. :oops:

The script was not really intended for big sites with lot of subdirectories, that's why you are having all these problems.

But don't worry, it can be fixed easily. :)

Open the slogin_lib.inc.php file and add the following code around line 50 (after the definition of the slogin_usehashes variable):

Code:
// Fix the paths.
if (!isset ($slogin_path)) {
  $slogin_path = "";
}
$slogin_userstxt = $slogin_path . $slogin_userstxt;
$slogin_altuser = $slogin_path . $slogin_altuser;


And around line 64 substitute the definition of the constant SLOGIN_LOG_FILE with this:
Code:
define ("SLOGIN_LOG_FILE", $slogin_path . SLOGIN_LOG_PREFIX . fslogin_logprefix() . SLOGIN_LOG_SUFFIX . ".txt");


Now, in all your pages in the main directory, you must change the include_once lines with this:
Code:
$slogin_path = "./";
include_once ($slogin_path . "/slogin_lib.inc.php");
include_once ($slogin_path . "/header.inc.php");


and at the end:
Code:
include_once ($slogin_path . "footer.inc.php");


For the pages in subdirectories (subfolders) do the same, but use the slogin_path like this:
Code:
$slogin_path = "../";


If you have deeper directories, use this:
Code:
$slogin_path = "../../";


And so on.


That should fix all your problems and will let you use relative paths (not the /var/www/html...).


Let me know how it worked, Eadwine.


Regards,

Mario A. Valdez-Ramirez.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: 07 Dec 2004, 08:49 
Thanks a bundle for helping me out!


Well, I have changed everything per instructions, (I hope!) and thank goodness I only have:

-maindirectory
--subdirectory 1
--subdirectory 2

and no:

---subdirectories


So, to recap, I have this:

Code:
$slogin_path = "./";
include_once ($slogin_path . "/slogin_lib.inc.php");
include_once ($slogin_path . "/header.inc.php");

in the main directory headers.



Both subdirectory 1 and 2 have now got this:

Code:
$slogin_path = "../";
include_once ($slogin_path . "/slogin_lib.inc.php");
include_once ($slogin_path . "/header.inc.php");

in their headers.



And all the footers in the main and in the two subdirectories have this:

Code:
include_once ($slogin_path . "footer.inc.php");




The thing it doesn't do anymore is create a slog_yearmonth_log.txt in the subdirectories, only in the main one, which is good. :)

The problem it has now is that it doesn't recognize the passwords at all. "Wrong username or password" is what I get, whichever page I try to log in from. I checked the slogin_lib.inc.php and found a number more /var/www/html/ lines which most likely still need to be changed:

Code:
// Set name of users file.
// To disable authentication, just empty the slogin_userstxt variable.
$slogin_userstxt = "/var/www/html/maindirectory/passwordfilename.txt";
$slogin_altuser = "/var/www/html/maindirectory/passwordfilename.php";




And a bit further on:

Code:
// Authenticate.
if ($slogin_logout || $slogin_login) {
  @session_unset ();
  @session_destroy ();
  include_once ("/var/www/html/maindirectory/header.inc.php");
  include_once ("/var/www/html/maindirectory/slogin.inc.php");
  include_once ("/var/www/html/maindirectory/footer.inc.php");
  exit;
}
else {
  if (($slogin_noauthpage != 1) || ($slogin_explicitauth)) {
    if ((!$slogin_Username) && (!$slogin_Password)) {
      if ((!$slogin_loginname) && (!$slogin_loginpass)) {
        include_once ("/var/www/html/maindirectory/header.inc.php");
        include_once ("/var/www/html/maindirectory/slogin.inc.php");
        include_once ("/var/www/html/maindirectory/footer.inc.php");
        exit;
      }
      else {
        if (fslogin_check_user ($slogin_loginname, $slogin_loginpass)) {
          fslogin_log_user ("{$slogin_text[$slogin_lang]["UserLoggedIn"]} $slogin_loginname");
          $slogin_Username = $slogin_loginname;
          $slogin_Name = $slogin_loginpass;
          $_SESSION["Username"] = $slogin_loginname;
        }
        else {
          @session_unset ();
          @session_destroy ();
          fslogin_log_user ("{$slogin_text[$slogin_lang]["LoginFailed"]} $slogin_loginname");
          include_once ("/var/www/html/books/header.inc.php");
          echo "<div align=\"center\">{$slogin_text[$slogin_lang]["WrongLogin"]}</div>";
          include_once ("/var/www/html/maindirectory/slogin.inc.php");
          include_once ("/var/www/html/maindirectory/footer.inc.php");
          exit;




As you can see I have been on a roll with this var/www/html stuff *laughs*

I hope you can help me out with that one as well :)


Report this post
Top
  
Reply with quote  
PostPosted: 08 Dec 2004, 03:23 
User avatar

Joined: 06 Mar 2003, 03:21
Posts: 447
Location: Monterrey, NL, Mexico
Eadwine:


Hi again.

> ...The thing it doesn't do anymore is create a
> slog_yearmonth_log.txt in the subdirectories,
> only in the main one, which is good.

Good! :D


> The problem it has now is that it doesn't recognize
> the passwords at all. "Wrong username or password"
> is what I get, whichever page I try to log in from.
> I checked the slogin_lib.inc.php and found a number
> more /var/www/html/ lines which most likely still
> need to be changed: As you can see I have been on
> a roll with this var/www/html stuff...

Mmmh. I'm testing with a similar structure and it works. :?

Did you made the changes (in slogin_lib.inc.php) I suggested in my previous post? Please verify them. Those changes allow the script to use the slogin_path variable as referece so you never has to use the full path (the var/www/html stuff). Backup your slogin_lib.inc.php file, then delete all full path references (all var/www/html stuff) and do the changes I suggested. If you have been tweaking a lot the file, maybe it would be easier to start with a new one from the original package.

The changes are:
Open the slogin_lib.inc.php file and add the following code around line 50 (after the definition of the slogin_usehashes variable):

Code:
// Fix the paths.
if (!isset ($slogin_path)) {
  $slogin_path = "";
}
$slogin_userstxt = $slogin_path . $slogin_userstxt;
$slogin_altuser = $slogin_path . $slogin_altuser;



And around line 64 substitute the definition of the constant SLOGIN_LOG_FILE with this:
Code:
define ("SLOGIN_LOG_FILE", $slogin_path . SLOGIN_LOG_PREFIX . fslogin_logprefix() . SLOGIN_LOG_SUFFIX . ".txt");



Eadwine, if you still have problems, please send me the slogin_lib.inc.php file by email (to mario@mariovaldez.org) and I'll check it for you. :)


Regards,

Mario A. Valdez-Ramirez.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: 08 Dec 2004, 09:15 
I have gotten it to work :)

I have simply given the remaining include_once lines this format:


Code:
include_once ($slogin_path . "apropriatefile.php");



I have logged in from all possible subdirectories and it works like a charm. The only adminlog location is now the main directory :)


Thank you so much for your help!!


Report this post
Top
  
Reply with quote  
PostPosted: 08 Dec 2004, 09:18 
Mind you, I'd be glad to send you a copy of my slogin_lib.inc.php file via email, if that would help you out with the development?

Just tell me which email to send it to :)


Report this post
Top
  
Reply with quote  
PostPosted: 20 Dec 2004, 02:56 
User avatar

Joined: 06 Mar 2003, 03:21
Posts: 447
Location: Monterrey, NL, Mexico
Eadwine:

> Mind you, I'd be glad to send you a copy of my
> slogin_lib.inc.php file via email, if that would help
> you out with the development? Just tell me which
> email to send it to

Thanks. If you think your file can provide any improvement please send it by email to mario@mariovaldez.org. All comments, suggestions or code is always welcome. :)

Regards,

Mario A. Valdez-Ramirez.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: 20 Dec 2004, 13:00 
mvaldez wrote:
Thanks. If you think your file can provide any improvement please send it by email to mario@mariovaldez.org. All comments, suggestions or code is always welcome. :)

Regards,

Mario A. Valdez-Ramirez.

Well.. I don't know THAT.. but I will send the file anyway for you to peruse ;)

:)


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group