Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> NukeSentinel™
Author Message
JohnGotti
New Member
New Member


Joined: Mar 04, 2005
Posts: 8

PostPosted: Wed Aug 17, 2005 6:15 pm Reply with quote

Hi guys...

I'm hoping someone can help me. I have a block that wont seem to work and I'm thinking that Sentinel might be the reason.. The block works fine on two other sites that I know of.. the only difference is that they are not using Sentinel.

The block is for accessing SquirrelMail... Here is the code...

Code:


<?php

// SquirrelMail Login Block

if (eregi("block-SquirrelMail_Login.php",$PHP_SELF)) {

  Header("Location: index.php");

  die();

}

?>

<?php

// Get PHP-Nuke Username

global $user;

if(!is_array($user)) {

   $user_get = base64_decode($user);

   $user_get = explode(":", $user_get);

   $username = "$user_get[1]";

   } else {

         $username = "$user[1]";

   }



// Compare PHP-Nuke Username to LDAP Username

$ds = ldap_connect('127.0.0.1', 389)

   or die("Could not connect to server.");

   ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);

if ($ds) {

   $dn = "uid=" . $username . ",ou=People,dc=example,dc=com";

   $value = $username . "@<domainname>.com";

   $attr = "mail";

   $r=ldap_compare($ds, $dn, $attr, $value);

   if ($r === -1) {



      // Optionally show LDAP error on website, good for debugging, not for production

      //$content .= "Error: " . ldap_error($ds);

      $content .= "<center>Sorry, we were unable to validate your e-mail account.</center>";

      } elseif ($r === true) {

      $content .= "<form action=\"https://www.<domainname>.com/webmail/src/redirect.php\" method=\"POST\" target=\"_blank\">";

      $content .= "<table align=\"center\" border=\"0\"><tr><td align=\"center\"><a href=\"http://www.squirrelmail.org/\" target=\"_blank\" title=\"[ Only registered users can see links on this board! Get registered or login! ]\"><img src="https://www.<domainname>.com/SquirrelMail_Login.jpg" width=\"130\" height=\"47\" border=\"0\" /></a></td></tr></table>";

      $content .= "<table align=\"center\" border=\"0\"><tr><td align=\"center\">";

      $content .= "<tr><td align=\"center\">Password:</td></tr><tr><td align=\"center\"><input type=\"password\" name=\"secretkey\" size=\"10\" />";

      $content .= "<input type=\"hidden\" name=\"login_username\" value=\"$username\" />";

      $content .= "<input type=\"hidden\" name=\"js_autodetect_results\" value=\"0\" />";

      $content .= "<input type=\"hidden\" name=\"just_logged_in\" value=\"1\" /></td></tr>";

      $content .= "<tr><td align=\"center\"><input type=\"submit\" value=\"Login\" /></td></tr></table></form>";

      } elseif ($r === false) {

      $content .= "<center>Sorry, you do not have an e-mail account.</center>";

      }

   } else {

   $content .= "<center>Sorry, we were unable to connect to the server.</center>";

}

?>



I have the block loaded on the left, and whenever I activate it.. Everything that is suppose to load after this block wont. It basically just stops right where this block is suppose to load and nothing happens after it.

I've contacted the author of the block and he cant seem to find anything wrong with it. The same code is being used on his site and its working properly. Again, it would seem the only difference is that he also is not using Sentinel.

We are using Nuke 7.5 with Sentinel 2.2.1. I'm not positive which Chatserv patch we are currently using.

Any help that anyone can give would greatly be appreciated!! Smile
 
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 17086

PostPosted: Wed Aug 17, 2005 9:12 pm Reply with quote

Shouldn't be your problem. Comment out the NukeSentinel include statements in your mainfile.php file. Still have the problem? If so, look at your server error log.

Btw, I thought you were dead ROTFL
 
View user's profile Send private message
JohnGotti
PostPosted: Wed Aug 17, 2005 9:52 pm Reply with quote

Raven wrote:
Shouldn't be your problem. Comment out the NukeSentinel include statements in your mainfile.php file. Still have the problem? If so, look at your server error log.

Btw, I thought you were dead ROTFL


Here's what the PHP Error Log is showing me...

Quote:

[17-Aug-2005 19:07:00] PHP Parse error: parse error, unexpected T_STRING in /home/sub1/public_html/blocks/block-SquirrelMail_Login.php on line 35


My PHP skills aren't that good ( must be from being dead and all LOL ).. The author of the script said the only thing around line 35 that makes him think there is a problem is the $username string.

Anyone have any ideas???

Thanks! Smile
 
Raven
PostPosted: Wed Aug 17, 2005 11:40 pm Reply with quote

First of all, I would suggest rewriting this code
Code:
if(!is_array($user)) {


   $user_get = base64_decode($user);

   $user_get = explode(":", $user_get);

   $username = "$user_get[1]";

   } else {

         $username = "$user[1]";

   }

