php

Zend Framework 1.9 and Doctrine Integration

I'm trying to setup Zend Framework and Doctrine. There is this previous discussion with ZF 1.8 http://stackoverflow.com/questions/973259/integrate-doctrine-with-zend-framework-1-8-app That discussion doesn't take into account the AutoLoader / Bootstrap System. If I generate an application skeleton with ./zh.sh how would I go about ...

Understanding PHP's database connection variable

How can you have only one declaration of the database connection variable, $dbconn? My login script is based on the following procedure If the user is not authenticated, he is thrown back to the login page If the user is authenticated, he gets an $_SESSION["logged_in"] = true; Then when the user is browsing the main page or other page...

To set up a login system by Sessions in PHP

I found the source of the problem #2. It is the use of *session_register(foo)*. I put the following to my *handle_registration.php*. session_register("foo"); session_register("foo2"); $foo2 = $_POST['email']; $foo['email'] = $_POST['email'] The problem still persists, since no variables are stored to my session cookie. This is th...

json decode in php

I have the following json string and I want to retrieve just the email address from it. How do I do it in php? {"communications":{"communication":[{"@array":"true","@id":"23101384","@uri":"xyz/v1/Communications/1111","household":{"@id":"111111","@uri":"xyz/v1/Households/5465465"},"person":{"@id":"","@uri":""},"communicationType":{"@id"...

Random WordPress Admin 404s

I've been getting completely random 404 errors when using the backend of WordPress. These errors are for completely legitimate admin pages. The workaround is to refresh the page – which usually works the second time around. I've seen this problem reported elsewhere but no solution. Wondering if anyone here has good ideas. ...

How do I maintain a $this reference across two classes in different scripts?

ok, that's a bit odd but here's the situation: I am working in an MVC context I have a User class used as a library(User.php) ANd then I have a controller class that handles input from the user(controller.php) Here's how it goes: user registers registerhandler() is called in controller registerhandler() calls register() method in U...

How to Prevent Linke break for Divs in CSS?

I am creating menu for a website. for each item (Home, Contact us, About us) I use Background color and text of size 125X30. In CSS, When i use float it works correct. But when i removed float, all individual item such as home, contact etc come down one by one. I need it left to right in a single line without float. Help me ...

€ char is shown as ? in UTF8 Output

I have reworked a website and now it is xhtml valid etc and using UTF8. Everything is fine, but if anywhere in the Database is a Euro-char it is just displayed as a questionmark. What would be the right way to fix this? As output is done by Typo3 i cant change much about that. ...

Check if a PDF file is corrupted with PHP

I was wondering if is there a way for php to check if a PDF file stored locally on the server is corrupted or not. We have a php application that deals with a lot of scanned documents converted in PDF and it would be nice to check which of them is corrupted to alert the user. I tried to look around but with no luck. ...

PHP: Truncate text at word boundaries

Does anybody have the exact name of the function Drupal uses to turn the following string: "Hello, how are you. Some more text." into "Hello, how..." I.e. The function that's used to cut off a sentence after x words, and then add an elipsis. Alternatively, if anybody has a php snippet that does this, that would be great too! ...

Regex to match string between %

I'm trying to match substrings that are enclosed in %'s but preg_match_all seems to include several at the same time in the same line. Code looks like this: preg_match_all("/%.*%/", "%hey%_thereyou're_a%rockstar%\nyo%there%", $matches); print_r($matches); Which produces the following output. Array ( [0] => Array ( ...

Problem with debug function in php

I am relatively new to Cake PHP framework and was trying few things in it. I have made a blog databse. I was trying to view an array of number of posts made in a particular year using the debug() function. I wrote the following function in the post model. function findByYear($year = null){ $date = $year.'-01-01 00:00:00'; $end...

__autoload mix up?

I have a server with many customers on, when I develop I include my init.php in which I have an __autoloader() function that includes the file with dir_name(__FILE__)."/classes/".$className for instance. But yesterday I saw that the server could not find the specific class, I restartat apache and then it worked again. Every customer ha...

image merging using php in GD

hi i want to merge to images but the problem is one image is .PNG format and second one is .JPG format and after merging the output should be .PNG format but the transparency is not appearing .plz help Thanks ...

Moving a file to the Recycle Bin (PHP)

Hi, This question is related to a Windows install of PHP5. Doing a file unlink() makes it difficult for recovery. Instead I would like to move the file to the Recycle Bin (without doing an exec()). Do you have any idea? Thanks for your help. ...

PHP Patterns - Service/Model/Mapper/Dao Examples ?

Hi Folks, does someone knows some good examples for an PHP Application using those 4 "Layers" ServiceLayer -> Model --> DataMapper --> DAO Iam not sure if it makes sense, when i use such a design i have to do the following to create a new Record in my Database : $servcie = new Service(new Mapper(new Dao)); $service->save($data) th...

PHP's gzuncompress function in Java?

I'm compressing a string using PHP's gzcompress() function: http://us2.php.net/manual/en/function.gzcompress.php I'd like to take the output from the PHP compression function and decompress the string in Java. Can anyone send me down the right path? Thanks so much! ...

Is there anyway to tell if a website is coded in PHP or ASP

Assuming that the .php and .aspx extensions have been hidden from the URLs, are there any clues in the HTML that might suggest the site is coded in either php or asp? Cheers. ...

Zend_OpenId_Extension_Sreg fails on me

Hello everybody, Below is a working example of my OpenId implementation. I use hyves.nl as the OpenId provider but this also works with me.yahoo.com and probably other OpenId providers as well (but not Google). So far so good. But now I want to fetch the nickname and/or fullname from my hyves profile. But when I set nickname and/or ful...

PHP Captcha wont show!

I am tring to get a form working on a new server but the captcha does not appear! http://www.perfectclaims.com/ppiclaimsnew/ I know that the url for the captcha is right as it creates the session! Does anyone know whats going on? Thanks ...