php

When should I NOT use mysql_real_escape_string

I saw this comment.... http://www.php.net/manual/en/function.mysql-real-escape-string.php#93005 And began to wonder why this would be a bad idea. ...

php variable to know when jquery has loaded?

I know you can get a $_SERVER['HTTP_X_REQUESTED_WITH'] php variable if jquery has loaded. That's great but if you use an iframe then that variable is no longer available. Is there a way to detect if jquery has loaded and give php a varaible in an iframe? I don't want to load a header or footer if jquery has loaded 100% but otherwise put ...

Need guidance regarding the correct flow of my PHP MVC Framework

I'm creating a PHP web application framework (MVC). I'd rather not use external libraries or components (as I want this to be purely my work for now) Can you tell me some tips/guidance for what each of my files should be responsible for doing? Such as, what should be handled by the Framework script and what should be handled by an Appli...

Structuring models in MVC framework?

I'm wondering if there's a best practice for this, I'm building a site that's going to require quite a few models and I don't want to end up with a unstructured mess. Basically I'm looking for a good rulesheet to structure out the models. Right now I can only think of two ways: Every table in the db has its own model, ie. accounts.php,...

PHP NuSOAP Client Issues (Articulate Online)

I'm trying to integrate with the Articulate Online SOAP API (https://www.articulate-online.com/Services/Api/1.0/Documentation/TOC.aspx) on a PHP4 server using the NuSOAP (http://sourceforge.net/projects/nusoap/) client. I've done NuSOAP integrations in the past without much effort, but this one seems to be more troublesome due to the co...

PHP Progress bar

I have one form as shown below: Page 1: <form name = "form1" method="post" action = "page2.php"> ........ </form> Page2.php: <?php For loop ... ..... end ?> Now i want to have progress bar on page 1 so that it can show the completion progress of for loop in page2.php. Tell me how can i do that? Please don't direct me to any pro...

Making a function that determines whether or not a user has 10+ entries per calendar day

Hello, I am using a table in MySQL called "submissions" that contains fields called "loginid" and "datesubmitted." "Loginid" is an integer and "datedubmitted" is a timestamp. I would like to make a function that will determine whether or not a given "$uid" equals a "loginid" that has 11 or more rows in "submissions" with a "datesubmit...

replace any link

I have a news script in PHP i need the script to replace any link which it will be included within the news (links to other websites which the original news will be there ) i need the link for the website to be replace with click here instead , all the links will be replaced every time with click here ...

How can I set text value of SimpleXmlElement without using its parent?

I want to set text of some node found by xpath() <?php $args = new SimpleXmlElement( <<<XML <a> <b> <c>text</c> <c>stuff</c> </b> <d> <c>code</c> </d> </a> XML ); // I want to set text of some node found by xpath // Let's take (//c) for example // convoluted and I can't be sure I'm setting right node $firstC = r...

Find Unix Timestamp of Midnight on Most Previous Monday

How can I find the Unix Timestamp of midnight on (the beginning of) the most previous Monday? ...

Selecting All Children From All Parents in mySQL

I have a simple table like this: +------------+---------+-----------+--------------+ | comment_id | post_id | parent_id | comment_text | +------------+---------+-----------+--------------+ | 1 | 200 | 0 | a | | 2 | 200 | 0 | b | | 3 | 200 | 1 | ...

Regex - PHP :: Regex pattern to parse links and images from html page

Possible Duplicates: How do I extract HTML content using Regex in PHP RegEx match open tags except XHTML self-contained tags Hi, I dont know regex, i working with PHP (possible use Zend framework) I need to get from html page images and links. I think the best way to do it with regex, regex pattern that insert images and ...

Facebook like status url detection

I am wondering if there is a script similar to the facebook status update thing, What I mean, is when for ex. I paste a youtube/other video site/image/link it automatically detects the contents of the page and associates an embed code with it (if its a video).. So I'm wondering if there is a ready script that has a large database of web...

[PHP] Are namespaces really all that useful in frameworks?

As far as I can tell, the only reason we have namespacing in PHP is to fix the problem of classes (+ functions & constants) clashing with others classes of the same name. The problem is that most frameworks setup their autoload and filesystem hierarchy to reflect the names of the classes. And no-one actually require()s or include()s fil...

Using AGPL for PHP Code

Here's the scenario. I have a website and I want to start open-sourcing some of the modules that I've developed. I originally looked into the GPL, but I notice there's a loophole where people don't have to share their modifications if they're used on a public website. I then found AGPL which seems better suited to my scenario, but have...

How do I print a certain wordpress category anywhere I want on any page?

Can someone tell me what the PHP would look like in order to get a category from Wordpress and then print it where ever I want? I'm guessing I have to build a PHP function. Something like: function get_a_category() { $category = get_the_category(); <-----( not sure how to ge ta specific category ) echo $category; } I have no idea ...

sorting an array of folder names for displaying the content of a folder

I have wrote a function for getting all the subfolders of a folder. It also has the option of going the an upper level and displaying the folders....much like a file manager but it works only for folders and has a restriction to not go upper than the base folder so to prevent users from browsing the entire hard disk. I am returning the ...

HTTP GET REST Web Service returns XML but file_get_contents returns blank

I am using PHP to interact with a Web Service using REST and HTTP GET requests to call on the available APIs to return XML data. When testing via the address bar, I get the expected XML content. So the next step I tried was to read that XML data or store the values returned into a string. But when I use file_get_contents I don't get a...

Unknown authorization header error with Buzz API - Using Zend OAuth

Here's the response I keep getting when trying to create a new activity: {"error":{"errors":[{"message":"Unknown authorization header","locationType":"header","location":"Authorization"}],"code": 401,"message":"Unknown authorization header"}} Here's the request I sent (for debugging): POST /buzz/v1/activities/@me/@self?alt=json HTTP/...

php question about scope

Hello, i've been thinking if something like this is possible. // this creates a variable $test in the scope it was called from function create_var() {} class A { function test() { create_var(); // now we have a local to var() method variable $test echo $test; } } So, the question is, can a function create_var() crea...