to
Code:
if(!is_array($user)) {


   $user_get = base64_decode($user);

   $user_get = explode(":", $user_get);

   $username = $user_get[1];

   } else {

         $username = $user[1];

   }
$username = addslashes($username);


If that doesn't fix it, then add this piece of code to see what $username is resolving to. Just before the
Code:
$username = addslashes($username);

add
Code:
die('$username = '.$username);

and report back.
 
JohnGotti
PostPosted: Thu Aug 18, 2005 8:32 am Reply with quote

It would seem I have a new problem..

I've changed the code where you have asked me to and I'm not longer getting an error on line 35 which is good! Smile

Now this is what my PHP Error log is showing me...

Quote:

[18-Aug-2005 09:21:57] PHP Parse error: parse error, unexpected T_STRING in /home/sub1/public_html/blocks/block-SquirrelMail_Login.php on line 42


Here is what line 42 in Crimson Editor shows me...

Code:


$content .= "<table align=\"center\" border=\"0\"><tr><td align=\"center\"><a href=\"http://www.squirrelmail.org/\" target=\"_blank\" title=\"[ Only registered users can see links on this board! Get registered or login! ]\"><img src= "https://www.warrentonsubdivision.com/SquirrelMail_Login.jpg" width=\"130\" height=\"47\" border=\"0\" /></a></td></tr></table>";


I know there has to be a problem with this line because in Crimson editor this part of the code...

Code:


<img src= "https://www.warrentonsubdivision.com/SquirrelMail_Login.jpg" width=\"130\" height=\"47\" border=\"0\" /></a></td></tr></table>";


is basically all in green... The "https:" is in black and "//www.warrenton" all the way down to the end is in green... I think this basically means there is a syntax error somewhere in that area, but I cant seem to find it.

Thanks again Raven for all the help... Maybe you can find where the syntax error is better then me! Smile
 
Raven
PostPosted: Thu Aug 18, 2005 8:40 am Reply with quote

Change
Code:
<img src= "https://www.warrentonsubdivision.com/SquirrelMail_Login.jpg" width=\"130\" height=\"47\" border=\"0\" /></a></td></tr></table>";
to
Code:
<img src= \"https://www.warrentonsubdivision.com/SquirrelMail_Login.jpg\" width=\"130\" height=\"47\" border=\"0\" /></a></td></tr></table>";
 
JohnGotti
PostPosted: Thu Aug 18, 2005 8:50 am Reply with quote

Raven..

I first want to say that I cant thank you enough for all your help so far.. Obviously this isn't your script and has nothing to do with anything you produce and yet you've been more than willing to help me! I REALLY appreciate it! Smile

Secondly, It would seem that if it isn't one thing.. Its another... Sad Made the change you just told me about and it cleared up that error... Now it would seem I'm getting a new one..

Quote:

[18-Aug-2005 09:47:02] PHP Fatal error: Call to undefined function: ldap_connect() in /home/sub1/public_html/blocks/block-SquirrelMail_Login.php on line 20


Here is the line...

Code:



$ds = ldap_connect('127.0.0.1', 389)
   or die("Could not connect to server.");
   ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
if ($ds) {
   $dn = "uid=" . $username . ",ou=People,dc=example,dc=com";
   $value = $username . "@warrentonsubdivision.com";
   $attr = "mail";
   $r=ldap_compare($ds, $dn, $attr, $value);
   if ($r === -1) {


Line 20 is the first line in that code...
 
Raven
PostPosted: Thu Aug 18, 2005 9:00 am Reply with quote

That is a PHP function Only registered users can see links on this board! Get registered or login!

My guess is that your host does not support LDAP via PHP. See Only registered users can see links on this board! Get registered or login! for the requirements, but here is a brief synopsis
PHP Manual wrote:
Requirements

You will need to get and compile LDAP client libraries from either OpenLDAP or Bind9.net in order to compile PHP with LDAP support.
Installation

LDAP support in PHP is not enabled by default. You will need to use the --with-ldap[=DIR] configuration option when compiling PHP to enable LDAP support. DIR is the LDAP base install directory. To enable SASL support, be sure --with-ldap-sasl[=DIR] is used, and that sasl.h exists on the system.

Note to Win32 Users: In order to enable this module on a Windows environment, you must copy several files from the DLL folder of the PHP/Win32 binary package to the SYSTEM folder of your windows machine. (Ex: C:\WINNT\SYSTEM32, or C:\WINDOWS\SYSTEM). For PHP <= 4.2.0 copy libsasl.dll, for PHP >= 4.3.0 copy libeay32.dll and ssleay32.dll to your SYSTEM folder.
 
JohnGotti
PostPosted: Thu Aug 18, 2005 9:30 am Reply with quote

Thanks Raven.. I'll check into that now and report back! Smile
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> NukeSentinel™

View next topic
View previous topic
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 vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©