Re: [PHP] simple question abt convert to integer
On Wednesday 25 May 2011 07:05:18 Negin Nickparsa wrote: my code is this: $query1=select * from patient where id=.$_POST['txt']; it works but Holy Jesus! Can't wait to send to your server POST request with txt=1;DROP DATABASE; -- Of course, if you'll switch to prepare statement instead of string embedding there will be no much fun. -- Vitalii -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple question abt convert to integer
Of course have to use filters and etc... Bálint Horváth On 25 May 2011 09:53, Vitalii Demianets vi...@nppfactor.kiev.ua wrote: On Wednesday 25 May 2011 07:05:18 Negin Nickparsa wrote: my code is this: $query1=select * from patient where id=.$_POST['txt']; it works but Holy Jesus! Can't wait to send to your server POST request with txt=1;DROP DATABASE; -- Of course, if you'll switch to prepare statement instead of string embedding there will be no much fun. -- Vitalii -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple question abt convert to integer
Vitalii Demianets vi...@nppfactor.kiev.ua wrote: On Wednesday 25 May 2011 07:05:18 Negin Nickparsa wrote: my code is this: $query1=select * from patient where id=.$_POST['txt']; it works but Holy Jesus! Can't wait to send to your server POST request with txt=1;DROP DATABASE; -- Of course, if you'll switch to prepare statement instead of string embedding there will be no much fun. -- Vitalii -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Prepared statements aren't the only solution, a decent bit of filtering would work too. In the OPs example he only needed an int, so something like: $val = intval($_POST['txt']); Would do the trick. It just means that the value is safe (or at least in an expected range) for use elsewhere in the code, it may not necessarily only be restricted to a DB query. Thanks Ash -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple question abt convert to integer
Hello Negin, $query1=select * from patient where id=.$_POST['txt']; $result1=mysql_query($query1); $rows=mysql_num_rows($result1); Note: you *didn't* execute the query by calling mysql_query on it. -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: Negin Nickparsa nickpa...@gmail.com To: php-general@lists.php.net Date created: , 7:05:18 AM Subject: [PHP] simple question abt convert to integer my code is this: $query1=select * from patient where id=.$_POST['txt']; it works but i think because i have error in next line: *Warning*: mysql_num_rows() expects parameter 1 to be resource, boolean given $num2=Mysql_num_rows($result1); i echoed $ query1 and the result was this=select * from patient where id=1 maybe it can't convert $_POST['txt'] from String to integer and then it can't get my $num it is int in my mysql how can i correct $query1? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple question abt convert to integer
Tnx to all:D Paul you are absolutly right:D it was a bad mistake from me there was no need 2 convert it Balint helped me n with mysql_error i found that my code hasn't any mistake i just forgot the BIG thing! selecting db:D i totally forgot it because i had array keys with if statement n in there i selected it but in the last one of them i forgot 2 set the selection of DB Ashley what is OP? and filtering i didn't understand Andre why u r telling me Note: you *didn't* execute the query by calling mysql_query on it. if it doesn't execute the query then what's it doing? Reply Vitalli believe me that i tried it n i can send the string without error i tried it: $query1=select * from patient where id=.$_POST['txt']; it works! after i found my error i tried it 2 n it was right!!!
Re: [PHP] simple question abt convert to integer
The problem is that if you set the post directly to the query it's available to be an attach code in the field... (eg. DROP DATABASE;) it's called to SQL injection... what I mean on filtering: always check the values in query eg.: $id = $_POST['id']; if(is_numeric($id)){...}else{bad post} and at other fields u can use eg. strstr() etc... On Wed, May 25, 2011 at 4:38 PM, Negin Nickparsa nickpa...@gmail.comwrote: Tnx to all:D Paul you are absolutly right:D it was a bad mistake from me there was no need 2 convert it Balint helped me n with mysql_error i found that my code hasn't any mistake i just forgot the BIG thing! selecting db:D i totally forgot it because i had array keys with if statement n in there i selected it but in the last one of them i forgot 2 set the selection of DB Ashley what is OP? and filtering i didn't understand Andre why u r telling me Note: you *didn't* execute the query by calling mysql_query on it. if it doesn't execute the query then what's it doing? Reply Vitalli believe me that i tried it n i can send the string without error i tried it: $query1=select * from patient where id=.$_POST['txt']; it works! after i found my error i tried it 2 n it was right!!!
Re: [PHP] simple question abt convert to integer
i got it tnx Balint
[PHP] simple question abt convert to integer
my code is this: $query1=select * from patient where id=.$_POST['txt']; it works but i think because i have error in next line: *Warning*: mysql_num_rows() expects parameter 1 to be resource, boolean given $num2=Mysql_num_rows($result1); i echoed $ query1 and the result was this=select * from patient where id=1 maybe it can't convert $_POST['txt'] from String to integer and then it can't get my $num it is int in my mysql how can i correct $query1?
Re: [PHP] simple question abt convert to integer
Hi, I've a simply idea... If you have integer in your mysql, don't use at that field in the query... Try this: $query=select * from patient where id=.$id.; There isn't apostrofy in the mysql query... Bálint Horváth On 25 May 2011 06:06, Negin Nickparsa nickpa...@gmail.com wrote: my code is this: $query1=select * from patient where id=.$_POST['txt']; it works but i think because i have error in next line: *Warning*: mysql_num_rows() expects parameter 1 to be resource, boolean given $num2=Mysql_num_rows($result1); i echoed $ query1 and the result was this=select * from patient where id=1 maybe it can't convert $_POST['txt'] from String to integer and then it can't get my $num it is int in my mysql how can i correct $query1?
Re: [PHP] simple question abt convert to integer
$id=(int)$_POST['txt']; $query1=select * from patient where id=.$id.; echo $query1; $result1=mysql_query($query1); echo $result1; $num2=Mysql_num_rows($result1); $num3=Mysql_num_fields($result1); still it has previous error Here is my output:select * from patient where id=1 *Warning*: mysql_num_rows() expects parameter 1 to be resource, boolean given in *Warning*: mysql_num_fields() expects parameter 1 to be resource, boolean given in **
Re: [PHP] simple question abt convert to integer
Bálint Horváth, the second post of me is using your idea your idea is working but why i have error still?
Re: [PHP] simple question abt convert to integer
$result1=mysql_query($query1); echo $result1; it can't echo $result1 i don't know why?
Re: [PHP] simple question abt convert to integer
If the query is incorrect u get boolean: false, if its correct u get a resource id... Bálint Horváth On 25 May 2011 06:28, Negin Nickparsa nickpa...@gmail.com wrote:
Re: [PHP] simple question abt convert to integer
i recieve nothing not a resource id and nore false
Re: [PHP] simple question abt convert to integer
On Wed, May 25, 2011 at 08:57:18AM +0430, Negin Nickparsa wrote: $id=(int)$_POST['txt']; $query1=select * from patient where id=.$id.; You're not *thinking* about what you're doing. The above is silly. Think about it: you're sending a string to MySQL. If $_POST['txt'] returns a string which looks like the number 1, then $query1 = select * from patient where id = $_POST[txt]; should suffice. If you like, test $_POST['txt'] first by echoing it. echo $query1; $result1=mysql_query($query1); Ideally, you should be calling this function with an added connection parameter. Like this: $link = mysql_connect($connection_stuff); $result1 = mysql_query($query1, $link); It's not *necessary*, but advisable. mysql_query() returns a resource object, unless there is a problem. If there is a problem, then it returns FALSE. You can check what it returns this way: if (is_resource($result1)) print It's a resource!; elseif ($result1 === FALSE) print It's false!; else print I don't know what the heck it is!; echo $result1; I don't know what you'll get from this echo if $result1 truly is a resource. But if it's false, you won't get much. $result1 should be a resource object, which means it's opaque. You can't know what's in it unless you use a helper function like mysql_num_rows(), etc. $num2=Mysql_num_rows($result1); $num3=Mysql_num_fields($result1); still it has previous error Here is my output:select * from patient where id=1 *Warning*: mysql_num_rows() expects parameter 1 to be resource, boolean given in *Warning*: mysql_num_fields() expects parameter 1 to be resource, boolean given in ** Your error messages clearly mean that 1) you're not getting a proper resource object back from mysql_query(), or 2) you're somehow changing $result1 into a boolean before passing it to these other functions. But I suspect it's #1 above. Please see the documentation for these functions at php.net. It may even be available in your native language. Paul -- Paul M. Foster http://noferblatz.com http://quillandmouse.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple question abt convert to integer
Problem solved succesfully after changed the query integer apostrofyless.. and printed the mysql_errno() and mysql_error()... Remember: -In the script languages as php the apostrofy ' or or sg. like these means the string marker... -While ure developing show all error codes and messages... -If ur query contains errors u'll not get the resource id to use just a false boolean... -..and always check u don't have empty variables... :D Let's ride PHP! Bálint Horváth (Valentine) On 25 May 2011 06:57, Negin Nickparsa nickpa...@gmail.com wrote: :D tnx very much *Notice*: Undefined variable: query in *D:\phpweb\Doctor.php* on line *45* 1065:Query was empty
[PHP] Simple question on simplexml
I have a catalog in XML format: ?xml version=1.0 encoding=iso-8859-1 ? catalog book ... book book ... book ... /catalog Now I want to add another book, which I have as a SimpleXMLElement: $book = new SimpleXMLElement($string); where $string reads book ... book Can I add this new entry to the catalog using SimpleXML functions, or do I have to introduce a DOMDocument? As may be obvious, I am very new to PHP programming; and advice or suggestions gratefully received. -- Timothy Murphy e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie tel: +353-86-2336090, +353-1-2842366 s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple question on simplexml
there is this: http://php.net/manual/en/function.simplexml-element-addChild.php which will allow adding of string data (so you won't be needing to create the new SimpleXMLElement object as per your example below). obviously you will have to first load tghe complete xml document into simplexml using one of the following: http://php.net/manual/en/function.simplexml-load-file.php http://php.net/manual/en/function.simplexml-load-string.php Timothy Murphy wrote: I have a catalog in XML format: ?xml version=1.0 encoding=iso-8859-1 ? catalog book ... book book ... book ... /catalog Now I want to add another book, which I have as a SimpleXMLElement: $book = new SimpleXMLElement($string); where $string reads book ... book Can I add this new entry to the catalog using SimpleXML functions, or do I have to introduce a DOMDocument? As may be obvious, I am very new to PHP programming; and advice or suggestions gratefully received. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [suspicious - maybe spam] Re: [suspicious - maybe spam] [PHP] Simple question: How to declare Vars in PHP? (I know it's not necessary, but I still want to know)
James Williams wrote: No You don't declare variables in PHP. You just start using them. Perhaps you mean assign? Since your example of var = variableName; is actually an assignment in Javascript. In PHP you simply do: $one_var = $another_var; -Rasmus You are however, when dealing with OOP and classes required to declare you're variable, right? You can, but you don't need to. Try it. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [suspicious - maybe spam] Re: [suspicious - maybe spam] [PHP] Simple question: How to declareVars in PHP? (I know it's not necessary, but I still want to know)
Jon M. wrote: So, are you saying that it is absolutely PHP-illegal to do: Yes, it is illegal. Inside a class definition you can define properties like this, but for regular variables it is simply not supported. And it makes no sense. If you can't stop your hands from typing this stuff, do this: #var $varName; -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [suspicious - maybe spam] Re: [suspicious - maybe spam] [PHP] Simple question: How to declareVars in PHP? (I know it's not necessary, but I still want to know)
hi, On 5/5/05, Jon M. [EMAIL PROTECTED] wrote: Oops!! What I meant was: JavaScript: var varName; PHP: var $varName; I can't believe I did that (I have been writing JavaScript for a few years, and know better -I gotta get more sleep). So, are you saying that it is absolutely PHP-illegal to do: var $varName; in PHP??? Would it be ignored? Or would it screw up the interpreter? Yes. I checked for var $i = 1; it throwed parse error. so i think you cannot do. Rasmus Lerdorf [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jon M. wrote: I know in JavaScript, that you declare vars like so: var = variableName; So I'm assuming that in PHP you do it like this: var = $variableName; But there doesn't seem to be a single shred of documentation on PHP.net (or in ANY book) that covers this. All they say is that it's good practice, but not necessary. Then they always skip telling you how. I always like to declare vars since it helps me keep track of the vars I will be using, and I just like to do things right. So am I right about how you do it? Yes, No, example please?? No You don't declare variables in PHP. You just start using them. Perhaps you mean assign? Since your example of var = variableName; is actually an assignment in Javascript. In PHP you simply do: $one_var = $another_var; -Rasmus -- bala balachandar muruganantham blog lynx http://chandar.blogspot.com web http://www.chennaishopping.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[suspicious - maybe spam] [PHP] Simple question: How to declare Vars in PHP? (I know it's not necessary, but I still want to know)
I know in JavaScript, that you declare vars like so: var = variableName; So I'm assuming that in PHP you do it like this: var = $variableName; But there doesn't seem to be a single shred of documentation on PHP.net (or in ANY book) that covers this. All they say is that it's good practice, but not necessary. Then they always skip telling you how. I always like to declare vars since it helps me keep track of the vars I will be using, and I just like to do things right. So am I right about how you do it? Yes, No, example please?? -Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [suspicious - maybe spam] Re: [suspicious - maybe spam] [PHP] Simple question: How to declare Vars in PHP? (I know it's not necessary, but I still want to know)
Jon M. wrote: I know in JavaScript, that you declare vars like so: var = variableName; So I'm assuming that in PHP you do it like this: var = $variableName; But there doesn't seem to be a single shred of documentation on PHP.net (or in ANY book) that covers this. All they say is that it's good practice, but not necessary. Then they always skip telling you how. I always like to declare vars since it helps me keep track of the vars I will be using, and I just like to do things right. So am I right about how you do it? Yes, No, example please?? No You don't declare variables in PHP. You just start using them. Perhaps you mean assign? Since your example of var = variableName; is actually an assignment in Javascript. In PHP you simply do: $one_var = $another_var; -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [suspicious - maybe spam] Re: [suspicious - maybe spam] [PHP] Simple question: How to declare Vars in PHP? (I know it's not necessary, but I still want to know)
Hi On 5/5/05, Jon M. [EMAIL PROTECTED] wrote: I know in JavaScript, that you declare vars like so: var = variableName; So I'm assuming that in PHP you do it like this: var = $variableName; I think you can do like this inside a class var $variableName; But there doesn't seem to be a single shred of documentation on PHP.net (or in ANY book) that covers this. All they say is that it's good practice, but check out http://www.php.net/manual/en/language.variables.php not necessary. Then they always skip telling you how. I always like to declare vars since it helps me keep track of the vars I will be using, and I just like to do things right. So am I right about how you do it? Yes, No, example please?? when u use OO concepts, then you can use var. other wise its not neccessary. -Jon -- bala balachandar muruganantham blog lynx http://chandar.blogspot.com web http://www.chennaishopping.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [suspicious - maybe spam] Re: [suspicious - maybe spam] [PHP] Simple question: How to declare Vars in PHP? (I know it's not necessary, but I still want to know)
No You don't declare variables in PHP. You just start using them. Perhaps you mean assign? Since your example of var = variableName; is actually an assignment in Javascript. In PHP you simply do: $one_var = $another_var; -Rasmus You are however, when dealing with OOP and classes required to declare you're variable, right? -- jamwil.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [suspicious - maybe spam] Re: [suspicious - maybe spam] [PHP] Simple question: How to declareVars in PHP? (I know it's not necessary, but I still want to know)
Oops!! What I meant was: JavaScript: var varName; PHP: var $varName; I can't believe I did that (I have been writing JavaScript for a few years, and know better -I gotta get more sleep). So, are you saying that it is absolutely PHP-illegal to do: var $varName; in PHP??? Would it be ignored? Or would it screw up the interpreter? Rasmus Lerdorf [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jon M. wrote: I know in JavaScript, that you declare vars like so: var = variableName; So I'm assuming that in PHP you do it like this: var = $variableName; But there doesn't seem to be a single shred of documentation on PHP.net (or in ANY book) that covers this. All they say is that it's good practice, but not necessary. Then they always skip telling you how. I always like to declare vars since it helps me keep track of the vars I will be using, and I just like to do things right. So am I right about how you do it? Yes, No, example please?? No You don't declare variables in PHP. You just start using them. Perhaps you mean assign? Since your example of var = variableName; is actually an assignment in Javascript. In PHP you simply do: $one_var = $another_var; -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Simple Question: Reading exec(locate) results into an array
Hello all, I'm sure this is very rudimentary, sorry if this sounds ignorant. I've only dabbled a bit in other languages and I'm working with a small knowledge of php since I only use it on-and-off at my job. I scribbled up this script today at work off the top of my head for a customer who was looking for a printout of my company's PEAR location. I wanted something quick and easy that would be adaptable to find other items. I was surprised it even worked since I haven't really had a chance to dig into PHP yet: ?php $temp = exec(which pear); $temp2 = exec(locate pear); echo which = $temp BRBR locate = $temp2; ? When executing the commands directly within Unix, without the php script: 'which' yields 1 line: the path to the pear module for PHP 'locate' yields dozens of lines, paths to everything with 'pear' in it. However, this is the printout when running the script from a browser (same via command line) : --- which = /usr/local/bin/pear locate = /usr/ports/www/pear-HTTP_Upload/pkg-descr --- It's only printing out a single line for locate. I'm assuming i'd need to run a loop to read all the lines of locate from an array. My question is: what sort of general syntax can I use to get the results from locate stored in an array so it can be read out? I don't need a script written for me; a general nudge in the right direction or the right website would be incredibly helpful. I've had trouble finding anything relevant thus far. Thanks! -Karl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple Question: Reading exec(locate) results into an array
Karl Fry wrote: Hello all, I'm sure this is very rudimentary, sorry if this sounds ignorant. I've only dabbled a bit in other languages and I'm working with a small knowledge of php since I only use it on-and-off at my job. I scribbled up this script today at work off the top of my head for a customer who was looking for a printout of my company's PEAR location. I wanted something quick and easy that would be adaptable to find other items. I was surprised it even worked since I haven't really had a chance to dig into PHP yet: ?php $temp = exec(which pear); $temp2 = exec(locate pear); echo which = $temp BRBR locate = $temp2; ? When executing the commands directly within Unix, without the php script: 'which' yields 1 line: the path to the pear module for PHP 'locate' yields dozens of lines, paths to everything with 'pear' in it. However, this is the printout when running the script from a browser (same via command line) : --- which = /usr/local/bin/pear locate = /usr/ports/www/pear-HTTP_Upload/pkg-descr --- It's only printing out a single line for locate. I'm assuming i'd need to run a loop to read all the lines of locate from an array. My question is: what sort of general syntax can I use to get the results from locate stored in an array so it can be read out? I don't need a script written for me; a general nudge in the right direction or the right website would be incredibly helpful. I've had trouble finding anything relevant thus far. http://us4.php.net/manual/en/function.shell-exec.php -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] simple question
I have this function: function supscript($texto) { print(sup.$texto./sup); } But when i do: print 2.supscript(3); I get the 3 before the 2, how is that posible? And: print(supscript(3).2); makes the 2 appear before the 3. I am confused! Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple question
On Tue, 2005-02-01 at 01:41 +, Pagongski wrote: I have this function: function supscript($texto) { print(sup.$texto./sup); } But when i do: print 2.supscript(3); I get the 3 before the 2, how is that posible? And: print(supscript(3).2); makes the 2 appear before the 3. I am confused! Thanks probably because it calls the function before it calls the main print. try return instead of print. example: function supScript($txt) { return sup{$txt}/sup; } print 2 . supScript(3); You shouldn't print a function that prints.. ;-) -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development * --- Now hosting PostgreSQL 8.0! --- / -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple question
On Tuesday 01 February 2005 09:41, Pagongski wrote: Please use a *descriptive* subject. I have this function: function supscript($texto) { print(sup.$texto./sup); } But when i do: print 2.supscript(3); I get the 3 before the 2, how is that posible? And: print(supscript(3).2); makes the 2 appear before the 3. I am confused! You're trying to use the function supscript() as though it returned a value, it doesn't, it just prints something out directly. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple question
Thank you so much, it was really stupid of me, basic mistake. I solved it differently, although your solution is miles away better than mine. Heres what i did: function supscript($texto) { global $supa; $supa = sup.$texto./sup; } supscript(3); print (2.$supa); Complicated little thing, eh? Thanks :-) Pag -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple question
Pagongski wrote: I have this function: function supscript($texto) { print(sup.$texto./sup); } But when i do: print 2.supscript(3); I get the 3 before the 2, how is that posible? Your function should return the value, not print it. The way you have it now, the function must be ran before the original string can be printed. That's why you see the 3 before the 2. function supscript($texto) { return sup{$texto}/sup; } -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple question
On Mon, 2005-01-31 at 20:41, Pagongski wrote: I have this function: function supscript($texto) { print(sup.$texto./sup); } But when i do: print 2.supscript(3); I get the 3 before the 2, how is that posible? And: print(supscript(3).2); makes the 2 appear before the 3. I am confused! Your second example does not print the 2 before the 3. And the reason your first example prints the 3 before the 2 is because the the print inside the function prints first because the print that contains the call to it can't print until it receives the return value form the function. What you probably want is the following: function supscript($texto) { return sup.$texto./sup; } print 2.supscript(3); -- .. | 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] Simple question: $_POST
Stuart Felenstein wrote: When using $_POST vars is it required that a form is used ? In other words I can create an href link and echo variable and pick them up using $_GET in the following page. No so with $_POST ? Google for PostToHost and Rasmus Lerdorf if you want to use PHP to send POST data (IE, to forge filling in a FORM) You can also use JavaScript to create a FORM, I think, and then fill in all the stuff, and then 'submit' it, if you trust JavaScript to work right and want to learn JavaScript enough to get it working... You can also make your FORMs use METHOD=GET to send the data as $_GET instead of $_POST I'm not sure if any of these address what you really want to know, but they may help. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple question: $_POST
Stuart Felenstein wrote: When using $_POST vars is it required that a form is used ? In other words I can create an href link and echo variable and pick them up using $_GET in the following page. No so with $_POST ? in order to create POST vars the proper request headers need to sent to the browser. that could be done with some newfangled javascript techniques e.g. XHTTPRequest object - see sitepoint.com (Harry Fuecks article) if you don't care if a var comes via post or get you could use a func like this to avoid having to check both superglobals everytime /** * getGP() * * this function will return the value of a GET or POST var that corresponds to the * variable name pasted, if nothing is found NULL is returned. contents of POST array * takes precendence over the contents of the GET array. You can specify a value as second argument * which will be returned if the GP var *does not* exist; a third parameter can be given to * which will act as the return value if the GP *does* exist - the limitation is that the parameter cannot be * used to return a literal NULL; but I suggest that this would probably be a silly thing to do in practice * * @var string $v // the name of GP variable whose value to return * @var mixed $r // value to return if the GP variable was not set * @var mixed $t // value to return if the GP variable was set (i.e. override the value from GP) * * @return mixed */ function getGP($v = '', $r = null, $t = null) { if (!empty($v)) { if (isset($_GET[$v])) { $r = (!is_null($t)) ? $t: $_GET[$v]; } if (isset($_POST[$v])) { $r = (!is_null($t)) ? $t: $_POST[$v];} } return $r; } Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple question: $_POST
14 2005 16:48 Stuart Felenstein (a): When using $_POST vars is it required that a form is used ? exactly
Re: [PHP] Simple question: $_POST
On Friday 14 January 2005 21:48, Stuart Felenstein wrote: When using $_POST vars is it required that a form is used ? Better worded as if you want to pass values from one page to another and you want said values to be available in $_POST then yes, you *have* to use a form. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple question: $_POST
Jochem Maas wrote: Stuart Felenstein wrote: When using $_POST vars is it required that a form is used ? In other words I can create an href link and echo variable and pick them up using $_GET in the following page. No so with $_POST ? in order to create POST vars the proper request headers need to sent to the browser. that could be done with some newfangled javascript I had a bit of a thinko there - that should have read '...sent to the server' not '...sent to the browser', sorry! techniques e.g. XHTTPRequest object - see sitepoint.com (Harry Fuecks article) if you don't care if a var comes via post or get you could use a func like this to avoid having to check both superglobals everytime /** * getGP() * * this function will return the value of a GET or POST var that corresponds to the * variable name pasted, if nothing is found NULL is returned. contents of POST array * takes precendence over the contents of the GET array. You can specify a value as second argument * which will be returned if the GP var *does not* exist; a third parameter can be given to * which will act as the return value if the GP *does* exist - the limitation is that the parameter cannot be * used to return a literal NULL; but I suggest that this would probably be a silly thing to do in practice * * @var string $v // the name of GP variable whose value to return * @var mixed $r // value to return if the GP variable was not set * @var mixed $t // value to return if the GP variable was set (i.e. override the value from GP) * * @return mixed */ function getGP($v = '', $r = null, $t = null) { if (!empty($v)) { if (isset($_GET[$v])) { $r = (!is_null($t)) ? $t: $_GET[$v]; } if (isset($_POST[$v])) { $r = (!is_null($t)) ? $t: $_POST[$v];} } return $r; } Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Simple question: $_POST
--- Ford, Mike [EMAIL PROTECTED] wrote: To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -Original Message- From: Stuart Felenstein Sent: 14/01/05 13:48 When using $_POST vars is it required that a form is used ? In other words I can create an href link and echo variable and pick them up using $_GET in the following page. No so with $_POST ? Short answer: correct. Long answer: well, this being PHP, there's pretty much always ways and means, e.g. cURL. (I suspect, from the way you've asked the question, though, the short answer probably suffices! ;) Cheers! Mike Yes, the short answer sufficed, though the different responses were great and appreciated. I did not know about java alternatives or cURL or other php extensions. More alternatives for the future. Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple question: $_POST
On Fri, 2005-01-14 at 07:48, Stuart Felenstein wrote: When using $_POST vars is it required that a form is used ? In other words I can create an href link and echo variable and pick them up using $_GET in the following page. No so with $_POST ? You could probably create hidden vars and on the href set the var values and submit the form ( with form method defined as post of course). You could create the javascript needed in a function built dynamically setting the vars and simply call the function in the onclick method of the href. I think you will have to return false from the function so that the link won't try to go to nowhere. Bret -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Simple question: $_POST
When using $_POST vars is it required that a form is used ? In other words I can create an href link and echo variable and pick them up using $_GET in the following page. No so with $_POST ? Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Simple question
Im sure this question seems primitive to most of you, im new to using foreach with forms my question is how is the best way to keep from getting the submit button from comming through with the variables below is my code. form method=post action=?fm=newAdvertisera=insert centerpreb Advertiser Username input type=text name=uName Advertiser Password input type=text name=pass Advertiser Number Of Clicks Or Signups input type=text name=numAdds Select Advertisement select name=type option value=1Paid to click/option option value=2Paid to signup/option /select input type=submit name=go /form ?php if(isset($_GET['a'])) { $a = $_GET['a']; foreach($_POST as $key = $value) { echo '$value',br; } } ? Thanks in addition for any help
Re: [PHP] Simple question
webmaster wrote: how is the best way to keep from getting the submit button from comming through with the variables Don't name it? Just remember that users can send _any_ variable they want through a form... blindly looping through and accepting $_POST as a whole is probably a bad idea. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple question
Hello, Saturday, March 20, 2004, 6:08:36 AM, you wrote: w Im sure this question seems primitive to most of you, im new to w using foreach with forms my question is how is the best way to keep w from getting the submit button from comming through with the w variables below is my code. Two ways: 1) If you don't need to have a name for your submit button, then removing this element will stop it appearing in the $_POST array in the first place. If all you want to do is change the text of the submit button, use the value= attribute instead of name=. 2) If you DO need the name (because of JavaScript or something) then just place a check in your foreach loop to ignore the $key called go. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Simple question
Hello, I have only one simple question.. I'm using this method to get the values from the text box: if(isset($_POST[Submit]) $_POST[Submit]==Submit) { $add = $_POST['textbox'] ; } But I don't know how to write the source for this: If the value from the textbox ($add) is Hello then.. do something. I think it could be nicely done with IF, but I dont know how to write this.. Can someone help me, please? Regards, Lab. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Simple question I hope
I am using Pdf-Php to create pdf docs. I have a long text line that wraps automatically when outputted in the pdf. That is what it is suppose to do, however, it also outputs the new lines of the text in the source of the php file. That is not what I want. So I do a string replace for the \n and replace it will or nothing and instead I getor two spaces. Example: $Scope = i$Report/i is a report summarizing all the locations within the Northeast Region. It contains all known business lines including LDS, BDS, and BS. Below each location will be listed with summary data relating to the location such as the full mailing address, phone number, network information and information about the phone system.; $Scope = str_replace(\n, , $Scope); Here I have a newline in the first line after the word known. I don't want it to put the new line there. So I added the str_replace function, but I get a double space instead of a single space. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple question I hope
On Tue, 2003-12-16 at 15:02, Christopher J. Crane wrote: I am using Pdf-Php to create pdf docs. I have a long text line that wraps automatically when outputted in the pdf. That is what it is suppose to do, however, it also outputs the new lines of the text in the source of the php file. That is not what I want. So I do a string replace for the \n and replace it will or nothing and instead I getor two spaces. Example: $Scope = i$Report/i is a report summarizing all the locations within the Northeast Region. It contains all known business lines including LDS, BDS, and BS. Below each location will be listed with summary data relating to the location such as the full mailing address, phone number, network information and information about the phone system.; $Scope = str_replace(\n, , $Scope); Here I have a newline in the first line after the word known. I don't want it to put the new line there. So I added the str_replace function, but I get a double space instead of a single space. try: $Scope = trim( ereg_replace( '[[:space:]]+', ' ', $Scope ) ); 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] Simple question I hope
That worked. Thanks Robert. Robert Cummings [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tue, 2003-12-16 at 15:02, Christopher J. Crane wrote: I am using Pdf-Php to create pdf docs. I have a long text line that wraps automatically when outputted in the pdf. That is what it is suppose to do, however, it also outputs the new lines of the text in the source of the php file. That is not what I want. So I do a string replace for the \n and replace it will or nothing and instead I getor two spaces. Example: $Scope = i$Report/i is a report summarizing all the locations within the Northeast Region. It contains all known business lines including LDS, BDS, and BS. Below each location will be listed with summary data relating to the location such as the full mailing address, phone number, network information and information about the phone system.; $Scope = str_replace(\n, , $Scope); Here I have a newline in the first line after the word known. I don't want it to put the new line there. So I added the str_replace function, but I get a double space instead of a single space. try: $Scope = trim( ereg_replace( '[[:space:]]+', ' ', $Scope ) ); 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] Simple Question on Date conversion
Dear all Can anyone pls tell me how i can turn number : 10 to Oct? i counting on the month, that's why i won't to convert the result to month! Thx a lot Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Simple Question on Date conversion
Dear all Can anyone pls tell me how i can turn number : 10 to Oct? i counting on the month, that's why i won't to convert the result to month! $months = array(1='January',2='February',3='March',...); echo $months[$your_month_number]; You could also use a combo of date() and mktime(). echo date('F',mktime(0,0,0,$your_month_number,15,2002); The day and year part of mktime() can be anything. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] simple question
Where can I found last version of the GD library ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] simple question
Hi, Where can I found last version of the GD library ? http://www.boutell.com/gd/ HTH Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple question
http://www.boutell.com/gd/http/ is a good start!! Jean-François Marseaut wrote: Where can I found last version of the GD library ? -- Timothy Hitchens Technologist / Entrepreneur e-mail: [EMAIL PROTECTED] mobile: 0419 521 440 - HiTCHO Group - ABN: 85 816 540 110 Web Site: http://www.hitcho.com.au/ Snail Mail: PO Box 101 Arana Hills QLD 4054 Telephone: 07 3351 0951 - Facsimile: 07 3351 0952 IMPORTANT: This email may be the view of the individual and not that of the organisation. The contents of this electronic mail (including attachments) may be privileged and commercially confidential. Any unauthorised use of the contents is expressly prohibited. If you have received this document in error, please advise us by telephone immediately and then delete the document. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] simple question
http://www.boutell.com/gd/ -Original Message- From: Jean-François Marseaut [mailto:[EMAIL PROTECTED]] Sent: 14 October 2002 13:51 To: [EMAIL PROTECTED] Subject: [PHP] simple question Where can I found last version of the GD library ? -- 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
[PHP] Simple question I guess.
Hi! I have a site with all my movies and stuff stored in a database. And I have made a admin page where I can add, delete and update records. When I add new records, I have made a listbox for the category (ex. action, comedy etc.) so I dont have to write it every time I add a new record. But when I push the update button and the data thats stored in the database is printed its printed just in a textarea. I know its possible to list the data in a listbox, but how do I get the right category selected for the movie I choose? Best regards Raymond -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Simple question I guess.
I have a site with all my movies and stuff stored in a database. And I have made a admin page where I can add, delete and update records. When I add new records, I have made a listbox for the category (ex. action, comedy etc.) so I dont have to write it every time I add a new record. But when I push the update button and the data thats stored in the database is printed its printed just in a textarea. I know its possible to list the data in a listbox, but how do I get the right category selected for the movie I choose? select name=whatever option value=1 ?if($something==1) { echo selected; } ?One/option option value=2 ?if($something==2) { echo selected; } ?Two/option etc... /select Put it into a function and the possible values into an array to make it easier... ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple question I guess.
Okay im not sure i understand you- you want to create a page where it will suck an item out of a database, and use it to choose which item in a drop down menu should be selected? If so, you can try something like select name=catagory option value=0?php if ($catagory == 0) {echo selected}; ?Action/option option value=1?php if ($catagory == 1) {echo selected}; ?Comedy/option option value=2?php if ($catagory == 2) {echo selected}; ?Etc./option /select On Monday 22 July 2002 16:07 pm, Raymond Lilleodegard wrote: Hi! I have a site with all my movies and stuff stored in a database. And I have made a admin page where I can add, delete and update records. When I add new records, I have made a listbox for the category (ex. action, comedy etc.) so I dont have to write it every time I add a new record. But when I push the update button and the data thats stored in the database is printed its printed just in a textarea. I know its possible to list the data in a listbox, but how do I get the right category selected for the movie I choose? Best regards Raymond -- What I conclude is that religion has nothing to do with experience or reason but with deep and irrational needs Richard Taylor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] simple question
Hello friends. I am able to add and query my database using php. I now wish to build webpages with textboxes and search the database with criteria from the textboxes. Can someone tell me the resources for building these pages? Thanks Denis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Simple Question
I have a quick question that I haven't been able to find the answer to yet. I've made a couple of guest books via PHP but the biggest problem I'm having is if any one inputs a ' or or anything like that, the output in the book shows the stupid \ for the escape. So the word Tom's looks like Tom\'s Is there anyway for me to handle those characters so the backslash doesn't appear in the output? Thanks, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Simple Question
stripslashes() -Original Message- From: Tom Ray [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 13, 2001 2:47 PM To: [EMAIL PROTECTED] Subject: [PHP] Simple Question I have a quick question that I haven't been able to find the answer to yet. I've made a couple of guest books via PHP but the biggest problem I'm having is if any one inputs a ' or or anything like that, the output in the book shows the stupid \ for the escape. So the word Tom's looks like Tom\'s Is there anyway for me to handle those characters so the backslash doesn't appear in the output? Thanks, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Simple(?) Question
Hello, Is there a way to post to a script without any user interventions... e.g The user posts to a script, and the script posts back to the original one. Thanks!
RE: [PHP] Simple(?) Question
if you want the browser to do it (as opposed to getting php to do it), then you could use a hidden form, like: body onload=document.forms[0].submit(); form action=... method=post input type=hidden name=... value=... ... etc (all hidden fields) ... /form -Original Message- From: Andrew Forgue [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 06, 2001 9:32 AM To: [EMAIL PROTECTED] Subject: [PHP] Simple(?) Question Hello, Is there a way to post to a script without any user interventions... e.g The user posts to a script, and the script posts back to the original one. Thanks!
Re: [PHP] Simple(?) Question
* Andrew Forgue [EMAIL PROTECTED] [Dec 05. 2001 17:35]: Is there a way to post to a script without any user interventions... e.g The user posts to a script, and the script posts back to the original one. (Please set your mail client to wrap at 72 chars) cURL can do this, among other things: curl.haxx.se Or something like this: http://marc.theaimsgroup.com/?l=php-generalm=100494042908669w=2 -- -Brian Clark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Simple Question: PHP, MySQL, HTML Form and NULL
I have added a new column in an existing MYSQL table called event_date - type: DATE, NULL default. This database field will be filled if and when the field in the HTML form is complete. When I added the new field to MySQL, it automatically assigned NULL to all the existing records - which is what I wanted it to do. I tested the HTML form, and when someone enters a date in the HTML form, the date appears correctly in the table field. Perfect. Now my question: When the HTML form date field is left blank and the form is submitted, instead of putting NULL in the MySQL event_date field, I found: -00-00. Is this because the form is submitting an to the database field? Is there some kind of if/then statement I should use so that when the field is empty, NULL will be entered into that table field? Thank you, Shawna -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Simple Question: PHP, MySQL, HTML Form and NULL
On Wed, 5 Dec 2001 09:01, [EMAIL PROTECTED] wrote: I have added a new column in an existing MYSQL table called event_date - type: DATE, NULL default. This database field will be filled if and when the field in the HTML form is complete. When I added the new field to MySQL, it automatically assigned NULL to all the existing records - which is what I wanted it to do. I tested the HTML form, and when someone enters a date in the HTML form, the date appears correctly in the table field. Perfect. Now my question: When the HTML form date field is left blank and the form is submitted, instead of putting NULL in the MySQL event_date field, I found: -00-00. Is this because the form is submitting an to the database field? Is there some kind of if/then statement I should use so that when the field is empty, NULL will be entered into that table field? Thank you, Shawna If memory serves me correctly, you need to test for an empty variable; if empty, assign it the value NULL (no quotes around it!) -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA Buy Land Now. It's Not Being Made Any More. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Simple Question, I think
I would suggest you implement this at the web server level. If using Apache, use virtual hosting or perhaps a rewrite condition if needed. If you must do this in PHP, and you want to do is redirect the user to a particular directory depending on the URL they type, then something like this should work: switch ($HTTP_HOST) { case www.firstdomain.com: header(Location: http://www.domainname.com/dir_01;); break; case www.seconddomain.com: header(Location: http://www.domainname.com/dir_02;); break; case www.thirddomain.com: header(Location: http://www.domainname.com/dir_03;); break; } Ralph -Original Message- From: Ratfish [mailto:[EMAIL PROTECTED]] Sent: Monday, October 01, 2001 7:25 PM To: [EMAIL PROTECTED] Subject: [PHP] Simple Question, I think All I want to do is what an ASP page I have is doing. I just want to host multiple sites with one page like the one in the article below until I can get my head around the real way of doing it. http://www.zdnet.com/devhead/stories/articles/0,4413,2418330,00.html Surely there is a PHP equivalent? Thanks Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Simple Question, I think
Try also mod_rewrite of apache. It is great for doing such things. Visit apache.org and search docs for mod_rewrite or simply look into archives of this list. Maxim Maletsky www.PHPBeginner.com -Original Message- From: Ralph Guzman [mailto:[EMAIL PROTECTED]] Sent: mercoledi 3 ottobre 2001 10.03 To: Ratfish; [EMAIL PROTECTED] Subject: RE: [PHP] Simple Question, I think I would suggest you implement this at the web server level. If using Apache, use virtual hosting or perhaps a rewrite condition if needed. If you must do this in PHP, and you want to do is redirect the user to a particular directory depending on the URL they type, then something like this should work: switch ($HTTP_HOST) { case www.firstdomain.com: header(Location: http://www.domainname.com/dir_01;); break; case www.seconddomain.com: header(Location: http://www.domainname.com/dir_02;); break; case www.thirddomain.com: header(Location: http://www.domainname.com/dir_03;); break; } Ralph -Original Message- From: Ratfish [mailto:[EMAIL PROTECTED]] Sent: Monday, October 01, 2001 7:25 PM To: [EMAIL PROTECTED] Subject: [PHP] Simple Question, I think All I want to do is what an ASP page I have is doing. I just want to host multiple sites with one page like the one in the article below until I can get my head around the real way of doing it. http://www.zdnet.com/devhead/stories/articles/0,4413,2418330,00.html Surely there is a PHP equivalent? Thanks Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Simple Question, I think
I would suggest you implement this at the web server level. If using Apache, use virtual hosting or perhaps a rewrite condition if needed. If you must do this in PHP, and you want to do is redirect the user to a particular directory depending on the URL they type, then something like this should work: switch ($HTTP_HOST) { case www.firstdomain.com: header(Location: http://www.domainname.com/dir_01;); break; case www.seconddomain.com: header(Location: http://www.domainname.com/dir_02;); break; case www.thirddomain.com: header(Location: http://www.domainname.com/dir_03;); break; } Ralph -Original Message- From: Ratfish [mailto:[EMAIL PROTECTED]] Sent: Monday, October 01, 2001 7:25 PM To: [EMAIL PROTECTED] Subject: [PHP] Simple Question, I think All I want to do is what an ASP page I have is doing. I just want to host multiple sites with one page like the one in the article below until I can get my head around the real way of doing it. http://www.zdnet.com/devhead/stories/articles/0,4413,2418330,00.html Surely there is a PHP equivalent? Thanks Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Simple Question, I think
All I want to do is what an ASP page I have is doing. I just want to host multiple sites with one page like the one in the article below until I can get my head around the real way of doing it. http://www.zdnet.com/devhead/stories/articles/0,4413,2418330,00.html Surely there is a PHP equivalent? Thanks Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Simple Question, I think
Perhaps check the URL and direct as such using header();. Use phpinfo(); to find what var holds the current URL. - k - Original Message - From: Ratfish [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, October 01, 2001 10:25 PM Subject: [PHP] Simple Question, I think All I want to do is what an ASP page I have is doing. I just want to host multiple sites with one page like the one in the article below until I can get my head around the real way of doing it. http://www.zdnet.com/devhead/stories/articles/0,4413,2418330,00.html Surely there is a PHP equivalent? Thanks Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Simple Question, I think
Thanks guys, that's just what I wanted to hear.and so quick too! From: [EMAIL PROTECTED] (Lawrence Sheed) Newsgroups: php.general Date: Mon, 1 Oct 2001 22:40:29 -0400 To: [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: [PHP] Simple Question, I think Simple to do it in php, but i would think its better done in apache using virtual host configuration. do a google search for virtual host apache -Original Message- From: Ratfish [mailto:[EMAIL PROTECTED]] Sent: October 2, 2001 10:25 AM To: [EMAIL PROTECTED] Subject: [PHP] Simple Question, I think All I want to do is what an ASP page I have is doing. I just want to host multiple sites with one page like the one in the article below until I can get my head around the real way of doing it. http://www.zdnet.com/devhead/stories/articles/0,4413,2418330,00.html Surely there is a PHP equivalent? Thanks Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] simple question...
ey guys.. how do i check if the postdata is a valid time format? something like '2001-09-15' I hate it when they'll be entering garbage in it... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] simple question...
One more thing... If I got '2001-09-01' Is there a fast way of incrementing the month of it? making it '2001-10-01' ? - Original Message - From: * RzE: [EMAIL PROTECTED] To: Ker Ruben Ramos [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, September 20, 2001 6:04 AM Subject: Re: [PHP] simple question... Original message From: Ker Ruben Ramos [EMAIL PROTECTED] Date: Thu, Sep 20, 2001 at 08:56:03PM -0700 Message-ID: 00f801c14251$5aa288b0$bb05aacb@weblinqproxy Subject: [PHP] simple question... ey guys.. how do i check if the postdata is a valid time format? something like '2001-09-15' I hate it when they'll be entering garbage in it... /Original message Reply See the example below: --- PHP Example Code --- PRE ?php /* Valid date */ $myDate = 2001-09-12; /* Invalid date */ //$myDate = 2001-13-20; /* Another invalid date */ //$myDate = 20o1-10-x9; if (ereg (([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}), $myDate, $matches)) { if (checkdate ($matches[2], $matches[3], $matches[1])) { print (Valid date!\n\n); print (date (r, mktime (0,0,0,$matches[2], $matches[3], $matches[1]))); } else { print (No valid date!); } } else { print (No valid date!); } ? /PRE --- End of PHP Example Code --- /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] simple question...
One more thing... If I got '2001-09-01' Is there a fast way of incrementing the month of it? making it '2001-10-01' ? list($year, $month, $day) = explode(-, $date); $month++; if ($month == 13) $month = 1; $date = $year-$month-$day; Eric O'Connel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] simple question...
Original message From: Ker Ruben Ramos [EMAIL PROTECTED] Date: Thu, Sep 20, 2001 at 09:36:55PM -0700 Message-ID: 012b01c14257$0afb3db0$bb05aacb@weblinqproxy Subject: Re: [PHP] simple question... One more thing... If I got '2001-09-01' Is there a fast way of incrementing the month of it? making it '2001-10-01' ? /Original message Reply You should date() do the work here. So just take the month and then +1. Date() will take care the result is a valid date. Below is some example... --- PHP Example Code --- PRE ?php $myDate = 2001-09-12; if (ereg (([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}), $myDate, $matches)) { if (checkdate ($matches[2], $matches[3], $matches[1])) { print (date (Y-m-d, mktime (0,0,0,$matches[2]+1, $matches[3], $matches[1]))); } else { print (No valid date!); } } else { print (No valid date!); } ? /PRE --- End of PHP Example Code --- /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] simple question...
You should date() do the work here. So just take the month and then +1. Date() will take care the result is a valid date. Below is some example... Well... I meant: let mktime() do the work... not date(). Date() only shows the result of mktime() in a proper format. Mktime() makes sure it's a valid time(stamp) :) -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] simple question...
again.. one more thing How do I know how many days date differ? let's say '2001-09-01' and '2001-09-08'. Just looking for the fastest way of code to run. - Original Message - From: * RzE: [EMAIL PROTECTED] To: Ker Ruben Ramos [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, September 20, 2001 6:46 AM Subject: Re: [PHP] simple question... You should date() do the work here. So just take the month and then +1. Date() will take care the result is a valid date. Below is some example... Well... I meant: let mktime() do the work... not date(). Date() only shows the result of mktime() in a proper format. Mktime() makes sure it's a valid time(stamp) :) -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] simple question...
Original message From: Ker Ruben Ramos [EMAIL PROTECTED] Date: Thu, Sep 20, 2001 at 10:16:01PM -0700 Message-ID: 016101c1425c$819cdcd0$bb05aacb@weblinqproxy Subject: Re: [PHP] simple question... again.. one more thing How do I know how many days date differ? let's say '2001-09-01' and '2001-09-08'. Just looking for the fastest way of code to run. /Original message Reply The sample code below does pretty much what you want. BUT!!! It's not a very nice solution... Eg it cannot calculate a difference of more than one year :( Furthermore I must point out that there is no error-checking in this example. So if you _do_ want to use this, you'll have to add the error-checking. Sorry that it's not a really good solution, but due to lack of time, I could not think of anything better right now... --- PHP Example Code --- PRE ?php $dateOne = 2001-09-01; $dateTwo = 2001-09-08; ereg (([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}), $dateOne, $match_1); ereg (([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}), $dateTwo, $match_2); $stampOne = mktime (0,0,0,$match_1[2],$match_1[3],$match_1[1]); $stampTwo = mktime (0,0,0,$match_2[2],$match_2[3],$match_2[1]); $days_differ = date(z, ($stampTwo-$stampOne)); print (Days: $days_differ); ? /PRE --- End of PHP Example Code --- /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] simple question...
Well, Here is a function that may be helpful. The bad part is that I never finished it, so it only accepts dates in the MDY format... http://www.deltacron.com/source/check_date.php -Jason Garber www.deltacron.com At 08:56 PM 9/20/2001 -0700, you wrote: ey guys.. how do i check if the postdata is a valid time format? something like '2001-09-15' I hate it when they'll be entering garbage in it... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] simple question...
Well, Here is a function that may be helpful. The bad part is that I never finished it, so it only accepts dates in the MDY format... http://www.deltacron.com/source/check_date.php BTW... If you already have a connection to MySQL, you could send simple queries to it to take advantage of its large amount of date functions. This is probably not optimal though! -Jason Garber www.deltacron.com At 08:56 PM 9/20/2001 -0700, you wrote: ey guys.. how do i check if the postdata is a valid time format? something like '2001-09-15' I hate it when they'll be entering garbage in it... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Simple question (what's ISAPI ?)
Hi folks. Can someone tell me what ISAPI is? I've requested how I could run PHP faster, if 20 USER's access my files at the same time. In my case, PHP run's the php.exe (ca. 5 MB) every time seperatly, and this eats my win-resources! Someone guides me to use it as an ISAPI module but WHAT is that? and HOW can I do that under my win-operation system. Thank's for any help! Tribun (Patrick) --- mp3o.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Simple question (what's ISAPI ?)
On Monday 13 August 2001 08:46, Tribun wrote: Hi folks. Can someone tell me what ISAPI is? It's microsoft's API for running software in IIS. I've requested how I could run PHP faster, if 20 USER's access my files at the same time. Using ISAPI means that php stays alive while the server is alive, so there is no overhead in starting and closing down php.exe on each request. There is a perfomance benefit, although once the script is actually going the speed is the same. i.e. the speed benefit is a fixed amount of time per script. This means you'll notice the speedup much more on shorter scripts. Now the bad news. The PHP ISAPI module is not very stable. For me, it won't work for more than a couple of requests without falling over. Others report more success. If you want the speed benefit of a server API version, plus stability, change from IIS to Apache and run the Apache module version of PHP. Cheers -- Phil Driscoll -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] simple question
is there a function to turn all chars that are not alphanumric to show \xhh but hh being the hex version of it :)?
Re: [PHP] simple question
Hi ReDucTor! On Mon, 09 Jul 2001, ReDucTor wrote: is there a function to turn all chars that are not alphanumric to show \xhh but hh being the hex version of it :)? you mean bin2hex() under String Function section? :) -- teodor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] simple question
eval(\$string=\.eregi_replace(([^A-Z]), \\x\.dechex(ord(\\\1\)).\, $string).\;); ;-) /* Chris Lambert, CTO - [EMAIL PROTECTED] WhiteCrown Networks - More Than White Hats Web Application Security - www.whitecrown.net */ - Original Message - From: ReDucTor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, July 08, 2001 10:18 AM Subject: [PHP] simple question is there a function to turn all chars that are not alphanumric to show \xhh but hh being the hex version of it :)? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] simple question
Lowercase letters are included (eregI_replace) but you could add number support with: [^A-Z0-9] __ / Chris Lambert - [EMAIL PROTECTED] |- ICQ #: 16435685 - AIM: ClipperChris `- Cell: (401) 743-2786 - http://sms.clambert.org/ - Original Message - From: ReDucTor [EMAIL PROTECTED] To: Chris Lambert - WhiteCrown Networks [EMAIL PROTECTED] Sent: Sunday, July 08, 2001 11:45 AM Subject: Re: [PHP] simple question | nice, but i might change it to have lower case and numbers...hehehe | | btw thx | - Original Message - | From: Chris Lambert - WhiteCrown Networks [EMAIL PROTECTED] | To: [EMAIL PROTECTED] | Sent: Monday, July 09, 2001 12:50 AM | Subject: Re: [PHP] simple question | | | eval(\$string=\.eregi_replace(([^A-Z]), | \\x\.dechex(ord(\\\1\)).\, $string).\;); | | ;-) | | /* Chris Lambert, CTO - [EMAIL PROTECTED] | WhiteCrown Networks - More Than White Hats | Web Application Security - www.whitecrown.net | */ | | - Original Message - | From: ReDucTor [EMAIL PROTECTED] | To: [EMAIL PROTECTED] | Sent: Sunday, July 08, 2001 10:18 AM | Subject: [PHP] simple question | | | is there a function to turn all chars that are not alphanumric to show | \xhh | but hh being the hex version of it :)? | | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | To contact the list administrators, e-mail: [EMAIL PROTECTED] | | | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] simple question
this is wierd, i have the following... $buffer = eregi_replace([^A-Z0-9], (\\x.dechex(ord(\\1)).) , $buffer); and this is what buffer is m192.168.0.2:27015Counter-Strike 1.1 Serverde_dust2cstrikeCounterStrike+dwwww.nuclearbox.com/podbot but this is what comes out (\x5c)(\x5c)(\x5c)(\x5c)m192(\x5c)168(\x5c)0(\x5c)2(\x5c)27015 and \x5c is \ ne1 know why? - Original Message - From: Chris Lambert [EMAIL PROTECTED] To: ReDucTor [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, July 09, 2001 2:47 AM Subject: Re: [PHP] simple question Lowercase letters are included (eregI_replace) but you could add number support with: [^A-Z0-9] __ / Chris Lambert - [EMAIL PROTECTED] |- ICQ #: 16435685 - AIM: ClipperChris `- Cell: (401) 743-2786 - http://sms.clambert.org/ - Original Message - From: ReDucTor [EMAIL PROTECTED] To: Chris Lambert - WhiteCrown Networks [EMAIL PROTECTED] Sent: Sunday, July 08, 2001 11:45 AM Subject: Re: [PHP] simple question | nice, but i might change it to have lower case and numbers...hehehe | | btw thx | - Original Message - | From: Chris Lambert - WhiteCrown Networks [EMAIL PROTECTED] | To: [EMAIL PROTECTED] | Sent: Monday, July 09, 2001 12:50 AM | Subject: Re: [PHP] simple question | | | eval(\$string=\.eregi_replace(([^A-Z]), | \\x\.dechex(ord(\\\1\)).\, $string).\;); | | ;-) | | /* Chris Lambert, CTO - [EMAIL PROTECTED] | WhiteCrown Networks - More Than White Hats | Web Application Security - www.whitecrown.net | */ | | - Original Message - | From: ReDucTor [EMAIL PROTECTED] | To: [EMAIL PROTECTED] | Sent: Sunday, July 08, 2001 10:18 AM | Subject: [PHP] simple question | | | is there a function to turn all chars that are not alphanumric to show | \xhh | but hh being the hex version of it :)? | | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | To contact the list administrators, e-mail: [EMAIL PROTECTED] | | | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] simple question
You messed up the regular expression I gave you. The parenthesis need to go in the first paramater, not the second. Otherwise it will replace an string instead of a single character. /* Chris Lambert, CTO - [EMAIL PROTECTED] WhiteCrown Networks - More Than White Hats Web Application Security - www.whitecrown.net */ - Original Message - From: ReDucTor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, July 08, 2001 1:28 PM Subject: Re: [PHP] simple question this is wierd, i have the following... $buffer = eregi_replace([^A-Z0-9], (\\x.dechex(ord(\\1)).) , $buffer); and this is what buffer is m192.168.0.2:27015Counter-Strike 1.1 Serverde_dust2cstrikeCounterStrike+dwwww.nuclearbox.com/podbot but this is what comes out (\x5c)(\x5c)(\x5c)(\x5c)m192(\x5c)168(\x5c)0(\x5c)2(\x5c)27015 and \x5c is \ ne1 know why? - Original Message - From: Chris Lambert [EMAIL PROTECTED] To: ReDucTor [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, July 09, 2001 2:47 AM Subject: Re: [PHP] simple question Lowercase letters are included (eregI_replace) but you could add number support with: [^A-Z0-9] __ / Chris Lambert - [EMAIL PROTECTED] |- ICQ #: 16435685 - AIM: ClipperChris `- Cell: (401) 743-2786 - http://sms.clambert.org/ - Original Message - From: ReDucTor [EMAIL PROTECTED] To: Chris Lambert - WhiteCrown Networks [EMAIL PROTECTED] Sent: Sunday, July 08, 2001 11:45 AM Subject: Re: [PHP] simple question | nice, but i might change it to have lower case and numbers...hehehe | | btw thx | - Original Message - | From: Chris Lambert - WhiteCrown Networks [EMAIL PROTECTED] | To: [EMAIL PROTECTED] | Sent: Monday, July 09, 2001 12:50 AM | Subject: Re: [PHP] simple question | | | eval(\$string=\.eregi_replace(([^A-Z]), | \\x\.dechex(ord(\\\1\)).\, $string).\;); | | ;-) | | /* Chris Lambert, CTO - [EMAIL PROTECTED] | WhiteCrown Networks - More Than White Hats | Web Application Security - www.whitecrown.net | */ | | - Original Message - | From: ReDucTor [EMAIL PROTECTED] | To: [EMAIL PROTECTED] | Sent: Sunday, July 08, 2001 10:18 AM | Subject: [PHP] simple question | | | is there a function to turn all chars that are not alphanumric to show | \xhh | but hh being the hex version of it :)? | | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | To contact the list administrators, e-mail: [EMAIL PROTECTED] | | | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Simple question about mail() limitations (if any :)
on IIS it is much better solution for more than few mails is to put them simply in pickup directory of smtp server, I am also sure that there is a similar possibility on linux How can I identify the location of the pickup directory for the smtp server (on NT)? Euan Greig Technical Consultant BRANN DATA [EMAIL PROTECTED] 01285 645997 ** Any opinions expressed in this email are those of the individual and not necessarily the Company. This email and any files transmitted with it, including replies and forwarded copies (which may contain alterations) subsequently transmitted from the Company, are confidential and solely for the use of the intended recipient. If you are not the intended recipient or the person responsible for delivering to the intended recipient, be advised that you have received this email in error and that any use is strictly prohibited. ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Simple question about mail() limitations (if any :)
Hi, Before I try it myself and kill my server :), is it safe to send via mail() function multiply e-mails like: while (expr) { mail ($to, $subject, $message); } Are there any limitation in this? (e.g. 100 mails? 100.000? 1.000.000?) If so, is it possible to work around the limitation by using delay between sending certain amount of mails? Regards, Sumarlidi Einar Dadason SED - Graphic Design -- Phone: (+354) 4615501 Mobile: (+354) 8960376 Fax: (+354) 4615503 E-mail: [EMAIL PROTECTED] Homepage:www.sed.is - New Homepage! -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Simple question about mail() limitations (if any :)
on IIS it is much better solution for more than few mails is to put them simply in pickup directory of smtp server, I am also sure that there is a similar possibility on linux -almir ""SED"" [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, Before I try it myself and kill my server :), is it safe to send via mail() function multiply e-mails like: while (expr) { mail ($to, $subject, $message); } Are there any limitation in this? (e.g. 100 mails? 100.000? 1.000.000?) If so, is it possible to work around the limitation by using delay between sending certain amount of mails? Regards, Sumarlidi Einar Dadason SED - Graphic Design -- Phone: (+354) 4615501 Mobile: (+354) 8960376 Fax: (+354) 4615503 E-mail: [EMAIL PROTECTED] Homepage:www.sed.is - New Homepage! -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Simple question!!!
Hi, Imagine the following script: HTML TITLESome Title/TITLE BODY ?php $var = 1; if ($var == 1) { die ("I'm dead"); } echo "I'm alive"; ? /BODY /HTML If I try to execute via Internet Explorer ("5.x") apparently every thing works fine. It shows the string "I'm dead". But if I use the Netscape 4.7x, I get a blank screen. When I view the Source Code ("HTML code in Netscape") it shows: HTML TITLESome Title/TITLE BODY I'm dead Netscape can't render the page if its missing the /BODY and /HTML tags in the end. I already used 'return' end 'exit' functions but with the same result. There is some configuration parameter to the PHP server to send the rest of HTML code after exit the script or workaround? Thanks, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Simple question!!!
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Ricardo D'Aguiar) wrote: Imagine the following script: HTML TITLESome Title/TITLE BODY ?php $var = 1; if ($var == 1) { die ("I'm dead"); } echo "I'm alive"; ? /BODY /HTML If I try to execute via Internet Explorer ("5.x") apparently every thing works fine. It shows the string "I'm dead". But if I use the Netscape 4.7x, I get a blank screen. When I view the Source Code ("HTML code in Netscape") it shows: HTML TITLESome Title/TITLE BODY I'm dead Netscape can't render the page if its missing the /BODY and /HTML tags in the end. I already used 'return' end 'exit' functions but with the same result. There is some configuration parameter to the PHP server to send the rest of HTML code after exit the script or workaround? Is it an option to just move the code below the /html tag? Another option would be to echo the closing tags from within the conditional, prior to calling the die(). I believe output buffering can also be used to achieve what you want, but someone else will have to explain how (whether?) that can be done here. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Simple question!!!
Hi, CC wrote: (...)Another option would be to echo the closing tags from within the conditional, prior to calling the die(). I already thought that, but if I want to use the die function inside another function that can be called anywhere in the script (inside a table or form) I've possibly the same problem. I believe output buffering can also be used to achieve what you want, but someone else will have to explain how (whether?) that can be done here. That a good idea, I thinks it is a new feature of PHP 4.0. Thanks ... +++ Ricardo D'Aguiar MemoSis - Sistemas Informticos Portugal +++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]