Date validation in PHP
What would the regex expression that would go into preg_split function to validate date in the format of 7-Mar-10 or how can I validate a date of format 7-Mar-10 in PHP Thanks. ...
What would the regex expression that would go into preg_split function to validate date in the format of 7-Mar-10 or how can I validate a date of format 7-Mar-10 in PHP Thanks. ...
I'm working on an open source script. I would like to provide a feature to extend the script by use of plugins/modules. I need some recommendations on open source cms/scripts to study code from, to gather the best practices on making script extendable by plugins. I've used WordPress in the past, and was planning to implement a similar s...
I have a mysql table for votes. there's an id, a project_id and a vote field (which is 1 if a specific project is voted). now i want to generate a ranking from those entries. is there a way to get the number of votes for each project_id and automatically sort the entries by the number of TRUE votes of a project with a single mysql query?...
Some nodes are showing a 404 status when they exist in the database. You also get a 404 if you type in the url to edit that node in the admin page. These nodes are being created in an automated fashion in the database, from CSV files. What I'd like to ask is which db fields would trigger a 404 on a node? I have checked the url_alias ta...
hi, i have the result of a ranking script in a foreach loop, sorted by the number of votes. is there a way to visualize this with a chart/graph tool? the results are in a table, so each "project" has its own <tr><td>project name</td><td>4</td></tr> i want to display the number of votes eg. 4, in a row underneath the written result. a...
How can we validate a CSV file ? I have an CSV file of structure: Date;Id;Shown 15-Mar-10;231;345 15-Mar-10;232;346 and so on and on !!! approx around 80,000 rows. How can I validate this CSV file before starting the parsing using fgetcsv ? ...
Normally it would be in such a structure: ../application/modules/somemodule/views/scripts/index/index.phtml How I move it to: ../application/templates/somemodule/template1/views/...... ../application/templates/somemodule/templateTWOOMG/....... ?? ...
The function is supposed to update the values in the database. Here is the code: //Functions //Function to Update users networth function update_net($name) { //Get worth & balance at the time $sql_to_get_worth_balance = "SELECT * FROM user WHERE username = '$name'"; $sql_query = mysql_query($sql_to_get_worth_balance); ...
I've been struggling to get a really basic PHP function working on my iMac, the PHP mail() function. I've used it countless times, albeit on a Windows platform and now I'm trying to get it running on Mac. I've installed XAMPP v1.01 maybe because I didn't know any better at the time and I thought it would all just work fine, because tha...
Playing with jquery for the first time, and I'm trying to get a simple AJAX set up working so I can better understand how things work. Unfortunately, I don't know a whole lot. Here's the HTML with the script: <html> <head> <title>AJAX attempt with jQuery</title> <script type="text/javascript" src="jquery.js"></script> <script type="t...
Hello, I'm validating a text field in my form as follows: $name = new Zend_Form_Element_Text('name'); $name->setLabel('First Name:') ->setRequired(true) ->addFilter(new Zend_Filter_StringTrim()) ->addValidator('regex',true,array('/^[(a-zA-Z0-9)]+$/')) ->addErrorMessage('Please enter a valid first name'); Wha...
Hy I have a script called dataface, on a shared host it outputs all the time this warning Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/usr/local/lib/php/Dataface/FormTool/text.php) is not within the allowed path(s): (/home/:/usr/lib/php:/tmp) in /home/a4385243/public_html/dataface/Data...
What is the best method, if there is one, of using Wordpress as a CMS for users to input data while not actually building the website on the Wordpress platform? One possible solution I've found is using a PHP class called "WPGet" (http://peter.upfold.org.uk/projects/wpget) which fetches directly from the database. ...
Before I go ahead and try to code my own, are there any functions / libraries for PHP which will generate SVG images with text wrapped to a bounding box? I'm looking for a function which will accept a string and a bonding box, along the lines of: wrapText($text,$x,$y,$width) So if $text were "The Quick Brown Fox Jumped Over The Lazy Do...
Hi! I am making a simple page load counter by storing the current count in a file. This is how I want to do this: Lock the file (flock) Read the current count (fread) Increment it (++) Write new count (fwrite) Unlock file/close it (flock/fclose) Can this be done without losing the lock? As I understand it, the file can't be written...
I've got this line of code: $xml_output .= "\t<Event=" . $x . ">\n"; And it will output: <Event=0> <Event=1> <Event=2> etc etc through my loop. I need it to output as this (with the quotes around the number): <Event="0"> <Event="1"> <Event="2"> Any help, and I'm sure it's simple would be greatly appreciated! ...
On our site, we have a lot of swimming times that we would like to convert to seconds. i.e. 1:23:33.03 or 58:22.43. Is there a PHP function that can do this? A MySQL function? ...
Hey, I have a php file (currently at / ) and I want this file to change the content of a file, "test.js". This file is in the dir "/libs/js/test.js". While I can read the content, for example with fread or file_get_contents, I can not write in it with file_put_contents or any other function. I always get the Warning Warning: rename...
I am triig to fill options list. I have 2 tables USERS and STREAMS I vant to get all streams and get names of users assigned to that streams. Users consists of username and id Streams consists of id, userID, streamID I try such code: <?php global $connection; $query = "SELECT * FROM streams "; ...
Im used to java and creating UML.. and i was wondering how can PHP be OOP, the objects live only until you make a request.. then they destroy, so if im using a database is useless to create a class and add the members (variables) to the class, they will be useless.. i cant pass the main system object from one page to another, or similar ...