php

fopen permission problem in php

open function working in local server but not working on mail server ...

What is LINQ? How can I use this with PHP?

Language Integrated Query. Now I know that the acronyms are. I have seen C# examples, but can't really understand them. Can I use them with PHP? Can I use it along with ORM? Has any PHP MVC framework has this? ...

PHP preg_replace html comments with empty space

Hi Guys, I have a bit of php code like this: $test = "<!--my comment goes here--> Hello World"; Now i want to strip the whole html comment from the string, i know i need to use preg_replace, but now sure on the regex to go in there. Can anybody help? Thanks ...

can I put the break on the same line

I have a switch statement that has over 300 case statements. case 'hello': { $say = 'some text'; } break; case 'hi': { $say = 'some text'; } break; Why is it that the break is always on a separate line? Is this required? Is there anything syntactically incorrect about me doing this: case 'hello': { $sa...

Open inviter(contacts exporter) only work for gmail..not work for yahoo.rediff etc.

I am using open inviter from php classes for grabbing all email contact of me... but it only work for gmail account..it fetch all contact from gmail..it not work for other like yahoo.hotmail.etc can any one help me..... ...

preg_match_all and newlines inside quotes

Another noob regex problem/question. I'm probably doing something silly so I thought I'd exploit the general ingenuity of the SO regulars ;) Trying to match newlines but only if they occur within either double quotes or single quotes. I also want to catch strings that are between quotes but contain no newlines. Okay so there's what i g...

A PHP design pattern for the model part [PHP Zend Framework]

I have a PHP MVC application using Zend Framework. As presented in the quickstart, I use 3 layers for the model part : Model (business logic) Data mapper Table data gateway (or data access object, i.e. one class per SQL table) The model is UML designed and totally independent of the DB. My problem is : I can't have multiple instance...

Event triggering in server-side scripts

In SO, when your question got answer. or you got new badge, event is triggered. Or when you got new PM in forum, it also lets you know by alerting message. You see message that something happened with your account when you enter site for first time after this event. How is this implemented? How do scripts know, that they have something...

Passing var from php to javascript

I try to do something pretty strait... getting php value to javascript here is the page here is the code.. <script language="javascript"> <?php $imagepath = $_REQUEST["path"]; ?> var whatisthepath = <?php $imagepath; ?> alert (whatisthepath); </script> ALWAYS getting UNDEFINE.... why ? -- Final wordking optimized code : ...

php regex - replace on "\${1}"

found this regex: insert " " every 10 characters: $text = preg_replace("|(.{10})|u", "\${1}"." ", $text); can you, please, explain what \${1} means. Why using \ and what curly brackets means? ...

Issue with converting PDF pages to images with ImageMagick's convert (and PHP)

I'm trying to create a small web service to convert PDF files to a series of images. When I run convert /full/path/to/source.pdf full/path/to/target.jpg when connected to the [Mediatemple (gs)] server via ssh, everything works correctly. When executing the same command through PHP's exec() function, only the first few pages of the PDF ...

How can I test if an input field contains foreign characters?

I have an input field in a form. Upon pushing submit, I want to validate to make sure the user entered non-latin characters only, so any foreign language characters, like Chinese among many others. Or at the very least test to make sure it does not contain any latin characters. Could I use a regular expression for this? What would be th...

PHP crc32() only numbers

I have a MD5 hash: 10f86782177490f2ac970b8dc4c51014 http://www.fileformat.info/tool/hash.htm?text=10f86782177490f2ac970b8dc4c51014 Result: c74e16d9 but PHP: crc32('10f86782177490f2ac970b8dc4c51014'); Result: -951183655 I don't understand! ...

Find key of parent in array / PHP

Perhaps someone can help me out with this one: I'm using a basic search function to find an array deep within an array. The problem is, once that array is found, I'd also like to return it's parent key. Is there a PHP function that can determine the parent key of an array? Below is an example of the Search Function... Ideally I'd like...

Automatic authentication in PHPMyAdmin

Hello! I have a local phpMyAdmin (installed via apt-get) adn I'm tired of entering login and password every time I try to open it. Database contains no sensitive info, just test tables, and is visible only from 127.0.0.1 I want phpMyAdmin already be logged in as root user with password 1234 (for example) when I open it. How do I do tha...

PHP MySQLi timeout on locked tables?

Hi guys I have a weird problem with mysqli timeout options, here you go: I am using mysqli_init() and real_connect() in order to set MYSQLI_OPT_CONNECT_TIMEOUT $this->__mysqli = mysqli_init(); if(!$this->__mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT,1)) throw new Exception('Timeout settings failed') $this->__mysqli->real_connect(h...

Display `pretty output` of directory content from array

Hi, I'm using the following code to get an array of directories and their sub-directories where each contain file type extension: png. It works great but I need to be able to output the results of the array in a list style format e.g. * Test -> test2.png -> test1.png * subfolder -> test3.png * sub sub folder -> test...

php database connection errors

Hello all, im hoping someone can help me quickly with a question i have. As site i have build is occasionally returning with the error Warning: mysqli::mysqli() [mysqli.mysqli]: (08004/1040): Too many connections in Warning: mysqli::query() [mysqli.query]: Couldn't fetch mysqli in Now at first i thought this was happening as i hade...

PHP Zend XML-RPC client - "Unknown type: i8" when making a request with Zend_Crypt_Math_BigInteger?

I am using Zend 1.10's XML-RPC client library to make XML-RPC requests to another server. One of the methods I have to call uses a i8 (a.k.a. ex:i8) type, i.e. extended big integer. This is supported in Zend (cf. http://framework.zend.com/apidoc/1.10/Zend_XmlRpc/Value/Zend_XmlRpc_Value_BigInteger.html). However whenever I try to make a f...

jquery repeat process once get reply from php file

i have one php file which process adding of record in Database fro array. for example in array i have 5 items aray an='abc','xyz','ert','wer','oiu' i want to call one php file in j query ajax method um = an.split(','); var counter = 0; if(counter < uemail.length) { $("#sending_count").html("Processing Record "+...