php

php/ldap - bind fails but errorno doesn't execute

I am trying to connect to ldap with a php web application. If the username/password is correct everything works fine however if the username/password is incorrect I get the following error: PHP Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Invalid credentials for some reason I am not able to look at the errorno o...

Using preg_replace in php for whitespace between <br/> and <p> tags

I need to remove this string if found in my string: <p><br/> </p> Cant replace this: <p><br/>Test. </p> The whitespace expression I am using wasn't working for that, thank you for your help! ...

Deleting YouTube videos using Zend/PHP

Hello, I'm using Zend and PHP to upload and delete videos from my home page. The uploading part is working fine but to download is more complicated. $videoEntryToDelete = $yt->getVideoEntry($videoId); $yt->delete($videoEntryToDelete); I use this code to delete a video and the first row do work. The video object is created and I can g...

Replace in place, parsing & string manipulation.

I'm trying to replace a set of characters within a string. The string may or may not have any data to change. The string is marked up in a way that allows for it to change it's color from a set of characters. The string can reset it's formatting to default by using a defined set of characters. This setup is very much like the ECMA-48 st...

Execute shell command in PHP on the desktop of another logged in user

The Setup: I have a LAMP server (Ubuntu 9.10) which is also hooked up to my HDTV. Upon boot, one user is automatically logged in so as to have a desktop environment on screen. What I want: I've been developing a remote, web interface in PHP for various things (play music, for example). However, I've hit a snag in that I would like to ru...

PHP Redirect problem with subdomain

I'm using PHP to redirect a page back to the previous page with the following: header("Location: {$_SERVER['HTTP_REFERER']}"); This set of pages will only be used by internal users, so I'm not terribly concerned about the fact that the referer will not always be available. The problem I'm running in to is that if the referer looks li...

How is the result of openssl_sign() encoded?

The docs about openssl_sign() say that the signature is returned in the passed string argument. My question is - how is it encoded? Base64, Hex-string, anything else? I don't have php installed and I have to use this PHP code I was given simply in order to verify whether my Java implementation is correct, so don't ask me "have you trie...

Strange JavaScript syntax error from an AJAX call to PHP

Hello, Long time reader, first time poster. Any help is greatly appreciated. I have crafted an AJAX query using JavaScript. The script works correctly, and the interface does what I want, but Firefox is giving me an error message related to the PHP file being hit. It's strange, because it seems to suggest there's a syntax error in t...

How to convert eregi to preg_match?

I am using a lib which uses eregi($match="^http/[0-9]+\\.[0-9]+[ \t]+([0-9]+)[ \t]*(.*)\$",$line,$matches) but as eregi is deprecated now, i want to convert above to preg_match. I tried it as below preg_match($match="/^http/[0-9]+\\.[0-9]+[ \t]+([0-9]+)[ \t]*(.*)\$/i",$line,$matches) but it throws an error saying Unknown modifier ...

Kohana3: Different .htaccess rewritebase and kohana base_url for dev and production environment

In my bootstrap.php I have the following: if($_SERVER['SERVER_NAME'] == 'localhost') Kohana::$environment = 'development'; else Kohana::$environment = 'production'; ... switch(Kohana::$environment) { case 'development': $settings = array('base_url' => '/kohana/', 'index_file' => FALSE); break; default:...

Is it possible to combine these 3 mySQL queries?

I know the $downloadfile - and I want the $user_id. By trial and error I found that this does what I want. But it's 3 separate queries and 3 while loops. I have a feeling there is a better way. And yes, I only have a very little idea about what I'm doing :) $result = pod_query("SELECT ID FROM wp_posts WHERE guid LIKE '%/$downloadfile'")...

IMDB Grabber PHP

I am recieving an error: Notice: Undefined variable: content in C:\wamp\www\includes\imdbgrabber.php on line 17 When using this code: <?php //url $url = 'http://www.imdb.com/title/tt0367882/'; //get the page content $imdb_content = get_data($url); //parse for product name $name = get_match('/<title>(.*)<\/title>/isU',$imdb_content);...

Using windows authentication with php?

Scenario: I have a area of a website that needs to be secure and accessible when offsite. I want the user to enter the username and password used to login at work in a web form. The form will send the username and password to authenticate it. If it works the user is logged in. I need to use a form not a pop-up login box. PHP is prefer...

Cakephp ACL authentication issue - I'm locked out

I've followed the CakePHP Cookbook ACL tutorial And as of right now I'm just trying to add users using the scaffolding method. I'm trying to go to /users/add but it always redirects me to the login screen even though I have added $this->Auth->allow('*'); in beforeFilter() temporarily to allow access to all pages. I've done this in both ...

include or required

What should I use in the following statement? Include or required. if(a ==b){ require 'requiredfile.php'; } else { require 'requiredfile_2.php' } If in a function, I know that one, either include or require, only includes the file when called, the other one will include the file regardless. Am I correct? ...

iPhone and Android GPS coordinates in PHP

Hello everyone, I'm am curently doing an application with Google Maps, where I am checking the position of the user with the javascript API, but I would like to know if there is a way to check the GPS variables in a PHP file ? Some kind of GET parameter, but it seems nothing like that exists. ...

Building counters from paginated search results...?

I'm creating eBay style search panes that allow users to narrow their results set by certain criteria. For example: Tags Literature (8) Fiction (4) English (4) American (3) Non-fiction (2) The number of results which have that property is in brackets. Initially, I built the counters by putting this code in my display ...

convert date string to mysql datetime field

I have a bunch of records with dates formatted as a string such as '04/17/2009' I want to convert them to a mysql datetime field I plan to use a foreach loop to read the old date value and insert the newly formatted value into a new field in each record what would be the best way to convert that string...I thought php might have a way...

Facebook connect JavaScript with PHP

I'm using the JavaScript method to sync/login (with the popup) with Facebook Connect on my site, it seems to work. However, after I get logged in, I want to continue in backend, with the PHP library. I see the cookies are set by the JavaScript lib, but I don't know how to use them with the PHP api. I used $fb = new Facebook($api_key, $s...

SimpleXML - "Node no longer exists"

Hi I'm trying to get the video data from this youtube playlist feed and add the interesting data to an array and use that later, but as you can see from the feed some videolinks are "dead" and that results in problems for my code. The error I get is "Node no longer exists" when I try to access $attrs['url']. I've tried for hours to fin...