Author |
Message |
JohnGotti
New Member


Joined: Mar 04, 2005
Posts: 8
|
Posted:
Wed Aug 17, 2005 6:15 pm |
|
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=\"[ www.squirrelmail.org ]\"><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!!  |
|
|
|
 |
Raven
Site Admin/Owner

Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Wed Aug 17, 2005 9:12 pm |
|
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  |
|
|
|
 |
JohnGotti

|
Posted:
Wed Aug 17, 2005 9:52 pm |
|
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 |
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!  |
|
|
|
 |
Raven

|
Posted:
Wed Aug 17, 2005 11:40 pm |
|
First of all, I would suggest rewriting this codeCode:if(!is_array($user)) {
$user_get = base64_decode($user);
$user_get = explode(":", $user_get);
$username = "$user_get[1]";
} else {
$username = "$user[1]";
}
|
toCode: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);
|
addCode:die('$username = '.$username);
|
and report back. |
|
|
|
 |
JohnGotti

|
Posted:
Thu Aug 18, 2005 8:32 am |
|
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!
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=\"[ www.squirrelmail.org ]\"><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!  |
|
|
|
 |
Raven

|
Posted:
Thu Aug 18, 2005 8:40 am |
|
ChangeCode:<img src= "https://www.warrentonsubdivision.com/SquirrelMail_Login.jpg" width=\"130\" height=\"47\" border=\"0\" /></a></td></tr></table>";
| toCode:<img src= \"https://www.warrentonsubdivision.com/SquirrelMail_Login.jpg\" width=\"130\" height=\"47\" border=\"0\" /></a></td></tr></table>";
|
|
|
|
|
 |
JohnGotti

|
Posted:
Thu Aug 18, 2005 8:50 am |
|
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!
Secondly, It would seem that if it isn't one thing.. Its another... 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

|
Posted:
Thu Aug 18, 2005 9:00 am |
|
That is a PHP function http://www.php.net/manual/en/function.ldap-connect.php
My guess is that your host does not support LDAP via PHP. See http://www.php.net/manual/en/ref.ldap.php for the requirements, but here is a brief synopsisPHP 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

|
Posted:
Thu Aug 18, 2005 9:30 am |
|
Thanks Raven.. I'll check into that now and report back!  |
|
|
|
 |
|