Re: [PHP] mail
On Tue, March 13, 2007 1:35 pm, Dani Dws wrote: I just want to know if the mail function works from a localhost (local server)? It *can* be made to work, even if you have not succeeded so far. I've checked my php.ini all the setting are right but the mail function is not sending any mail, any idea? Step 1. Make sure you can send email from the command line, with PHP not in the picture: mail [EMAIL PROTECTED] This is a test. . The . by itself on a line indicates the end of the message. If that doesn't successfully send out mail, then adding PHP into the mix is unlikely to also work. * Step 2. Make sure that the PHP user, which is not your usual login, can send email. su to the PHP user on the command line, and repeat step 1, and see if it works. In particular, the sendmail program has to be executable by the PHP user, and the mail configuration (usually sendmail.cf) has to allow the PHP user to send out email. If you are not using sendmail, the moral equivalent of the preceding sentence is still true. Step 3. Make sure php.ini has the correct settings for 'sendmail' (Un*x) or 'SMTP' (Windoze) * Technically, your mail server could be configured to deny access to you to send email, but allow PHP user to send email, but this is unlikely. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] variables in CSS in PHP question/problems
Surf directly to your CSS URL and see what happens. There are several possibiliies: #1. Your CSS has ?php ... ? in its output, because you have not convinced your web-server to run your CSS file through PHP to compute the dynamic result. You need something like this in .htacces: File whatever.css ForceType application/x-httpd-php /File whatever.css should be your CSS filename. application/x-httpd-php is the default, but your webhost/httpd.conf could use ANY mime type it felt like using there. Read your httpd.conf to figure this out if it's not the usual (above) Once you get your web-server to pass your CSS through PHP and spit out the dynamic CSS that you desire... #2. Your CSS has what you expect in it, but the browser thinks it's an HTML document, and shows it as such. This is because in php.ini your default Content-type is text/html. But when you spit out your CSS, with the PHP dynamic content to it, you need this at the very tip-top: ?php header(Content-type: text/css); ? so that the BROWSER knows that you are sending CSS. Note: Some browsers may *ignore* the Content-type and assume from the .css URL that it is CSS. That's pretty broken, but they are trying to help the web designers who can't configure their web server to send the right Content-type for .css files. #3 Once you have done all that, there is a VERY good chance that your browser (especially IE) has cached the old .css file... You may need to hold the control-key and click on the Refresh button, or hold down SHIFT (or is it ALT?) and control-R for reload in Mozilla-based, or ... Actually, if you surf directly to the CSS, and reload that, as in #1 and #2 above, the browser should do the right thing. But the problem remains that as you change your CSS dynamically, if the browser is caching the OLD CSS... So now you may need some no-cache and Last-modified headers as well. #4 You are on your own to fix the 50-line OOP mess to solve a 1-line problem... :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using a reentrant form
On Tue, March 13, 2007 10:19 am, Todd Cary wrote: To validate a page, I set the form value to the page name the user is on. Then there is a hidden variable, looped that is set to 1. By checking looped, I know if the user has re-entered the form so I can do my validation checks. Is there a disadvantage to this approach? If a malicious user is TRYING to mess you up, they could easily edit a copy of the form on their hard drive, and change looped to interesting and obvious values that will probably break your application: 0, -1, 42, ' 1; drop table mysql.user' spring to mind as intereting values to cram into there. :-v Consider, however, if you put an un-predictable random token in the first form output, and log that token in your session (or DB) as valid After the first submission, mark it as used At the point, the user cannot mess you up, unless they are good enough to guess the 1 in a billion chance of another valid unused token. See http://php.net/uniqid and http://php.net/md5 for how to generate an unpredictable unique token for this use. An SQL-injection attack is still possible, but an md5 is always 32 characters, so one of your sanity checks can be: $token = $_POST['token']; if (strlen($token) !== 32){ //log their IP or whatever, because they almost-for-sure are bad guy die(Invalid token. Loser!); } $token_sql = mysql_real_escape_string($token); $query = select used from token where token = '$token_sql'; used is a boolean. They either used it already, and you should ignore the re-POST (or whatever you want to do) or not,and you should process it and do: $query = update token set used = 1 where token = '$token_sql'; The $_SESSION version is even easier... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dst and strtotime
He meant + 24 * 60 * 60 not * 24 * 60 * 60 The idea is to ADD the number of seconds in one day to shift your time over by one day, not to multiply the time by the number of seconds in one day, which is just plain ridiculously high number beyond the scale of Unix time stamp. I would recommend checking the OS for recent DST related patches, and figuring out why one function thinks your computer us in EST but the other one thinks your computer is in EDT, because adding a day is just a band-aid, not medicine. On Tue, March 13, 2007 11:52 am, Jake McHenry wrote: On 3/13/07, Jake McHenry [EMAIL PROTECTED] wrote: -Original Message- From: Jake McHenry [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 13, 2007 11:22 AM To: For users of Fedora; PHP-General Subject: Re: [PHP] dst and strtotime A little more info: strtotime(last monday) or yesterday, is correct, but strtotime(last sunday) gives me 3/10 (saturday), strtotime(last saturday) gives me 3/9 (Friday), last friday gives me 3/8 thursday.. etc. maybe it will go away after a week?? What is the output of the below? echo date(Y-m-d g:i A T, time()); echo date(Y-m-d g:i A T, strtotime(last sunday)); 2007-03-13 12:30 PM EDT 2007-03-10 11:00 PM EST Hmm, EST and EDT ? There's the problem i think, as it is 11PM, making it 12PM it means next day. You could fix this with adding 24*60*60 to the result of strtotime() , or change it somehow ... So this would give you the right date: echo date(Y-m-d g:i A T, strtotime(last sunday) * 24*60*60); Tijnema That gives me this: 1903-11-13 2:32 AM EST Thanks, Jake -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Capitalizing the first letter
On Tue, March 13, 2007 9:10 am, Todd Cary wrote: I would like to write a filter that takes the text smith or SMith and returns Smith; same for ralph smith. No, you don't. :-) You *think* you want to write that function, but this is one of those things that is *way* more complicated than it seems to the beginner. How about: O'Brian McCormick Rodham-Clinton von Freeman del Castillo . . . Is the a good source on using filters this way? No. You could, perhaps, compare the name you have with a list of common names, and see if it is different only by case, and then prompt the user to confirm that it is not a typo. However, somewhere out there, there is some person who, for whatever reason, *wants* to use SMith as their last name, and they are legally entitled to do so, no matter how asinine it may seem. Checking the name against a zillion names, and prompting the user is probably more trouble than it's worth. What *IS* a good idea is to give the user a second confirmation look at the data before it goes in, and make them click a second time to confirm that it is correct. Most people will catch most of their mistakes if they actually look at what they typed. You won't get 100%, but you won't do any better with the zillion name list check anyway, and this is a lot cheaper/easier/faster. Human names are infinitely more complex than they seem at first glance. Throw in artist/band names, and the complexity is squared. E.g., The correct spelling of the lead singer from disappear fear is SONiA I am not making this up as an example. This is for real. http://www.disappearfear.com And that's an easy one. Don't even ask me to spell any rapper/hip-hop names! PS Every beginning programmer makes this mistake. Some of us (me) were dumb enough to think we knew better than the experienced folks saying Don't do that. We were wrong. :-) Don't do that. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Printer
Sir, I am trying to use printer functions in my script.pls. help me. The printer is working fine with other documents of ms-word etc. pls. help me Thanx Raaj The code is: ?php $handle = printer_open(); printer_write($handle, Text to print); printer_close($handle); ? It is giving errors like : Warning: printer_open() [function.printer-open]: couldn't connect to the printer [] in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 2 Warning: printer_write(): supplied argument is not a valid Printer Handle resource in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 4 Warning: printer_close(): supplied argument is not a valid Printer Handle resource in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 5 Food fight? Enjoy some healthy debate in the Yahoo! Answers Food Drink QA. http://answers.yahoo.com/dir/?link=listsid=396545367
Re: [PHP] PHP Printer
On 3/14/07, raaj sharma [EMAIL PROTECTED] wrote: Sir, I am trying to use printer functions in my script.pls. help me. The printer is working fine with other documents of ms-word etc. pls. help me Thanx Raaj The code is: ?php $handle = printer_open(); You should define which printer to open, or remove the printer_write($handle, Text to print); printer_close($handle); ? It is giving errors like : Warning: printer_open() [function.printer-open]: couldn't connect to the printer [] in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 2 Warning: printer_write(): supplied argument is not a valid Printer Handle resource in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 4 Warning: printer_close(): supplied argument is not a valid Printer Handle resource in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 5 Food fight? Enjoy some healthy debate in the Yahoo! Answers Food Drink QA. http://answers.yahoo.com/dir/?link=listsid=396545367 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question regarding form filtering
I use PCRE for filtering all the time. As a general rule, be sure you are using a pattern that says allow these valid characters and not one that says deny these invalid characters. You never know when some user will send Unicode or something so far outside what you expected that your deny invalid won't catch it. allow valid insures that ONLY the cases you thought of as valid, are valid. That said, sometimes the Right Thing to do is to deny invalid character, such as newline in anything you are cramming into email headers, as the spammers send out entire emails crammed into your Subject box on form-mail, and then you send out their email for them, as a side-effect of your attempt to send valid email. Play with an SMTP server and send it some emails by hand to see how this works... You'd have to be getting a heck of a lot of traffic and have a *TON* of inputs with PCRE being called on them for it to be any significant drain on resources. I daresay you couldn't manage to do it at all in a real-world scenario, but I presume somebody somewhere has somethng weird enough where the PCRE check is too expensive... The odds that you have that are about 1 in 1,000,000 though. On Tue, March 13, 2007 6:20 am, Tim Earl wrote: HI all, Well I have been going through various methods on filtering form data, and the one I never see is filtering form data using regular expressions, (although the html form and validition class by Manuel Lemos does seem to use them) this is the only I could find. I often see lines like (for checking a 4 character number for example): $input_value = html_entities($input_value); If (strval(intval($input_value)) strlen($input_value) == 4) { // do something with validated data (maybe put in valid array or something) } Ok so whats wrong with good ole: If (preg_match('/^[0-9]{4}$/',trim($input_value)) { // do something with validated data (maybe put in valid array or something) } Am I going to get a performance hit if I validate all my fields with regular expressions? As I see it I am only calling one function (ok 2 with the trim()) to validate my form data. Just wondering what you all thought about these different methods, and what approach suits best a given situation.. Regards, Tim -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirecting in a PHP script
On 3/14/07, Chris Shiflett [EMAIL PROTECTED] wrote: Tijnema wrote: Did you guys ever noted that little arrow down just right of the back button, where you can go back 2 steps at once, so you don't have to click very fast? I think we both remember browsing before that feature was invented. Chris How long ago is that? Was it before i came to earth? ... LOL It was in Win95 right? I never worked on Win3.x so maybe it was there :) Tijnema -- Chris Shiflett http://shiflett.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Data Types Problem
THIS IS (ALMOST) TOTALLY OFF-TOPIC HIT DELETE NOW Unless you want a chuckle at my expense... :-) On Tue, March 13, 2007 9:23 am, Jochem Maas wrote: Richard Lynch wrote: By definition, all HTTP data is of type 'string' because that's the ONLY data type HTTP supports. PHP will cheerfully typecast it to whatever it needs to be later, but when it first comes in from the GET (or POST or COOKIE or whatever) data, it's going to start its life as a string, no matter how it looks. If you *know* it should be integer, typecast it as you get it: $foo = (int) $_GET['foo']; Do this to a) self-document your code, b) foil a ton of web-bots and nasty people trying to cram the wrong kind of data into your application to break/abuse it. you forgot c. c) because it's what all the cool kids do. actually forget c. cool kids aren't writing code, they're all smoking crack, driving 100,000 dollar cars and pimping out college girls. here's hoping your day is better than mine :-P Actually, I think I posted this on the same day that Com Ed (local electical utility company monopoly) did their usual monthly auto-pay out of my checking account... Their meter-reader-in-training however, misread the meter, and they decided that my electric bill was: US $9,443.78 Yes, really. I live in a one-bedroom apartment. My usual bill is like $30 in winter, up to $100 in hot summer months with window A/C going full blast all month. (I hate muggy heat.) I don't think I could put any gear in here that would use $9K worth of electricity in one month without the gear bursting into flames! By the time I spotted this error, and called them it was Friday after 5 pm. The phone monkeys all agreed (both bank and Com Ed phone monkeys) that it was obviously a mistake, but they could do nothing until Monday. Except the one who *thought* she could, only it turns out she couldn't reverse it out because it was a mistake of over $5K, and only a manager can reverse out a $5K or bigger mistake, so I'd have to wait until Monday. At no point did any human question the utter impossibility of this charge being correct -- They only said that they couldn't fix it because things usually don't go this wrong, and they weren't permitted to fix it as a matter of policy. So not until 5 days after the event did I get my money back. The United States Postal Service never actually delivered my statement, by the way, so I didn't really have a chance to head this off in advance. [Chicago postal service just made headlines as worst in nation, as usual, for those who disbelieve the previous sentence.] Did I mention that I'm trying to buy a house, so my earnest money check was invalid?... I got lucky, and the seller didn't actually deposit the check. And the deal fell through, but still... I'd have to say this was one of my more stressful weekends. So, no, Jochem, I probably wasn't having a better day than you that day. :-) Take heart. Your day could have been worse. I doubt the Sears Tower spends $9K on electricity in a month. Maybe some full-up monster data center... Does anybody know of any valid electical monthly bill (not counting something in arrears on previous months) of over US $9K? Sheesh! You *know* they have all kinds of red flag checks to protect themselves against scammers, schemers, and just plain no-payers, but I guess they don't give a [bleep] about protecting *my* money, with a simple sanity check. :-( Lord knows they can't even do an estimated bill right -- When they can't get in to read the meter, they routinely estimate it at either $50 (a bit high, but okay) or $8.xx. I dunno why their algorithm likes 8 so much, but this has happened once or twice a year for 22 years. It got to the point, before autopay, where I just ignored their estimate, and sent in my estimate, so I wouldn't end up in arrears. I'd have a credit until they read the meter, and then they'd figure out I was right, and I'd be caught up. So they can't do a simple estiment. Apparently, every Com Ed programmer skipped Home Ec. And 5th grade math. And 6th grade. And 7th, 8th, and most of high school math. Forget college. Because estimating a bill is about as simple as it gets... So, to make this post nominally be ON-topic: Moral: Your PHP script should be smart enough to not do something this stupid if you are handling money. Sanity checks are good. Unusual events should require human review. Computers are stupid. Humans should be given the authority to do their damn job, or have a Manager available 24/7 who *does* have that authority. Thank you. PS I'm still waiting on the bank to reverse the $25 overdraft fee this caused, as I do *not* keep $9K+ in my checking account. Bill Gates might do that, but I sure don't. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List
RE: [PHP] Re: question regarding form filtering
I personally would not presume that PHP and JS regex patterns are 100% compatible... Store a separate pattern for each. And, actually, the PHP check might be more involved than the JS check. For example, if the users is making up a password, and this password has access to something that's actually sensitive and worth protecting (money, medical records, private matters)... You should probably have JS and PHP to check that the password is long enough, has mixed alpha and digit, that the password and confirmation match, that neither password nor username contains the other as a substring, etc. But in PHP you'd probably *ALSO* want to check against a database of words (say the one in /usr/share/web2, Webster's 2nd Edition dictionary, now in the public domain) and make sure they did not choose a simple word. You almost for sure do *NOT* want to attempt to send the entire Webster's 2nd Edition dictionary to the browser as JS data so that the JS can check. :-) I suppose you could do a Web 2.0 Ajax-y thingie for that... At any rate, the validation in JS may not always be exactly the same as in PHP, even if their PCRE patterns are 100% compatible, which I doubt. For anything that really matters, your sanitation probably ought to be custom-tailored rather than off-the-rack anyway... Plus, the easy ones are easy, and the framework probably won't handle the hard ones, so what's the point of the clutter of the framework? So I personally wouldn't even go down this road. I expect many on this list to disagree with the preceding 2 paragraphs. YMMV On Tue, March 13, 2007 9:36 am, Tim wrote: -Message d'origine- De : Haydar Tuna [mailto:[EMAIL PROTECTED] Envoyé : mardi 13 mars 2007 14:53 À : php-general@lists.php.net Objet : [PHP] Re: question regarding form filtering Hello, You can write some basic functions such as checking length of variable, removing special character, checking number or string, trimming blank lines and so on. And then you can use this functions together and you can write new functions. For example, if you want to check number (such as digit count is 4), you can write like a checknumber($number,$digit). With this function, you can use like length of variable function, removing special character function, checking number or string function and trimming blank lines function together. :) Sure i hear you, have been their and done that in the past. Maybe the situation i am in will help describe why i am going for regular_expressions.. I have made a form generation/(soon to be)validation class with integrated contextual help via javascript info popups. I would like to offer the possibility of javascript validation for those that have it enabled, for obvious pratical reasons being less work load on server if each does his own validation on client-side, and of course server-side validation for security reasons.. Now my forms are made like this: // options array for new form $form_options = array('name' = 'parametres_site', 'aide' = 'Enregistrer les modifications apportés aux coordonées de l\'entreprise', 'bouton'= 'Mettre à jour les paramètres' ); // initialize form class and add new form $form = new formulaire($this-debug_mode,$form_options); // initialize inputs array $input_options = array(); // add an text input with various options based on its type (default values are not listed) $input_options[] = array( 'name' = 'nom', 'type' = 'text', 'maxlength' = '35', 'size' = '35', 'label' = 'Votre nom :',//label 'regexp'= '/^[a-zA-Z1-9_- ]{0,35}$/', //regexp for content filtering 'newline' = 0,//no new line (next input on same line) 'aide' = 'Le nom qui apparaîtra que votre site', //contextual help msg 'erreur'= 'Mauvais caractères dans le nom' //error msg in case bad input based on regexp ); $form-add_inputs($input_options,'parametres_site'); // generate form and if success assign html_form to $content if ($form-generer_formulaire('parametres_site')) { $content = $form-html_forms['parametres_site']; } // echo the form to the page Echo $content; Ok so my reason being for using regexp is
Re: [PHP] session/login issue
Check the before/after php.ini settings. My first guess is they finally turned register_globals OFF and the Plesk code is relying on register_globals. Upgrade, fix, or abandon Plesk if that's the case. My second guess is they changed the session.auto_start or completely messed up the session GC or time limit settings in php.ini Actually, if it broke yesterday... The DST date/time change may also mean that the OS idea of now and the PHP idea of now may be out of whack, or, more likely, their server clock is so screwed up that sessions are expired as soon as they are issued. Can we just abandon this stupid DST thing already? Who actually *LIKES* it? If you've got a problem with the amount of daylight you are getting, just get up earlier or later or whatever, and leave the damn clocks alone! On Tue, March 13, 2007 9:11 am, Gunter Sammet wrote: Hi all: I inherited an application using PHP 5.1.4 with MySQL 4.1.20, Apache/2.0.46 (Red Hat) on a VPS server with Plesk 7.5. The authentication used to work just fine till yesterday. Now it doesn't authenticate anymore. My debugging so far hasn't revelaed much. It seems like the sessions are not started or started and destroyed right away again. Session handling is done via session class with session data stored in the database. The database doesn't contain any data but debugging revealed that session data is written to the DB and then immediately deleted. None application of the code has changed. Haven't had a chance yet to find out if the hosting company changed/updated anything. I suspect it has something to do with the environment but at the moment I am spinning wheels. Any pointers would be appreciated! Thanks, Gunter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] About exec function
The PHP User probably does not have write access to the new .out file it just created. Why Windows would be this weird, and let you create a file you cannot write to is beyond my comprehension, but there it is... If it's a multi-user Windows box, try logging in as the user PHP runs as, which is IUSER_machinename, I think, on some Windows boxes... exec() also takes 2 more arguments, which pass back output and error code. If Windows is giving any kind of error message and or OS error code, you can get them by using those 2 args. Do this first, actually, as it is better than just guessing what went wrong. On Tue, March 13, 2007 6:14 am, Pablo Luque wrote: Hello, I'm designing a website with php and the critical point of the design is to execute a program in the server, so after execution is finished, server will show the client some data and info. The program is called pspice, which analizes electronic circuits, works in msdos and in order to call him you need to write in the command the input file (which is created before we call the program) and the output file, which can have the same name as the input file, since they have a different extension. If everything works correctly after the execution of the proper command, a .out (the output file written in the command) file should be created with the data the server would later provide to the client. I have got to execute the program using the line: exec('c:\WINDOWS\\SYSTEM32\\cmd.exe /c start c:\\PHP\\PSPICE\\pspice1.exe ej1 ej1') The problem I have is that the execution never ends. The cmd window with the execution of the program appears and never ends, just keep simulating (and the execution should be over in less than a second). The .out file is created but it is empty. How can I make the execution of the program stop and continue executing the rest of the code of my php file? Thanks! _ Descubre la descarga digital con MSN Music. Más de un millón de canciones. http://music.msn.es/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP URL issues
Plus, after you urlencode() the values to go into the URL, you should use htmlentites on the URL to go to the browser, if you want it to be valid HTML. Use Firefox with HTMLValidator and make your HTML valid will solve about 20% of beginner PHP problems. On Tue, March 13, 2007 7:47 am, Satyam wrote: You should use urlencode() on variables that will go into URL arguments. You might have a whitespace in any of those variables and the URL stops at the first whitespace. If those spaces are at the ends and are not significant, you might want to use trim(). - Original Message - From: Don Don [EMAIL PROTECTED] To: PHP List php-general@lists.php.net Sent: Tuesday, March 13, 2007 11:37 AM Subject: Re: [PHP] PHP URL issues I've just noticed that if am passing only one value it works fine, but when am passing in more than one none works. Why is that or what could be wrong ? e.g. this works echo ba href='test.php?term=$letter_value'$letter_value nbsp;/a/b; on test.php i can display the value of term but with this echo ba href='test.php?term=$letter_valuetype=$type_value'$letter_value nbsp;/a/b; on test.php the values are empty. Nikola Stjelja [EMAIL PROTECTED] wrote: If you are going to insert variables like $var_name in a string you need to enclose that string with double qoutations marks, not single. PHP will replace var names with values only inside double qoutations. Hope that helps On 3/12/07, Don Don [EMAIL PROTECTED] wrote: I've got the following url rewriting problem. on page 1 i've got this p a href='page1.php?messageId=$tmpForumuserId=$user_id' See /a/p and on page 2 i've got this $messageID = $_REQUEST[messageId]; $userID = $_REQUEST[userId]; when i check to see the values of these variables its says its empty, but when i place my cursor on the link in page 1 i can see both variables being show with their values in the browser. But on page 2 i cant get the values Something seems wrong perharps ? Cheers - Now that's room service! Choose from over 150,000 hotels in 45,000 destinations on Yahoo! Travel to find your fit. -- Please visit this site and play my RPG! http://www.1km1kt.net/rpg/Marinci.php - Don't get soaked. Take a quick peek at the forecast with theYahoo! Search weather shortcut. No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.10/720 - Release Date: 12/03/2007 19:19 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP URL issues
On Tue, March 13, 2007 9:31 am, Steve wrote: This may or may not help, but here's a few things to note: 1) I would avoid placing variable output in double quoted strings. While not important for smaller scripts, doing a large number of outputs like this causes a decent performance hit. In fact, I wouldn't use double quotes ever in php. Instead, strive for something like: echo 'ba href=test.php?term='.$letter_value.''.$letter_value.' nbsp;/a/b'; Have you benchmarked this, or can you provide a link to others' benchmarks demonstrating this perofmrnace hit?... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PLS HELP ME
Sir, I am trying to use printer functions in my script.pls. help me. The printer is working fine with other documents of ms-word etc. i am trying it on localhost. Is it needed to make any changes in php.ini. if so how it will work on the server. pls. help me Thanx Raaj The code is: ?php $handle = printer_open(HP PSC 1400 series); printer_write($handle, Text to print); printer_close($handle); ? It is giving errors like : Warning: printer_open() [function.printer-open]: couldn't connect to the printer [HP PSC 1400series] in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 2 Warning: printer_write(): supplied argument is not a valid Printer Handle resource in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 4 Warning: printer_close(): supplied argument is not a valid Printer Handle resource in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 5 Never miss an email again! Yahoo! Toolbar alerts you the instant new Mail arrives. http://tools.search.yahoo.com/toolbar/features/mail/
[PHP] Re: question for translating fsockopen into CURL
Yeni Setiawan wrote: dear all. I'm currently writing a script that connect to specific IP (server) at a specific port (1950). then I need to send some parameters and the server will give me a reply. too bad, my current webhost no longer accept fsockopen(). so I need to translate my script into CURL thingie. here's my script using fsockopen(), and it run very well: ?php $ptr=fsockopen(xxx.114.105.87,1950); if($ptr){ fputs($ptr,WQUOTES-EURUSD,USDJPY,USDCHF,GBPUSD,EURCHF,EURJPY,EURGBP,AUDUSD,NZDUSD,USDCAD,GBPCHF,AUDJPY,GBPJPY,CHFJPY,AUDJPY,NZDUSD\n); echo fgets($ptr,500); fclose($ptr); } ? then, I tried following script using CURL: ?php $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, xxx.114.105.87); curl_setopt ($ch, CURLOPT_PORT, 1950); curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, WQUOTES-EURUSD,USDJPY,USDCHF,GBPUSD,EURCHF,EURJPY,EURGBP,AUDUSD,NZDUSD,USDCAD,GBPCHF,AUDJPY,GBPJPY,CHFJPY,AUDJPY,NZDUSD\n); echo curl_exec ($ch); curl_close ($ch); ? but it like looping forever and none the result displayed. actually I was confused which one to replace fputs() function. any response will be great. you must specify the protocol, curl currently support the http, https,ftp, gopher, telnet, dict, file, and ldap protocols(see documenation for more). if the protocol you use is not supported by curl, you have to find another way :( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: question for translating fsockopen into CURL
Yeni Setiawan wrote: dear all. I'm currently writing a script that connect to specific IP (server) at a specific port (1950). then I need to send some parameters and the server will give me a reply. too bad, my current webhost no longer accept fsockopen(). so I need to translate my script into CURL thingie. here's my script using fsockopen(), and it run very well: ?php $ptr=fsockopen(xxx.114.105.87,1950); if($ptr){ fputs($ptr,WQUOTES-EURUSD,USDJPY,USDCHF,GBPUSD,EURCHF,EURJPY,EURGBP,AUDUSD,NZDUSD,USDCAD,GBPCHF,AUDJPY,GBPJPY,CHFJPY,AUDJPY,NZDUSD\n); echo fgets($ptr,500); fclose($ptr); } ? then, I tried following script using CURL: ?php $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, xxx.114.105.87); curl_setopt ($ch, CURLOPT_PORT, 1950); curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, WQUOTES-EURUSD,USDJPY,USDCHF,GBPUSD,EURCHF,EURJPY,EURGBP,AUDUSD,NZDUSD,USDCAD,GBPCHF,AUDJPY,GBPJPY,CHFJPY,AUDJPY,NZDUSD\n); echo curl_exec ($ch); curl_close ($ch); ? but it like looping forever and none the result displayed. actually I was confused which one to replace fputs() function. any response will be great. you must specify the protocol, curl currently support the http, https,ftp, gopher, telnet, dict, file, and ldap protocols(see documenation for more). if the protocol you use is not supported by curl, you have to find another way :( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Printer
On 3/14/07, raaj sharma [EMAIL PROTECTED] wrote: $handle = printer_open(); again it is giving same errors. i am trying it on localhost. Is it needed to make any changes in php.ini. if so how it will work on the server. Thanx Raaj You have not set a default printer in php.ini, and php can't find one. You could set the default printer in php.ini, or enter it inside the printer_open function look at the manual page, www.php.net/printer_open Tijnema ps. Include the PHP list(php-general@lists.php.net) in your CC when replying to this list. - Original Message From: Tijnema ! [EMAIL PROTECTED] To: raaj sharma [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Wednesday, March 14, 2007 2:04:12 PM Subject: Re: [PHP] PHP Printer On 3/14/07, raaj sharma [EMAIL PROTECTED] wrote: Sir, I am trying to use printer functions in my script.pls. help me. The printer is working fine with other documents of ms-word etc. pls. help me Thanx Raaj The code is: ?php $handle = printer_open(); You should define which printer to open, or remove the printer_write($handle, Text to print); printer_close($handle); ? It is giving errors like : Warning: printer_open() [function.printer-open]: couldn't connect to the printer [] in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 2 Warning: printer_write(): supplied argument is not a valid Printer Handle resource in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 4 Warning: printer_close(): supplied argument is not a valid Printer Handle resource in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 5 Food fight? Enjoy some healthy debate in the Yahoo! Answers Food Drink QA. http://answers.yahoo.com/dir/?link=listsid=396545367 TV dinner still cooling? Check out Tonight's Picks on Yahoo! TV. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PLS HELP ME
On 3/14/07, raaj sharma [EMAIL PROTECTED] wrote: Sir, I am trying to use printer functions in my script.pls. help me. The printer is working fine with other documents of ms-word etc. i am trying it on localhost. Is it needed to make any changes in php.ini. if so how it will work on the server. pls. help me Thanx Raaj The code is: ?php $handle = printer_open(HP PSC 1400 series); printer_write($handle, Text to print); printer_close($handle); ? It is giving errors like : Warning: printer_open() [function.printer-open]: couldn't connect to the printer [HP PSC 1400series] in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 2 It just means that your printer is NOT named HP PSC 1400series, find out what the real name of the device is! Warning: printer_write(): supplied argument is not a valid Printer Handle resource in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 4 Warning: printer_close(): supplied argument is not a valid Printer Handle resource in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 5 These errors are because first command failed... Never miss an email again! Yahoo! Toolbar alerts you the instant new Mail arrives. http://tools.search.yahoo.com/toolbar/features/mail/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 errors I can not understand
Richard Lynch wrote: On Tue, March 13, 2007 6:04 pm, Jonathan Kahan wrote: This did fix the problem but I am amazed that $s%$d=0 would be interpereted as a statement assigning d to 0 since there is some other stuff in front of d... I would think that would produce an error at compile time since $s%$d is an illegal variable name. Normally when my php script errors at compile time nothing will display to the screen. You still have not correctly puzzled out what $s % $d = 0 is doing... The = operator takes precedence, and $d is set to 0. But why? According to the manual, the modulus operator has precedence over the equals! So shouldn't this expression resolve to: ($s % $d) = 0 which gives an error? -- _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 errors I can not understand
On 3/14/07, Myron Turner [EMAIL PROTECTED] wrote: Richard Lynch wrote: On Tue, March 13, 2007 6:04 pm, Jonathan Kahan wrote: This did fix the problem but I am amazed that $s%$d=0 would be interpereted as a statement assigning d to 0 since there is some other stuff in front of d... I would think that would produce an error at compile time since $s%$d is an illegal variable name. Normally when my php script errors at compile time nothing will display to the screen. You still have not correctly puzzled out what $s % $d = 0 is doing... The = operator takes precedence, and $d is set to 0. But why? According to the manual, the modulus operator has precedence over the equals! So shouldn't this expression resolve to: ($s % $d) = 0 which gives an error? Might it be that it generates only an error in specific error levels? Tijnema -- _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/ -- 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] PHP URL issues
There are lies, damned lies and statistics. Had he known about benchmarks! I have already tried different ways of producing output and I completely disagree that concatenating the pieces and then echoing them is the best. In a first try, I found that echoing the separate parts as arguments to echo with commas in between was the fastest and variable interpolation within double quotes strings (or heredoc) was fastest than concatenation. Nevertheless, in a later trial, the numbers which were so clearly in favor of echo with multiple arguments, turned only slightly better, not enough to justify the loss of flexibility of building up a string first and having the option of manipulating it. This last sentence was confusing, lets see. When writing functions, you might either have them do the echo themselves or returning a string. The first is fastest, the second offers flexibility. If the first is really much faster, I'm willing to do away with the flexibility, which is no more than a potencial benefit, since 90% of the time I might have nothing at all to do with the return value of the funcion and, if really needed, I might use output buffering. Neverhteless, if the straight echoes are not that much faster, I'd rather keep an ace in my sleeve and go with returning strings. In my first trial, the result was conclusive, it was about 4 to 1, in the second, it was about 20% faster. The first was done on my own personal machine, a Windows machine doing nothing else, the second on my ISP shared hosting with an unknown load. I might say that my test on my own idle machine was the most representative, since it didn't have to deal with external issues such as competing for external resources, but then, that competition is really part of life. Though avoiding the memory shuffling of doing many string concatenations, doing echoes with multiple arguments might require the interpreter to negotiate access to IO buffers more often than building the whole page in memory and then getting it echoed just once. And I am sure that the way Windows and Linux handles IO with Apache is quite different, so, which benchmark is really representative? I am sure that some benchmarks are quite representative, independent of platforms. For example, it would make sense that doing an exact equality (triple =) should be faster than a plain equality. The first fails straight away if types are different and in no case is any conversion made. In the second, if the types don't match conversions need to be made first (after figuring out which one to make) so logic indicates it should take longer. Nevertheless, I don't feel like testing it out since the results, as my previous experience indicate, seem to be so uncertain. I'm not even arguing whether it makes sense or not in trying to shave off a few ticks of the clock. I am sure that a machine handling who knows how many users requests simultaneously will appreciate any little help, actually, I'm not sure I am actually looking for answers because, as far as I know, the answer is: it depends Satyam - Original Message - From: Richard Lynch [EMAIL PROTECTED] To: Steve [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Wednesday, March 14, 2007 10:07 AM Subject: Re: [PHP] PHP URL issues On Tue, March 13, 2007 9:31 am, Steve wrote: This may or may not help, but here's a few things to note: 1) I would avoid placing variable output in double quoted strings. While not important for smaller scripts, doing a large number of outputs like this causes a decent performance hit. In fact, I wouldn't use double quotes ever in php. Instead, strive for something like: echo 'ba href=test.php?term='.$letter_value.''.$letter_value.' nbsp;/a/b'; Have you benchmarked this, or can you provide a link to others' benchmarks demonstrating this perofmrnace hit?... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.11/721 - Release Date: 13/03/2007 16:51 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable variables and references
On Wed, 2007-03-14 at 12:39 +0100, Jochem Maas wrote: Richard Lynch wrote: On Sat, March 10, 2007 6:28 am, Dave Goodchild wrote: Hi guys, I have just read 'Programming PHP' (O'Reilly) and although I think it's a great book, I am confused about variable variables and references - not the mechanics, just where you would use them. The subject of variable variables is explained but no examples are given as to why and where you would utilise them. 99% of the time, using variable variables means you screwed up and should have used an array. :-) you could change that adage to this and it would still be true ;-) : 75% of the time, using fill in a blank means you screwed up and should have used an array. :-) - Lynchism #3 I'm certain it conforms to the golden ratio :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 errors I can not understand
Robert Cummings wrote: On Wed, 2007-03-14 at 12:57 +0100, Tijnema ! wrote: On 3/14/07, Myron Turner [EMAIL PROTECTED] wrote: Richard Lynch wrote: On Tue, March 13, 2007 6:04 pm, Jonathan Kahan wrote: This did fix the problem but I am amazed that $s%$d=0 would be interpereted as a statement assigning d to 0 since there is some other stuff in front of d... I would think that would produce an error at compile time since $s%$d is an illegal variable name. Normally when my php script errors at compile time nothing will display to the screen. You still have not correctly puzzled out what $s % $d = 0 is doing... The = operator takes precedence, and $d is set to 0. But why? According to the manual, the modulus operator has precedence over the equals! So shouldn't this expression resolve to: ($s % $d) = 0 which gives an error? Might it be that it generates only an error in specific error levels? Simple proof of precedence problem: ?php $x = 6; $y = 4; echo ($x%$y=5).\n; echo ($x%$y=4).\n; ? Cheers, Rob. This illustrates what in fact happens. But I still don't understand why, since, given the precedence of these operators, the = should be applied after the modulus. The expression should resolve to ($x % $y) = 5 and not to $x % ($y=5). Or shouldn't it? -- _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 errors I can not understand
On Wed, 2007-03-14 at 07:42 -0500, Myron Turner wrote: Robert Cummings wrote: On Wed, 2007-03-14 at 12:57 +0100, Tijnema ! wrote: On 3/14/07, Myron Turner [EMAIL PROTECTED] wrote: Richard Lynch wrote: On Tue, March 13, 2007 6:04 pm, Jonathan Kahan wrote: This did fix the problem but I am amazed that $s%$d=0 would be interpereted as a statement assigning d to 0 since there is some other stuff in front of d... I would think that would produce an error at compile time since $s%$d is an illegal variable name. Normally when my php script errors at compile time nothing will display to the screen. You still have not correctly puzzled out what $s % $d = 0 is doing... The = operator takes precedence, and $d is set to 0. But why? According to the manual, the modulus operator has precedence over the equals! So shouldn't this expression resolve to: ($s % $d) = 0 which gives an error? Might it be that it generates only an error in specific error levels? Simple proof of precedence problem: ?php $x = 6; $y = 4; echo ($x%$y=5).\n; echo ($x%$y=4).\n; ? Cheers, Rob. This illustrates what in fact happens. But I still don't understand why, since, given the precedence of these operators, the = should be applied after the modulus. The expression should resolve to ($x % $y) = 5 and not to $x % ($y=5). Or shouldn't it? You must have missed the post where I said it looks like a bug :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dst and strtotime
On 3/14/07, Jake McHenry [EMAIL PROTECTED] wrote: He meant + 24 * 60 * 60 not * 24 * 60 * 60 The idea is to ADD the number of seconds in one day to shift your time over by one day, not to multiply the time by the number of seconds in one day, which is just plain ridiculously high number beyond the scale of Unix time stamp. I would recommend checking the OS for recent DST related patches, and figuring out why one function thinks your computer us in EST but the other one thinks your computer is in EDT, because adding a day is just a band-aid, not medicine. I agree, already said this but the dst update seems fine on the system, and its kinda hard to mess up. And it only needs an hour to kick it back into the right date I found. time() and date() return correctly, its just strtotime that pulls from EST instead of EDT for some reason Quite strange, but it is fixed in PHP5, so nothing to worry about i think. If you don't want to upgrade, you can use the fix i provided, It doesn't harm. Also you might be able to set the timezone to something outside a EST/EDT region. (like the netherlands (CET)) but of course when doing that, time and date wouldn't return the right values... Tijnema On Tue, March 13, 2007 11:52 am, Jake McHenry wrote: On 3/13/07, Jake McHenry [EMAIL PROTECTED] wrote: -Original Message- From: Jake McHenry [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 13, 2007 11:22 AM To: For users of Fedora; PHP-General Subject: Re: [PHP] dst and strtotime A little more info: strtotime(last monday) or yesterday, is correct, but strtotime(last sunday) gives me 3/10 (saturday), strtotime(last saturday) gives me 3/9 (Friday), last friday gives me 3/8 thursday.. etc. maybe it will go away after a week?? What is the output of the below? echo date(Y-m-d g:i A T, time()); echo date(Y-m-d g:i A T, strtotime(last sunday)); 2007-03-13 12:30 PM EDT 2007-03-10 11:00 PM EST Hmm, EST and EDT ? There's the problem i think, as it is 11PM, making it 12PM it means next day. You could fix this with adding 24*60*60 to the result of strtotime() , or change it somehow ... So this would give you the right date: echo date(Y-m-d g:i A T, strtotime(last sunday) * 24*60*60); Tijnema That gives me this: 1903-11-13 2:32 AM EST Thanks, Jake -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- 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] Help me specify/develop a feature! (cluster web sessions management)
On Tue, March 13, 2007 7:27 pm, Mark wrote: I have a web session management server that makes PHP clustering easy and fast. I have been getting a number of requests for some level of redundancy. As it is, I can save to an NFS or GFS file system, and be redundant that way. Talk to Jason at http://hostedlabs.com if you haven't already. I just did, he's using memcached not MCache. The name space for this class of project is fairly limited. He's rolling out a distributed redundant PHP architecture using your MCache as an almost turn-key webhosting service. Not quite sure exactly how he's makeing the MCache bit redundant, but he's already doing it. He's using memcache, which is redundant, but it doesn't do what MCache does. The memcached program is strictly a cache for things SQL queries. MCache is more like an object data store. Here is an explanation of how it works: http://www.mohawksoft.org/?q=node/36 NB: There is a typo in False Scalability section: ... but regardless of what you do you, every design has a limit. I took me a few minutes to see the typo even after you posted it. Thanks. What would you be looking for? How would you expect redundancy to work? In the ideal world, the developers are also working as an N-tier architecture in their Personnel Org Chart. :-) One Lead has to understand the whole system and the intricacies of your system, as well as its implications and gotchas really well. In an ideal world the Lead can then arrange things so that other Developers (non lead) can just program normally and have little or no impact on their process to roll-out to the scalable architecture. This is not to say that they can squander resources, but rather that if their algorithm works correctly and quickly (enough) on their dev box with beefy datasets, it should seemlessly work on the scaled boxes, assuming the datasets are not dis-proportionately larger comparing hardware to hardware pro-rated to dataset size. Yes, if the algorithm is anything bigger than O(n) this is not really safe but it's a close rule of thumb, and you can generally figure out pretty fast if your algorithm is un-workable. At least in my experience, if I can get it to work on a relatively large dataset on my crappy dev box, the real server can deal with it. So the less intrusive the redundant architecture can be, the better. I think a lot of people go completely overboard with redundancy. Yea, you need a load balancer and multiple web servers, but outside some hypothetical requirement of never any down time, I can't see much value in trying to create a single 5 nines system. If you can't deploy two independent service platforms, you will most likely suffer a failure somewhere. I think the big focus should be ensuring data integrity and fast recovery in the event of a failure. I mean sure, if you have the capital, go for it, but you can save a lot of money on your data center if you take a more rational view of downtime. Documentation of exactly how it all works is crucial -- If it's all hand-waving, the Lead will never be able to figure out where the gotchas are going to be. I'd also expect true redundancy all across the board, down to spare screws for the rack-mounts. Hey, a screw *could* sheer off at any moment... :-) Like I said, a lot of people go nuts about redundancy. Multiple data centers on a few different continents. US, Europe, Asia, India (which seems to have caught the American consumerism big-time lately...) Australia... Probably need 2 or 3 just in the US. That really is the *only* way to prevent down time. Some folks need WAY more bigger farms than others. Offer a wide variety of choices, from a simple failsafe roll-over up to sky's-the-limit on every continent. [Well, okay, you can probably safely skip Antartica. :-)] I'm not sure it makes sense to try to target huge web farms. That really is a different problem. Think about a SQL database. As long as you can replicate to a hot spare, most web farms settle for that. A truly distributed SQL database cluster is a big deal, and most sites won't ever need it. I'd like a status board web panel of every significant piece of gear and a health status in one screen of blinking lights. :-) If I have to be the one to SysAdmin the things, make that a control panel as well. Okay, in reality, I would *not* be the one to SysAdmin that stuff, as I would still need to hire a guy actually qualified to do that. Which is why we're working with Jason (above) who's essentially our out-source SysAdmin guy taking care of all this hardware and redundancy stuff so we can focus on our WEb App from a business perspective (mostly) instead of constantly fighting with hardware. [I am so *not* a hardware guy...] And, of course, *when* an MCache box falls over, the user should seemlessly be sent to the next-closest box, with their session data already waiting for them. I have plans for a
Re: [PHP] 2 errors I can not understand
Thanks for alll the feedback. I also needed to correct a logic issue with this code to check that a number not be divisible by 2 as my function was stating all perfect powers of 2 were prime. I need to remeber as I move from other languages the difference between = and ==. Of course I will be more careful about this next time. - Original Message - From: Robert Cummings [EMAIL PROTECTED] Newsgroups: php.general To: Myron Turner [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; Jonathan Kahan [EMAIL PROTECTED]; php Lists php-general@lists.php.net Sent: Wednesday, March 14, 2007 8:29 AM Subject: Re: [PHP] 2 errors I can not understand On Wed, 2007-03-14 at 06:52 -0500, Myron Turner wrote: Richard Lynch wrote: On Tue, March 13, 2007 6:04 pm, Jonathan Kahan wrote: This did fix the problem but I am amazed that $s%$d=0 would be interpereted as a statement assigning d to 0 since there is some other stuff in front of d... I would think that would produce an error at compile time since $s%$d is an illegal variable name. Normally when my php script errors at compile time nothing will display to the screen. You still have not correctly puzzled out what $s % $d = 0 is doing... The = operator takes precedence, and $d is set to 0. But why? According to the manual, the modulus operator has precedence over the equals! Must be a bug... parenthesis will help to not find the bug :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cannot load mysql extension - PHP Installation on Vista/Apache
Rahul Sitaram Johari wrote: 'cannot load mysql extension, please check PHP Configuration'. I¹ve installed PHP on XP computers hundreds of times, so I¹m not exactly a newbie to this, but I¹m not sure if it¹s Vista causing the problem or I¹m doing something wrong. Which MySQL extension are you using? The native mysql or mysqli? I had to copy the libMySQL.dll file that is installed when you install MySQL 5 over the top of the one in the PHP 5 installation directory before it would work for me on Vista Home Premium. I.e. I copied this: C:\Program Files\MySQL\MySQL Server 5.0\bin\libmySQL.dll to here: C:\PHP\php-5.2.1-Win32 replacing the one that existed already. Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk Never trust a computer you can't throw out of a window -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cannot load mysql extension - PHP Installation on Vista/Apache
On 3/14/07, Rahul Sitaram Johari [EMAIL PROTECTED] wrote: Ave, I recently configured Installed PHP on my Windows Vista PC, running Apache 2.2 Web Server. MySQL 5 was also installed. Apache is running fine mySQL is running fine PHP is running fine. The problem is, I¹m getting this error when I try to run a PHP page which needs to connect to the mySQL Server: 'cannot load mysql extension, please check PHP Configuration'. I¹ve installed PHP on XP computers hundreds of times, so I¹m not exactly a newbie to this, but I¹m not sure if it¹s Vista causing the problem or I¹m doing something wrong. In my PHP.INI, I have the modules/extensions directory set to ³C:\php\ext² which contains all my modules (including the mySQL DLL and others). I also uncommented the mySQL Extension load from the PHP.INI file. I just can¹t figure out what the problem is. Do I need to copy the DLL files somewhere else in the system to make this work? Anyone else has this problem? Thanks. First of all i would NOT recommend for using Vista as a server, but of course that's your own choice. I think the problem you are facing has to do something with administrator rights, but i'm not sure.. In Vista a lot of security has been added, and so a non priviliged user cannot do a lot of things. Apache/Mysql are running from unprivilged user i think, and they probabky have problems accessing files due to the new security in vista. I don't know a lot of Apache/PHP/MySQL on Windows, as i'm using a Linux server. But you could, for testing only, run PHP/Apache from the administrator account. I believe the DLL is in the right place, i don't see why you should move it. Tijnema ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely² -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cannot load mysql extension - PHP Installation on Vista/Apache
You're probably on the right track here. I was doing some googling and I came across someone running Apache/PHP/mySQL on a Windows 2000 computer and was getting the exact same error. They found out it was a Security issue since administrative rights were not being delivered to required applications. I think I have a similar issue. I recently upgraded from XP to Vista and I run the Apache Web Server/PHP/mySQL as a testing server on my home system for my personal websites which I host on commercial servers. I don't think I would want to revert back to XP due to this single issue, since everything else is working fine and I like to learn get my hands on new technologies. I'd rather like to find out solutions to existing problems. I did see that Vista has (in some ways, quite unnecessarily) upped security, and I had a feeling this has something to do with what I'm facing. I'm just not sure how to make php.ini or the mySQL DLL extensions get administrative privileges while Apache tries to access them. Thanks. On 3/14/07 9:54 AM, Tijnema ! [EMAIL PROTECTED] wrote: On 3/14/07, Rahul Sitaram Johari [EMAIL PROTECTED] wrote: Ave, I recently configured Installed PHP on my Windows Vista PC, running Apache 2.2 Web Server. MySQL 5 was also installed. Apache is running fine mySQL is running fine PHP is running fine. The problem is, I¹m getting this error when I try to run a PHP page which needs to connect to the mySQL Server: 'cannot load mysql extension, please check PHP Configuration'. I¹ve installed PHP on XP computers hundreds of times, so I¹m not exactly a newbie to this, but I¹m not sure if it¹s Vista causing the problem or I¹m doing something wrong. In my PHP.INI, I have the modules/extensions directory set to ³C:\php\ext² which contains all my modules (including the mySQL DLL and others). I also uncommented the mySQL Extension load from the PHP.INI file. I just can¹t figure out what the problem is. Do I need to copy the DLL files somewhere else in the system to make this work? Anyone else has this problem? Thanks. First of all i would NOT recommend for using Vista as a server, but of course that's your own choice. I think the problem you are facing has to do something with administrator rights, but i'm not sure.. In Vista a lot of security has been added, and so a non priviliged user cannot do a lot of things. Apache/Mysql are running from unprivilged user i think, and they probabky have problems accessing files due to the new security in vista. I don't know a lot of Apache/PHP/MySQL on Windows, as i'm using a Linux server. But you could, for testing only, run PHP/Apache from the administrator account. I believe the DLL is in the right place, i don't see why you should move it. Tijnema ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely² -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cannot load mysql extension - PHP Installation on Vista/Apache
You kidding me? I didn't know anything about that! That could be the solution! I'm gonna give this a try and see if that makes a difference. I'm using native mySQL btw, not mysqli. Thanks! On 3/14/07 9:54 AM, Richard Davey [EMAIL PROTECTED] wrote: Rahul Sitaram Johari wrote: 'cannot load mysql extension, please check PHP Configuration'. I¹ve installed PHP on XP computers hundreds of times, so I¹m not exactly a newbie to this, but I¹m not sure if it¹s Vista causing the problem or I¹m doing something wrong. Which MySQL extension are you using? The native mysql or mysqli? I had to copy the libMySQL.dll file that is installed when you install MySQL 5 over the top of the one in the PHP 5 installation directory before it would work for me on Vista Home Premium. I.e. I copied this: C:\Program Files\MySQL\MySQL Server 5.0\bin\libmySQL.dll to here: C:\PHP\php-5.2.1-Win32 replacing the one that existed already. Cheers, Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: question regarding form filtering
-Message d'origine- De : Richard Lynch [mailto:[EMAIL PROTECTED] Envoyé : mercredi 14 mars 2007 09:48 À : Tim Cc : 'Haydar Tuna'; php-general@lists.php.net Objet : RE: [PHP] Re: question regarding form filtering I personally would not presume that PHP and JS regex patterns are 100% compatible... Store a separate pattern for each. Fair enough, beats writing a new function for each :) And, actually, the PHP check might be more involved than the JS check. For example, if the users is making up a password, and this password has access to something that's actually sensitive and worth protecting (money, medical records, private matters)... Not yet but maybe future clients ? ;) (archived) You should probably have JS and PHP to check that the password is long enough, has mixed alpha and digit, that the password and confirmation match, that neither password nor username contains the other as a substring, etc. But in PHP you'd probably *ALSO* want to check against a database of words (say the one in /usr/share/web2, Webster's 2nd Edition dictionary, now in the public domain) and make sure they did not choose a simple word. Good idea, sounds like plesk internals here.. I'll most definately keep this in mind when i implent the user management system in the framework.. You almost for sure do *NOT* want to attempt to send the entire Webster's 2nd Edition dictionary to the browser as JS data so that the JS can check. :-) Hehe, oh? Really? ;-) I suppose you could do a Web 2.0 Ajax-y thingie for that... Not a fan of forcing users to download/use active-x controls.. (accesibility, usability etc..) At any rate, the validation in JS may not always be exactly the same as in PHP, even if their PCRE patterns are 100% compatible, which I doubt. I'll do some experimenting with this.. For anything that really matters, your sanitation probably ought to be custom-tailored rather than off-the-rack anyway... Glad we share this opinion.. Plus, the easy ones are easy, and the framework probably won't handle the hard ones, so what's the point of the clutter of the framework? So I personally wouldn't even go down this road. Erm gonna have to explain to me what you mean... (easy ones are easy.. Etc.) Once again thanks Richard am well on my way now ;) Regards, Tim Programming is a race between people making better and faster programs and the universe making bigger and dumber people. So far the universe is winning -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP URL issues
I personally have not unfortunately. A good friend of mine is also a developer who initially told me about it when I first began coding. Because I don't want to stick with the he-said, she-said approach, I did a quick google search and came up with this link: http://spindrop.us/2007/03/03/php-double-versus-single-quotes/ There's several other pages saying similar things if you do look around. Even the performance different isn't significant, it will add up. If something like this is known to help ever so slightly with execution time and it's something you can teach yourself to do subconsciously, then I feel it's definitely worthwhile to pursue. Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tue, March 13, 2007 9:31 am, Steve wrote: This may or may not help, but here's a few things to note: 1) I would avoid placing variable output in double quoted strings. While not important for smaller scripts, doing a large number of outputs like this causes a decent performance hit. In fact, I wouldn't use double quotes ever in php. Instead, strive for something like: echo 'ba href=test.php?term='.$letter_value.''.$letter_value.' nbsp;/a/b'; Have you benchmarked this, or can you provide a link to others' benchmarks demonstrating this perofmrnace hit?... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Environment variables...
Hi, I'd like to read an environment variable with PHP. I've tried with : exec ('echo $CONTEXTE_D_EXECUTION',$result); $result is empty !!! I've put the variable in /etc/environment, in /etc/profile, in /etc/bash.bashrc but nothing worked... Do you have any idea ? If it is not possible, I suppose I can put a variable in php.ini ? Thank you very much. David. signature.asc Description: PGP signature
Re: [PHP] Environment variables...
On 3/14/07, David BERCOT [EMAIL PROTECTED] wrote: Hi, I'd like to read an environment variable with PHP. I've tried with : exec ('echo $CONTEXTE_D_EXECUTION',$result); $result is empty !!! I've put the variable in /etc/environment, in /etc/profile, in /etc/bash.bashrc but nothing worked... Do you have any idea ? If it is not possible, I suppose I can put a variable in php.ini ? Thank you very much. David. PHP is running from apache, which is running probably from the nobody user. This user hasn't loaded any variables i think. So, why are you not just reading /etc/profile from php? Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Environment variables...
Depending on your system and environment (platform and cli v. cgi), they should be in either of the $_ENV or $_SESSION superglobals. On Mar 14, 2007, at 9:32 AM, David BERCOT wrote: Hi, I'd like to read an environment variable with PHP. I've tried with : exec ('echo $CONTEXTE_D_EXECUTION',$result); $result is empty !!! I've put the variable in /etc/environment, in /etc/profile, in /etc/bash.bashrc but nothing worked... Do you have any idea ? If it is not possible, I suppose I can put a variable in php.ini ? Thank you very much. David. erik jones [EMAIL PROTECTED] sofware developer 615-296-0838 emma(r)
Re: [PHP] Environment variables...
Le Wed, 14 Mar 2007 15:40:28 +0100, Tijnema ! [EMAIL PROTECTED] a écrit : On 3/14/07, David BERCOT [EMAIL PROTECTED] wrote: Hi, I'd like to read an environment variable with PHP. I've tried with : exec ('echo $CONTEXTE_D_EXECUTION',$result); $result is empty !!! I've put the variable in /etc/environment, in /etc/profile, in /etc/bash.bashrc but nothing worked... Do you have any idea ? If it is not possible, I suppose I can put a variable in php.ini ? Thank you very much. David. PHP is running from apache, which is running probably from the nobody user. This user hasn't loaded any variables i think. I think, on Debian, it is www-data. Some variables are loaded, but I don't know where they come from... If I find, I can add one ;-à So, why are you not just reading /etc/profile from php? Yes, it is possible, but I'd like to do the same under many servers, with different OS (RedHat, Debian for example), so, files are not at the same place. David. signature.asc Description: PGP signature
[PHP] Referring URL Authentication
The situation is as follows: I wish to protect the entire Website http://www.example.com from direct URL access. i.e. if someone enters http://www.example.com into their browser they get a message stating that they are not authorised to access the site. The only way to access http://www.example.com should be to log into a second site http://www.intranet.com and follow a link from within to http://www.example.com. The problem: I initially thought I should use the predefined PHP variable $_SERVER['HTTP_REFERER'], but the PHP website explains that this cannot really be trusted (http://uk2.php.net/manual/en/reserved.variables.php). Next I thought about HTTP authentication. If I password protect the the Website using .htaccess and .htpasswd as follows: Code: AuthName Login to access the Website AuthType Basic AuthUserFile /var/www/vhosts/example.com/httpdocs/.htpasswd Require user username Then my link within http://www.intranet.com could simply be: Code: a href=http://username:[EMAIL PROTECTED]Link to example.com/a However this doesn't seem secure. The username and password are visible to anyone who views the source of the page with the link. Also as these are not encrypted is it not possible for them to be intercepted? I could of course write my own authentication code on http://www.example.com and pass a variable via a GET or POST from http://www.intranet.com, which would cause a login and a cookie to be set there. But this is basically the same as above and still seems insecure! Is there a better/standard way to do this kind of thing? Any help will be most appreciated, Matthew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Environment variables...
Le Wed, 14 Mar 2007 09:42:13 -0500, Erik Jones [EMAIL PROTECTED] a écrit : Depending on your system and environment (platform and cli v. cgi), they should be in either of the $_ENV or $_SESSION superglobals. It is Debian... But the variable I added is not in $_ENV or $_SESSION superglobals... David. On Mar 14, 2007, at 9:32 AM, David BERCOT wrote: Hi, I'd like to read an environment variable with PHP. I've tried with : exec ('echo $CONTEXTE_D_EXECUTION',$result); $result is empty !!! I've put the variable in /etc/environment, in /etc/profile, in /etc/bash.bashrc but nothing worked... Do you have any idea ? If it is not possible, I suppose I can put a variable in php.ini ? Thank you very much. David. erik jones [EMAIL PROTECTED] sofware developer 615-296-0838 emma(r) signature.asc Description: PGP signature
[PHP] Parse
I keep getting a parse error line x when trying view php info() Can you help please? - Be a PS3 game guru. Get your game face on with the latest PS3 news and previews at Yahoo! Games.
Re: [PHP] Referring URL Authentication
On 3/14/07, Matthew Vickery [EMAIL PROTECTED] wrote: The situation is as follows: I wish to protect the entire Website http://www.example.com from direct URL access. i.e. if someone enters http://www.example.com into their browser they get a message stating that they are not authorised to access the site. The only way to access http://www.example.com should be to log into a second site http://www.intranet.com and follow a link from within to http://www.example.com. The problem: I initially thought I should use the predefined PHP variable $_SERVER['HTTP_REFERER'], but the PHP website explains that this cannot really be trusted (http://uk2.php.net/manual/en/reserved.variables.php). Next I thought about HTTP authentication. If I password protect the the Website using .htaccess and .htpasswd as follows: Code: AuthName Login to access the Website AuthType Basic AuthUserFile /var/www/vhosts/example.com/httpdocs/.htpasswd Require user username Then my link within http://www.intranet.com could simply be: Code: a href=http://username:[EMAIL PROTECTED]Link to example.com/a However this doesn't seem secure. The username and password are visible to anyone who views the source of the page with the link. Also as these are not encrypted is it not possible for them to be intercepted? I could of course write my own authentication code on http://www.example.com and pass a variable via a GET or POST from http://www.intranet.com, which would cause a login and a cookie to be set there. But this is basically the same as above and still seems insecure! Is there a better/standard way to do this kind of thing? Any help will be most appreciated, Matthew I don't know about a standard way of doing this, and the biggest part of this problem is on the users side, the side that you cannot change with a PHP code. AFAIK browsers as IE, FireFox and Mozilla just set the referer header fine, but some other silly browsers might not, and thereby might not be able to access your protected site. Also, this is quite easy to hack, as some browsers even support defining what referer to use. But i see you really care that a user is authenticated, so a login system is recommended. .htaccess files would do the job sometimes, but not always, so i think you'd be better off using cookies/sessions. Tijnema -- 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] Parse
al phillips wrote: I keep getting a parse error line x when trying view php info() Can you help please? - Be a PS3 game guru. Get your game face on with the latest PS3 news and previews at Yahoo! Games. . And the code you use would look like? (I mean the whole code) Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [!! SPAM] [PHP] Parse
al phillips wrote: I keep getting a parse error line x when trying view php info() Can you help please? - Be a PS3 game guru. Get your game face on with the latest PS3 news and previews at Yahoo! Games. . Or maybe you should try with phpinfo() ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse
2007. 03. 14, szerda keltezéssel 07.53-kor al phillips ezt írta: I keep getting a parse error line x when trying view php info() Can you help please? no, if you don't post the exact error message and your code here btw, it is probably a typo in your code at line x, but we cannot see it as you didn't show us your code greets Zoltán Németh - Be a PS3 game guru. Get your game face on with the latest PS3 news and previews at Yahoo! Games. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [!! SPAM] [PHP] Parse
On 3/14/07, Andrei [EMAIL PROTECTED] wrote: al phillips wrote: I keep getting a parse error line x when trying view php info() Can you help please? - Be a PS3 game guru. Get your game face on with the latest PS3 news and previews at Yahoo! Games. . Or maybe you should try with phpinfo() ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Looks like a simple typo :) if it isn't a typo, post the part of the code you are executing phpinfo() and of course post a copy of the error -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Referring URL Authentication
On Wed, 2007-03-14 at 14:50 +, Matthew Vickery wrote: The situation is as follows: I wish to protect the entire Website http://www.example.com from direct URL access. i.e. if someone enters http://www.example.com into their browser they get a message stating that they are not authorised to access the site. The only way to access http://www.example.com should be to log into a second site http://www.intranet.com and follow a link from within to http://www.example.com. The problem: I initially thought I should use the predefined PHP variable $_SERVER['HTTP_REFERER'], but the PHP website explains that this cannot really be trusted (http://uk2.php.net/manual/en/reserved.variables.php). Next I thought about HTTP authentication. If I password protect the the Website using .htaccess and .htpasswd as follows: Code: AuthName Login to access the Website AuthType Basic AuthUserFile /var/www/vhosts/example.com/httpdocs/.htpasswd Require user username Then my link within http://www.intranet.com could simply be: Code: a href=http://username:[EMAIL PROTECTED]Link to example.com/a However this doesn't seem secure. The username and password are visible to anyone who views the source of the page with the link. Also as these are not encrypted is it not possible for them to be intercepted? I could of course write my own authentication code on http://www.example.com and pass a variable via a GET or POST from http://www.intranet.com, which would cause a login and a cookie to be set there. But this is basically the same as above and still seems insecure! Is there a better/standard way to do this kind of thing? So you want a user who has authenticated on domain A to be able to transparently transfer to domain B? Do they share a common database? Do you have scripting access to both systems? Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Using a reentrant form
I honestly don't know why people use the approach of having a hidden field on a re-entrant form to indicate whether it should be validated or not. I have used re-entrant forms for years without such a thing. How? Quite simply there are two phases to a form - GET, which requests a form from the server, and POST, which sends a form to the server. It is therefore quite obvious that I validate on every POST. Simple, isn't it? -- Tony Marston http://www.tonymarston.net http://www.radicore.org Todd Cary [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] To validate a page, I set the form value to the page name the user is on. Then there is a hidden variable, looped that is set to 1. By checking looped, I know if the user has re-entered the form so I can do my validation checks. Is there a disadvantage to this approach? Thank you... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP] PHP URL issues
One more example of a questionable benchmark, not wrong but I wonder (as I was doing in my previous) whether it is really representative. There are two main ways to handle strings, one is to malloc exactly the required memory for each string and keep moving characters around from one chunk of memory to another. If you append a single character to a string, you would measure both, add their lengths plus whatever overhead your data representation requires, malloc that much memory, move the characters from each source and then free the memory occupied by the first. The other way to do it is to malloc memory in more or less fixed sizes and include in the header of your variable a length field. With plenty of memory available nowadays, few still choose the first option. Appending a few characters does not require any new memory allocation nor freeing it up. The later method depends on how good where your statistics (more damned lies once again) about the average string length, but if you get it right, appending to a string ( .= operator) becomes as fast as appending to a StreamBuffer, as found in other languages with separate Strings and Streams classes. Some languages do not even require string space to be contiguous so that when one block is used up you don't have to get a bigger one and move everything to the new place, the blocks comprising the string are linked in a list. That's one reason why lots of languages now prefer 'immutable strings', it is no longer possible to treat the string as an array of characters since they cannot be accessed via a simple offset. This benchmark is probably exercising more the symbol table lookups and memory allocation functions than the actual concatenation, since it is allocating and freeing up lots of space for really tiny strings that don't take much of that space at all. Whatever difference there is in the actual string operation might be clouded under other factors. Regardless, I do prefer to use single quotes and, as I mentioned elsewhere, I just echo the bits and pieces as soon as I am able, reasoning that the output buffer is truly a stream buffer and since the echo is a language construct (no function call overhead), it should be faster than managing memory to hold strings. As I said, though, the performance of one option against others varies so much in different trials under different conditions that I feel foolish just to show them. Then, not even logic works fine if you mean to define what is faster and what is not. Sometimes the developers, using profilers and such tools, find a very slow spot and they get to optimize it to such an extent that it works faster than its un-optimized relative, which under equal circumstances would have actually been faster. Using single quotes for PHP strings frees me the double quotes for HTML attribute values without any need to escape them. I have defined CRLF and TAB as constants which I can redefine at any time to an empty string if I no longer care my HTML output to be readable. Since I prefer to keep all values in their native PHP format up to the last moment, and those values have to be passed either through htmlentities(), number_format(), money_format() or strftotime() on output, variable interpolation is out of the question anyway. Satyam - Original Message - From: Steve [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Wednesday, March 14, 2007 3:25 PM Subject: Re: [PHP] PHP URL issues I personally have not unfortunately. A good friend of mine is also a developer who initially told me about it when I first began coding. Because I don't want to stick with the he-said, she-said approach, I did a quick google search and came up with this link: http://spindrop.us/2007/03/03/php-double-versus-single-quotes/ There's several other pages saying similar things if you do look around. Even the performance different isn't significant, it will add up. If something like this is known to help ever so slightly with execution time and it's something you can teach yourself to do subconsciously, then I feel it's definitely worthwhile to pursue. Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tue, March 13, 2007 9:31 am, Steve wrote: This may or may not help, but here's a few things to note: 1) I would avoid placing variable output in double quoted strings. While not important for smaller scripts, doing a large number of outputs like this causes a decent performance hit. In fact, I wouldn't use double quotes ever in php. Instead, strive for something like: echo 'ba href=test.php?term='.$letter_value.''.$letter_value.' nbsp;/a/b'; Have you benchmarked this, or can you provide a link to others' benchmarks demonstrating this perofmrnace hit?... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?
RE: [PHP] cannot load mysql extension - PHP Installation on Vista/Apache
-Message d'origine- De : Rahul Sitaram Johari [mailto:[EMAIL PROTECTED] Envoyé : mercredi 14 mars 2007 15:05 À : Richard Davey; PHP Objet : Re: [PHP] cannot load mysql extension - PHP Installation on Vista/Apache You kidding me? I didn't know anything about that! That could be the solution! I'm gonna give this a try and see if that makes a difference. I'm using native mySQL btw, not mysqli. Thanks! On 3/14/07 9:54 AM, Richard Davey [EMAIL PROTECTED] wrote: Rahul Sitaram Johari wrote: 'cannot load mysql extension, please check PHP Configuration'. I¹ve installed PHP on XP computers hundreds of times, so I¹m not exactly a newbie to this, but I¹m not sure if it¹s Vista causing the problem or I¹m doing something wrong. Which MySQL extension are you using? The native mysql or mysqli? I had to copy the libMySQL.dll file that is installed when you install MySQL 5 over the top of the one in the PHP 5 installation directory before it would work for me on Vista Home Premium. I.e. I copied this: C:\Program Files\MySQL\MySQL Server 5.0\bin\libmySQL.dll to here: C:\PHP\php-5.2.1-Win32 replacing the one that existed already. Cheers, (this is a bit off list, but i think it is important for developpers to understand even a part of how the systems they are using works..) I follow the thread and none of the explanation make any logical sens.. Ahem.. Win. Anyways, Put it this way guys, apache, php and mysql are native to *nix, *nix has strict standards on names (no spaces.. Above i see a line with spaces in the dir that doesn't work, and one without spaces that does work.. Hint hint?), a common place to access all configuration files (no copying this file here then there cus we don't know where to look to configure things correctly), strict standards on user permissions (nowadays hehe) AND you all mentioned vista's new 'security tightening', is this really a suprise?? For years have been setting up servers on *nix machines and always came to appreciate this 'tight security' as a strive from the developpers to have a good security base for the running daemons before even using them... Suggestion? Learn how to setup a server on a unix system, get out your old 386 or 486 (even made a router/firewall/ftp server with an old 286, great cus they have no fans on em so make no noise ;) and install a linux distrib to get a feel for permissions and security and you will appreciate the new security features in vista (to some extent lmao).. Second Suggestion.. Learn your OS, its security schema, user permissions etc.. Click and go is NOT a solution, it never will be and will almost always miss a case (especially when it comes to server daemons) where it should have worked.. You'll save yourself a lot of time this way rather then searching in the wrong places.. My productions servers are linux, my developpment server is linux, i wouldn't have it any other way.. It's almost treason to run an open source language on a proprietary OS! (laugh laugh, don't get upset its a joke).. Double quote: He who asks a question may be a fool for a few minutes He who does not ask may be a fool forever ... but he who takes the question ... who has the want to find out for himself ... the reasoning behind ... and not just the answer. Those are the sort of people that will learn ... (Rhino) - y'all know who he is ;) Regards, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Referring URL Authentication
-Message d'origine- De : Robert Cummings [mailto:[EMAIL PROTECTED] Envoyé : mercredi 14 mars 2007 16:13 À : Matthew Vickery Cc : php-general@lists.php.net Objet : Re: [PHP] Referring URL Authentication On Wed, 2007-03-14 at 14:50 +, Matthew Vickery wrote: The situation is as follows: I wish to protect the entire Website http://www.example.com from direct URL access. i.e. if someone enters http://www.example.com into their browser they get a message stating that they are not authorised to access the site. The only way to access http://www.example.com should be to log into a second site http://www.intranet.com and follow a link from within to http://www.example.com. Are you admin of these machines? If so use firewall rules to filter traffic allowing only your domain to acces it.. And then setup authentication on destination server. You'll save yourself some trouble.. If not, what kind of acces do you have on these servers regarding scripting/.htaccess and server config files? If you can get to apache config files, lookup the Apache directory directives, you should have some hints in their as to how to limit certain hosts, to certain domains.. Regards, Tim Programming is a race between people making better and faster programs and the universe making bigger and dumber people. So far the universe is winning -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cannot load mysql extension - PHP Installation on Vista/Apache
Ave, Well good words there, I'm not gonna argue with you on that. And as much as I have heard general windows users crib about Vista's security features, I have heard same amount of praise by more 'developers' genre of users about its' security features. Your second suggestion of learning your OS is something I'm deeply dwelling into everyday since I installed Vista, and is one strong reason I'm not willing to go back to XP just because things work in XP. I'm finding the challenges in Vista intriguing and a learning experience. I'm not sure which drive names you were referring to, but coming from a Web Developing background, I certainly pay utmost attention to naming conventions. 10 years ago I've been there where simple HTML pages wouldn't pull up due to Case mismatch, spaces or special characters. I can assure you in my personal case with this Cannot load mySQL extension, folder/file names is not the issue. Security is a an issue I need to learn understand further in regards to Vista and may well be the cause of my problem. And while I don't find much logic in Richard's solution (I.e., copying the DLL), without trying, it would be too premature to label it logical or illogical - because if it does work, logic can be scrutinized. All in all, good post there mate, and appreciate you sharing your mind! Cheers! ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely² On 3/14/07 11:36 AM, Tim [EMAIL PROTECTED] wrote: (this is a bit off list, but i think it is important for developpers to understand even a part of how the systems they are using works..) I follow the thread and none of the explanation make any logical sens.. Ahem.. Win. Anyways, Put it this way guys, apache, php and mysql are native to *nix, *nix has strict standards on names (no spaces.. Above i see a line with spaces in the dir that doesn't work, and one without spaces that does work.. Hint hint?), a common place to access all configuration files (no copying this file here then there cus we don't know where to look to configure things correctly), strict standards on user permissions (nowadays hehe) AND you all mentioned vista's new 'security tightening', is this really a suprise?? For years have been setting up servers on *nix machines and always came to appreciate this 'tight security' as a strive from the developpers to have a good security base for the running daemons before even using them... Suggestion? Learn how to setup a server on a unix system, get out your old 386 or 486 (even made a router/firewall/ftp server with an old 286, great cus they have no fans on em so make no noise ;) and install a linux distrib to get a feel for permissions and security and you will appreciate the new security features in vista (to some extent lmao).. Second Suggestion.. Learn your OS, its security schema, user permissions etc.. Click and go is NOT a solution, it never will be and will almost always miss a case (especially when it comes to server daemons) where it should have worked.. You'll save yourself a lot of time this way rather then searching in the wrong places.. My productions servers are linux, my developpment server is linux, i wouldn't have it any other way.. It's almost treason to run an open source language on a proprietary OS! (laugh laugh, don't get upset its a joke).. Double quote: He who asks a question may be a fool for a few minutes He who does not ask may be a fool forever ... but he who takes the question ... who has the want to find out for himself ... the reasoning behind ... and not just the answer. Those are the sort of people that will learn ... (Rhino) - y'all know who he is ;) Regards, Tim -- 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: Fw: [PHP] PHP URL issues
On Wed, 2007-03-14 at 16:31 +0100, Satyam wrote: One more example of a questionable benchmark, not wrong but I wonder (as I was doing in my previous) whether it is really representative. There are two main ways to handle strings, one is to malloc exactly the required memory for each string and keep moving characters around from one chunk of memory to another. If you append a single character to a string, you would measure both, add their lengths plus whatever overhead your data representation requires, malloc that much memory, move the characters from each source and then free the memory occupied by the first. The other way to do it is to malloc memory in more or less fixed sizes and include in the header of your variable a length field. You forgot realloc(). Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Printer
raaj sharma wrote: Sir, I am trying to use printer functions in my script.pls. help me. The printer is working fine with other documents of ms-word etc. pls. help me Thanx Raaj The code is: ?php $handle = printer_open(); printer_write($handle, Text to print); printer_close($handle); ? It is giving errors like : Warning: printer_open() [function.printer-open]: couldn't connect to the printer [] in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 2 Warning: printer_write(): supplied argument is not a valid Printer Handle resource in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 4 Warning: printer_close(): supplied argument is not a valid Printer Handle resource in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 5 Food fight? Enjoy some healthy debate in the Yahoo! Answers Food Drink QA. http://answers.yahoo.com/dir/?link=listsid=396545367 You do realize this is going to print to a printer connected to the server, not the client right? -- Enjoy, Jim Lucas Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Printer
On 3/14/07, Jim Lucas [EMAIL PROTECTED] wrote: raaj sharma wrote: Sir, I am trying to use printer functions in my script.pls. help me. The printer is working fine with other documents of ms-word etc. pls. help me Thanx Raaj The code is: ?php $handle = printer_open(); printer_write($handle, Text to print); printer_close($handle); ? It is giving errors like : Warning: printer_open() [function.printer-open]: couldn't connect to the printer [] in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 2 Warning: printer_write(): supplied argument is not a valid Printer Handle resource in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 4 Warning: printer_close(): supplied argument is not a valid Printer Handle resource in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 5 Food fight? Enjoy some healthy debate in the Yahoo! Answers Food Drink QA. http://answers.yahoo.com/dir/?link=listsid=396545367 You do realize this is going to print to a printer connected to the server, not the client right? -- Enjoy, Jim Lucas Quite smart question... people always try to combine server side code (PHP) with client side.. Tijnema Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- 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] cannot load mysql extension - PHP Installation on Vista/Apache
-Message d'origine- De : Rahul Sitaram Johari [mailto:[EMAIL PROTECTED] Envoyé : mercredi 14 mars 2007 16:48 À : Tim; PHP Objet : Re: [PHP] cannot load mysql extension - PHP Installation on Vista/Apache Ave, Well good words there, I'm not gonna argue with you on that. And as much as I have heard general windows users crib about Vista's security features, I have heard same amount of praise by more 'developers' genre of users about its' security features. Your second suggestion of learning your OS is something I'm deeply dwelling into everyday since I installed Vista, and is one strong reason I'm not willing to go back to XP just because things work in XP. I'm finding the challenges in Vista intriguing and a learning experience. I know, geuss i shouldn't be so hard on vista users, its still a young os.. I'm not sure which drive names you were referring to, but coming from a Web Developing background, I certainly pay utmost attention to naming conventions. 10 years ago I've been there where simple HTML pages wouldn't pull up due to Case mismatch, spaces or special characters. I can assure you in my personal case with this Cannot load mySQL extension, folder/file names is not the issue. Security is a an issue I need to learn understand further in regards to Vista and may well be the cause of my problem. Have fun with the KB ;) i gave up ages ago.. But happy to hear you want to go further :) And while I don't find much logic in Richard's solution No this is not a solution, it is a fluke it just happened to work, but the world is still not aware of WHY! The eternal all so important question !! (I.e., copying the DLL), without trying, it would be too premature to label it logical or illogical - because if it does work, logic can be scrutinized. You right i miss-worded that (if you do search further the reason it works will most certainly BE logical), lets do this again: Copying a file over into a place that makes something work is not an answer, an answer is 'the .dll must be placed here for x reasons'. Which i bet will if you go further into the matter be because 'folder x doesnt have the same permissions as the original folder'. What i mean is: The more you search for the reasons, the more you will understand the workings, the less you will have to fix the problems ;) All in all, good post there mate, and appreciate you sharing your mind! Thanks, and I sincerely hope you get thing up and running like you need them, and don't forget to have fun getting their ;) Regards, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Printer
Tijnema ! wrote: On 3/14/07, Jim Lucas [EMAIL PROTECTED] wrote: raaj sharma wrote: Sir, I am trying to use printer functions in my script.pls. help me. The printer is working fine with other documents of ms-word etc. pls. help me Thanx Raaj The code is: ?php $handle = printer_open(); printer_write($handle, Text to print); printer_close($handle); ? It is giving errors like : Warning: printer_open() [function.printer-open]: couldn't connect to the printer [] in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 2 Warning: printer_write(): supplied argument is not a valid Printer Handle resource in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 4 Warning: printer_close(): supplied argument is not a valid Printer Handle resource in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 5 Food fight? Enjoy some healthy debate in the Yahoo! Answers Food Drink QA. http://answers.yahoo.com/dir/?link=listsid=396545367 You do realize this is going to print to a printer connected to the server, not the client right? -- Enjoy, Jim Lucas Quite smart question... people always try to combine server side code (PHP) with client side.. Tijnema Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php goes along with the question of How do I open a new window with PHP? Isn't going to happen!... :) -- Enjoy, Jim Lucas Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Printer
On 3/14/07, Jim Lucas [EMAIL PROTECTED] wrote: Tijnema ! wrote: On 3/14/07, Jim Lucas [EMAIL PROTECTED] wrote: raaj sharma wrote: Sir, I am trying to use printer functions in my script.pls. help me. The printer is working fine with other documents of ms-word etc. pls. help me Thanx Raaj The code is: ?php $handle = printer_open(); printer_write($handle, Text to print); printer_close($handle); ? It is giving errors like : Warning: printer_open() [function.printer-open]: couldn't connect to the printer [] in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 2 Warning: printer_write(): supplied argument is not a valid Printer Handle resource in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 4 Warning: printer_close(): supplied argument is not a valid Printer Handle resource in C:\apachefriends\xampp\htdocs\Project\Seekitall\printer.php on line 5 Food fight? Enjoy some healthy debate in the Yahoo! Answers Food Drink QA. http://answers.yahoo.com/dir/?link=listsid=396545367 You do realize this is going to print to a printer connected to the server, not the client right? -- Enjoy, Jim Lucas Quite smart question... people always try to combine server side code (PHP) with client side.. Tijnema Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php goes along with the question of How do I open a new window with PHP? Isn't going to happen!... :) -- Enjoy, Jim Lucas And a lot of other questions, like How do I make a file browser in PHP?, How do I update the page once a second with PHP? If you can do that, i wanna see :) Tijnema Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Fw: [PHP] PHP URL issues
- Original Message - From: Robert Cummings [EMAIL PROTECTED] To: Satyam [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Wednesday, March 14, 2007 4:49 PM Subject: Re: Fw: [PHP] PHP URL issues On Wed, 2007-03-14 at 16:31 +0100, Satyam wrote: One more example of a questionable benchmark, not wrong but I wonder (as I was doing in my previous) whether it is really representative. There are two main ways to handle strings, one is to malloc exactly the required memory for each string and keep moving characters around from one chunk of memory to another. If you append a single character to a string, you would measure both, add their lengths plus whatever overhead your data representation requires, malloc that much memory, move the characters from each source and then free the memory occupied by the first. The other way to do it is to malloc memory in more or less fixed sizes and include in the header of your variable a length field. You forgot realloc(). Yes I did, but it doesn't matter that much. When asigning by blocks the best strategy is to keep all blocks the same size, or of a few assorted sizes, and link them in lists because blocks of different sizes end up fragmenting the memory too much and giving the garbage collector lots of trouble, if all blocks are of the same size, they are immediately reusable. Basically, if you are dealing with the memory yourself, assigning it, freeing it, collecting garbage afterwards and defragmenting, you won't resort that much to individual calls to the memory library functions, you just grab a big chunk and manage it on your own. Satyam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Referring URL Authentication
Robert Cummings wrote: On Wed, 2007-03-14 at 14:50 +, Matthew Vickery wrote: The situation is as follows: I wish to protect the entire Website http://www.example.com from direct URL access. i.e. if someone enters http://www.example.com into their browser they get a message stating that they are not authorised to access the site. The only way to access http://www.example.com should be to log into a second site http://www.intranet.com and follow a link from within to http://www.example.com. The problem: I initially thought I should use the predefined PHP variable $_SERVER['HTTP_REFERER'], but the PHP website explains that this cannot really be trusted (http://uk2.php.net/manual/en/reserved.variables.php). Next I thought about HTTP authentication. If I password protect the the Website using .htaccess and .htpasswd as follows: Code: AuthName Login to access the Website AuthType Basic AuthUserFile /var/www/vhosts/example.com/httpdocs/.htpasswd Require user username Then my link within http://www.intranet.com could simply be: Code: a href=http://username:[EMAIL PROTECTED]Link to example.com/a However this doesn't seem secure. The username and password are visible to anyone who views the source of the page with the link. Also as these are not encrypted is it not possible for them to be intercepted? I could of course write my own authentication code on http://www.example.com and pass a variable via a GET or POST from http://www.intranet.com, which would cause a login and a cookie to be set there. But this is basically the same as above and still seems insecure! Is there a better/standard way to do this kind of thing? So you want a user who has authenticated on domain A to be able to transparently transfer to domain B? Do they share a common database? Do you have scripting access to both systems? Cheers, Rob. Hi Rob, Thanks for your reply. Yes, I want a user who has authenticated on domain A to be able to transparently transfer to domain B. No, domains A and B don't share a common database. I only have scripting access to domain B. Basically I am creating a mini-site on my Web server (domain B) that a company needs to access securely via their Intranet (domain A), hopefully without the need to setup an extensive user database and login system on my Web server that will be additional to their Intranet login... I hope this makes thins clearer? Cheers, Matthew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Fw: [PHP] PHP URL issues
On Wed, 2007-03-14 at 17:15 +0100, Satyam wrote: - Original Message - From: Robert Cummings [EMAIL PROTECTED] To: Satyam [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Wednesday, March 14, 2007 4:49 PM Subject: Re: Fw: [PHP] PHP URL issues On Wed, 2007-03-14 at 16:31 +0100, Satyam wrote: One more example of a questionable benchmark, not wrong but I wonder (as I was doing in my previous) whether it is really representative. There are two main ways to handle strings, one is to malloc exactly the required memory for each string and keep moving characters around from one chunk of memory to another. If you append a single character to a string, you would measure both, add their lengths plus whatever overhead your data representation requires, malloc that much memory, move the characters from each source and then free the memory occupied by the first. The other way to do it is to malloc memory in more or less fixed sizes and include in the header of your variable a length field. You forgot realloc(). Yes I did, but it doesn't matter that much. When asigning by blocks the best strategy is to keep all blocks the same size, or of a few assorted sizes, and link them in lists because blocks of different sizes end up fragmenting the memory too much and giving the garbage collector lots of trouble, if all blocks are of the same size, they are immediately reusable. Basically, if you are dealing with the memory yourself, assigning it, freeing it, collecting garbage afterwards and defragmenting, you won't resort that much to individual calls to the memory library functions, you just grab a big chunk and manage it on your own. I realize that, but in the absence of your own management system (option 2 you mention) it is superior to using malloc(), memcpy(), and free(). Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] logging erros and user access to logs
My users want to be able to debug their scripts, see mysql errors, and such. Using mysql_error(), and display_errors, problems such as non-existent databases, or variable and such seem to get printed to the screen. However, syntax errors do not. They get written to the global php log, for example, PHP Parse error: parse error, unexpected T_ECHO, expecting ',' or ';' when a semi-colon is missing. I can't just give all system users access to the global log. I saw an example at http://www.php.net/manual/en/ref.errorfunc.php#ini.display-errors that seemed to suggest including the script to debug in something like this demodebug.php script would do the trick: ?php error_reporting(E_PARSE); ini_set('display_errors','On'); ini_set('display_startup_errors','On'); include('demo.php'); ? When I remove a semi-colon from demo.php and load demodebug.php in the browser, nothing is displayed on the screen. The error still goes to the global log. I'm running PHP 4.3 on Apache 2. I have these settings in my php.ini: error_reporting = E_ALL ~E_NOTICE display_errors = Off display_startup_errors = Off I thought the above debugdemo.php script was basically supposed to do a local override so that script could display the errors. Is there any good way to let users see all the errors from their scripts. Jason Joines = -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_POST array order
Hi, Quick question regarding $_POST array element order, first the situation: I am submitting a form with x first fields and the post value returns the last element as being the submit button name and value Is it safe to consider that the last element in the $_POST array will ALWAYS be the submit element (it is always last in form)? I would like to array_pop($_POST) to get rid of that last element for various reasons (validation scheme) later on.. Regards, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: $_POST array order
Why not simply unset() the unwanted value by its key, i.e., the submit button's name. Tim wrote: Hi, Quick question regarding $_POST array element order, first the situation: I am submitting a form with x first fields and the post value returns the last element as being the submit button name and value Is it safe to consider that the last element in the $_POST array will ALWAYS be the submit element (it is always last in form)? I would like to array_pop($_POST) to get rid of that last element for various reasons (validation scheme) later on.. Regards, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_POST array order
-Original Message- From: Tim [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 14, 2007 12:58 PM To: 'PHP' Subject: [PHP] $_POST array order Hi, Quick question regarding $_POST array element order, first the situation: I am submitting a form with x first fields and the post value returns the last element as being the submit button name and value Is it safe to consider that the last element in the $_POST array will ALWAYS be the submit element (it is always last in form)? I would like to array_pop($_POST) to get rid of that last element for various reasons (validation scheme) later on.. Regards, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You could also omit the name parameter of the submit button and it will not even be passed at all. input type=submit value= Submit Form -B -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] variables in CSS in PHP question/problems
At 2:15 AM -0500 3/14/07, Richard Lynch wrote: Surf directly to your CSS URL and see what happens. There are several possibiliies: #1. Your CSS has ?php ... ? in its output, because you have not convinced your web-server to run your CSS file through PHP to compute the dynamic result. You need something like this in .htacces: File whatever.css ForceType application/x-httpd-php /File whatever.css should be your CSS filename. To all: In addition to what Richard said: I came into this conversation late, so please forgive me if I'm not on track, but if one is trying to use php variables in css, you might want to place this at the top of your css files: ?php header('Content-Type: text/css; charset=UTF-8'); ? and then add this to your .htacces file: FilesMatch \.(htm|html|css|tpl)$ SetHandler application/x-httpd-php /FilesMatch After that, you can set variables within your css files by ?php echo(whatever) ? hth's 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
Re: [PHP] Re: $_POST array order
Al wrote: Why not simply unset() the unwanted value by its key, i.e., the submit button's name. actually double unset it. to avoid the request array key hack that exists in older versions of php :-) Tim wrote: Hi, Quick question regarding $_POST array element order, first the situation: I am submitting a form with x first fields and the post value returns the last element as being the submit button name and value Is it safe to consider that the last element in the $_POST array will ALWAYS be the submit element (it is always last in form)? I would like to array_pop($_POST) to get rid of that last element for various reasons (validation scheme) later on.. Regards, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Referring URL Authentication
On Wed, 2007-03-14 at 16:23 +, Matthew Vickery wrote: Robert Cummings wrote: On Wed, 2007-03-14 at 14:50 +, Matthew Vickery wrote: The situation is as follows: I wish to protect the entire Website http://www.example.com from direct URL access. i.e. if someone enters http://www.example.com into their browser they get a message stating that they are not authorised to access the site. The only way to access http://www.example.com should be to log into a second site http://www.intranet.com and follow a link from within to http://www.example.com. The problem: I initially thought I should use the predefined PHP variable $_SERVER['HTTP_REFERER'], but the PHP website explains that this cannot really be trusted (http://uk2.php.net/manual/en/reserved.variables.php). Next I thought about HTTP authentication. If I password protect the the Website using .htaccess and .htpasswd as follows: Code: AuthName Login to access the Website AuthType Basic AuthUserFile /var/www/vhosts/example.com/httpdocs/.htpasswd Require user username Then my link within http://www.intranet.com could simply be: Code: a href=http://username:[EMAIL PROTECTED]Link to example.com/a However this doesn't seem secure. The username and password are visible to anyone who views the source of the page with the link. Also as these are not encrypted is it not possible for them to be intercepted? I could of course write my own authentication code on http://www.example.com and pass a variable via a GET or POST from http://www.intranet.com, which would cause a login and a cookie to be set there. But this is basically the same as above and still seems insecure! Is there a better/standard way to do this kind of thing? So you want a user who has authenticated on domain A to be able to transparently transfer to domain B? Do they share a common database? Do you have scripting access to both systems? Cheers, Rob. Hi Rob, Thanks for your reply. Yes, I want a user who has authenticated on domain A to be able to transparently transfer to domain B. No, domains A and B don't share a common database. I only have scripting access to domain B. Basically I am creating a mini-site on my Web server (domain B) that a company needs to access securely via their Intranet (domain A), hopefully without the need to setup an extensive user database and login system on my Web server that will be additional to their Intranet login... I hope this makes thins clearer? It does... but you have no control. What you want to do can't be done with any certainty about the incoming connection. You need control over A to have any kind of security when transferring to B. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Environment variables...
Well, as David BERCOT pointed out, if this is in a web environment then the environment available to php will be that of whatever user your web server is running as (probably 'nobody' if you're on apache, not sure about other web servers). So, you'll need to look at making that variable available in you're web server user's env. On Mar 14, 2007, at 9:52 AM, David BERCOT wrote: Le Wed, 14 Mar 2007 09:42:13 -0500, Erik Jones [EMAIL PROTECTED] a écrit : Depending on your system and environment (platform and cli v. cgi), they should be in either of the $_ENV or $_SESSION superglobals. It is Debian... But the variable I added is not in $_ENV or $_SESSION superglobals... David. On Mar 14, 2007, at 9:32 AM, David BERCOT wrote: Hi, I'd like to read an environment variable with PHP. I've tried with : exec ('echo $CONTEXTE_D_EXECUTION',$result); $result is empty !!! I've put the variable in /etc/environment, in /etc/profile, in /etc/bash.bashrc but nothing worked... Do you have any idea ? If it is not possible, I suppose I can put a variable in php.ini ? Thank you very much. David. erik jones [EMAIL PROTECTED] sofware developer 615-296-0838 emma(r) erik jones [EMAIL PROTECTED] sofware developer 615-296-0838 emma(r)
Re: [PHP] $_POST array order
On 3/14/07, Tim [EMAIL PROTECTED] wrote: Hi, Quick question regarding $_POST array element order, first the situation: I am submitting a form with x first fields and the post value returns the last element as being the submit button name and value Is it safe to consider that the last element in the $_POST array will ALWAYS be the submit element (it is always last in form)? I would like to array_pop($_POST) to get rid of that last element for various reasons (validation scheme) later on.. Regards, Tim No, it isn't always the latest element, they are stored in the way the were submit, and browsers like IE do this in order they are placed on the page. for example this form: form action='test.php' method='post' input type='submit' name='submit' value='Go!' input type='hidden' name='go' value='test' /form would return a $_POST array like this: Array ( [submit] = Go! [go] = test ) And so is submit the first element in the array and not the last one. Tijnema -- 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] displaying image from MySQL DB using HTML/PHP
On Tuesday 13 March 2007 22:09, Tijnema ! wrote: On 3/13/07, Bruce Gilbert [EMAIL PROTECTED] wrote: On 3/13/07, Tijnema ! [EMAIL PROTECTED] wrote: So you just need to set the content-type and output add this to the bottom of the script: header(Content-Type: .$encodeddata); echo $title; If i understand you right. Tijnema Thanks, I changed the code around some and now have: [php] ?php //check for validity of user $db_name=bruceg_mailinglist; $table_name =image_holder; $connection = @mysql_connect(db_address, uasername, password) or die (mysql_error()); $db = @mysql_select_db($db_name, $connection) or die (mysql_error()); $img = $_REQUEST[img]; $result = @mysql_query(SELECT * FROM image_holder WHERE id= . $img . ); if (!$result) { echo(Error performing query: . mysql_error() . ); exit(); } while ( $row = @mysql_fetch_array($result) ) { $imgid = $row[id]; header(Content-Type: .$encodeddata); echo $title;} ? [/php] and in the HTML centerimg src=image.php?id=1 width=200 border=1 alt=/center but I am getting a MySQL error Error performing query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 -- ::Bruce:: You changed your html code, you have id=1, and in your PHP code you are requesting img, so change centerimg src=image.php?id=1 width=200 border=1 alt=/center to centerimg src=image.php?img=1 width=200 border=1 alt=/center But i must also say, it is NOT safe to input data from ?img= directly into your database, someone could do a SQL injection right away with this code!. He's not using image.php to insert. Earlier he mentioned using phpmyadmin to insert the image, that was the way I used too. First learn to display an image, this way its easier to know if any upload script you make up later is working correctly. Then about this piece of code while ( $row = @mysql_fetch_array($result) ) { $imgid = $row[id]; header(Content-Type: .$encodeddata); echo $title; } I hope for you that there's only one item with this id, if not, there would come an error again, so a while loop is not needed, and second, now you don't define $encodeddata and $title anymore, try this piece of code instead of the one above: $row = @mysql_fetch_array($result); header(Content-Type: .row['mimetype']); echo $row['filecontents']; ps. Reply to the full PHP list, not just me... -- --- Børge Kennel Arivene http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP URL issues
Steve wrote: I personally have not unfortunately. A good friend of mine is also a developer who initially told me about it when I first began coding. Because I don't want to stick with the he-said, she-said approach, I did a quick google search and came up with this link: http://spindrop.us/2007/03/03/php-double-versus-single-quotes/ There's several other pages saying similar things if you do look around. Even the performance different isn't significant, it will add up. If something like this is known to help ever so slightly with execution time and it's something you can teach yourself to do subconsciously, then I feel it's definitely worthwhile to pursue. Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tue, March 13, 2007 9:31 am, Steve wrote: This may or may not help, but here's a few things to note: 1) I would avoid placing variable output in double quoted strings. While not important for smaller scripts, doing a large number of outputs like this causes a decent performance hit. In fact, I wouldn't use double quotes ever in php. Instead, strive for something like: echo 'ba href=test.php?term='.$letter_value.''.$letter_value.' nbsp;/a/b'; Have you benchmarked this, or can you provide a link to others' benchmarks demonstrating this perofmrnace hit?... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? Check out this page I just created using the example from the link that you provided. I have grown off what the above examples page. it takes a few seconds to load, so be patient. http://www.cmsws.com/examples/php/speed_variables.php -- Enjoy, Jim Lucas Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_POST array order
On Wed, March 14, 2007 11:58 am, Tim wrote: Quick question regarding $_POST array element order, first the situation: I am submitting a form with x first fields and the post value returns the last element as being the submit button name and value Is it safe to consider that the last element in the $_POST array will ALWAYS be the submit element (it is always last in form)? Sorry, no. The HTTP spec specifically allows the browser to order the args in any way it likes. I would like to array_pop($_POST) to get rid of that last element for various reasons (validation scheme) later on.. Would be better to always prepend button name with button_ or something, so you can walk the keys of $_POST and strip them out. Regards, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_POST array order
On Wed, March 14, 2007 12:28 pm, Brad Fuller wrote: You could also omit the name parameter of the submit button and it will not even be passed at all. input type=submit value= Submit Form I dunno about these new-fangled browsers, but in the old ones, you'd get Submit as the name if the user clicked on the button, and nothing if they just hit enter in a form field... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] logging erros and user access to logs
Get the errors OFF the web page (display_errors OFF) and into the logs and provide your users with logs for their own domains with vhosts. On Wed, March 14, 2007 11:02 am, Jason Joines wrote: My users want to be able to debug their scripts, see mysql errors, and such. Using mysql_error(), and display_errors, problems such as non-existent databases, or variable and such seem to get printed to the screen. However, syntax errors do not. They get written to the global php log, for example, PHP Parse error: parse error, unexpected T_ECHO, expecting ',' or ';' when a semi-colon is missing. I can't just give all system users access to the global log. I saw an example at http://www.php.net/manual/en/ref.errorfunc.php#ini.display-errors that seemed to suggest including the script to debug in something like this demodebug.php script would do the trick: ?php error_reporting(E_PARSE); ini_set('display_errors','On'); ini_set('display_startup_errors','On'); include('demo.php'); ? When I remove a semi-colon from demo.php and load demodebug.php in the browser, nothing is displayed on the screen. The error still goes to the global log. I'm running PHP 4.3 on Apache 2. I have these settings in my php.ini: error_reporting = E_ALL ~E_NOTICE display_errors = Off display_startup_errors = Off I thought the above debugdemo.php script was basically supposed to do a local override so that script could display the errors. Is there any good way to let users see all the errors from their scripts. Jason Joines = -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Using a reentrant form
And if the user re-loads the page they just POSTed? On Wed, March 14, 2007 10:24 am, Tony Marston wrote: I honestly don't know why people use the approach of having a hidden field on a re-entrant form to indicate whether it should be validated or not. I have used re-entrant forms for years without such a thing. How? Quite simply there are two phases to a form - GET, which requests a form from the server, and POST, which sends a form to the server. It is therefore quite obvious that I validate on every POST. Simple, isn't it? -- Tony Marston http://www.tonymarston.net http://www.radicore.org Todd Cary [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] To validate a page, I set the form value to the page name the user is on. Then there is a hidden variable, looped that is set to 1. By checking looped, I know if the user has re-entered the form so I can do my validation checks. Is there a disadvantage to this approach? Thank you... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse
?php phpinfo();? No space in the function name 'phpinfo' If that's not it, show us your source code. On Wed, March 14, 2007 9:53 am, al phillips wrote: I keep getting a parse error line x when trying view php info() Can you help please? - Be a PS3 game guru. Get your game face on with the latest PS3 news and previews at Yahoo! Games. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_POST array order
On Wed, 2007-03-14 at 17:23 -0500, Richard Lynch wrote: On Wed, March 14, 2007 12:28 pm, Brad Fuller wrote: You could also omit the name parameter of the submit button and it will not even be passed at all. input type=submit value= Submit Form I dunno about these new-fangled browsers, but in the old ones, you'd get Submit as the name if the user clicked on the button, and nothing if they just hit enter in a form field... Can't rely on that these days. Don't remember which, but at least one of them sends the first encountered submit button. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Environment variables...
PHP runs as its own user in its own environment. Stuff you cram into your environment has no effect on that, as it should be. If you alter the environment of the PHP user you might get what you want. You may also be able to use http://php.net/setenv And http://php.net/getenv is probably faster than your exec. Setting the env up in httpd.conf and/or php.ini and/or .htaccess should work. httpd.conf for sure, others I think. On Wed, March 14, 2007 9:32 am, David BERCOT wrote: Hi, I'd like to read an environment variable with PHP. I've tried with : exec ('echo $CONTEXTE_D_EXECUTION',$result); $result is empty !!! I've put the variable in /etc/environment, in /etc/profile, in /etc/bash.bashrc but nothing worked... Do you have any idea ? If it is not possible, I suppose I can put a variable in php.ini ? Thank you very much. David. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: question regarding form filtering
On Wed, March 14, 2007 9:07 am, Tim wrote: You almost for sure do *NOT* want to attempt to send the entire Webster's 2nd Edition dictionary to the browser as JS data so that the JS can check. :-) Hehe, oh? Really? ;-) I suppose you could do a Web 2.0 Ajax-y thingie for that... Not a fan of forcing users to download/use active-x controls.. (accesibility, usability etc..) No, I meant using an XmlHttpRequest to compare their password as they type it in the form with the webster's dictionary up on your server. Dunno if it would be fast enough to do it per keystroke, but perhaps upon leaving the password field. For anything that really matters, your sanitation probably ought to be custom-tailored rather than off-the-rack anyway... Glad we share this opinion.. Plus, the easy ones are easy, and the framework probably won't handle the hard ones, so what's the point of the clutter of the framework? So I personally wouldn't even go down this road. Erm gonna have to explain to me what you mean... (easy ones are easy.. Etc.) What I mean is that trying to write Framework for your sanitization routines will lock you into that Framework. So while PCRE is *great* for most sanitization routines, it's not the Right Answer for all of them. But if your framework only does PCRE, you've given up on custom sanitization for an off-the-rack answer, and are using a hammer on a screw sooner or later. The easy ones, like username or email are a one-liner anyway, or a few lines of code at most. The really complex ones like password, probably won't fit into any generic Framework you can build. I think it's better to hand-craft this code on each, rather than trying to generalize it. YMMV -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 errors I can not understand
On Wed, March 14, 2007 6:52 am, Myron Turner wrote: Richard Lynch wrote: On Tue, March 13, 2007 6:04 pm, Jonathan Kahan wrote: The = operator takes precedence, and $d is set to 0. But why? According to the manual, the modulus operator has precedence over the equals! So shouldn't this expression resolve to: ($s % $d) = 0 which gives an error? Ya got me there. I hadn't even checked the precedence list before answering. Unless somebody has a rational explanation, I think this should be an error... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2 + IE 7 = HTTP 304 in login procedure [SOLVED]
On Wed, March 14, 2007 6:22 am, Seak, Teng-Fong wrote: Richard Lynch wrote: I wonder if the changes that allow for Interntional domain names, with various Unicode characters I don't even know how to get out of my keyboard, *ALSO* made _ suddenly be legal... Just a hypothesis. I gotta say that Apache being current on RFCs and IE being broken seems a lot more likely to this naive reader... :-) And you have to admit that if various characters that my keyboard can't even produce are valid URL characters, then outlawing '_' is kinda bogus... You're probably talking about IDNA (called iDNS before). http://en.wikipedia.org/wiki/Internationalized_domain_name Yes. And while _ is ASCII and therefore should not have IDNA applied to it, it would not shock me to find out that somebody messed up and that is what happens to it... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Using a reentrant form
Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] And if the user re-loads the page they just POSTed? Easy peasy. After a successful POST I perform a redirect, either to the same page or a different, which changes the POST into a GET. So if the user presses the refresh button it simply repeats the GET. -- Tony Marston http://www.tonymarston.net http://www.radicore.org On Wed, March 14, 2007 10:24 am, Tony Marston wrote: I honestly don't know why people use the approach of having a hidden field on a re-entrant form to indicate whether it should be validated or not. I have used re-entrant forms for years without such a thing. How? Quite simply there are two phases to a form - GET, which requests a form from the server, and POST, which sends a form to the server. It is therefore quite obvious that I validate on every POST. Simple, isn't it? -- Tony Marston http://www.tonymarston.net http://www.radicore.org Todd Cary [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] To validate a page, I set the form value to the page name the user is on. Then there is a hidden variable, looped that is set to 1. By checking looped, I know if the user has re-entered the form so I can do my validation checks. Is there a disadvantage to this approach? Thank you... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirecting in a PHP script
On 3/13/07 4:50 PM, Tijnema ! wrote: Did you guys ever noted that little arrow down just right of the back button, where you can go back 2 steps at once, so you don't have to click very fast?? Browsers have buttons in them? Next thing, you'll be telling me I can see images and color in my browser! What craziness! ;-) -- Ben Ramsey http://benramsey.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Regex error
Hello; The following regex: ereg(member value='[a-zA-Z ]{1,25}' uspace='([a-z0-9-\.\/]{2,11})' id='$m[1]', $groups, $m1); is causing the following error: Warning: ereg() [function.ereg]: REG_ERANGE in path info_proc.php on line 81 Can someone tell me what this means? What I am trying to do is pick out some info from an xml tag the is id'd by $m[1] ( a match from a preceding regex. This regex is only supposed to be applied if there is an $m[1] match. This happened without the dot (.) and forward slash escaped in the uspace=' etc ' section. I used back slashes to see if that made a difference, it does not. I have gotten a little hazy on what needs to be escaped in character classes. I have written a number of similar regexs in the same collections of scripts and I can not see what this one is complaining about. php v5.1.2, Apache 1.3.34, FreeBSD v6.0 Thanks in advance Jeff K -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Regex error
Get The Regex Coach http://weitz.de/regex-coach/ Use preg_match_all() Build your pattern one step at a time using the coach. Don't forget the delimiters. jekillen wrote: Hello; The following regex: ereg(member value='[a-zA-Z ]{1,25}' uspace='([a-z0-9-\.\/]{2,11})' id='$m[1]', $groups, $m1); is causing the following error: Warning: ereg() [function.ereg]: REG_ERANGE in path info_proc.php on line 81 Can someone tell me what this means? What I am trying to do is pick out some info from an xml tag the is id'd by $m[1] ( a match from a preceding regex. This regex is only supposed to be applied if there is an $m[1] match. This happened without the dot (.) and forward slash escaped in the uspace=' etc ' section. I used back slashes to see if that made a difference, it does not. I have gotten a little hazy on what needs to be escaped in character classes. I have written a number of similar regexs in the same collections of scripts and I can not see what this one is complaining about. php v5.1.2, Apache 1.3.34, FreeBSD v6.0 Thanks in advance Jeff K -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex error
jekillen wrote: Hello; The following regex: ereg(member value='[a-zA-Z ]{1,25}' uspace='([a-z0-9-\.\/]{2,11})' id='$m[1]', $groups, $m1); is causing the following error: Warning: ereg() [function.ereg]: REG_ERANGE in path info_proc.php on line 81 Can someone tell me what this means? What I am trying to do is pick out some info from an xml tag the is id'd by $m[1] ( a match from a preceding regex. This regex is only supposed to be applied if there is an $m[1] match. This happened without the dot (.) and forward slash escaped in the uspace=' etc ' section. I used back slashes to see if that made a difference, it does not. I have gotten a little hazy on what needs to be escaped in character classes. I have written a number of similar regexs in the same collections of scripts and I can not see what this one is complaining about. php v5.1.2, Apache 1.3.34, FreeBSD v6.0 Thanks in advance Jeff K What is this part of the regex supposed to be doing: [a-z0-9-\.\/] ? Your problem is this: 0-9-, which causes a bad range error. -- _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] register_globals and passing variables
Ok, all I am new to PHP MySQL. (please don't let this scare you off) I had my site hosted with Gisol.com and due to their very poor service and tech support I left them for Lunarpages.com who so far have a better service and their tech support is excellent!! But my pages won't pass variables any more. When I started I purchased two books MySQL and PHP MySQL both published by O'Riely. So far the are excellent help and instructors. I wote some pages where I track users and their characters from an on-line game called World of Warcraft. On the Gisol server they were working EXCELLENT!! Once I moved to Lunarpages, the pages load ok but they don't pass the variables from one page to another. The below code queries the db and list's the user's in a table, and has a hyperlink to the right of each, on Gisol I could click the link and it would load the view_char.php page and it listed their character and the info i needed, and gave options to delete and edit. Again it was working beautifully. VIEW USERS PAGE CODE: $sql=SELECT f_name, l_name, char_id, char_name, char_level FROM t_char, t_users where t_users.user_id = t_char.user_link ORDER BY char_name ASC; mysql_select_db($db_select,$db); $result = mysql_query($sql,$db); echo TABLE border=2; echoTRTDBCharacter Name/BTDBCharacter Level/BTDBOwner/B/TR; while ($myrow = mysql_fetch_array($result)) { echo TRTD.$myrow[char_name].TD.$myrow[char_level].TD.$myrow[f_name]. .$myrow[l_name]; echo TDA href=\view_char.php?charid=.$myrow[char_id].\View/A; } //$charid=[.$myrow[char_id].]; - I tried this line with no success. Possibly have it in the wrong place?? echo/TABLE; VIEW_CHAR PAGE CODE $sql = SELECT * FROM `t_char` WHERE `t_char`.`char_id` = '$charid'; -- now all this does is produce a blank page... used to work great! //$sql = SELECT * FROM `t_char` WHERE `t_char`.`char_id` = '21'; - i used this code to test the page w/o the $charid string and it works FINE!! $result=mysql_query( $sql ); if (!$result) { die(Could not query the database: br /.mysql_error()); } I wrote a help ticket to Lunarpages where I am now hosted and asked them to set the register_globals to ON thinking this was the problem based on what I've read and the wrote back and told me that they use suPHP to parse php files and I have the option of using custom php.ini files. That I could create a .htaccess file or put individual php.ini files in the folder that contains the files im running. In other words do it myself. So I created this file: [PHP] register_globals = on named it php.ini and dropped it in the folder with all of my files. It didn't help any. So I added this line to the first file include ('php.ini'); all it does is add :[PHP] register_globals = on as text at the top of my page now. At this point im lost!! I don't know what to do to get my A href=\view_char.php?charid=.$myrow[char_id]. to equal $charid in the following pages. Any help you could provide me would GREATLY be APPRECIATED!!! Signed, I'm trying -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can a Form Action transfer to another file that is a form?
I have a script file that is both the form and action handle (using isset), which is a menu selection. If the action handler is executing it is a switch statement that will chose the next form. I would like to transfer to another script file that is also a combination form and handler. Can I do this without using a redirect? I have no need to bounce back to the user's browser. Or should I just separate my forms and their action handlers? Thanks Stephen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing Variables
Ok, all I am new to PHP MySQL. (please don't let this scare you off) I had my site hosted with Gisol.com and due to their very poor service and tech support I left them for Lunarpages.com who so far have a better service and their tech support is excellent!! But my pages won't pass variables any more. When I started I purchased two books MySQL and PHP MySQL both published by O'Riely. So far the are excellent help and instructors. I wote some pages where I track users and their characters from an on-line game called World of Warcraft. On the Gisol server they were working EXCELLENT!! Once I moved to Lunarpages, the pages load ok but they don't pass the variables from one page to another. The below code queries the db and list's the user's in a table, and has a hyperlink to the right of each, on Gisol I could click the link and it would load the view_char.php page and it listed their character and the info i needed, and gave options to delete and edit. Again it was working beautifully. VIEW USERS PAGE CODE: $sql=SELECT f_name, l_name, char_id, char_name, char_level FROM t_char, t_users where t_users.user_id = t_char.user_link ORDER BY char_name ASC; mysql_select_db($db_select,$db); $result = mysql_query($sql,$db); echo TABLE border=2; echoTRTDBCharacter Name/BTDBCharacter Level/BTDBOwner/B/TR; while ($myrow = mysql_fetch_array($result)) { echo TRTD.$myrow[char_name].TD.$myrow[char_level].TD.$myrow[f_name]. .$myrow[l_name]; echo TDA href=\view_char.php?charid=.$myrow[char_id].\View/A; } //$charid=[.$myrow[char_id].]; - I tried this line with no success. Possibly have it in the wrong place?? echo/TABLE; VIEW_CHAR PAGE CODE $sql = SELECT * FROM `t_char` WHERE `t_char`.`char_id` = '$charid'; -- now all this does is produce a blank page... used to work great! //$sql = SELECT * FROM `t_char` WHERE `t_char`.`char_id` = '21'; - i used this code to test the page w/o the $charid string and it works FINE!! $result=mysql_query( $sql ); if (!$result) { die(Could not query the database: br /.mysql_error()); } I wrote a help ticket to Lunarpages where I am now hosted and asked them to set the register_globals to ON thinking this was the problem based on what I've read and the wrote back and told me that they use suPHP to parse php files and I have the option of using custom php.ini files. That I could create a .htaccess file or put individual php.ini files in the folder that contains the files im running. In other words do it myself. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] re regex error
Hello again; Regarding the error I was inquiring about: Warning: ereg() [function.ereg]: REG_ERANGE in path info_proc.php on line 81 I still would like to know what it means but I solved the script problem. I found that since $groups is a string that was exploded to form the $g_list array it may have been struggling to try and crawl back through the whole string in the middle of the for loop. But I don't know, because I don't know what REG_ERANGE means. I should have not been trying to run this regex at this stage of the script and, in fact (I have been doing a lot of complex programming on this project ) I had the same regex further down the list where is should have been and was already. Anyhow, I think this may be valuable for anyone who is trying to learn by watching and reading this list. thanks Jeff K -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] register_globals and passing variables
Hi Jeff, You want to leave register_globals OFF. Depending on how $charid is passed, you want to use $_POST or $_GET: $charid = $_POST['charid']; or $charid = $_GET['charid']; I think you'll need to do the same for your $db_select variable. Is that what you're after? Regards, Bruce Jeff [EMAIL PROTECTED] 14/03/2007 4:01 p.m. Ok, all I am new to PHP MySQL. (please don't let this scare you off) I had my site hosted with Gisol.com and due to their very poor service and tech support I left them for Lunarpages.com who so far have a better service and their tech support is excellent!! But my pages won't pass variables any more. When I started I purchased two books MySQL and PHP MySQL both published by O'Riely. So far the are excellent help and instructors. I wote some pages where I track users and their characters from an on-line game called World of Warcraft. On the Gisol server they were working EXCELLENT!! Once I moved to Lunarpages, the pages load ok but they don't pass the variables from one page to another. The below code queries the db and list's the user's in a table, and has a hyperlink to the right of each, on Gisol I could click the link and it would load the view_char.php page and it listed their character and the info i needed, and gave options to delete and edit. Again it was working beautifully. VIEW USERS PAGE CODE: $sql=SELECT f_name, l_name, char_id, char_name, char_level FROM t_char, t_users where t_users.user_id = t_char.user_link ORDER BY char_name ASC; mysql_select_db($db_select,$db); $result = mysql_query($sql,$db); echo TABLE border=2; echoTRTDBCharacter Name/BTDBCharacter Level/BTDBOwner/B/TR; while ($myrow = mysql_fetch_array($result)) { echo TRTD.$myrow[char_name].TD.$myrow[char_level].TD.$myrow[f_name]. .$myrow[l_name]; echo TDA href=\view_char.php?charid=.$myrow[char_id].\View/A; } //$charid=[.$myrow[char_id].]; - I tried this line with no success. Possibly have it in the wrong place?? echo/TABLE; VIEW_CHAR PAGE CODE $sql = SELECT * FROM `t_char` WHERE `t_char`.`char_id` = '$charid'; -- now all this does is produce a blank page... used to work great! //$sql = SELECT * FROM `t_char` WHERE `t_char`.`char_id` = '21'; - i used this code to test the page w/o the $charid string and it works FINE!! $result=mysql_query( $sql ); if (!$result) { die(Could not query the database: br /.mysql_error()); } I wrote a help ticket to Lunarpages where I am now hosted and asked them to set the register_globals to ON thinking this was the problem based on what I've read and the wrote back and told me that they use suPHP to parse php files and I have the option of using custom php.ini files. That I could create a .htaccess file or put individual php.ini files in the folder that contains the files im running. In other words do it myself. So I created this file: [PHP] register_globals = on named it php.ini and dropped it in the folder with all of my files. It didn't help any. So I added this line to the first file include ('php.ini'); all it does is add :[PHP] register_globals = on as text at the top of my page now. At this point im lost!! I don't know what to do to get my A href=\view_char.php?charid=.$myrow[char_id]. to equal $charid in the following pages. Any help you could provide me would GREATLY be APPRECIATED!!! Signed, I'm trying -- 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] Passing Variables
On Wed, March 14, 2007 9:14 pm, Jeff wrote: I've read and the wrote back and told me that they use suPHP to parse php files and I have the option of using custom php.ini files. That I could create a .htaccess file or put individual php.ini files in the folder that contains the files im running. In other words do it myself. You *could* create a file named .htaccess and put this in it: php_value register_globals on and your scripts will work as-is. It would be INFINITELY BETTER to fix up the scripts so that instead of using just $charid in the query, you would do like this at the tip-top: $charid = mysql_real_escape_string($_GET['charid']); This will take care of the register globals and it will keep you safe from SQL-injection attack. At the moment, if you turn on register_globals, it will work, but it's very very very un-safe without the MySQL escaping anyway, so you might as well fix both at once. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex error
On Wed, March 14, 2007 7:56 pm, jekillen wrote: Hello; The following regex: ereg(member value='[a-zA-Z ]{1,25}' uspace='([a-z0-9-\.\/]{2,11})' id='$m[1]', $groups, $m1); is causing the following error: Warning: ereg() [function.ereg]: REG_ERANGE in path info_proc.php on line 81 Can someone tell me what this means? You used to have the - after the 9 at the end, and then you tacked on the \. and \/ after that, and now PCRE is trying to use the - as if it were a range-specifier, like, a-z or 0-9, only you've got, essentially, a-z0-9-. This makes no sense at all, as it sort of means 'a to z' or '0 to 9' or, umm, '9 to .' or something like that, only not. Move the - to the END of the pattern, right after the \/ PS Technically, \ is a special character inside of quotes in PHP, as well as an escape character for PCRE, so you really should use \\. and \\/ -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] register_globals and passing variables
Firstly, welcome to PHP. :-) Secondly, that's not how you would enable register_globals if they're not enabled. Thirdly, you do not want to turn on register_globals. register globals are a security risk. They're disabled by default on any recent (within the past 5 years) version of PHP, although some web hosts foolishly turn them on to be compatible with code written 8 years ago that shouldn't be used anymore. :-) Instead, access the proper super-global to get the data you want. For instance: $_GET['charid'] Will have the value of the charid GET parameter passed on the URL like so: http://example.com/index.php?charid=5 There's also $_POST['charid'], which would check just a POST request. Use those instead of just $charid. Also, you'll want to ensure that they're the data type you expect to avoid SQL injection, a security risk. For instance, assuming you know the character ID will be an integer: $charid = (int)$_GET['charid']; Or even better: $charid = isset($_GET['charid']) ? (int)$_GET['charid'] : 0; That's the ternary operator, which is useful for setting defaults in cases where, for instance, no charid was passed at all. That way you get back a 0, so you know you have a value and that it's an integer. Thank you for taking PHP Security 101 in a Nutshell. :-) Cheers. On Tuesday 13 March 2007 10:01 pm, Jeff wrote: Ok, all I am new to PHP MySQL. (please don't let this scare you off) I had my site hosted with Gisol.com and due to their very poor service and tech support I left them for Lunarpages.com who so far have a better service and their tech support is excellent!! But my pages won't pass variables any more. When I started I purchased two books MySQL and PHP MySQL both published by O'Riely. So far the are excellent help and instructors. I wote some pages where I track users and their characters from an on-line game called World of Warcraft. On the Gisol server they were working EXCELLENT!! Once I moved to Lunarpages, the pages load ok but they don't pass the variables from one page to another. The below code queries the db and list's the user's in a table, and has a hyperlink to the right of each, on Gisol I could click the link and it would load the view_char.php page and it listed their character and the info i needed, and gave options to delete and edit. Again it was working beautifully. VIEW USERS PAGE CODE: $sql=SELECT f_name, l_name, char_id, char_name, char_level FROM t_char, t_users where t_users.user_id = t_char.user_link ORDER BY char_name ASC; mysql_select_db($db_select,$db); $result = mysql_query($sql,$db); echo TABLE border=2; echoTRTDBCharacter Name/BTDBCharacter Level/BTDBOwner/B/TR; while ($myrow = mysql_fetch_array($result)) { echo TRTD.$myrow[char_name].TD.$myrow[char_level].TD.$myrow[f _name]. .$myrow[l_name]; echo TDA href=\view_char.php?charid=.$myrow[char_id].\View/A; } //$charid=[.$myrow[char_id].]; - I tried this line with no success. Possibly have it in the wrong place?? echo/TABLE; VIEW_CHAR PAGE CODE $sql = SELECT * FROM `t_char` WHERE `t_char`.`char_id` = '$charid'; -- now all this does is produce a blank page... used to work great! //$sql = SELECT * FROM `t_char` WHERE `t_char`.`char_id` = '21'; - i used this code to test the page w/o the $charid string and it works FINE!! $result=mysql_query( $sql ); if (!$result) { die(Could not query the database: br /.mysql_error()); } I wrote a help ticket to Lunarpages where I am now hosted and asked them to set the register_globals to ON thinking this was the problem based on what I've read and the wrote back and told me that they use suPHP to parse php files and I have the option of using custom php.ini files. That I could create a .htaccess file or put individual php.ini files in the folder that contains the files im running. In other words do it myself. So I created this file: [PHP] register_globals = on named it php.ini and dropped it in the folder with all of my files. It didn't help any. So I added this line to the first file include ('php.ini'); all it does is add :[PHP] register_globals = on as text at the top of my page now. At this point im lost!! I don't know what to do to get my A href=\view_char.php?charid=.$myrow[char_id]. to equal $charid in the following pages. Any help you could provide me would GREATLY be APPRECIATED!!! Signed, I'm trying -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it. -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
Re: [PHP] Class and subclass
I think you'd need to take this up with Zend if they are claiming it's invalid syntax when it is valid. If it's really not valid, I'm not seeing why, but what do I know? On Tue, March 13, 2007 4:18 am, Alain Roger wrote: Hi Richard, In fact the problem is that under Zend Studio editor, when i typed : $this-class_A_property-Class_B_method did not appear as valid. if i typed $this-class_A_property , this was valid because $this refered to Class_A. but if you define a property (private $myobject_B) in class A, and create an instance via $this-myobject_B = new Class_B(); after : $this-myobject_B-Class_B_method was displayed as not correct syntax in Zend :-( Al. On 3/13/07, Richard Lynch [EMAIL PROTECTED] wrote: I think he's claiming that if you typed it correctly, it should work. You haven't told us anything about the not working part... var_dump $this-myotherclass and see what's in it. On Wed, March 7, 2007 8:45 am, Alain Roger wrote: Yes, for sure. On 3/7/07, Tijnema ! [EMAIL PROTECTED] wrote: On 3/7/07, Alain Roger [EMAIL PROTECTED] wrote: A() or B() mean constructors of th class A and B respectively. Al. Yes but they are functions. On 3/7/07, Robert Cummings [EMAIL PROTECTED] wrote: On Wed, 2007-03-07 at 14:23 +0100, Alain Roger wrote: Hi, i have a class A with some properties. i have a class B with several public functions (i.e : Render()) i would like to do something like that : class B() { B() I'm pretty sure you mean function B() or in PHP 5 function __construct(). { } public function Render() { ... } } class A { private $myotherclass; A() Similarly, I'm pretty sure you mean function A() or in PHP 5 function __construct(). { $this-myotherclass = new classB(); } public function test() { $this-myotherclass-Render(); } } however, i'm not able to access to -Render() of class B from Class A property. Where could be the problem ? Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- Alain Windows XP SP2 PostgreSQL 8.1.4 Apache 2.0.58 PHP 5 -- Alain Windows XP SP2 PostgreSQL 8.1.4 Apache 2.0.58 PHP 5 -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- Alain Windows XP SP2 PostgreSQL 8.1.4 Apache 2.0.58 PHP 5 -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] re regex error
jekillen wrote: Hello again; Regarding the error I was inquiring about: Warning: ereg() [function.ereg]: REG_ERANGE in path info_proc.php on line 81 I still would like to know what it means but I solved the script problem. I found that since $groups is a string that was exploded to form the $g_list array it may have been struggling to try and crawl back through the whole string in the middle of the for loop. But I don't know, because I don't know what REG_ERANGE means. I should have not been trying to run this regex at this stage of the script and, in fact (I have been doing a lot of complex programming on this project ) I had the same regex further down the list where is should have been and was already. Anyhow, I think this may be valuable for anyone who is trying to learn by watching and reading this list. thanks Jeff K was not the answer to your question already given to you in one of your previous posts about this problem? If you didn't get it, here it is again. quote You used to have the - after the 9 at the end, and then you tacked on the \. and \/ after that, and now PCRE is trying to use the - as if it were a range-specifier, like, a-z or 0-9, only you've got, essentially, a-z0-9-. quote -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirecting in a PHP script
On Tue, March 13, 2007 3:41 pm, Chris Shiflett wrote: Robert Cummings wrote: I've found clicking really fast can get you back :) I, too, have successfully used this technique. :-) +1 Sometimes back button followed at just the right time by top so I get the HTML, but no JS runs. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirecting in a PHP script
On Tue, March 13, 2007 3:50 pm, Tijnema ! wrote: On 3/13/07, Chris Shiflett [EMAIL PROTECTED] wrote: Robert Cummings wrote: I've found clicking really fast can get you back :) I, too, have successfully used this technique. :-) Chris Did you guys ever noted that little arrow down just right of the back button, where you can go back 2 steps at once, so you don't have to click very fast?? Yes, but 2 pages back is not where I want to be. I want to be on the page with the stupid JS or META re-direct, without getting bounced forward. Quick-draw McGraw says back + stop == DWIM -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php