php

Error handling for popen

Hello All, I am using popen in PHP to execute a TCL file . $cmd='C:/wamp/www/Tcl/bin/tclsh84.exe'; //windows $ph = popen($cmd,'w') But if someone restarts the machine or the tclsh84.exe process is killed . How do I know this error condition has occured ? $ph is not returning 0 in these conditions. Regards, Mithun ...

Does Invision Power Board v3.0.3 store un-encoded versions of message posts?

Edit: This is an IPB (Invision Power Board) forum, not PHPBB as originally posted. My humble apologies. I'm trying to write a widget that displays a sampling of popular topics in our forum. However, parsing bbcode tags is a bit of a pain. We're using the PEAR BBCodeParser, so handling bbcode tags isn't a problem. But the real issue ...

codeiginter - business logic - controllers, models or library?

in CI, for me at least, views must be your layout (html), controllers are the structure and models handles the data. When building an app, where do business logic will be? I have maintained the controller only to handle urls, because i want to separate structure to business logic. i've been using my models to retrieve data and process i...

Fuzzy Text Search: Regex Wildcard Search Generator?

I'm wondering if there is some kind of way to do fuzzy string matching in PHP. Looking for a word in a long string, finding a potential match even if its mis-spelled; something that would find it if it was off by one character due to an OCR error. I was thinking a regex generator might be able to do it. So given an input of "crazy" it w...

Simple question about image_graphviz

Hello, I'm trying to display the example of image_graphviz Here, but it doesn't display anything in my page. Here is my page: test.php <?php require_once 'Image/GraphViz.php'; $gv = new Image_GraphViz(); $gv->addEdge(array('wake up' => 'visit bathroom')); $gv->addEdge(array('visit bathroom' => 'make coffee'))...

How to sort an array in php

i want the same value has the same index for example 1 2 2 3 5 after sort: array( 0=>1 1=>2 1=>2 3=>3 4=>5); but we can not set duplicate index in the array of php. ...

In php: dropdownlist values depend on another drop down list in the same form

Hi, How can I realize this solution? dropdownlist values depend on another dropdownlist in the same form e.g. :a form contains dropdownlist(car_name),dropdownlist (models of this car),button(search) notice that : 1)car_model values depend on car_name value 2)car_name dropdownlist and car_model dropdownlist in the same form thanks Best R...

How to retrive number with prep_match_all()

Hi, Inside my webpage "http://www.my_web_page" I have something like that: img border="0" class="borderx" id="pic_15132" I wanna know which parameter did I have to use inside preg_match_all("") to retrive only the number. Here is what I tried but my result is: _15132 $webpage = file_get_contents("http://www.my_web_page"); pre...

Active Directory Lookup via PHP

How can you do an Active Directory lookup via PHP? Without needing to recompile PHP. PHP version is 5.3 I want to find a persons display name from their user name. Web server is IIS 6 and PHP is served using FastCGI. I get the username with: $cred = explode('\\',$_SERVER['REMOTE_USER']); if (count($cred) == 1) array_unshift($cred, "(n...

Copy folder without overwriting

Hi all, I found this question (here) about copying a file without overwriting http://stackoverflow.com/questions/226894/how-do-you-copy-a-file-in-php-without-overwriting-an-existing-file What I need is a php script to copy all files in a folder, there are also some subfolders; so it should be recursive. I need to transfer it via FTP ...

PHP - Killing child process started by pcntl_fork

I am using pcntl_fork to start a child process to send an email via SMTP. The child process uses the PEAR Mail package to send the email, but the trouble is if the remote server doesn't respond the process just runs forever waiting for a response, regardless of any time limit that is set in php.ini. To get around this I'm using pcntl_a...

PHP - Doctrine, specify interfaces in YAML

Hi, Does anyone know if it is possible to specify an interface for a Doctrine model to implement within YAML? I cannot find anything within the documentation. Thanks ...

PHP RegExp for nested Div tags

I need a regexp I can use with PHP's preg_match_all() to match out content inside div-tags. The divs look like this: <div id="t1">Content</div> I've come up with this regexp so far which matches out all divs with id="t[number]" /<div id="t(\\d)">(.*?)<\\/div>/ The problem is when the content consists of more divs, nested divs like ...

how can i get data from other browser without refreshing browser in cakephp??

i am new to cakephp, and also new to ajax. the function i trying to do is basically like this: i am in a add page, which let me select few customer on that page. but i wanted to set 1 more link for user, which let user click customer immediately on the add page, and the new data will show in my add page without refresh, so that the user...

How can I measure the execution time of a for loop?

I want to measure the execution time of for loops on various platforms like php, c, python, Java, javascript... How can i measure it? I know these platforms so i am talking about these: for (i = 0; i < 1000000; i++) { } I don't want to measure anything within the loop. Little bit modification: @all Some of the friends of mine a...

Warning in image_graphviz

Hello, I have got a warning in image_graphviz, i have viewed a post, who has a similar error. I have installed pear image_graphviz package(Image_GraphViz-1.2.1), I also installed graphviz.msi(Graphviz2.25.msi) in windows(But i don't know if does something with image_graphviz and if it does have some effects when i use image_graphviz). ...

CakePHP - why aren't errors being reported?

I've stopped receiving error messages in my CakePHP app. Normally error messages are suppressed if you have debug set to 0; if it is 1 or 2 then you get the error message, (plus stack trace, etc.) But I don't get anything if there is an error, regardless of my debug setting. So if I introduce an error (syntax, logic, whatever) all I get ...

Cached XML for PHP?

I have a custom PHP framework and am discovering the joys of storing configuration settings as human-readable, simple XML. I am very tempted to introduce XML (really simple XML, like this) <mainmenu> <button action="back" label="Back"/> <button action="new" label="New item"/> </mainmenu> in a number of places in the framework. It i...

How could I find all whitespaces excluding the ones between quotes?

I need to split string by spaces, but phrase in quotes should be preserved unsplitted. Example: word1 word2 "this is a phrase" word3 word4 "this is a second phrase" word5 this should result in array after preg_split: array( [0] => 'word1', [1] => 'word2', [2] => 'this is a phrase', [3] => 'word3', [4] => 'word4', [5] => 'thi...

sending email in while loop

Hi, When i try to send email from while loop with phpmailer, it sometimes sends 2, sometimes 3 same email (it is like random) to each recipient, here is my code, do you think it has problems? $list = $_POST['list']; $items = rtrim($_POST['items'],","); $query = "SELECT * FROM `mail` WHERE `ID` IN ($items)"; $result = mysq...