php

php ereg_replace in php 5.3

Hi guys, So I am trying to create this function which replaces a certain symbol with something else. I was going to use ereg_replace but I saw that it has been deprecated in 5.3. Can you guys give me suggestion on what to use for this purpose. To be more specific, I want to create a function that parses in an email which replaces a cer...

Having some trouble with Regex

Ok, so I have this: $fromArray = array( "/(\[color=)(.+)(\])/", "(\[\/color\])"); $toArray = array( "<span style=\"color:\\2\">", "</span>"); What that's supposed to do it match all [color= to . I'm running that, but this is what the source outputs: <span style="color:red]RED<b>BOLD</b>RED[/color"> When I try to run [color=red...

curl downloading a file fails

For some reason when I use my php script to download files via curl it keeps just giving up after a few bytes have been downloaded whereas it was working fine a few weeks ago. The curl error is: transfer closed with xxx bytes remaining to read I'm running this on localhost but it works fine on my server, I've also tried restarting apach...

Modular Application Zend Framework 1.10 not see class in default folder model

i have next folder structure zf version 1.10 /application /config application.ini /Forms /Layouts /modules /default /controllers /models manufactur.php /view bootstrap.php bootrstrap.php apllication.ini have next content includePaths.library = APPLICATION_PATH "/../library" bootstrap.path = APPLI...

How to change the Date format that we get from text field "16-JUL-2010" to 20100716 using php or using jquery

How to change the Date format that we get from text field "16-JUL-2010" to 20100716 using php or using jquery ...

Start download automatically when a user navigates to another page

I was wondering how to accomplish an effect I've seen on several websites, where I click a download now link, it takes me to another page, and the download starts automatically. What is the best way to accomplish this? ...

Auth in CakePhp using 2 tables

I would like to know how to make a login in CakePhp when my data comes from 2 tables. Due to the specifications in the application the data in the table is divided like this: users: details: id id idDetail username group_id pas...

simplepie seems to return wrong results for Amazon top seller RSS feed

I tried parsing Amazon top seller RSS feed using simplepie PHP library. It doesn't return correct results for it, though it is pretty good for parsing blog feeds. Is simplepie only for parsing blog feeds? ...

Drupal: Cron runs but Autoresponder doesn't send email?

Hi All, Within Drupal I have the Autoresponder module installed. I've configured cron to run twice a day which within the status report it's shown as being run successfully - however no emails are being sent from autoresponder.... If I then run cron manually then the emails are sent? Any ideas very much appreciated. Shane ...

Using the set redirectUrl methods in Zend Redirector action helper

I'm unit testing some extensions of Zend_Controller_Action in SimpleTest. I want to be able to set a redirect url using the set methods of the Redirector action helper, and then use Redirector's redirectAndExit() method to actually redirect later in the process. This process doesn't seem to be working as I expected from reading the doc...

Sorting an array properly with php

I have an array that I wish to sort, it contains images with file extensions, the filename is numeric and the file extension is obviously a string. $files = array(); $files[] = '4.jpg'; $files[] = '14.jpg'; $files[] = '1.jpg'; $files[] = '44.jpg'; If i use sort() then I end up with the following: sort($files); print_r($files); Array...

Is this valid PHP syntax?

if ($var == ($var1 || $var2)) { ... } I am considering using this, but am ont sure if it is valid, and there doesn't seem to be somewhere to check. It seems logically consistent to me but am not sure, and I don't have something to test it on close by. If it is valid, what other mainstream languages support this sort of construct. ...

How to remove all .php extension from a dir and all of its subdirectories?

My web is dir structured is as follows : moving/       includes/       controllers/       includes/       etc... I have the following questions about /moving and all of its sub-diretories: How can i request any php script without the .php extension? How can i request ...dir/index.php?q=about as just ...di...

How can I replicate the Excel FV function in PHP?

Hi all, I'm converting some rather complex calculations from an Excel spreadsheet, to PHP. I'm stuck on the conversion of Excel's FV function, which is defined thusly: FV( interest_rate, number_payments, payment, PV, Type ) I've been working on this for 2 hours now, and there has to be something I'm missing. Essentially, I need to re...

Convert HTML & CSS to a png image

Is there a way using php to take a div block with text and css and convert it to a solid png image? ...

On page load for chrome, ie, ff triggers form validation error message in PHP

Hello, if($username=="") { $login_domain_error="Enter User Name"; } if(isset($_POST['passwd'])) { $login_p_error="Enter Password"; When I enter the above two validation, it triggers the validation errors, without form submission using PHP What exactly is wrong Thanks Jean ...

Can't log in to Drupal 6 site

I am developing a custom theme for our Drupal based website, and I needed to log out to check on the look of the site for an anonymous user. Once I logged out, I could not log back in. I tried several admin accounts, on several computers, and none of them worked. Thankfully, my laptop loads the website logged in as admin. From there, I...

Sending Geolocation to a Server via PHP CURL

I am trying to scrape data from a site that requires my geolocation via PHP and CURL. Is there any way to include Geolocation into the CURL call? ...

PHP drop down menu

I am doing a select on the database and some time it returns me 10 records and sometimes 1000, depending on the criteria of search. What I want is a drop down that will have break after every 30 records. something like this <select id="dd" > <option value="0">1-30</option> <option value="30">31-60</option> <option value="60">61-90...

PHP: preg_split

Hey guys, I need help on regular expression here. I want PHP to be able to splits a string in sections of arrays such that a substring enclosed by <%me %> will be in its own slot. So for example, Hi there how are <%me date(); %> => {"Hi there how are ", "<%me date(); %>} Hi there how are you<%me date(); %> => {"Hi there how are you"...