php

regexp with russian lang

Hello! I can't solve my problem with regexp. Ok, when i type: $string = preg_replace("#\[name=([a-zA-Z0-9 .-]+)*]#","$name_start $1 $name_end",$string); everything is ok, except situation with Russian language. so, i try to re-type this reg-exp: $string = preg_replace("#\[name=([a-zA-Z0-9**а-яА-Я** .-]+)*]#","$name_start $1 $name_e...

Zend Framwork - Route module on subdomain

I'm having trouble getting the Zend_Controller_Router_Route_Hostname to work properly. I'm using Zend Framework 1.9.4 In my config I have: resources.router.routes.www.type = "Zend_Controller_Router_Route_Hostname" resources.router.routes.www.route = ":module.domain" resources.router.routes.www.defaults.module = "frontend" resources.r...

start downloading file with ajax

Hello, I like to access my download.php with ajax, that way I can show a little downloadscreen in a div, BUT I have this in my htaccess file, that basicly says deny outside access for all pages. I forgot about it, while I was trying to access my download.php file with window.location = urlnieuw Is there a workaround for this problem...

PHP regex backreference

Hi all, I'm trying to match attributes from a html tag, but I can't get it working :) Let's take this tag for example: <a href="ddd" class='sw ' w'> Obviously the last part is not quite right. Now I tried to match the attributes part with this piece of code: preg_match('/(\s+\w+=(?P<quote>(\'|\"))[^(?P=quote)]*(?P=quote))*/U', " ...

Returning first x items from array

Hi, I want to return first 5 items from array. How can I do this? ...

How to verify a mail has been sent when using Zend_Mail?

I am using the Zend framework to send mail. Once the config is done and the code written it all boils down to one call: $Mail->send($Transport) How can i check that this mail has been sent correctly? I read somewhere that Zend Mail throws an exception but other people have said this is sometimes not the case. What's the bulletproof p...

Mysql search via PHP help

Hi. I have a textfield variable $string... It contains for example "BMW COUPE"... How can i search mysql db field for word matches??? SELECT * FROM db WHERE description xxxxxxxxxxxxxxxxxxx? description is the field name! so if description containse either 'BMW' or 'COUPE' it will return this field... Thanx ...

Getting post vars with swf-upload

I am using swf-upload to allow users to upload images quickly. I need them to be able to select which galleries they want them to appear in so I have added extra controls to the form - but they are never passed in GET or POST to the upload.php catcher. I think 'addPostParam' is what I need to set, but am not entirely sure where or how ...

simplyXML and accented characters in PHP

I have written an XML file which is using the ISO-8859-15 encoding and most of the data within the feed is ran through htmlspecialchars(). I am then using simplyxml_load_string() to retrieve the contents of the XML file to use in my script. However, if I have any special characters (ie: é á ó) it comes out as "é á ó". The How can I ...

question regarding php function preg_replace

Hi, I want to dynamically remove specific tags and their content from an html file and thought of using preg_replace but can't get the syntax right. Basically it should, for example, do something like : Replace everything between (and including) "" by nothing. Could anybody help me out on this please ? ...

PHP Functions with multiple MySQL results only returning one record.

This is the function that im calling. function GetSubmissions($coach){ $result = mysql_query("SELECT * FROM `ptable` WHERE coach = '$_SESSION[username]'") or trigger_error(mysql_error()); while($row = mysql_fetch_array($result)){ foreach($row AS $key => $value) { $row[$key] = stripslashes($value); } $id = $row['id'];...

Simplehtmldom - curl, loops, arrays?

Hello. Pse forgive what is most likely a stupid question. I've successfully managed to follow the simplehtmldom examples and get data that I want off one webpage. I want to be able to set the function to go through all html pages in a directory and extract the data. I've googled and googled but now I'm confused as I had in my ignora...

Custom Markdown for PHP handling new lines

Hello World, I need custom Markdown library for PHP which converts new lines to <br/> without the need to put double space on the end of the line, kinda like here on SO. I've been looking on the web but without success. I know I could just amend standard library but my regex skills are none. Does anybody know about such library in exi...

looping through a object which contains an object php

I have a PHP Object which contains other objects i.e $obj->sec_obj->some_var; I want to use a foreach loop to loop through the object and all objects objects. I think the max level is 3, so $obj->sec_obj->third_obj->fourth_obj Any ideas? ...

best way redirect/reload pages in PHP

Hi, Whats the best way to reload/redirect a page in PHP which completly removes all history/cache? Which headers should I use? The page today: While clicking on a link, get-parameters is set and a script is running. When finished, I want to redriect and reload the page without the get-parameters. At first, it looks like nothing has h...

Workarounds for PHP's array_reduce integer third parameter

For some or other reason, the array_reduce function in PHP only accepts integers as it's third parameter. This third parameter is used as a starting point in the whole reduction process: function int_reduc($return, $extra) { return $return + $extra; } $arr = array(10, 20, 30, 40); echo array_reduce($arr, 'int_reduc', 0); //Will out...

Memory leak in transition from PHP 4 to 5 - any hints?

I am porting a large web application to a shared web hosting environment. The app was written in PHP 4. The new environment has PHP 5.2. For some reason, the application is leaking tremendous amounts of memory when running in PHP 5.2. I can literally watch memory usage going through the roof using memory_get_usage(), until it reaches ...

Undeclare a class in PHP

I have a daemon processing quite a bit of MVC logic in the background that includes the classes it needs on demand. Sometimes, however, it comes to a point where it includes two identically named classes from different modules within one cycle. Ideally, I would like to "undeclare" a class before I include it again, I cannot find in the P...

OpenSSO Fedlet with PHP

Is it possible to use the OpenSSO fedlets with PHP (or tech. other than Java or .Net) to Enable to enable Identity Federation? Is there any examples of using fedlets implementing with PHP? ...

Problems with output buffering in php

I have a php script which takes a long time to finish and it fails due to execution timeout (script runs too long) or network timeout. Essentially the script does a for loop which does two to three processes on each iteration. request an external service through curl parse the xml insert the response into a database Suppose that ...