php

Regular expression needed for date/time validation

I need a PHP 5 regular expression for the following date/time format: 10 Jul 2010 15:00 (2 digits space 3 characters space 4 digits space 2 digits colon 2 digits) Character case does not matter, and the only allowed input is a-z, 0-9, space, colon Thanks in advance. ...

What does the PDO::PARAM_EVT_* constants do?

I can't find any information on these constants but the sparse bit the documentation gives. What can they be used for, and do I to use them? ...

How do I increment value with mysql update query (php)

Hi. I have a query that look like this: $sql = "UPDATE tbl SET amt_field='amt_field+1' WHERE username='" .mysql_real_escape_string($_SESSION['username']). "'"; mysql_select_db('db',$con); mysql_query($sql,$con); I want to increment the value as easily as possible I have tried : "UPDATE tbl SET amt_field='amt_field+1'...

Grabbing entry domain for a site.

I have several domains that point to the same site, some of them ending in ".br" (domain for Brazil, thus for portuguese speakers) I want to detect from what domain the person came (.br or not) and load the correct landuage... I can use PHP, JavaScript or standard HTML/CSS etc... How I do it? (and with what?) ...

PHP MySQL Query Question / Help - Joining tables

Hi, I need to help to show wall posts from the friends of the logged in user, and the user himself ofc.. :P I've searched on every coding forums, and google, did not find the answer I was looking for :/ The Session for the logged in user are: $_SESSION['userid'] This is the MySQL Query I have so far: SELECT DISTINCT * FROM status_up...

PHP AJAX login, is this method secure?

I have just started PHP and MySQL and have created a login form and all works well! Now I am looking to add ajax and the first method I considered is using the jQuery $.post method. I am okay with the code and here is a quick idea of what I will be doing: function login(){ $.post('login.php', { username:form.username.value, ...

hidden variables for buttons causing problems

Here is my code in php. I have a php creditcard confirmation page, with 2 button, edit details and submit. I have an init file which will perform tasks based on what cc_confirm is and what editval is, confirm and editing details respectively. if($_POST['cc_confirm1']=='y' && $_POST['$editval']!='y' && !isset($editval)) {echo '<input n...

Move a file and rename it.

Figured PHP's rename would be my best bet. I didn't see many examples on how to use relative URLs in it though, so I kind of compromised. Either way, this give me permission denied: I want to do this: $file = "../data.csv"; rename("$file", "../history/newname.csv"); Where ../ of course would go back 1 directory from where the script ...

How to list items from unlimited $_POST variables like paypal?

Hi, I Want to receive items details using $_POST and list them like an invoice (exactly like paypal) So if i receive: item_name = Flowers item_description = Alicia Flowers Store item_quantity = 3 item_name1 = Twilight item_description1 = Main Library item_quantity1 = 1 item_name2 = GTA IV item_description2 = Rock Star item_quantity2 ...

a question about mysql select query!

I have a list of events for example I wanna show on a page with the users that have created them which is all in a table and the user who has created them's unique id, now if I wanna show their username and avatar I would have to run 100 queries inorder to show 100 events! but I'm sure their is a easier way I don;t know! i have a table ...

How to print all sessions currently set in PHP?

Without having to call each session by name, is there a way to display the contents of all sessions currently set? ...

PHP __autoload performance

I have a script that uses autoload to load classes that arn't found. I don't deliberately include file though i can but i would like the autoload function to include the required files , because the script can be recursive that is if the class is already loaded i don't want to check the corresponding file is loaded and if class_exist on ...

using conditions in magento layout xml

Hi all, Wondering if anyone has used the or statements in magento's layout XML for a custom module? I realise that I could check the values in the module controller or block itself, but it seems like a logical place for the logic to live. Mage_Core uses them in catalog.xml to test for javascript. <!--<params/><if/><condition>can_loa...

.htaccess Allowing only the rest of the pages to view

Hi? How can I allow only a visitor to view only some part of the page and while my IP(assigned IP) can view all pages. ...

php - unlink with username and password?

Hi guys, im new to php. I have a basic unlink php file which deletes a test.html. Using Apache httpserver <?php $fh = fopen('test.html', 'a'); fwrite($fh, '<h1>Hello world!</h1>'); fclose($fh); unlink('test.html'); ?> So now how do i set a authentication method so that only a person with the correct username/password can access this...

Encrypt request from iPhone to web app?

We have the following: iPhone native app, with login form that posts to: A php script on remote web server which checks against MySQL user table. For security, would it be best practice to use some two-way encryption to encrypt every request? including this initial login? otherwise the user and pass will simple be passed to the web a...

PHP named constant prints/concats as the variable name, not value

I have an old osCommerce site that was PHP4, now running on PHP5. Named constants defined with define() are being evaluated incorrectly: $string = '<a href="http://www.oscommerce.com" target="_blank">' . BOX_ENTRY_SUPPORT_SITE . '</a><br>'; will show as BOX_ENTRY_SUPPORT_SITE, not the value placeed in BOX_ENTRY_SUPPORT_SITE. Somethi...

PHP - linux/unix CTIME (inode change time) is being set when it's only being modified.

According to: http://www.php.net/manual/en/function.filectime.php "In most Unix filesystems, a file is considered changed when its inode data is changed; that is, when the permissions, owner, group, or other metadata from the inode is updated." However, running Debian linux (uname -r: 2.6.26-2-686) when I access and write to a file, s...

Releasing a PHP CMS... how to?

I'm about to release a CMS written in PHP (using Zend Framework). It's very powerful and easy to manage once you understand it. I was wondering to release it some under commercial license (I want money) but I realized that there's a saturation of CMS's on market. So I think I'm going to release it under some open-source license. I kn...

Regex: how to match the last dot in a string

I have two example filename strings: jquery.ui.min.js jquery.ui.min.css What regex can I use to only match the LAST dot? I don't need anything else, just the final dot. A little more on what I'm doing. I'm using PHP's preg_split() function to split the filename into an array. The function deletes any matches and gives you an array...