AyKay47
Members-
Posts
3,281 -
Joined
-
Last visited
-
Days Won
1
Everything posted by AyKay47
-
if the date is stand-alone, which judging solely from the example it is, then yes it will, thanks.
-
Thanks for that. But i'm still getting the same problem with $date = '1/2/20033'; because 1/2/2004 is not in the format of dd/mm/yyyy. the correct way to write it would be 01/02/2004 if the day and the month are allowed to be a single digit, which it appears you want, the pattern will look like this: $date = '1/2/2003'; if(!preg_match('~(?:[1-9]|[12][0-9]|3[01])/(?:[1-9]|1[012])/(?:19|20)\d{2}~', $date)) echo "false"; else echo "true";
-
if you truly want it in the format of dd/mm/yyyy then it will always have two digits as the day and month (e.g 01 not 1) and 4 digits as the year. With that being said, this is what I have come up with. $date = '01/02/2003'; if(!preg_match('~(?:0[1-9]|[12][0-9]|3[01])/(?:0[1-9]|1[012])/(?:19|20)\d{2}~', $date)) echo "false"; else echo "true"; now if you want it in the format of d/m/yyyy , the pattern will need adjusted.
-
of course 1/2/20033 will return false, as it should be.
-
Forum Issue: Unable to access a previous topic
AyKay47 replied to abhishekdeveloper's topic in PHP Coding Help
from what I have heard, several hours of posts were lost during the maintenance time. You will most likely have to post your thread again. -
no problem, please mark this thread as solved (bottom left corner button).
-
append an i modifier to the end of the pattern to make it case insensitive, I was hoping you would take some initiative and see that. $pattern = "~\b([A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4})\b~i"; $str = "1111111 <br/> 123emailaddress123@gmail.com <br/> 22222"; $replacement = '<a href="mailto:$1">$1</a>'; echo preg_replace($pattern, $replacement,$str);
-
hello, you can use something like this: $pattern = "~\b([A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4})\b~"; $str = "1111111 <br/> 123emailaddress123@gmail.com <br/> 22222"; $replacement = '<a href="mailto:$1">$1</a>'; echo preg_replace($pattern, $replacement,$str); results: 1111111 <br/> <a href='mailto:123emailaddress123@gmail.com'>123emailaddress123@gmail.com</a> <br/> 22222
-
also, i like to keep the sql and query call in separate variables, that way if an error occurs in the query, I can output both the SQL and the mysql_error() call.
-
first thing that I notice about the functionality is that when I click the side feedback tab, you cannot slide it back by clicking the tab again. Layout is simple, but nice. Color scheme works. Light grey text in the right column needs to be darkened.
-
My thoughts are to redirect to the pretty url, then have the rewrite serve the correct file until Google indexes the proper url. RewriteEngine On RewriteCond %{HTTP_REFERER} .*google.*$ RewriteCond %{THE_REQUEST} ^[a-z]+\ 09search_results\.php\?search_KEYWORD=([a-z]+)&search_RANGE=([a-z]+)&o=(\d+)$ [NC] RewriteRule ^09search_results\.php$ %2/%1/%3 [R=301,NC,L] RewriteRule ^([a-z]+)/([a-z]+)/(\d+)$ 09search_results.php?search_KEYWORD=$2&search_RANGE=$1&o=$3 [NC,L]
-
looking back at your original post, the solution I provided here: is what you want. If someone types in /frames/aluminium/1 they will be served: /09search_results.php?search_KEYWORD=aluminium&search_RANGE=Frames&o=1&search=1 which is what you asked for. It is up to you to modify your code to cater this rewrite, e.g changing the internal links etc..
-
You seem to ask a lot of general questions that you can simply test yourself. If you are serious about programming, put in the time to test things yourself that you do not understand, which is essential for understanding concepts. Don't just post questions on here that you want a simple answer to from us when you can answer the question yourself. It's a waste of our time and yours. Btw, the php manual does a fine job of describing the $_FILES super global array.
-
( ! ) Parse error: syntax error, unexpected $end in (line 77)
AyKay47 replied to Lorenzdakid's topic in PHP Coding Help
also, what is the point of declaring $begin as global in your function when it is being passed into the functions scope via parameter list? doesn't make sense, not a good practice, don't do it. -
this seems more like a common sense question, simple math. Have you tried your solution? Was the value what you expected? There are factors that may go into this as well: 1. are the credit values rounded? e.g if I have 1,500 credits would that equal 2 credit points? 2. is the total rounded? please explain the requirements more thoroughly.
-
contact form - easy question for most of you
AyKay47 replied to greentrancer's topic in PHP Coding Help
actually, PHP has numerous built-in regex's that are available for validation and filtering. Take a look at filter_var, the example includes the email validation syntax. -
I like to use other characters as delimiters, like the "~" so I do not have to escape forward slashes.
-
what do you mean? I don't quite understand whats going wrong for you now, can you explain the problem more thoroughly.
-
its pretty sad when you have hundreds of errors to fix.. errors come in the order that the parser parses, top to bottom. Next time, prevent the errors from happening in the first place..
-
Can PHP dynamically change .htaccess files?
AyKay47 replied to Ivan Ivković's topic in PHP Coding Help
Whatever the case may be, there is almost always a better solution than updating .htaccess with PHP. This could lead to very un-wanted results. -
what data types are `resdate` and `deltime` set to in the database? you are using a comparison operator in your query, change to: $sql = "SELECT * FROM reservations WHERE `resdate` = '$resdate' AND `deltime` = '$posstime'"; $reserved = mysql_query($sql) or die("Query: " . $sql . "<br />" . mysql_error()); EDIT: I see that you found the solution, however this should really be done with a join for optimization
-
session variable not working and register_globals question
AyKay47 replied to ricmetal's topic in PHP Coding Help
since you are using $_SESSION['user'] and not $user to call the session value, register_globals plays no part here, unless $_SESSION['user'] has already been set and you are manipulating $user, that's a problem. check the session values that are set: if(isset($_SESSION['user'])) print_r($_SESSION); else echo "session not set"; don't enable register_globals -
alright, now wherever you are executing the curl with curl_exec, set it up similar to the code that I have posted, setting the results to a variable, then var_dump()ing the results.
-
Can PHP dynamically change .htaccess files?
AyKay47 replied to Ivan Ivković's topic in PHP Coding Help
yeah, I wouldn't really mess around with the .htaccess file using PHP. There should never be a legitimate reason why you would ever need to change .htaccess dynamically. -
most likely a charset issue, if you want to view the transfer results as a string, the CURLOPT_RETURNTRANSFER option needs to be set. $ch = curl_init("http://www.test.com"); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); $transf = curl_exec($ch); curl_close($ch); if($transf !== false) var_dump($transf);