Re: [PHP] RegEx to check for non-Latin characters
> For a Form Validation process, I need a function to avoid Latin characters > to be provided as the first or last name. Since we expect our users to > enter their personal info in Persian. > > Do you know any regular expression to provide this functionality? > 1) Regex to check whether there are Latin and Numerical characters in a > string. > 2) Regex to check whether the string only consists of certain characters. In a PCRE regex, [\x80-\xFF] will find all extended ASCII chars. Or, if you wanted all ASCII chars, you could use: [\x00-\xFF] That would catch space and punctuation as well though. Or you could amend it to suit. It's in hexadecimal (ie FF == 255) -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org (Updated November 1st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable Argument List
> ... And you might also be interested in func_get_args(), which returns an array of args passed to the function (don't know what it does if used outside a function. Probably get an error). -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org (Updated November 1st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RegEx to check for non-Latin characters
Hi Behzad, I would try a different approach ... EXAMPLE (UTF-8): http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http://www.w3.org/1999/xhtml";> Persia '; } function mbStringToArray ($string, $encoding) { $strlen = mb_strlen($string); while ($strlen) { $array[] = mb_substr($string,0,1,$encoding); $string = mb_substr($string,1,$strlen,$encoding); $strlen = mb_strlen($string); } return $array; } ?> As you can see I'm using the multibyte string functions [1] and split $username into a character by character array. Then I use strlen() for which an UTF-8 char has a length > 1. Note: This might change with PHP6. It also does not check for Persian characters only yet. You would have to try something like this ... EXAMPLE (UTF-8): http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http://www.w3.org/1999/xhtml";> Persia '; if (mb_strpos($chars, $char, 0, $encoding) !== false) echo $char.' is a Persian character'; } function mbStringToArray ($string, $encoding) { $strlen = mb_strlen($string); while ($strlen) { $array[] = mb_substr($string,0,1,$encoding); $string = mb_substr($string,1,$strlen,$encoding); $strlen = mb_strlen($string); } return $array; } ?> [1] http://in.php.net/manual/en/ref.mbstring.php [2] http://in.php.net/manual/en/function.strlen.php
[PHP] user access/roles/privs functionality
Hi list... I need a way of managing users/teams/etc.. implementing roles/access rights/privs,etc... I'd like a way of being able to have users "report to" the resource above them, ie, the ability to have a hierarchical kind of tree approach would be good as wel, as this would allow different user/mgr/teams to be moved up/down in the tree as required. If I can find the right process, I'll implement it in my targeted app. I'd prefer something that's fairly well compartmentalized.. but if need be, I'm willing to rip the right system out of it's parent app if I can find one that's good!!! I've reviewed the systems in the vtiger/knowledgetree apps. thoughts/comments/pointers would be useful! thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RegEx to check for non-Latin characters
Thanks everyone. I guess I find the answer: *// return true if the $str ONLY consists of Arabic characters and space-character public function isArabicString($str) { return preg_match('/^([\p{Arabic}]|\s)*$/u', $str); } * PHP 5.1.x or higher is required. @see: http://www.regular-expressions.info/unicode.html Cheers, -b
[PHP] Another question about Google maps
Hi gang: I posted this question on the Google Map Discussion group/list thingie, but got zip in replies. Maybe someone here might have an idea. Here's the url: http://masoncollision.com/contact.php In both Safari and FireFox for the Mac (I have not tested it with other browsers) as the page loads the map border is momentary drawn twice. The map border is shown stacked one above the other making the page much longer than it actually is. But immediately thereafter, the map is drawn correctly and the page returns to the size it's supposed to be. I just want to get rid of the momentary flash. Anyone have any ideas? Cheers and thanks, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ability to find include files...
Hi list... starting to go through a debug/understanding session of a couple of php web apps. i'm wondering if there's any kind of tool/method that i can use to see which files are accessed/included/required when a given page is displayed.. this would allow me to quickly understand the "flow" of the apps. searching via google hasn't really turned up anything... thoughts/comments/pointers welcome. thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Days until Easter and Christmas
Is there a way to modify this code so it will always be the *next* Christmas and Easter? "; echo $days_until_Easter . ""; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ability to find include files...
On Sat, Nov 15, 2008 at 6:07 PM, bruce <[EMAIL PROTECTED]> wrote: > > Hi list... > > starting to go through a debug/understanding session of a couple of php web > apps. i'm wondering if there's any kind of tool/method that i can use to see > which files are accessed/included/required when a given page is displayed.. > > this would allow me to quickly understand the "flow" of the apps. searching > via google hasn't really turned up anything... > > thoughts/comments/pointers welcome. > > thanks! > Yes. How about get_included_files(). http://www.php.net/get_included_files Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] user access/roles/privs functionality
On Sat, Nov 15, 2008 at 11:21 AM, bruce <[EMAIL PROTECTED]> wrote: > Hi list... > > I need a way of managing users/teams/etc.. implementing roles/access > rights/privs,etc... > > I'd like a way of being able to have users "report to" the resource above > them, ie, the ability to have a hierarchical kind of tree approach would be > good as wel, as this would allow different user/mgr/teams to be moved > up/down in the tree as required. > > If I can find the right process, I'll implement it in my targeted app. I'd > prefer something that's fairly well compartmentalized.. but if need be, I'm > willing to rip the right system out of it's parent app if I can find one > that's good!!! > > I've reviewed the systems in the vtiger/knowledgetree apps. > > thoughts/comments/pointers would be useful! > > thanks! > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Take a look at Zend_Acl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Days until Easter and Christmas
Ron Piggott wrote: > Is there a way to modify this code so it will always be the *next* > Christmas and Easter? > > > $todays_date_seasonal_format = DATE("Y-m-d"); > $next_Christmas = DATE("Y") . "-12-25"; > $next_Easter = date("D d M Y", strtotime("2009-03-21 > +".easter_days(2009)." days")); > $days_until_Christmas = ( strtotime($next_Christmas) - > strtotime($todays_date_seasonal_format) ) / 86400; > $days_until_Easter = round(( strtotime($next_Easter) - > strtotime($todays_date_seasonal_format) ) / 86400); > > echo $days_until_Christmas . ""; > echo $days_until_Easter . ""; Have you tried incrementing the year value by one when you define $next_[holiday] Cheers -- David Robley He who always plows a straight furrow is in a rut. Today is Setting Orange, the 28th day of The Aftermath in the YOLD 3174. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mySQL query question
Michael S. Dunsavage wrote: On Fri, 2008-11-14 at 12:46 -0800, Jim Lucas wrote: SELECT @confirm_number AS confirm_number; Are we not SELECTING the column value here? should we be selecting confirm_number as confirm_number? The idea is to give you the number that was used in the INSERT statement. It might have changed since the INSERT. Never know. So, giving you the one used in the INSERT is the best way to make sure you get the one you are expecting. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php