php

How to match a fixed number of digits with regex in PHP?

I want to retrieve the consecutive 8 digits out of a string. "hello world,12345678anything else" should return 12345678 as result(the space in between is optional). But this should not return anything: "hello world,123456789anything else" Because it has 9 digits,I only need 8 digits unit. ...

How to remove one instance of one string in PHP?

I have a open source editor on the cms that I am making that automatically inserts a <br /> tag at the beginning of the post it submits to the database. This makes validation a pain, since even though there is no real text being submitted, the form still accepts the break tag as input and prevents the "Please enter some text" error f...

How can custom properties be added to a column in Doctrine

With doctrine if you execute this code $columns = $accountTable->getColumns(); foreach ($columns as $column) { print_r($column); } you could get for example this as result: Array ( [type] => integer [length] => 20 [autoincrement] => 1 [primary] => 1 ) Array ( [type] => string [length] => 255 ) Is there a...

indirect path for download files

hey guys i need to create a download section on my website , but as i concern , i want my users can only download files with indirect links , to prevent them from sharing my files on my server such as : http://mysite.com/download/12.zip to http://mysite.com/download/12 is there a way in php to do so ? ...

PHP MVC based web application

Hi, Not sure if this is a available as I am new to the MVC model. But does any one have a link or link's to a article or blogs about building a MVC based PHP web application without using a Framework ? Thanks in advance. ...

How do i remove error warnings made by tpl files in my eclipse project

Recently i installed eclipse 3.5.2 with php support and when i created my php project all tpl files appeared with errors, seem to be searching zend_debugger, how do i remove that errors for the sake of keep my code flow normal with no red warns everywhere? ...

My -tpl file won't update!

Hi, I am running the site at www.euroworker.no, it's a linux server and the site has a backend editor. It's a smarty/php site, and when I try to update a few of the .tpl's (two or three) they don't update. I have tried uploading through FTP and that doesn't work either. It runs on the livecart system. any ideas? Thanks! ...

Is it possible to upload PHP files to blogspot?

I am trying to create a blog using blogspot. It seems it is not possible to upload anything other than image files to blogspot. I want to upload a PHP file. I managed to upload the file to google sites, but it is coming as downloadable there instead of executing. Is there a work-around here other than buying my own server space? ...

How to generate a .po file?

On Windows using WAMPserver (Apache, MySql, Php) I have the following: //test.php if (!defined('LC_MESSAGES')) define('LC_MESSAGES', 6); $lang = "sv"; putenv("LANG=$lang"); setlocale(LC_ALL, $lang); $domain = "messages"; bindtextdomain($domain, "./locale"); textdomain($domain); echo _("This is a string"); It works fine, i.e. it out...

Checking for a valid and in-use email address in PHP

I'm not sure if this is exactly possible, but figured I'd throw it out there. I have a client that is getting some hate-mail from somebody he knows via a contact form on a website that I developed for him. Currently I do the normal checks for a validly-formatted email address, along with a Captcha, but the client has requested that a u...

PHP regular expressions question?

I really don't understand regular expressions and was wondering what the following regular expressions do I wanted my address and name to except periods hyphens letter uppercase and lowercase and numbers. Is my regular expressions living up to there job and is there need for improvement? Plus if some one can break down the regular expre...

home-automation x10 with a linux based nas

i have automated my home with the x10 protocol and use the cm15pro interface on my computer to program the switches now i want to connect the cm15pro interface to my synology nas and run commands with php on the nas to the interface are there programs for running the cm15pro under linux on a nas ? and is there a commandline tool for li...

php fputcsv and enclosing fields.

I was just about to ask the same questions as the question aksed here.... http://stackoverflow.com/questions/2489553/forcing-fputcsv-to-use-enclosure-for-all-fields The question was When I use fputcsv to write out a line to an open file handle, PHP will add an enclosing character to any column that it believes needs it, but wi...

php date list for specified duration

hi is there any php classes or functions, which will gives us all the days from specific duration? for example, if i want a list of dates from 25/03/2010 (25th march 2010) to 15/05/2010 (15th May 2010), it will give me: 25/03/2010 26/03/2010 26/03/2010 .... .... .... 14/05/2010 15/05/2010 thanks a lot for any help! ...

AJAX POST problems with CKFinder

We're using CKFinder for one of our sites, which has been working fine for us until we moved to a new dedicated server (which is similar but not exactly the same as the old server). Now we cant upload, the AJAX request simply never finishes. From monitoring it in Firebug it attempts to POST to here: http://www.site.com/temp/ckfinder/cor...

Copy a multi-dimentional array by Value (not by reference) in PHP.

Language: PHP I have a form which asks users for their educational details, course details and technical details. When the form is submitted the page goes to a different page to run processes on the information and save parts to a database. HOWEVER(!) I then need to return the page back to the original page, where having access to the ...

PHP email validation question?

Will this email validation allow foreign email address like russian, hebrew and so on? And how can I just check for the @ sign? Here is the php code. if (preg_match ('/^[\w.-]+@[\w.-]+\.[A-Za-z]{2,6}$/', $_POST['email'])) { $email = mysqli_real_escape_string($mysqli, strip_tags($_POST['email'])); } else { echo '<p class="error"...

Sample twitter application

I have installed WAMP and running PHP scripts on localhost. I have enabled cURL. Here is my code. <?php function updateTwitter($status) { // Twitter login information $username = 'xxxxx'; $password = 'xxxxx'; // The url of the update function $url = 'http://twitter.com/statuses/update.xml'; // Arguments we are posting to Twi...

MySQL & PHP - Creating Multiple Parent Child Relations

Hi, I'm trying to build a navigation system using categories table with hierarchies. Normally, the table would be defined as follows: id (int) - Primary key name (varchar) - Name of the Category parentid (int) - Parent ID of this Category referenced to same table (Self Join) But the catch is that I require that a category can be child...

Count the number of fields that are not empty in MySQL

I have a database of users where they can send messages to other users (up to four) and the ID of the message they sent is in their user row. Name | Email | Msg1 | Msg2 | Msg3 | Msg4 --------+-------------+------+------+------+----- Pez | [email protected] | 1 | 55 | 42 | 5 Steve | [email protected] | 0 | 0 | 0 | 0...