Forum: PHP 29 Days Ago |
| Replies: 4 Views: 467 You could verify the credit card number using the Luhn Algorithm. http://en.wikipedia.org/wiki/Luhn_algorithm There is a link at the bottom for an example of a php algorithm.
There are some... |
Forum: PHP Oct 29th, 2009 |
| Replies: 2 Views: 548 if you're making the form submit to itself then you need to make the index action in the index controller look for post data so it knows it needs to validate the form.
<?php
class... |
Forum: PHP Sep 18th, 2009 |
| Replies: 15 Views: 317 I've now tested it on both linux (centos) and windows (xp) and both php 5.2.10 and php 5.3.0 and don't see the dot directories showing up.
<?php
error_reporting(E_ALL | E_STRICT);
$path =... |
Forum: PHP Sep 18th, 2009 |
| Replies: 15 Views: 317 change that line to:
$parts = explode('.',$file->getBasename());
$extension = strtolower(end($parts));
apparently explode returns its value by reference.
Are . and .. showing? In my... |
Forum: PHP Sep 18th, 2009 |
| Replies: 15 Views: 317 post what is on line 97 of your file. There is nothing in my code that is passed by reference.
The indentation will be a little more tricky but i'll see what i can do. |
Forum: PHP Sep 18th, 2009 |
| Replies: 15 Views: 317 I am not sure what the point of $x is in that function besides being a counter. But this should solve your recursion issue.
<?php
//Path to starting point
$path = '/your/path/goes/here';
... |
Forum: PHP Jul 23rd, 2009 |
| Replies: 11 Views: 515 Just be very careful when working with values passed in the GET & POST arrays . Its extremely easy for them to be modified by the user and you have to be fully aware of this.
Probably the most... |
Forum: PHP Jul 21st, 2009 |
| Replies: 16 Views: 868 That is what I was trying to illustrate as well, that it was a path problem, aka the filename was missing from the path, the code itself was fine. The example i posted was from the manual... |
Forum: PHP Jul 20th, 2009 |
| Replies: 16 Views: 868 The problem you're having is $_FILES['userfile']['tmp_name'] is an actual filename. your destination is a directory without a file name. its trying to create a file named "uploads", which is a valid... |
Forum: PHP Jul 20th, 2009 |
| Replies: 6 Views: 279 Why even bother with all of the sanitizing when the php5 DOM does this for you.
Check out the following code...it is based on what you originally posted and creates the same XML. Its not a perfect... |
Forum: PHP Jul 16th, 2009 |
| Replies: 5 Views: 500 check out http://www.mysqlperformanceblog.com/ you will have to do some looking and some reading but provide a lot of really good information for performance tuning and/or what you can expect from... |
Forum: PHP Jun 9th, 2009 |
| Replies: 12 Views: 1,412 This is such a common topic that can be debated in so many different ways. The fact is BOTH the unix timestamp and mysql date fields are standards and php and mysql both provide the necessary... |
Forum: PHP May 21st, 2009 |
| Replies: 4 Views: 248 Google for Wildcard DNS (http://tinyurl.com/qrg3qm) |
Forum: PHP Apr 10th, 2009 |
| Replies: 11 Views: 596 Actually in a purely PHP file, the closing tag ?> should be excluded.
It is necessary when you are jumping in an out of php control structures that are mixed with html or some other kind of... |
Forum: PHP Apr 9th, 2009 |
| Replies: 10 Views: 470 Then the problem is in the code prior to:
echo '<tr>'.
'<td>'.$row['title'].'</td>'.'<td>'.$row['category'].'</td>'.'<td>'.$row['year'].'</td>'.
'<td>'.'<font size="2"><a... |
Forum: PHP Mar 15th, 2009 |
| Replies: 18 Views: 99,851 Well you're definitely right. regex is definitely slower when compared to str_replace especially as the length of the string increases. Although return str_replace(' ', '', $str); is not the same as... |
Forum: PHP Mar 13th, 2009 |
| Replies: 12 Views: 1,894 Do you possibly have cookies disabled in FF and have php configured to use a cookie to store the session id? |
Forum: PHP Mar 13th, 2009 |
| Replies: 18 Views: 99,851 If it solves your problem how you need it to solve your problem then its a solution. There is always more than one way to skin a cat. |
Forum: PHP Mar 13th, 2009 |
| Replies: 12 Views: 1,101 That is because your column type is set to datetime or timestamp not certain which one actually produces that as I don't use the mysql datetime or timestamp data type.
To store a unix timestamp... |
Forum: PHP Mar 12th, 2009 |
| Replies: 12 Views: 1,101 |
Forum: PHP Mar 12th, 2009 |
| Replies: 12 Views: 1,101 Store a UNIX Timestamp (http://en.wikipedia.org/wiki/Unix_time) in that mysql column.
<?php
$iCurrentTime = time();
$iCurrentTime would result in an integer like: 1236884436
Which is the... |
Forum: PHP Mar 12th, 2009 |
| Replies: 18 Views: 99,851 GAH! Just realized how old this thread is, how did it get resurrected?!:-O |
Forum: PHP Mar 12th, 2009 |
| Replies: 18 Views: 99,851 For starters, functions in loops should be avoided whenever possible. e.g. for($i = 0; $i < strlen($s); $i++) also, you're doing a lot of extra work here.
I would suggest something like this:
... |
Forum: PHP Mar 10th, 2009 |
| Replies: 2 Views: 246 header( 'refresh: 5; url=http://www.example.com' );
Can also be a url relative to your site, like: home.php etc. |
Forum: PHP Mar 10th, 2009 |
| Replies: 13 Views: 578 But the notices are important, I always like to develop with error_reporting( E_ALL | E_STRICT ); In a production environment I NEVER leave error reporting enabled.
The problem with the notices... |
Forum: PHP Mar 9th, 2009 |
| Replies: 13 Views: 578 It's the escaping in your html in this area
if ( empty( $_POST ) )
{
echo "<table border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n";
echo "<form method=\"post\"... |
Forum: PHP Mar 9th, 2009 |
| Replies: 13 Views: 578 Try this. I made several changes, including moving an IF/ELSE statement up into the prior control structure. I also revised your sql statements slightly.
See if this does the trick and if you have... |
Forum: PHP Mar 9th, 2009 |
| Replies: 13 Views: 578 That is a Notice not an error, what it is telling you, is that your code is checking the value of $_SESSION['uid'] even though the array key 'uid' does not exist in the $_SESSION array.
replace:
... |
Forum: PHP Mar 9th, 2009 |
| Replies: 13 Views: 578 What is the actual error message you are getting, and what is the value of $_SESSION['uid'] in this part of your code?
if($_SESSION['uid']){
/** Add the following line **/
echo... |
Forum: PHP Mar 9th, 2009 |
| Replies: 1 Views: 294 I'm not sure if there will be a reliable alternative for the time being.
This is due to the Y2K38 problem. http://en.wikipedia.org/wiki/Year_2038_problem |
Forum: PHP Mar 8th, 2009 |
| Replies: 6 Views: 703 That is what I get for not testing that code. Glad to see you figured it out. |
Forum: PHP Mar 7th, 2009 |
| Replies: 11 Views: 2,734 so let me try to wrap my head around this, you have 200+ domains we'll call them domain1.com, domain2.com etc etc etc
they all point to the same theoretical directory, aka they are domain... |
Forum: PHP Mar 7th, 2009 |
| Replies: 5 Views: 715 SimpleXML as it will eliminate having to first load the contents with either cURL or file_get_contents and then having to load that data into SimpleXML or the DOM to then parse the XML. |
Forum: PHP Mar 7th, 2009 |
| Replies: 5 Views: 715 Are there parameters and if so do they need passed via GET or POST requests?
cURL will allow for GET and POST requests, but file_get_contents will only be able to open urls that can accept GET... |
Forum: PHP Mar 7th, 2009 |
| Replies: 6 Views: 550 Depends on the use case.
I always use a database for information that needs to be related together. I couldnt personally say 50/50 or 80/20 etc because my uses of flat files vs databases changes... |
Forum: PHP Mar 7th, 2009 |
| Replies: 11 Views: 2,734 It is NOT possible to set a cookie for a different domain then the one that script is currently executing on via php. The closest you can get is specifying .domain.com in the setcookie function and... |
Forum: PHP Mar 7th, 2009 |
| Replies: 2 Views: 278 For starters the above code has absolutely nothing to do with troubleshooting a connection to your database server.
gagan22: Is your site throwing any php errors and/or any mysql connection... |
Forum: PHP Mar 7th, 2009 |
| Replies: 11 Views: 2,734 While you can't directly set a cookie for a remote site with php, at least not from what I could tell with some quick tests. You can emulate it by calling a script on a foreign site and passing some... |
Forum: PHP Mar 5th, 2009 |
| Replies: 5 Views: 296 If the information that you want is available in an rss feed, then i think that is the way to go. If the info you want to scrape is not available to you in the rss feed(s) then you will have to grab... |
Forum: PHP Mar 5th, 2009 |
| Replies: 6 Views: 906 Are you trying to set something up, where as you make changes throughout the day, at a certain point, say once a night the server goes and compiles the source into a nightly build?
If this is more... |