Re: [PHP] Regex for telephone numbers
On Dec 29, 2010, at 7:12 PM, Ethan Rosenberg wrote: > Dear List - > > Thank you for all your help in the past. > > Here is another one > > I would like to have a regex which would validate that a telephone number is > in the format xxx-xxx-. > > Thanks. > > Ethan > > MySQL 5.1 PHP 5 Linux [Debian (sid)] > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > You can't, phone numbers are more complex then that. You could use \d{3}-\d{3}-\d{4} to match that basic pattern for all numbers though. Regards, -Josh ___ http://joshuakehn.com Sent from my iPod -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Encryption/Decryption Question
On Aug 11, 2010, at 6:50 PM, tedd wrote: > Hi gang: > > Okay, a question to the Encryption/Decryption gurus out there. > > If you were given: > > 1. This encrypted string: > > p3IVhDBT26i+p4vd7J4fAw== > > 2. Were told it was a social security number (i.e., in the form of > 123-45-6789). > > 3. And it had been generated from this code: > > $cipher = mcrypt_module_open(MCRYPT_TRIPLEDES,'','cbc',''); > mcrypt_generic_init($cipher, $key1, $key2); > $encrypted = mcrypt_generic($cipher,$social_security_number); > > 4. Where $key1 and $key2 are md5() values calculated from two different > security phrases. > > 5. Where each security phrase contains multiple non-English words. > > What would it take for you to break the encrypted string and decipher the > social security number? Can it be done? If so, how long? > > And lastly, where would the "best" place to store these security phrases? > (Note: I didn't ask where would be the best place for me to put them.) :-) > > Cheers, > > tedd > > PS: No, the SS number in question is not 123-45-6789. :-) > > -- > --- > http://sperling.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Tedd- Considering you can brute force the entire keyspace for Triple DES in under a few hours (without specialized equipment) I don't think it would take long. Granted, I'm not an encryption expert. I look forward to hearing more. Thanks, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quotes vs. Single Quote
On Aug 5, 2010, at 10:10 PM, Rick Dwyer wrote: > Hi List. > I've mentioned before that I am both just beginning to learn PHP AND I have > inherited a number of pages that I'm trying to clean up the w3c validation on. > > Something that confuses me is how the code on the page is written where in > one instance, it follows this: > > echo " > > And elsewhere on the page it follows: > > echo ' > > In what I've read and from many of the suggestions from this board, the > latter seems to be the better way to code, generally speaking. > > So given that the page has javascript in it, perhaps the reason for the > previous developer switching between the two was for ease of incorporating > JS? Don't really know... but what I would like to know is it considered > poor coding switch between the two on a single page or is it perfectly > acceptable? > > 2nd question, in the 3 lines below: > > $_SESSION['newpage'] = $newpage; > $checkstat = "select field from table where fieldid = $field_id"; > $result1 = @mysql_query($checkstat,$connection) or die("Couldn't execute > query"); > > > If I were to recode in the latter style, should they not look like this: > > $_SESSION['newpage'] = $newpage; > $checkstat = 'select field from table where fieldid = "'.$field_id.'"'; > $result1 = @mysql_query($checkstat,$connection) or die('Couldn\'t execute > query'); > > > The focus being here: > > "'.$field_id.'"'; > ('Couldn\'t execute query') > > Is this correct? > > Thanks for the help. > > --Rick > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Rick- It is generally accepted that you should use single quotes whenever possible. I only use double quotes when writing SQL queries (so I don't have to continually escape them for the single quotes) and when I need to output control characters like "\r" or "\n". It would be considered "best practice" to make consistent use of them, but it wouldn't be something I would loose sleep over. Regards, -Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP The Anthem
That. That is awesome. I will be forwarding this to some perl people now. Regards, -Josh On Aug 5, 2010, at 7:57 PM, Daevid Vincent wrote: > http://www.youtube.com/watch?v=S8zhmiS-1kw > > http://shiflett.org/blog/2010/aug/php-anthem > > ...some people have way too much time. ;-) > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] the state of the PHP community
On Jul 29, 2010, at 1:36 AM, Nathan Rixham wrote: > Hi All, > > I find myself wondering about the state of the PHP community (and related > community with a PHP focus), so, here's a bunch of questions - feel free to > answer none to all of them, on list or off, or add more of your own - this > isn't for anything specific, just out of interest and sure I (and everybody > who reads the replies) will learn something + doors/options/contacts may come > of it. The only thing I can guarantee is that I'm genuinely interested in > every reply and will read every one of them + lookup every tech and link > mentioned. > > in no particular order: > > What other languages and web techs do you currently use other than PHP? > - if you include html or css please include version, if js then preferred > libs, and whether client or server side. Java, JS (in the form of Node and MongoDB, +raw client / jQuery stuff) and PHP get used regularly. Python / Ruby infrequently. > > What's your previous language/tech trail? Started with QBasic and realized it was crap. Moved on to Java, realized object rock but J2EE doesn't. Moved to PHP / Java. > > Are you considering any new languages or techs, and if so which? > - names / links http://www.mongodb.org/ http://nodejs.org/ See http://joshuakehn.com/blog/index.php/blog/view/28/MongoDB-Node-js/ > > Is PHP your hobby/interest, primary development language, just learning or? Primary dev, hobby, interest, all of the above? > > How many years have you been using PHP regularly? More then five, but it's really hard to say when it stopped being just a language and the primary. > > How many years have you been working with web technologies? More then eight, though I remember HTML when tables were used for everything and spacer gifs were *the* thing. > > Did you come from a non-web programming background? Yes, primarily Java. > > Is your primary role web developer or designer? Developer. I couldn't design if you paid me my weight in gold. > > In your developer life, are you an employer, and employee, contractor, > freelancer, part of a team of equal standing members? Contractor / freelancer / employee / employer. Currently teaming up with a friend. > > Do you tend to work on jobs for geo-local clients, clients in the same > country, or do you work internationally 'on the web'? I like to work in person, but sometimes that doesn't work. I have done international work before. > > How do you get your projects? do they come to you, word of mouth, do you hunt > and bid for projects, code call, visit clients, target clients individually > you think you can help, or? > - not looking for trade secrets, just to get enough for an overall picture. Word of mouth mostly. > > Do you have any frustrations with the PHP community, do you find you want to > talk shop but can't, or find people to work with but can't, have projects in > mind you want to do but can't find people to do them with etc? Not particularly. > > Do you network with other PHP'ers in real life - meetups etc, do you tend to > shy away, or do you find you circulate in other web related but non PHP > focussed communities? I haven't gotten flashed on any PHP meetups, but I wouldn't shy away from them. > > Are you a member or any other web tech communities, opensource efforts, or > standardization bodies - again, if so which? None that I recall. > > Are there any efforts, projects or initiatives which are floating your boat > right now and that your watching eagerly (or getting involved with)? Node, Mongo. I'm also watching a couple git repos, memcached and scribe to name two. Some stuff I just can't be involved in (C / C++ dev is tricky when you work with Java / PHP). > > ps: please *do not* flame anybodies answers, that really wouldn't be fair. > > Best & Regards, > > Nathan > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Regards, -Josh