PHP - Ldap Issue With Multiple Ips On One Server
Hi Everyone,
Hopefully someone will be able to assist with my problem. Basically, my situation is that we have a server which hosts multiple websites using multiple IP address. One of the new sites we are moving to this server needs an LDAP connection outside of our network. The outside LDAP has already been enabled to accept requests from the specific IP assigned to this site. However, other sites on this server are using other IP addresses. It seems as if the LDAP authentication request is getting sent by a IP address which is not authorized by the firewall on the outside LDAP server. Thus trouble authenticating. So, my question is, is there a way to force the ldap_bind request to use a specific IP address to send the request for authentication? Supposedly this can be done using an event handler. However, I don't have much experience with event handlers so am not sure how to go about doing this. I would appreciate any help or ideas to resolve this situation. Thanks! - Jodie Similar TutorialsI have an application that uses the PHP LDAP library to connect to the Windows Active Directory:
$ds = ldap_connect($ini['ad_server']) or die("Could not connect");
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); I am wondering if anyone knows if this upcoming patch "2020 LDAP channel binding and LDAP signing" coming from Microsoft will break any PHP applications that are using this ldap library. Thanks in advance,
M Hi, I'm working with the LDAP directory, and using PHP to access it. I am able to extract the name, departments and phone nos. from the directory. On the display page, i am looking to make the name column sort A-Z. (Like the "name" will be clickable and will sort the names from A-Z and Z-A ) Would appreciate if someone could suggest approaches to achieve this using PHP Thanks I just did a huge import from an app I have been working on. No issues except for this. I uploaded & imported all files & databases from my wampserver (localhost, local server) to my main online server. Before I continue with the problem, I have to give you info on how the files work. I am using a "controller" to view the files. Meaning, from index.php, I call all the files. For example, instead of mysite.com/register.php, its mysite.com/index.php?page=register. The index defines the doctype & html tags etc. The other files that are called through index.php are just pure php code, it does not contain the head & body tags etc. So, the issue is , when the surfer submits a form, i need to set a cookie. this cookie is VERY important. I cannot get it to work. I am getting the header warnings after submit Of course, this is to be expected. But I tried it on my local server, & it worked. I am not very familiar with cookies, this is a side of PHP i never really even touched. I know almost everything but that. So the php code is before the html code on the page, so I figured it was worth a shot. Im guessing the problem here is, since the code being outputted as index.php code + the form page code. So the cookie is being set after the html tags. How can I fix this? I need it to work thru the controller. I cannot just make it a single file, all files on the site needs to be thru this controller, otherwise it will mess everything up. Ino I could just add the code from index.php plus the form page code & just run the php code before all of the html tags, but like I said it has to be called thru index.php. I appreciate your replies, & I hope you guys dont think im an idiot & can understand my question, im terrible with words! I am using mod_php with Apache/2.4.6 (CentOS). I currently do not have multiple versions of PHP running on my server, but wish to do so now. Will I need to use php-fpm? Even if multiple instances can be accomplished with mod_php, is it typically preferred to use php-fpm? Any unusual gotcha's that I should be aware of? Will I need to uninstall mod_php before installing php-fpm? I previously used remi-php73 repo. Better to install from source? Thanks Edited August 25, 2019 by NotionCommotion've create a SOAP Server using the PHP Soap functions. It has 3 functions in it and is initialised as follows; // Initialise the SOAP Server $opts = Array(); $opts['compression'] = SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP; $server = new SoapServer('SOTBWSDL.wsdl', $opts); $server->addFunction('getAvailability'); $server->addFunction('putReservation'); $server->addFunction('putCancelBooking'); $server->handle();
There are then 3 Functions as defined with the code in for each . $client = new SoapClient('http://xxxxxxxxx/SOTBWSDL.wsdl',array('trace'=>1,'exceptions=>1')); $res = $client->getAvailability($xmlparams);
This works and returns data as expected. $res = $client->putReservation($xmlparams); (To another function)
it is the first function (get Availability) that is executed. Hi, I have some code which scrapes data from a page. However there are around 1200 product pages on the site I need to scrape, when I attempt to loop through all the pages I get a server timeout. I can only get to around 40 without timeout. Has anyone else had this problem? I am moving my website to a new Service Provider. The script I use for multiple updating worked on the older server but not on the new one. It shows the information but does not update the records. Any help would be greatly appreciated. Old Server : PHP 5.2.11 MYSQL: 5.0.92-community New Server : PHP 5.2.17 MYSQL: 5.1.47-community Script: <?php include("head.php"); $host="localhost"; // Host name $username="xxxxxxx"; // Mysql username $password="xxxxxxx"; // Mysql password $db_name="xxxxxxx"; // Database name $tbl_name="xxxxxxx"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name limit 20"; $result=mysql_query($sql); // Count table rows $count=mysql_num_rows($result); ?> <title>PowerMan South Africa</title> <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Expires" CONTENT="-1"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="style.css" type="text/css" media="screen" /> <style type="text/css" media="screen,projection"> @import url(calendar.css); </style> </head> <table width="500" border="0" cellspacing="1" cellpadding="0"> <form name="form1" method="post" action=""> <tr> <td> <table width="500" border="0" cellspacing="1" cellpadding="0"> <tr> <td align="center"><strong>ID</strong></td> <td align="center"><strong>Company</strong></td> <td align="center"><strong>contact</strong></td> <td align="center"><strong>Email</strong></td> <td align="center"><strong>Telephone</strong></td> <td align="center"><strong>Type</strong></td> </tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td align="center"><? $id[]=$rows['id']; ?><? echo $rows['id']; ?></td> <td align="center"><input name="company[]" type="text" id="company" value="<? echo $rows['company']; ?>"></td> <td align="center"><input name="contact[]" type="text" id="contact" value="<? echo $rows['contact']; ?>"></td> <td align="center"><input name="email[]" type="text" id="email" value="<? echo $rows['email']; ?>"></td> <td align="center"><input name="telephone[]" type="text" id="telephone" value="<? echo $rows['telephone']; ?>"></td> <td align="center"><input name="type[]" type="text" id="type" value="<? echo $rows['type']; ?>"></td> </tr> <?php } ?> <tr> <td colspan="4" align="center"><input type="submit" name="Submit" value="Submit"></td> </tr> </table> </td> </tr> </form> </table> <?php // Check if button name "Submit" is active, do this if($Submit){ for($i=0;$i<$count;$i++){ $sql1="UPDATE $tbl_name SET company='$company[$i]', contact='$contact[$i]', email='$email[$i]',type='$type[$i]', telephone='$telephone[$i]' WHERE id='$id[$i]'"; $result1=mysql_query($sql1); } } if($result1){ header("location:update_multiple.php"); echo "<meta http-equiv=Refresh content=0;url=update_multiple.php>"; } mysql_close(); ?> Im working on an issue that keeps sending the user to logge_in.php and never to post_new.php even if it is the referer. Here is the code I have wrote so far: Code: [Select] if($_SERVER['HTTP_REFERER'] =="post_new.php"){ $referer = "post_new.php"; }elseif($_SERVER['HTTP_REFERER'] =="logged_in.php"){ $referer = "logged_in.php"; } header("Location: ".$referer." "); exit(); } Thanks in advance! i am trying io copy my template to the newly created file using copy function but the copy function does not work on the server it worked fine in localhost.. i tried using fil_get_contents and file_put_function but that didnt work as well mayb cuz of the restrictions of the server.. and i do not have the permission to edit the php.ini file.. i am talking to talk with the hosting company.. but just wanted to knw is der any oder wat to copy my template to a new file that is created? I have a website uploaded onto Host Gator hosting and the sessions are carried over to the other pages ok. When using the same website in XAMPP it does not carry over the session to the next page and need to login again. If i log in it puts the following after the URL - ?sid=3b71942d410d84c45f9f4433561c325a The when i go to another link it loses the sid and i'll need to manualy past it into the next URL to get it working unless i log in again on the new page. This is only happening with XAMPP but working fine in the Host Gator hosting environment. Please help! My login is integrated with the phpbb3 login. This is the code at the beginning of every page - Code: [Select] <?php ob_start(); define('IN_PHPBB', true); $phpbb_root_path = './phpbb3/'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); // Start session management $user->session_begin(); $auth->acl($user->data); $user->setup(); ?> I'm getting the error below when I run my script on my remote server. I'm providing a relative path to this file and it works on my local server (XAMPP). I've researched it a bit and I think it has to do with how I indicate the path to the file on the remote server. I don't know what to do about it, however. I hope someone can help me. The file is in the indicated directory on the remote server and there are no permissions issues that I am aware of. The mystery phrase is: include_path='.:/opt/cpanel/ea-php73/root/usr/share/pear'
--Kenoli Warning: require(bootstrap/start.php): failed to open stream: No such file or directory in /home4/ournight/public_html/tio-new/__classes/pi_admin.php on line 3 Warning: require(bootstrap/start.php): failed to open stream: No such file or directory in /home4/ournight/public_html/tio-new/__classes/pi_admin.php on line 3 Fatal error: require(): Failed opening required 'bootstrap/start.php' (include_path='.:/opt/cpanel/ea-php73/root/usr/share/pear') in /home4/ournight/public_html/tio-new/__classes/pi_admin.php on line 3
Here is one of those purely conceptual questions, which involves no code. I'm trying to create a select query which among other things, allows a user of a website to search other members who fall within a particular age range. I have a column in the table where the members' information are stored which records their ages. Which brings us to the problem. On any given day, a member's age may increase by one year compared to what it was the previous day, hence the need to update this column periodically. I can't think of any way to automatically update this column on a daily basis. So my solution is to run an initial update query every time a member tries to search other members based on age, which updates the age column for all other members, before running the select query which eventually retrieves the desired age range. This leads to the second problem. Imagine there are thousands of users using the website. At any given instance, there could be hundreds of members, trying to search others based on age. This means hundreds of users will be updating a single column (the age column) in one table at the same time. Is this feasible? Can it cause the server to crash? Or is there really a more reasonable way to do all of this? Thank you all for taking your time to read this. Appreciate any responses. I wrote wrong LDAP server for test but my script dont die! why ? in php.ini I wrote extension=php_ldap.dll and I have this lib in php/ext/ error_reporting(1); $ldaphost = 'my.office.company.com'; // Connecting to LDAP $ip = gethostbyname($ldaphost); $ldapconn = ldap_connect($ip) or die("Could not connect to $ldaphost"); echo 'done'; I'm using Active Directory and PHP with LDAP. I have been trying to create a script that will list all the members of each group in a OU. When I run this script in an OU with Users, it will return an array with all the available attributes of each User. However when I use it with a group, it doesn't return any attributes of the group. Code: [Select] <?php $ig_ldaphost="LDAP://domain/"; //filtered for security $ig_ldapou="OU=Drive Security,OU=Groups,DC=this,DC=and,dc=that"; //filtered for security $ig_ldapconn=ldap_connect($ig_ldaphost) or die("Could not connect to {$ig_ldaphost}"); $ig_ldapopt=ldap_set_option($ig_ldapconn,LDAP_OPT_PROTOCOL_VERSION,3) or die("Could not set options: {$ig_ldapopt}"); $ig_ldapbind=ldap_bind($ig_ldapconn) or die("Could not bind: {$ig_ldapbind}"); $ig_ldapsearch=ldap_search($ig_ldapconn,$ig_ldapou,"objectClass=*"); for ($ig_ldapentry=ldap_first_entry($ig_ldapconn,$ig_ldapsearch);$ig_ldapentry!=FALSE;$ig_ldapentry=ldap_next_entry($ig_ldapconn,$ig_ldapentry)) { $ig_ldapvalues=ldap_get_attributes($ig_ldapconn,$ig_ldapentry); $ig_ldapdn=ldap_explode_dn(ldap_get_dn($ig_ldapconn,$ig_ldapentry),1); echo "/".$ig_ldapdn[1]."/".$ig_ldapdn[0]."<br />"; var_dump($ig_ldapvalues); echo "<br /><br />"; } ldap_close($ig_ldapconn); ?> Can anyone help with this? I am having trouble using ldap_start_tls(). I am using the same code I have seen in a dozen different forums: $ds = ldap_connect($ldap['host'],$ldap['port']); ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); ldap_set_option($ds, LDAP_OPT_REFERRALS, 0); ldap_start_tls($ds); ldap_bind($ds,$ldap['user'],$ldap['pass']) ldap_close($ds); but I still receive the same error message: Warning: ldap_start_tls() [function.ldap-start-tls]: Unable to start TLS: Connect error The LDAP authentication had been working fine without the ldap_start_tls. I feel like I must have missed something big - is ldap_start_tls() dependent on having a local certificate? is OpenSSL a pre-requisite? I've seen lots of discussions turn towards OpenLDAP, but I had assumed this was only on the target server. Can anyone confirm that? Any help would greatly appreciated. Darren Hi, I'm completely new to LDAP authentication but have managed to get a fairly smooth working script. However, I was wondering what is the easiest way to get a BASEDN from a Fully Qualified Domain Name. At the moment I have a loop which would take: example.com and turn it into dc=examplem,dc=com But is that the best way? Hi guys, I have this problem and id appreciate all your advice in helping solve it. I'm working on a service with is "cloud" hosted. However I want it so when a person employed by Corporation A logs onto myservice.corporationa.com they enter their Corporation A LDAP details but somehow that sends them to myservice.com and authenticates them. I know how to do the get LDAP details part to put on myservice.corporationa.com but no idea how to do the rest and make it send back etc. Any ideas? Many many thanks in advance. (PS - If this all makes sense please do let me know) Hi,
I haven't worked with PHP in years and was asked to debug something. Maybe you can help me out since I'm stuck. This error popped up when we upgraded from PHP 5.3 to 5.4.
It is setting LDAP options.
Here is the code:
ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3); ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0) or die ("Could not set option referrals"); Both of these statement are throwing the following error message to the log. 52 is not a valid ldap link resource Anything I can check or look at? I am a little clueless here. Thanks Hello everyone, I'm new to PHP and I have a question about a PHP Login page using LDAP. I have received a project from my boss. A project to digitizing a form. Well having that part done, my boss said to make login page that uses LDAP. A page that using the username and password from the AD to login and redirected to a different page. So that the person doesn't have to remember different usernames and passwords. Is there a simple script, doing this? Kind regards, Rinse Ringma ( Don't mind my bad English ) |