php

ldap login form works, but need to add active-directory group access

I created a form that asks you to log in, then verifies the user/pass against the ldap server/active-directory, if successful, it creates a session, which will be checked on every page. Now I want to check the session, which is the username of the person who is logged in, and do a search for them using ldap_search, so I can check what g...

php preg_split last occurrence of character

Looking for some help! I need to split a string at the last occurrence of a space... e.g. "Great Neck NY" I need to split it so I have "Great Neck" and "NY" I haven't had a problem using preg_split with basic stuff but I'm stumped trying to figure out how to tell it only to split at the last occurrence! Any help would be appreciate...

How to split css-images across multiple subdomains using php?

I wrote a php script to stick in my page just before my main stylesheet. The idea is to split all the background images needed by my page across a few different subdomains so that I can use more than two parallel HTTP requests (latency is horrible from Australia to American hosting). I know that this requires resolving extra DNS lookup...

Is this query vulnerable to sql injection?

$myq = sprintf("select user from table where user='%s'", $_POST["user"]); I would like to know if the above query can be exploited using SQL injection. Is there any advanced SQL injection technique that could break sprintf for this particular query? ...

PHP Compare Two Arrays?

I'm trying to compare two entries in a database, so when a user makes a change, I can fetch both database entries and compare them to see what the user changed, so I would have an output similar to: User changed $fieldName from $originalValue to $newValue I've looked into this and came accross array_diff but it doesn't give me the outp...

Check string for link

I have rather long entries being submitted to a database. How can I create a function to see if this entry has a link within it? Can someone get me started? Pretty much, I want the function to find any <a, <a href or any other related link instances within a string. I'd prefer not to throw the entry into an array. Are there an...

How do I know if my PHP application is using too much memory?

I'm working on a PHP web application that let's users network with each other, book events, message etc... I launched it a few months ago and at the moment, there's only about 100 users. I set up the application on a VPS with ubuntu 9.10, apache 2, mysql 5 and php 5. I had 360 Mb of RAM, but upgraded to 720 MB a few minutes ago. Late...

Open source gravatar-like implementations?

I'm already using gravatar icons for the users of my web service. However, I'm finding several problems with this approach: Only a small percentage of the users take the time to set up a gravatar profile. My users are not tech-savvy, but would be likely to add a dedicated photo to my site. Users of my service are encouraged to use imag...

UI: What are the different ways to display a Has and Belongs to Many relationship?

This is not a question about a specific framework. I am using plain php with jquery. I am trying relate multiple products to multiple sets of options. That is each product can have multiple non-exclusive sets of options related to them. What would be the best way to represent this on screen? I suppose it could be a multiselect box. That ...

PDO fails to prepare a statement with over 13 placeholders

Hello, this is the code I'm using: self::$DB->prepare($query, $types); when the $query and types are: //$query UPDATE Permisos SET empleado_id = ?, agregar_mensaje = ?, borrar_mensaje = ?, agregar_noticia = ?, borrar_noticia = ?, agregar_documento = ?, borra...

Displaying name instead of ID PHP MySQL

Hi, I need something simple; I have page where a user clicks an author to see the books associated with that author. On my page displaying the list of books for the author, I want a simple HTML title saying: 'The books for: AUTHORNAME' I can get the page to display author ID but not the name. When the user clicks the link in the previo...

Some JPEG images are not working in IE

Hello, I have a press archive. The press archive displays automattically created thumbnails as links to a PDF document. This is what i get in IE 6, 7 & 8: While it works fine in Chrome: The thumbnails are automatically created by imagemagick: $cmd = 'convert ' . $_FILES['file']['tmp_name'] # This is a PDF file . '[0]' #...

Post High Score and Retrieve Position

I'm not so savvy with MYSQL, so my apologies in advance is this is a dumb question. I've created a super basic PHP High Scores table. Upon inserting a new score into the DB Table, I'd like to retrieve the position of that score so that I can get 10 results with the persons score falling within that range. My INSERT Query looks somethin...

PHP AND SOAP. Change envelope

Hi All!!! It is many questions there about PHP and SOAP. But I am not found answer on my situation. So. I use PHP SoapClient and WSDL for it. Object sends this: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.site.com"&gt;&lt;SOAP-ENV:Body&gt; But I need this: <soap:Envelope xmlns:...

PHP SoapClient() function returning a single XML string

I am having difficulty with the PHP SoapClient() function. The SOAP request is successful, but the response is returned as an object containing a single XML string with the key "any". For example: <?php $params = array('strUsername' => 'Test', 'strPassword' => 'Test'); $client=new SoapClient('http://www.example.com/webs...

What are the benefits of the PHP the different PHP compression libraries?

I've been looking into ways to compress PHP libraries, and I've found several libraries which might be useful, but I really don't know much about them. I've specifically been reading about bcompiler and PHAR libraries. Is there any performance benefit in either of these? Are there any "gotchas" I need to watch out for? What are the r...

proper link formatting

I am trying to create a link, which will, allow my paginated search to go onto the next page of results including the search term in the url I get the following error with the link I have created Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/dd615/public_htm...

Textarea Adding Space To Beginning of Text?

I'm having a strange problem in that I have php inserting text into a <textarea> and the <textarea> is adding one white space to the top of my text. I created an example page to display the problem... here it the code behind the page. <textarea style="width:600px;height:100px;"><?php get_film_info('main description'); ?></textarea> <br...

Checklist for good email delivery in php

I have a PHP application that sends email using the pear Mail function. Unfortunately all my emails end up in the junk folder. Can i get a checklist for things i should do to make sure my emails are recieved correctly. Thank you ...

Getting rid of unused php files

I'm looking into removing php files that are no longer used on my site. I can use something like get_included_files to show the included files, but that would mean I would have to put it on every child page. If I put it on a parent page, it won't show me the child page that called it. Has anybody else run into a similar situation? If so...