php

Reg exp to Null/empty string if string contains non alphanumeric characters

Hey Guys, I'm looking for a php preg replace to null/empty string if string contains any non alphanumeric characters or spaces e.g. Strings $string = "This string is ok"; $string = "Thi$ string is NOT ok, and should be emptied" When I say emptied/nulled I mean it will make the string "". So basically anything a-z A-Z 0-9 or space ...

Do browsers always use the cached version of a page with .html extension?

I have a web page written in pure HTML (with a .html extension). Whenever I edit it and push "Refresh" in my browser, the page does not get updated. However, if I change the extension to .php this problem does not occur. Could someone explain to me what's going on? ...

When parsing RSS feed, wrong date is displayed.

Here is my code: <?php $RSSFEEDS = array( 0 => "http://samnabi.posterous.com/rss.xml", ); function FormatRow($date, $title, $link, $description) { return <<<HTML <p class="blogdate">$date</p><h2 class="blogtitle">$title</h2> <div class="clearer">&nbsp;</div> $description HTML; } ob_start(); if (!isset($feedid)) $feedid = 0; $rss_ur...

How to do Php Security check for input fields and input treatment ?

Hi, How to do Php Security check for input user fields and input user treatment(please if you can solve example1+2)? Example1: check if user insert url or something else: <label>url: </label> <input type="text"> Example2: check if user insert html or something else <label>paste html: </label> <textarea></textarea> thanks ...

How to set up my login system?

I'm trying to figure out if it is better to store my user's data in a session cookie (like password, username, etc), and update that cookie only when I change the MYSQL database from my PHP, OR Store the user's username and user ID in a session cookie and reach out to the MYSQL database every time I need to get the user's data. Which ...

CakePHP ACL Individual Object Access Control

I'm working on a project that requires one user to have many, say, posts. But, each user can only access his or her own posts. How can I accomplish this type of behavior with CakePHP's ACL component? Currently, it seems that Cake's ACL is focused on actions and controllers rather than objects. Any ideas (even switching to a different f...

php setting encoding iso-8859-1 by default in browser

I have a php file which when displays data shows strange characters, but when I change encoding from tools in chrome to iso-8859-1 the strange characters are displayed correctly, the strange characters are actually Portuguese alphabets. please tell how can we set by default the encoding to iso-8859-1. ...

Possible to download a file through the Zend HTTP Client?

I am trying to build a script where it downloads a file using the Zend http client: http://framework.zend.com/manual/en/zend.http.html but I can't find anywhere where it says how to do this so I'm wondering if its possible... The file is dependent on being logged in so I need to have it done through the zend http client so it can make us...

ActionScript 3: how to create a array or list like: array["name1"] = "hello" (just like you can do in PHP)

hello, in PHP i am used to create a array with using names as keys like array["something1"] = "output1"; array["something2"] = "output2"; array["something3"] = "output3"; and then use foreach to let them print or do other things with it like foreach ($array as $key => $value) { echo "$key = $value"; } is there something similar po...

php nusoap script not working

I have a php script using nusoap to connect to a web service on: $uri = 'http://soap.1011.my-online-check.com:8080/avavoip_gate.php?wsdl'; $client = new nusoap_client($uri, true, false, false, false, false, 30, 90); $client->setHeaders($headers); $result = $client->call($method, $args); It works fine on my Mac. However, when I uplo...

Checking md5sum programmatically with php on server

I'm not sure if what I'm asking is possible. You know how when you download something, you can run an md5sum check on it to verify it hasn't been corrupted when transmitted. Well, I'm trying to do the same thing programmatically on the server. The file would have been downloaded to the web root folder or some other folder, and I want t...

Facebook multi-friend-selector gets cut off in iframe

I've been working on a Facebook app and the only thing that's still bogging me down is the friend requests. When I use the fb:multi-friend-selector code, the confirmation pop-up gets cut off by the iframe on the right hand side. The app is an iframe-based canvas app. Any ideas? ...

In PHP, whats the difference between :: and -> ?

Noob to PHP here, I've come across 2 distinct function calls which I'd like to clarify... Whats the difference between $response->setParameter('foo', 'bar'); and sfConfig::set('foo', 'bar'); I'm assuming -> is used for functions for variables, and :: is used for functions for classes. Correct? Different question, is the => assig...

What's the difference between POST and raw POST in PHP at all?

I have this question after reading the answer here, what's the difference at all? Is it possible to submit raw POST with html ? ...

CakePHP beginner's question about views

Hello, I have finally quit the idea of learning Zend and instead i find CakePHP and CodeIgniter to be very impressive and simple to understand rather than cramming the strange global functions and configuration of index.php. Anyways, i wanted to ask you that CakePHP even spits out Html in sort of php language like :- <?= $html->css('d...

Implementing jquery upload plugin 'uploadify' with codeigniter

How can i implement this in codeigniter?Uploadify(Jquery) I mean what will be the controller? Hows the progress tracked? And what will happen if flashplayer is not installed by the user? And How do i check progess? Have any one tried this with codeigniter? ...

How do I determine if a PHP script I'm running is as a result of mod_rewrite pointing to it?

I have a PHP script and I'd like to know if it's been executed as a result of mod_rewrite redirecting the request to it. Is there anything I can easily inspect simply to get a yes or no answer? Is there any way to get the rewritten path rather than the one that was originally requested? ...

Using array_key_exists with preg_match

Hi, I'm trying to determine if a match, or matches exist within an array based on a pattern, an example of the array: Array ( [author_id] => 1 [channel_id] => 1 [site_id] => 1 [entry_id] => 6 [url_title] => test_title_with_file2 [title] => Test Title with file [field_id_1_directory] => 1 [field_id_4_dir...

Asterisk: detect incoming call

In asterisk/elastix/freepbx, how do you.... 1- detect an incoming call 2- read the caller id 3- do something...(perform function) ? ...

Simpletest PHP scriptable browser... how to test submit a form that has [ ] in the form name (basically in array format)?

I am using simpletest, the php scriptable browser and trying to test submit a form that is in array format so its like this: <input id="password" name="session[password]" value="" type="password"> Other input names start with "session" so I have to give the full name of each but it doesn't seem to work when I do it like this in my PHP...