php

How to 'undo' this small function in PHP?

I am using this to adapt my text which then gets inserted into a mysql db: $ad_text=nl2br(wordwrap($_POST['annonsera_text'], 60, "\n", true)); When users wish to change their posting, they click a link on my page, and a form opens. In this form, the textarea where I fetch the info from mysql, I am displaying the text again. Only probl...

Make all variables global, PHP

Is there a way to make all variables global? ...

HT Access - Mod Rewrite

If i use: RewriteEngine On RewriteRule ^.* controller.php It would send all requests to controller.php But if controller.php included a css file (/assets/css/main.css) then it wouldn't work, as when the browser called it, it would just redirect to controller.php Is there a way i can fix this? ...

Preg match problem

Hello! I try to "validate" a date field. I only want to allow, numeric chars and - character. $born_date=$_POST['date']; $goodchars = array("1","2","3","4","5","6","7","8","9","0","-"); $char_re_good = '/['.preg_quote(join('', $goodchars), '/').']/'; if (!(preg_match($char_re_good, $born_date))) { echo "not ok, co...

Check is record exists before inserting

I have a php script to insert new parts into a postgres database. I want to check if the part exists before it is created. How can I do this. I am using the usual INSERT INTO clause. ...

PHP/Apache, options +indexes in htaccess doesn't work for root directory

I need to offer a directory listing of the root directory of my site, so I created an .htaccess file containing options +indexes It works for subdirectories, but for the main directory I get the Test Page for the Apache HTTP Server on Red Hat Enterprise Linux page. I have two sites that are identical except for the PHP version insta...

mumamo-alt-php-tags-mode by default

Hello, I just started playing about with emacs yesterday for a project I'm working on. Anyway, i've started using the nxhtml-mumamo for web dev work and have got everything working alright except for when an HTML attribute contains is written as such... <element attribute="<?= _ID ?>"></element> ... which invalidates the source. I've...

How can I improve my skills in website development?

Right now I'm working on PHP. I am using the Doctrine ORM and the jQuery JavaScript library. In my second project I used the Zend Framework. What are the various things I should learn to make a better site? What are the various things to keep in mind or what are the various new things I should learn? Right now being I fresher we keep i...

In PHP: How to store the current time/date in UTC format in a string?

example: $date = 'Wed, 18 Feb 2009 16:03:52 GMT'; //How can I get $date to equal the current time in the same format? ...

cakephp webservice

I have problem in creating web-service using cakephp . this what i do to create this web-service . I use NuSOAP - Web Services Toolkit for PHP for this. I create a controller called WsController and import the library on it. class WsController extends AppController{ var $uses = array(); function info() { $this->layout= null; ...

Disable PHP mailing on Mac OS?

I'm developing a web application in PHP, and my Macbook, running Snow Leopard, is actually sending emails when PHP's mail() function is called. It's emailing customers, and that's BAD. I COULD prevent this in my code, but I'd rather just disable mailing for my machine. Is there a way to do this under Mac OS? ...

PHP MySQL database strange characters

Hello, I'm trying to output product information stored in a MySQL database, but it's writing out some strange characters, like a diamond with a question mark inside of it. I think it may be an encoding/UTF8 issue, but I've specified the encoding I want: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> Is this rig...

In PHP: How can I filter a subset of one array into another?

foreach ($myarray as $value) { if (strpos($value,'mysearchstring')) //add this $value to new array here } Also where would the second array need to be declared and how? ...

How can I compare the performance of PHP to Perl?

Although both are interpreted languages there are differences or? What are the performance differences of both languages? Even if Perl would be faster than PHP, the most would choose PHP, because of the simplicity of PHP. Does someone have experience in this regard? ...

How to display a web page and keep its location a secret?

Background: I have a PHP based (Zend Framework) application. It is secure, and only users who have been invited are able to access its resources. One of the resources that I want to keep secure is a link to a private Google Calendar. This is a public link, but I want to be in control of who can view it. There may be a time when a user a...

How can I make a database driven list/feed that can be updated with jQuery ajax?

I'm wanting to know what the best way to go about creating a list of say, users's statuses (similar to what facebook/twitter has) that is loaded in with PHP when the page loads. But ajax checks for new status updates every 10 seconds or so. It looks like to me that there are about 2 options: Put the "new items" html in the PHP file th...

codeigniter installation problem on shared host

my host account is something like: ~ ~/public_html ~/public_html/system/application to access my web, I need to put http://example.com/~userid in address bar I install codeigniter in the ~/public_html directory, I can access http://example.com/~userid. The Welcome page shows correctly, and the related user guide pages show correctl...

Memcache to deal with high latency web services APIs - good idea?

I have a PHP application that calls web services APIs to get some objects before rendering a web page that incorporates those objects. In some cases these APIs are really slow (seconds) and that is not acceptable from a user experience point of view. Two things I know I can do... Use ajax and make these calls in the background Time out...

PHP, Zend Framework: How to fetch a page from another server, then deliver the content?

I think this might also be referred to as "scraping". Basically, what I want to do, is if someone clicks this link: <a href="/links/display/id/47">Click here</a> I want my links controller, display action to: find the actual url of link #47 from the database (i.e. http://www.google.com), fetch/scrape the content, display the content...

Native php support in Visual Studio 2010?

Is there any truth to the rumor that Visual Studio 2010 will natively support PHP coding? (http://www.codeplex.com/php4vs) If not,what are the options?(except VS.php) ...