php

Run query against each DB

Im using php to do this: while ($row = mysql_fetch_object($db_list)) { echo $row->Database . "<br>"; } DB1 DB2 DB3 DB4 I want to add to this by adding a simple select query and running that against each database. the select will pull out the firstname of every user in the users table from each DB. ...

Php: Generate ul-li tree from active directory results

I've got a result set from adLDAP of the form OU=LEAF1,OU=PARENT1,OU=ROOT,DC=datacenter,DC=local OU=PARENT1,OU=ROOT,DC=datacenter,DC=local OU=ROOT,DC=datacenter,DC=local OU=LEAF2,OU=CHILD,OU=PARENT2,OU=ROOT,DC=datacenter,DC=local OU=CHILD,OU=PARENT2,OU=ROOT,DC=datacenter,DC=local OU=PARENT2,OU=ROOT,DC=datacenter,DC=local Where each li...

Adjusting time zone in PHP with DateTime / DateTimeZone

There's a lot of info on doing time zone adjustments in PHP, but I haven't found an answer for specifically what I want to do due to all the noise. Given a time in one timezone, I want to convert it to the time in another timezone. This is essentially what I want to do, but I need to be able to do it using only the built-in PHP libs, ...

I have a php form that I want propogated with the current logged in Microsoft Active Directory Real Name

I have a simple intranet form where the user has to enter info for a Time off Request or other for some other internal company use. I would like to propagate the name field with the current Real Name that is logged in Microsoft Active Directory. The user has to login on their computer. Is there a way to pull that Real Name with a ph...

How to remove "index.php" in codeigniter's path

How do I remove the "index.php" sticking out in every path in codeigniter somewhere in the center? I want clean non index.php-fied URLs? ...

Image from PDF using ZendFramework

Hello, is there any way to save a PDF as an image using ZendFramework? I'm still looking for a solution with good performance. I've heard of ImageMagick, but the performance sucks and it's hard to configure the output properly for special needs (e.g. different sizes and DPI). Greets dom ...

Include: css with php file extension??

I'd like to wrap a css file in php... So I write the header for the css file and give it a php extension, thus... css.php. The question is will this work if the page is already being used as an include... or will this new header clash with the frame the page is being included into???? ...

Validating Timestamp overlaps with PHP

Hello all. My database holds date, start and end variables. In my code I grab the start and them as the user selects them, and convert them to timestamps like so (all inside a foreach loop).. $selectionDate = strtotime($timeQry['date']); $startTimes[] = strtotime($timeQry['start'],$selectionDate); $endTimes[] = strtotim...

Facebook Offline Access Key and login

Hey guys, I've been working on this for a while now and I can't seem to get it to work. It seems to be a frequently asked, but a rarely well-answered question. I want my website's users to link their facebook account with my website. So they can see their stream e.t.c on my site. At the moment, each time they log into my site they ha...

Get content between two strings PHP

Whats is the best way to obtain the content between two strings e.g. ob_start(); include('externalfile.html'); ## see below $out = ob_get_contents(); ob_end_clean(); preg_match('/{FINDME}(.|\n*)+{\/FINDME}/',$out,$matches); $match = $matches[0]; echo $match; ## I have used .|\n* as it needs to check for new lines. Is this correct? #...

Why does this javascript/jQuery JSON parsing code not work?

Here is my jQuery code. It should parse the json returned by this php script. The php is known to work. It should also convert the date literals to a javascript date object. However, an error occurs at dates.length. Can anyone see what is wrong with the code? if($("#calendar").length) { var dates; $.post("/dates/jsondates.php",f...

In PHP does the PDO::PDOStatement->bindParam() work as it is expected?

I am trying out PDO in PHP for the first time. I thought that PDOStatement->bindParam() would be a cool way to set the datatypes of the values that i pass in to the sql query. But somehow it doesnt work for me. For example I set the type of a variable to INT in bindParam call. But it still doesnt throw error even when I pass pure string ...

regex encapsulation php

What are the differences pros/cons of using either '/' or '#' as the regex encapsulation e.g. '/' = preg_match('/MYSEARCH}(.+)ENDMYSEARCH/s',$out,$matches); '#' = preg_match('#MYSEARCH}(.+)ENDMYSEARCH#s',$out,$matches); Thanks! ...

PHP display problems

I am pulling messages from mysql using PHP to be displayed on a specific page. Instead of displaying the title of the message in the designated title bar and the message in the designated body text box...there is no content displayed and its displaying the title in the url. What am I missing in my query? Or what is going on? ...

Getting a Magento 404 error when accessing the module settings through admin panel

So I downloaded the Magento free blog extension but it only supports a single blog. So I duplicated the extension as I need more than one blog in my magento store. I changed all the references and calls appropriately in my extension copy and was able to install it as a separate extension. However when I want to create a new post from t...

Create a variable from array of bytes

In PHP I have an array of bytes that I want to turn into a single variable. $bytes = array(0x12, 0x8D, 0x9D, 0x40, 0x09, 0x64, 0x5A, 0x6E); I figured I could create a string like so: $string = chr(0x12).chr(0x8D)......; but that seems hacky. Any suggestions? ...

PHP display problems revisited

I am pulling messages from mysql using PHP to be displayed on a specific page. Instead of displaying the title of the message in the designated title bar and the message in the designated body text box...there is no content displayed and its displaying the title in the url. What am I missing in my query? Or what is going on? /*--Here is...

How do i properly write a ajax reponse

I know this is a bad title for my question but what i am trying to do is reply to Autocomplete http://docs.jquery.com/Plugins/Autocomplete#API%5FDocumentation Instead of getting many elements i only receive "Array". I know this is obviously wrong bc of the way echo works but how do i echo in such a way this autocomplete works? mydoc....

ColdFusion or PHP Shopping script

Hello what I want to do is include a shopping cart on CF site. There are only 10 products but they want it to have their same look. Is there a way to have an include that would render a mini shopping cart inside their pages, but use outside shopping cart program. I'm not sure if there is anything like this so any suggestions would ...

column access with multidimensional array in php

I have a 2-D array of integers. I'd like to initialize it in column order, and then access it in row order. Is it possible to initialize in PHP in column order without explicitly iterating over every row? For example, in R, one can do my2d = matrix(nrow=2, ncol=2) # create 2x2 matrix my2d[,1] = c("a","c") # initialize column 1 in a s...