php

Very simple regular expression help

Hi Guys I'm very new to regex, can you help me with this. I have a string like this "<input attribute='value' >" where attribute='value' could be anything and I want to get do a preg_replace to get just <input /> How do I specify a wildcard to replace any number of any characters in a srting? like this? preg_replace("/<input.*>/",$r...

How do I check that string has only international letters and spaces in UTF8 in PHP?

In Python I could've converted it to Unicode and do '(?u)^[\w ]+$' regex search, but PHP doesn't seem to understand international \w, or does it? ...

php: writing files

Hi All, I want to create a file on the webserver dynamically in PHP. First I create a directory to store the file. THIS WORKS // create the users directory and index page $dirToCreate = "..".$_SESSION['s_USER_URL']; mkdir($dirToCreate, 0777, TRUE); // create the directory for the user Now I want to create a file called index.php and...

mysql - is it possible to insert a row but only if a value does not already exist

Is it possible to insert a row, but only if one of the values already in the table does not exist? I'm creating a Tell A Friend with referral points for an ecommerce system, where I need to insert the friend's email into the database table, but only if it doesn't already exist in the table. This is because I don't want any more than 1 p...

how to force php to use utf-8 charset

errr im not sure if my question's title is clear enough but i'll try my best to explain i really am not sure about how php executes the function mysql_query in terms of retrieval and storageof strings, does it recognize any character set encodings used in the table? and does my browser by default overrides any character encodings sent th...

Separating code from DB functionality

I'm developing an object-oriented PHP website right now and am trying to determine the best way to abstract database functionality from the rest of the system. Right now, I've got a DB class that manages all the connections and queries that the system uses (it's pretty much an interface to MDB2). However, when using this system, I've rea...

How to read a mailing list as RSS

Hi Im subscribed in a mailing list that i use only as reference for developing and im trying to read it with my rss client but the mailing list doesnt provide the rss. So i thought it should be a way to convert the mailing list to a rss i was trying to find some php class to install it in my server but cant find anyone. Can you suggest...

How to password protect streaming videos with php

What is the best way to password protect quicktime streaming videos using php/.htaccess. They are being streamed using rtsp, but I can use other formats if necessary. I know how to do authentication with php, but I'm not sure how to setup authentication so that will protect the streaming files urls so that a user can't just copy the url...

TinyMCE Draws Okay, But Won't Let Me Type In It. In FF, Buttons Have Error: Component returned failure code: 0x80004005

In previous applications, I was able to get TinyMCE to work just fine. But in this web app, I get the rich editor to show up okay, but for some reason I cannot type into the rich editor field and when I click a button like for bolding, I get this error: Error: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE)...

What is the best way to password protect folder/page using php without a db or username

What is the best way to password protect folder using php without a database or user name but using. Basically I have a page that will list contacts for organization and need to password protect that folder without having account for every user . Just one password that gets changes every so often and distributed to the group. I understa...

How to insert/embede images in dynamically generated MS Excel file using PHP?

I need to export a report to Excel file using PHP i.e. on the fly. I am acutally getting data from mysql and presenting it in HTML tables. I am able to export all this data into Excel file format, except images. I can't point the image source to absolute url, because this file also needs to work offline. Is there any way, I can embede/in...

Need a good regex to convert URLs to links but leave existing links alone

I have a load of user-submitted content. It is HTML, and may contain URLs. Some of them will be <a>'s already (if the user is good) but sometimes users are lazy and just type www.something.com or at best http://www.something.com. I can't find a decent regex to capture URLs but ignore ones that are immediately to the right of either a do...

Match everything inbetween two tags with Regular Expressions?

How can I match (PCRE) everything inbetween two tags? I tried something like this: <!--\s*LoginStart\s*-->(.*)<!--\s*LoginEnd\s*--> But it didn't work out too well for me.. I'm kind of new to regular expressions, so I was hoping if someone would be kind enough to explain to me how I would accomplish this, if its even possible wit...

CodeIgniter - Uploading an Image through a form, store the location of the image in database

Hey folks - I'm trying to upload an image to my site through a form, however it's much more efficient to (rather than bog down the database) just store the location of the image in the database. I'm having trouble with my form and really don't know where to go: <?=form_open('bro/submit_new');?> //other form data Image: <input type="...

Is there a site which simply outputs the latest stable version numbers of php and mysql?

I want to write a little app for myself which notifies me if there is a new version of php or mysql but I would need a feed or an xml file to read it from. ...

Good open source PHP projects

I'd really like to spend more time writing and learning about PHP, so I'd like to delve into the code of some well-written open source projects, and possibly contribute if I became familiar enough with the code. I know everyone says you should pick something you use or enjoy, but all of the open source PHP applications I've used have bee...

How to turn off mysql errors from being displayed to screen in CodeIgniter

Even though error_reporting is set to 0, database errors are still being printed to screen. Is there a setting somewhere I can change to disable database error reporting? This is for CodeIgniter v1.6.x EDIT: Re: Fixing errors - Um, yes. I want to fix the errors. I get error notices from my error log, not from what my visitors see printe...

Dynamically Generated Datatable for Google's Annotated Time Line

I want to use Google's Annotated Time Line Visualization. It is very easy to make this work by manually adding the lines for column & row data. This is all done through attributes of google.visualization.DataTable(). I would like to update this data table dynamically, but I do not know how. The data is on a server running MS SQL Server ...

Mysql throwing query error yet finishing query just fine-why?

I am getting Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in *filename* on line 81 While running a query to build a chart. The query gets data from the mysql db and uses it to build the chart. Usually, I get this error and go to the code and find where I've screwed up, fix it, and move on. ...

How to build a PHP form Dynamically with OOP?

How would I go about creating a real world form creation class that I can use to display a new form with fields of different types, as how many fields I want, I can use drop downs and I can do all of this by using OOP? ...