php

highlighting words at the end of a word

i'm not sure how i could have phrased the title better, but my issue is that the highlight function doesn't highlight the search keywords which are at the end of the word. for example, if the search keyword is 'self', it will highlight 'self' or 'self-lessness' or 'Self' [with capital S] but it will not highlight the self of 'yourself' o...

Detect how long it takes for a file to upload (PHP)

Is it possible to know (serverside) the time it took for a file to upload? I have an image upload API and in my response I'd like to return the upload time (not including script execution time). ...

MySQL: How to consume/discard the result of a query?

I have a stored procedure which executes an optimize table statement for every table in a DB. Those optimize table statements are prepared statements of course (they have to be built at runtime) and I need to call that procedure from PHP using ext/mysql API. Unfortunately, ext/mysql does't support doing such thing because optimize table...

How save JavaScript and HTML in option without it being auto-escaped?

And there I thought I knew Wordpress well. It now seems that update_option() auto-escapes code. If I want to save some Javascript or HTML code in an option, this behavior renders the code unusable. I refuse to do a str_replace on the returned value to filter out every backslash. There has to be a better way. Here's the PHP for the text...

PHP Time Zone Adjustment

I have a time that is being sent to me in UTC time, but I want to adjust it so its the outer edges of the days on East Coast time (EST/EDT). That is, I want the user to be able to enter in EDT/EST centric dates, and have it query with the UTC correct dates. $start_date and $end_date are MM/DD/YYYY formatted dates passed via a GET varia...

Can someone port this to C?

I've spent the last few hours trying to port this to C, with no success. Can someone please help? function zerofill($a, $b) { $z = hexdec(80000000); if ($z & $a) { $a = ($a>>1); $a &= (~$z); $a |= 0x40000000; $a = ($a>>($b-1)); } else { $a = ($a>>$b); } return $a; } ...

MySQLi error handling

Is it possible to specify that MySQLi sends any errors and warnings to the PHP default 'error_log' directive? I can't seem to find any error options for the class specification, and I don't wish to handle errors manually like so: if ($result = $mysqli->query("...")) { } else handle $mysqli->error; ...

Drupal Views Relationship problem using nodes and profiles

Hello, I'm using nodes as profiles so I dont think standard Views relationships are working, can you advise if this is the case? I have users profile nodes with a CCK field called "field_sports" and a CCK field for a content type of events called "field_sport". I only want the view to display sports that match in these two fields. Se...

Sorting a google calendar feed (parsing with DOM)

I'm embedding dates from google calendar into a website, and it's all working, with the exception of sorting. For some reason, it sorts into reverse-chronological order, when I'd really just like it to be normal chronological (first event first). this is the output: August 11th: Intern depart August 6th: Last Day of Summer Camp July ...

Using custom buttons with js & php

How can I make a form with my own "submit" button & post the info to a php server side? how can I get js to post it? ...

Is there a way in PHP to check if a directory is a symlink?

The title says it all. I have symlinks to certain directories because the directories' names have non English characters that I got fed up trying to get apache's rewrite rules to match. There's a bounty on that question http://stackoverflow.com/questions/2916194/trouble-with-utf-8-chars-apache2-rewrite-rulesif anyone wants to go for it,...

What's the equivalent of PHP's " .= " in Javascript, to add something to a variable..?

In PHP you can do: $myvar = "Hello"; $myvar .= " world!"; echo $myvar; The output is: Hello world! How can I do this in Javascript/jQuery..? ...

Zend_Soap_Client doesn't work with proxy

I'm accessing a SOAP web service like : $client = new Zend_Soap_Client($wsdl_url, array('proxy_host'=>"virtual-browser.25u.com" , 'proxy_port'=>80)); Since my shared server blocks port 8888, I'm using this proxy server. But Zend Soap Client tries to directly connect it. Exception information: Message: SOAP-ERROR: Parsing WSDL: Coul...

Where does authentication and loader go in Zend Framework?

Hi guys, Still trying to learn the basics of MVC. I'm making use of Zend_Loader for Google Calendar feed. What file would this information go in? The .phtml view? // load library Zend_Loader::loadClass('Zend_Gdata'); Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); Zend_Loader::loadClass('Zend_Gdata_Calendar'); Ze...

Can anyone decipher this for me? PHP (I think)

This code is being used to parse email, it's stored as a table in a mySQL database. I believe it's PHP code. What does the (.+) do? /A new order has been successfully placed through(.+)Name:(.+)Company:(.+)Email:(.+)Address 1(.+)Order ID:(.+)Date:(.+)Payment Type:(.+)Order Status:(\s*)Accepted(.*)\n(.+)\$([\d\.]+)\s+X/si Thanks, sup...

Wordpress plugin - how to use functions as get_posts?

Hey. I am trying to make a plugin for wordpress that is supposed to use the function get_posts (declared in one of wordpress' include files, but depending on a lot of other files depending on more files.), and I just can't seem to find out how to do it! Please help. Thank you :) ...

Get "As low as" price for bundle product in Magento

I'm trying to display a list of bundled products using my custom template. I'm not able to display the dynamic price of the bundle product. Previously for simple products I used: $product->getPrice(); which worked, but it just displays $0.00 for bundle items. looking at ../catalog/products/list.phtml I tried $this->$getPriceHtml($...

File uploads simply do not work - what could be wrong server side?

This has been grinding my gears for at least a week now. I have a site which has a crucial function - the upload component. Without it, the site is completely useless. Now, lots of users have problems uploading files. This is why I implemented a log system that keeps track of what happens when the file is on the server. Problem is, o...

How do I call this function in CodeIgniter controller?

I've got this code, but I'm not sure I make it work: /** * Function: youtube data grabber * * @description : * @param $ : video code, url type (embed/url) * @return : data array * @author : Mamun. * @last -modified-by: Mamun. */ if (! function_exists('youtube_data_grabber')) { function youtube_data_gra...

How do I make replies to comments? (PHP)

I want to create something like reddit where they have comments, then replies to the comment, then reply to the reply. What type of database structure do they use so: 1. they keep track of all the comments to a posting 2. a reply to a comment 3. a reply to a reply All I have right are is just a posting and a bunch of comments relatin...