Re: [PHP] phpscriptor.com
Paul M Foster wrote: On Sat, Jul 11, 2009 at 08:14:35AM -0700, PHPScriptor wrote: Ok this may look like spam but what the hell... I'm the owner of phpscriptor.com, I had bigg plans with this domainname but... well yes, no time. So I'm selling it. I don't want to make profit out of it. So for, lets say 200 dollar, you can have to domainname. And if you want, you get the website free with it. Why am I reminded of the Vincent D'Onofrio Edgar-cum-cochroach character when I read those lines above? I found myself adopting the cochroach accent as I read the first line. Seriously. You don't want to make a profit, yet you're selling it for $200? Those two statements are contradictory. He has a lot of mouths to feed. Plus if he's been sitting on it, the $200 might let him break even. I've learned that much, eh? SL -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] isset question
Waynn Lue wrote: I notice that you're checking $_POST['mort'] but you're echoing $mort, is that your actual code? That was my observation as well. Is $mort = $POST['mort']; being set somewhere else or not? If not, how is your script supposed to know what value $mort should be? And, what the other guys said. Gary, before you do anything with submitted data you need to process it against strip_tags() and/or htmlentities() at the very least, mysql_real_escape_string() if the data goes to a db. Reese -- On 6/18/09, Gary gwp...@ptd.net wrote: I have a form that gives the submitter a choice or either one set of questions, or another. I am still getting the message even if the input was left blank. So on the line below, $msg.= isset($_POST['mort']) ? The mortgage amount is $mort\n : ; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] utf-8 ?
Tom Worster wrote: Because, I thought, HTML files were basically just text files with different file extensions, and that those other characters would not store or display properly if saved in .txt format. Was I mistaken? yes. see http://www.w3.org/TR/html401/charset.html which says that html uses the UCS, a character-by-character equivalent to the Unicode character set. so if you use a unicode character encoding (such as utf-8) then you you have a direct encoding for every unicode character in html. I wonder if you've looked at any of those non-encoded characters in vi while shelled in. so a utf-8 html file or stream should normally to have no entities other than lt;, gt;, $amp; and perhaps quot; as needed. Well there it is, that should word. I've already named one example where should doesn't work as expected in all cases, here's another one: Client blog that uses Wordpress and the UTF-8 charset. Text that is copied pasted with non-English letters fancy punctuation marks displays alright in the body-text of posts, but not in post subject lines. I think that's because Wordpress is doing some conversions in the background, but isn't doing them everywhere. So when one of those is present in the subject line, there's a little glyph that shows up when viewed in a Web browser. Unless that character is properly encoded by me. Have you looked at the Wordpress wp-includes/formatting.php file? Lots of busy work in the form of substituting one thing for another thing, there. http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt That is supposed to be a UTF-8 encoded text file, between 1/3 and 1/2 of the characters do not display correctly on my screen. why this doesn't work for you is not clear. it could be that your browser has a preference configured to override the charset specified in the http headers. or perhaps the browser does not observe the specified content type for txt files. I don't think it has anything to do with configuration preferences like that. I'm running Win2K as indicted earlier, the client is running a Mac and he sees the same thing I do - in Safari and MacFF both. What OS are you running? I'd expect XP or Vista to behave slightly differently from Win2k, and who knows what different Linux distros will do w/out testing. Either way, this next link suggests that Turkish characters with no equivalent in the English language should be encoded for Web display: http://webdesign.about.com/od/localization/l/blhtmlcodes-tr.htm don't believe everything you read on the web. while some browsers may tolerate it, i don't think pages encoded according to those suggestions would even be valid html. I'll let you investigate that at http://validator.w3.org - I satisfied my curiosity about that long before you said anything. And because that is off-topic, I'll throw this in: The consensus seems to be that the proposed ifset() and ifempty() functions are more effort than they are worth. What I'd like to know is, why empty() still exists when every time I turn around, the mentors I turn to locally tell me not to use it, to use isset() instead. Because empty() doesn't work with zero. Anyone care to take a stab at that? perhaps because it's hard to get rid of language elements without breaking existing code? Perhaps. I think Chris said it best, they serve difference purposes. It's been my observation though, they can generally be interchanged with minor changes to syntax. Unless working with zero. Reese -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] utf-8 ?
Tom Worster wrote: why use SGML character entity references in a utf-8 file or stream? can't you just put the character in the file? Because, I thought, HTML files were basically just text files with different file extensions, and that those other characters would not store or display properly if saved in .txt format. Was I mistaken? http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt That is supposed to be a UTF-8 encoded text file, between 1/3 and 1/2 of the characters do not display correctly on my screen. Either way, this next link suggests that Turkish characters with no equivalent in the English language should be encoded for Web display: http://webdesign.about.com/od/localization/l/blhtmlcodes-tr.htm And because that is off-topic, I'll throw this in: The consensus seems to be that the proposed ifset() and ifempty() functions are more effort than they are worth. What I'd like to know is, why empty() still exists when every time I turn around, the mentors I turn to locally tell me not to use it, to use isset() instead. Because empty() doesn't work with zero. Anyone care to take a stab at that? Reese -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] utf-8 ?
Tom Worster wrote: On 4/28/09 4:05 PM, Reese howel...@inkworkswell.com wrote: Granted, this isn't a PHP question but I'm curious, how does UTF-8 solve this display issue? if we're talking about web browsers, they are quite good at automatically choosing fonts that can display the unicode characters it finds in a page. Right, and I figured out the bit that was confusing me earlier: years ago, I read that some encodings such as #0147; and #0148; (curly quotes) should not be used, that #8220; and #8221; should be used instead. I misremembered that, when I looked at the utf-8 charset here: http://www.columbia.edu/kermit/utf8-t1.html I stand apprised and enlightened. I found the encodings for letters G with breve, S with cedilla, and lower case I w/out the dot, too. Reese -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] utf-8 ?
Tom Worster wrote: On 4/27/09 4:25 PM, PJ af.gour...@videotron.ca wrote: Exactly what are the advantages of using utf-8? How will it solve my problem? actually, i have no idea because i have no idea what problem you are trying to solve and i apologize for presumptuous. i presumed that you have a php app with a bunch of data in mysql and you needed to handle international characters in the db beyond latin-1. Actually, that describes me. I'm using UTF-8 on XHTML 1 pages with the .php extension, so that I can do wizard-like things when it is necessary. But I recently encountered an issue with a lengthy passage Turkish text where it was necessary to display accent marks on consonant characters. Particularly, on upper and lower case G characters. Granted, this isn't a PHP question but I'm curious, how does UTF-8 solve this display issue? Because I've Googled until I'm blue in the face but I didn't find a resolution that was ISO-8859-1 or UTF-8 compatible. Bringing it back around, thank you Tedd for the suggestion of going through the .docs and writing examples of each function. Brilliant! Reese -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is wrong with this code
9el wrote: *Note:* It is worth noting that the mail() function is not suitable for larger volumes of email in a loop. This function opens and closes an SMTP socket for each email, which is not very efficient. For the sending of large amounts of email, see the » PEAR::Mail, and » PEAR::Mail_Queue packages. * Note:* The following RFCs may be useful: » RFC 1896, » RFC 2045, » RFC 2046, » RFC 2047, » RFC 2048, » RFC 2049, and » RFC 2822. Copy from PHP Manual. How is larger volumes of email defined where mail() is concerned? Is a number specified anywhere? I didn't see one on the manual page for mail(). Reese -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is wrong with this code
9el wrote: But in practice. I mean in real life you'll find the mail() function is disabled in most servers :) That's nice, but how many is larger volumes of email? 500? 5,000? 25,000? I note PEAR:Mail has 3 open bugs, PEAR:Mail_Mime has 23 with 3 open support requests. PHPMailer was mentioned earlier, it has 31 open bugs (and someone noted that at least one was closed as resolved even though it wasn't actually fixed). So how many addresses can mail() safely handle? Reese -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Randomiser
Andrew Barnett wrote: I ended up using an example from the PHP website. ?php $input = array(Neo, Morpheus, Trinity, Cypher, Tank); $rand_keys = array_rand($input, 2); echo $input[$rand_keys[0]] . \n; echo $input[$rand_keys[1]] . \n; ? Just extended the array to the number of lines I needed. That works, but shuffle() is cleaner and then you can echo things out with a foreach() expression. http://www.php.net/manual/en/function.shuffle.php Reese -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Randomiser
Chris wrote: That works, but shuffle() is cleaner and then you can echo things out with a foreach() expression. http://www.php.net/manual/en/function.shuffle.php If you're doing a shuffle inside a loop, it's going to be even slower. Might not be an issue for the OP but after your array gets to a certain size, doing that will be a problem. Inside the loop? I envisioned shuffling the array, then launching the loop. Probably it is possible to avoid but if shuffle fires inside the loop, reshuffling seems like it would be an issue. Reese -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php image and javascript include
javasac wrote: snip Where is the PHP? There's nothing between ?php and ? tags. Nothing between PHP short tags ( ? and ? ), either. Reese -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php image and javascript include
b wrote: javasac wrote: [lots of stuff ...] Second, at least one of the image paths is relative to your own desktop computer's drive (why is it that this always happens on a Windows box?) td width=11 C:/wamp/www/yojoe-web/html/site/images/box_top_rht.jpg /td PEBKAC error? I've seen it happen when an inexperienced developer copied a file to another location, from within Dreamweaver, on a Mac. Dreamweaver updates the file path(s) if permitted and depending on a couple of variables, puts in an absolute path to the location on that particular machine. Reese -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Evaluating script complexity
Good morning everyone, I've usually taken a dive-in/head-first approach to the things I've engaged in, more and more lately I've come to realize that this approach is not always appropriate. I believe this realization can be called experience. So, I have a question I hoped the group could help me with. While it is generally applicable to programming in any language, I am asking with specific regard to PHP. When a customer, client or supervisor presents with task description, how is that tasking rated for complexity? By how many functions are involved? My how many logic decisions must be performed? A combination? Now throw in a time factor. What if your ability would have you completing it in 12 hours but they want it in 6? Or 4? Are there guidelines for helping someone new at these types of evaluations? Or is it all based on experience and familiarity with past accomplishments? Given the nature of this tasking (a coding challenge) how likely is it that they do not really expect a finished product but wanted to see how far a person got with it? If that, is 16 hours (overnight) excessive? How many of us are willing to stay up all night on a coding challenge for a prospective employer with no promise of being hired? The reason I ask, I saw tasking to create a loan repayment calendar (or calculator). So basically, all the usual complexity of a calendar (or calculator), then calculate weekends and holidays, and shift the paydate to the left as needed to not fall on one of those. Now figure that the usual time to complete this task (just the processing script, not a GUI for it) is claimed to be 3-4 hours (but 16 hours are given). So while I want to know how to rate tasking complexity more generally, at root I'm wondering what degree of proficiency (with PHP) must a programmer have to complete this sort of task in those sorts of time frames. Reese -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)
Daniel Brown wrote: On Jan 15, 2008 6:42 PM, Jochem Maas [EMAIL PROTECTED] wrote: funny that, I usually use 'exit;' for a clean exit and 'die();' to signify a shitty exit ... although they are actually indentical functionally - just my idiosyncrasity ... that said I also so stuff like 'exit(1);' when I really want to offer a proper exit code. :-/ [snip!] While I'd be more inclined to believe that die() would be considered more of a function (which is why I continue to write it with the attached parentheses) than a language construct (such as 'exit'), it appears to be nothing more than a matter of semantics in PHP. I saw questioning whether die() was a really function or not, as metaphorical joke on the metaphysical. Maybe I'm just weird. Other discussion re: globals-on has me thinking about an element of coding on a client site I haven't reviewed lately, a move to OOP seems indicated. Is that the usual method to avoid that or is that just one of several methods? Ulex (channeling an English teacher who said That that is that that that was technically correct in English but she wouldn't explain it to the class at the time. It was high school, many years ago.) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] uh oh, I defined a resoruce
I have been using define to create a constant for the link resource returned by mysql pconnect like so: $PL = @mysql_pconnect(localhost, $DBUser, $DBPass); define(SITE_DB,$PL); Later I use the constant to select my databases. mysql_select_db($SrcdbID ,SITE_DB); This code seems to be working as I expected and I have many thousands of llines of code done over several years using this construct. But, I happened to be reading the php doco today and noticed that you are not supposed to use define for resources, so question is, is what I am doing safe or am I going to run into problems and if so what is the best way to globally pass resources to multiple classes and functions, command line scripts etc? Cheers Charlie Reese -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Login script problem
Daniel Brown wrote: if(!isset($key=='1')) //caused parse error That's because isset() isn't able to eval() an expression. Got it, I see the mistake now. Remove the !isset() part, or the =='1' part and that will remove the parse error. I changed it to if(!isset($key)) and you were right, the parse error went away. This change seems to have no effect on access code logins (I'm able to log in, as expected) or IP-authenticated logins (I still cannot log in, even though my IP is in the MySQL db). Reese -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Login script problem
Greetings, I've been lurking for several weeks, I thought I'd post to describe a problem I've been having in the hope that a solution can be found. And my thanks to Casey, for his offlist assistance with another, unrelated issue earlier this week. :-) I apologize up front, for what is probably too much information. I know this will take some time to read and digest. On a client's site (PHP4 environment, natch), two login methods are used to control access to premium content. The first sets a cookie when valid access codes are submitted via the login form, there are no known problems with that method at this time. The second method was grafted on top of the first by a 2nd programmer. It is a link to the verification script (index1.php) that is supposed to do IP lookups in a MySQL db table. The table is called getIPval and has 4 Fields, which are named 'nIP','ipStart','ipEnd','nStatus' All ipStart/ipEnd ranges have a status of 1, and can accommodate the number of characters required for IPv6 addresses but to the best of my knowledge, no IPv6 addresses are listed at this time (there are a couple thousand line items). The script(s) is supposed to check rows in the table and if the requesting IP is = ipStart AND = ipEnd on a given row, grant access to the requesting IP [load the page identified by the rYear (decade) year (actual year) variables called out in the navigation link] - the default page after login is /1940s/1949.php . If the requesting IP is not found, the user is to be bounced to the login page [index.php]. Outside of these two scripts, the 'rYear'and 'year' values are passed via GET in the navigation links, the key is not passed by the navigation links. To repair emergent problems with the 1st access method while getting the 2nd access method to work, the key was introduced but it is not included in the navigation links. An example nav link looks something like this: http://[domain][path]index1.php?rYear=value1year=value2 Or at least, that is how it is all supposed to work, per my understanding of the programmer's description and my own understanding after reviewing the code myself. The Problem A growing number of what are supposed to be authorized, IP-authenticated users have reported an inability to navigate away from the initial premium content page, 1949.php, after the script checks their IP and lets them in that far. Access code users do not report difficulties. I've been over this with the programmer, he says he cannot find anything wrong with the PHP scripts. I've checked some of the affected IP-range entries in the MySQL db table, our best guess to date has been that a cache server is misbehaving somewhere. Neither of us is able to duplicate the reported error of not being able to navigate away from the 1949 page. What I have observed recently however, with my own IP listed in the db table as part of a range, sometimes the script will randomly either let me in or not let me in. Whichever state it is in, persists, until new changes are made when it will then either let me in or not. It always lets me in if I list my specific IP (not as part of a range). So as the number of users who report the navigation difficulty grows, I am beginning to wonder if there might really be a problem in the script that the programmer isn't seeing for whatever reason. Does anyone see anything obviously wrong in the code below? I've obscured the actual server domain name, login, passwords, and some path statements. Watch for line wraps. Reese -- ?php // //login script, invoked by all premium content pages via GET //file name index1.php // $link = mysql_connect('mysql_server_url', 'login_id', 'login_password'); if (!$link) { die('Not connected : ' . mysql_error()); } // make mrfsql_db1 the current db $db_selected = mysql_select_db('login_id', $link); if (!$db_selected) { die ('Can\'t use foo : ' . mysql_error()); } $domain = GetHostByName($REMOTE_ADDR); // users IP// if(!empty($_REQUEST['rYear'])) { $yrs = $_REQUEST['rYear'].'s'; $yr = $_REQUEST['year']; } function getIP($cdomain) { $sql= SELECT nStatus FROM getIPval WHERE ipStart ='.$cdomain.' ; $result = mysql_query($sql); $row = mysql_fetch_array($result); return $row['nStatus']; } $row = getIP($domain); if(!empty($_COOKIE[monthcode])) { $pcode = $_COOKIE[monthcode]; } if($row == '1' || $pcode!='') { header(Location: decade/$yrs/$yr.php?key=1); } else { $sdomain = explode(.,$domain); $cdomain = $sdomain['0'].'.'.$sdomain['1'].'.'.'0'.'.'.'0'; $row = getIP($cdomain); if($row == '1' $sdomain['3'] 256) { header('Location: decade/1940s/1949.php?key=1'); } else { header('Location: index.php'); } } ? EOF Below, the check script that is used on all other premium pages. Its intended function is to verify that the user is authorized
Re: [PHP] Login script problem
Web Design Company wrote: Someone? Me31!1!1ONE Please, if you do not need amplifying information or if you do not intend to pose a suggestion, it is better to remain silent. I wasn't helped by your Someone? post, no one else was either. Reese -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Login script problem
Daniel Brown wrote: [snip=all] Reese, While I noticed several areas for improvement in the code (such as being sure to exit; after calling header(Location: ); ), two things primarily come to mind: Do you expect the value of $key in this condition to be a literal zero? $twoyears = array('alphanumeric_code1', 'alphanumeric_code2', 'alphanumeric_code3', 'alphanumeric_code4', 'alphanumeric_code5', 'alphanumeric_code6', 'alphanumeric_code7'); $key = in_array($sPromocode,$twoyears); if($key=='0') No, it should either be 1 if set or NULL(?) if not set, there is nothing to set that value to 0 - only this check to see if it is == to 0. Is this another area, like the one Casey helped with earlier, where '!empty' was being used instead of 'isset'? The programmer is aware that improvement is possible and we've had some discussions in that regard, but owing to this being a for a friend item and his currently declared job demands, either he is truly swamped or he is brushing me off. I'm willing to give him benefit of the doubt, until I'm confronted with evidence to the contrary. Also, what about ISPs such as AOHell who use fully-dynamic IP proxies that change on location, at time intervals, and are interspersed with random changes? Even putting that into a range won't help, as it's likely the IP will only have the network prefix (and perhaps the same Class B slot). That's an area where I left detail out, my apologies. The dual login mechanisms are geared towards accommodating this, AOHell users will tend to be individual entities and the 'access code' mechanism is geared towards them. Meanwhile, entities with static, assigned IP addresses such as libraries on city networks are meant to be given IP-based access, hence the other login validation method (which isn't working quite right). Reese -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php