php-general Digest 19 Mar 2003 11:12:59 -0000 Issue 1947 Topics (messages 140213 through 140271):
Re: Using PHP to get a word count of a MSword doc 140213 by: Pete James 140236 by: -{ Rene Brehmer }- 140237 by: -{ Rene Brehmer }- php and javascript 140214 by: Antoine 140215 by: Jim Lucas 140217 by: Oscar F 140218 by: Kevin Stone 140220 by: Chris Hayes 140243 by: -{ Rene Brehmer }- Recommended package for online editing of HTML files 140216 by: Brad Hubbard 140226 by: Marco Tabini Re: Encrypt data to base for authentication... 140219 by: Abdul-wahid Paterson Re: Which is quicker, if-else statements 140221 by: Ernest E Vogelsinger 140240 by: -{ Rene Brehmer }- 140245 by: Jason Sheets 140247 by: daniel 140267 by: Ernest E Vogelsinger Re: I.P. range authentication 140222 by: Ernest E Vogelsinger 140232 by: John W. Holmes 140265 by: Ernest E Vogelsinger How to define a path of download file in header? 140223 by: Ruo Zhang 140225 by: Abdul-wahid Paterson Re: what's the best way to handle this? 140224 by: Justin French Does PHP run better under any specific unix os? 140227 by: Charles Kline 140229 by: Jason Sheets 140244 by: -{ Rene Brehmer }- test 140228 by: Ryan A Shopping cart question and FREE HOSTING OFFER 140230 by: Ryan A 140231 by: Ryan A Posting Query Results to an HTML form 140233 by: Jason Eley 140235 by: John W. Holmes php to perl 140234 by: Sebastian 140248 by: Daniel Andersen Re: Mailing List Digest 140238 by: -{ Rene Brehmer }- Re: nstalling PHP 140239 by: -{ Rene Brehmer }- Re: mass mail and selected mailings 140241 by: -{ Rene Brehmer }- Re: Mail attachment 140242 by: -{ Rene Brehmer }- LIsting all the Members who have not loged in for 60 days ... 140246 by: Philip J. Newman 140249 by: Sebastian Need help with coding problem 140250 by: Ben C. 140270 by: Tony Burgess Getting linux server's country 140251 by: Martin Towell Detecting if GET field is Numeric or Alpha numeric 140252 by: Stephen of Blank Canvas 140254 by: Foong connecting securely to remote database 140253 by: Dennis Gearon 140255 by: Joshua Moore-Oliva md5() number of aruments 140256 by: Dennis Gearon 140257 by: Jason k Larson random letter/character? 140258 by: Bryan Koschmann - GKT 140259 by: Jason Wong Re: random letter/character?[Scanned] 140260 by: Michael Egan running PHP through command shell 140261 by: Foong 140263 by: Jason Wong Mailing list addon for PHP-Nuke-type app 140262 by: David Russell mail() function. 140264 by: Fredrik Apache and PHP Problem 140266 by: t-systems-fitz remove ' from string 140268 by: Fredrik 140269 by: Dan Hardiker MySQL qusetion 140271 by: Marc Bakker Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] ----------------------------------------------------------------------
--- Begin Message --- The tokenizer that Erik was referring to is actually a PHP lexer, not a general tokenizer. Perhaps you would be looking for the strtok() function?
www.php.net/strtok
Brad Wright wrote:Erik, thanks, are you able to pint me to some good reference sources on
tokenizer's... i have never come across them before
I have been scouring the web, and am coming up a decided blank. :)
Cheers,
Brad
Nel vino la verità, nella birra la forza, nell'acqua i bacilli -------------------------------------------------------------------------- In wine there is truth, in beer there is strength, in water there are bacteria
From: Erik Price <[EMAIL PROTECTED]> Date: Tue, 18 Mar 2003 16:45:47 -0500 To: Brad Wright <[EMAIL PROTECTED]> Cc: PHP General List <[EMAIL PROTECTED]> Subject: Re: [PHP] Using PHP to get a word count of a MSword doc
Brad Wright wrote:
Thanks for the reply Rene,
Any change of a code sample of how u did this?? Im not at all experienced in Java.
According to the manual, PHP does have some tokenizer functions:
http://www.php.net/manual/en/ref.tokenizer.php
However, the documentation appears to be lacking as they are still under development. Using it might be somewhat straightforward if you are accustomed to using a tokenizer in another language (like Java) but if not, it's really a little too difficult to explain in an email.
A less elegant but ultimately quicker and probably more reliable solution might be to investigate some kind of external word-counting program that knows how to parse .DOC files (good luck on that part), and call this from your PHP script using system(). Catch-22: the only libraries I am familiar with that can parse .DOC files are the Jakarta POI libraries, which are written in Java. But I am sure that if you scour the web you can find some Perl, Python, or maybe even PHP-based solution.
Erik
--- End Message ---
--- Begin Message ---On Wed, 19 Mar 2003 07:30:20 +1000, Brad Wright wrote about "Re: [PHP] Using PHP to get a word count of a MSword doc" what the universal translator turned into this: >Thanks for the reply Rene, > >Any change of a code sample of how u did this?? Im not at all experienced in >Java. > >Thanks again for replying Weren't sure whether or not to post this to the list or not, since Java ain't really got anything to do with PHP ... but I did it anyway... Anyways, had to dig a little, as I did this for a school project ... Here's the Java function as it looks in the project, just snipped it all to make it clearer to see the connection: // function countWords public void countWords(String tekst) { String tmpString; st = new StringTokenizer(tekst); numChars = 0; numWords = st.countTokens(); numWordsOver6 = 0; while (st.hasMoreTokens()) { tmpString = st.nextToken(); if (tmpString.length() > 6) { numWordsOver6++; } // if numChars += tmpString.length(); } // while percWords = (double) (numWordsOver6 / numWords) * 100; } // method countWords As I said, not easily convertible to PHP since Java is purely object oriented, and PHP is not really so ... >From the code above: st = new StringTokenizer(tekst); /* Create new tokenizer object, and send it string tekst */ numWords = st.countTokens(); /* Count number of tokens in the text. This is a standard function in the Java StringTokenizer class. */ The rest is more or less self-explanatory. Java buils heavily on C++, which shows ... I'm not gonna go further into Java than this. I don't use it myself, but in some ways it's alot simpler than other languages to work with. But when it comes to I/O functions, Java is a nightmare. Loading a file into Java is by no means an easy task, and requires careful studying of how the system calls needs to made ... Totally don't understand why anyone likes to use a language designed for washing machines and coffee makers...(that's actually part of why it's called Java) Rene -- Rene Brehmer This message was written on 100% recycled spam. Come see! My brand new site is now online! http://www.metalbunny.net
--- End Message ---
--- Begin Message ---> From: Erik Price <[EMAIL PROTECTED]> > Date: Tue, 18 Mar 2003 16:57:57 -0500 > > The only tokenizers I have used are the StringTokenizer and > StreamTokenizer classes in Java. If you want to learn about these, go > to this web page: http://www.mindview.net/Books/TIJ/ and download the > book "Thinking in Java". Chapter 9 is the chapter that covers File I/O > and discusses how to use them. I have a feeling that the PHP tokenizers > work very similarly to the Java one (just judging from the docs on the > PHP site). Just peeked at the strtok() function in PHP manual ... and the only real difference from Java seems to be how the tokenizer is initialized, and how to get the next token. Another method is the one I use in VB (which don't have a tokenizer function): Split the entire text into an array, then count the number of elements in the array (but be warned: A text file in array causes a massive memory drain). I do this is in all my VB programs to deal with file paths ... in VB there's simply no simpler to construct entire folder trees that don't exist... Rene -- Rene Brehmer This message was written on 100% recycled spam. Come see! My brand new site is now online! http://www.metalbunny.net
--- End Message ---
--- Begin Message ---I wrote a function to redirect my page to another one. But for some reason I keep getting an error. here is the function I made function js_pointer_login($thepage) { echo '<script language="javascript"> window.location = '$thepage' </script>'; } -- Antoine <[EMAIL PROTECTED]>
--- End Message ---
--- Begin Message ---you are trying to include a variable inside a single quoted string. change the echo line to this. echo "<script language='javascript'> window.location = '$thepage'> </script>"; Jim ----- Original Message ----- From: "Antoine" <[EMAIL PROTECTED]> To: "php list" <[EMAIL PROTECTED]> Sent: Tuesday, March 18, 2003 2:52 PM Subject: [PHP] php and javascript > I wrote a function to redirect my page to another one. But for some > reason I keep getting an error. > here is the function I made > > function js_pointer_login($thepage) > { > echo '<script language="javascript"> window.location = '$thepage' > </script>'; > } > > > -- > Antoine <[EMAIL PROTECTED]> > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
--- End Message ---
--- Begin Message ---It has to do with the fact that you're using single quotes, and $thepage is not replaced for its value.
I think you'd want to rewrite the function like this (note the \ escaping the "):
function js_pointer_login($thepage) { echo "<script language=\"javascript\"> window.location = '$thepage' </script>"; }
Hope this Helps, Oscar F.
Antoine wrote:I wrote a function to redirect my page to another one. But for some
reason I keep getting an error. here is the function I made
function js_pointer_login($thepage) { echo '<script language="javascript"> window.location = '$thepage' </script>'; }
--- End Message ---
--- Begin Message -------- Original Message ----- From: "Antoine" <[EMAIL PROTECTED]> To: "php list" <[EMAIL PROTECTED]> Sent: Tuesday, March 18, 2003 3:52 PM Subject: [PHP] php and javascript > I wrote a function to redirect my page to another one. But for some > reason I keep getting an error. > here is the function I made > > function js_pointer_login($thepage) > { > echo '<script language="javascript"> window.location = '$thepage' > </script>'; > } > > > -- > Antoine <[EMAIL PROTECTED]> Three fundemental flaws: 1) single quotes in PHP denote a litteral string so $thepage will not be parsed 2) the first single quote before $thepage will end the echo statement anything after that is a parse error 3) the proper javascript syntax to redirect to a url within the active window is window.location.href=""; - Kevin
--- End Message ---
--- Begin Message --- At 23:52 18-3-2003, you wrote:beside the quote thing which others mentioned, please make it as cross-browser-compatible as possible:I wrote a function to redirect my page to another one. But for some reason I keep getting an error. here is the function I made
function js_pointer_login($thepage) { echo '<script language="javascript"> window.location = '$thepage' </script>'; }
window.location.href=
and try to let $thepage be a complete url, including the http:// and the www.domain.org/ part. That will work in more browsers!
--- End Message ---
--- Begin Message ---On Tue, 18 Mar 2003 15:59:32 -0700, Kevin Stone wrote about "Re: [PHP] php and javascript" what the universal translator turned into this: >----- Original Message ----- >From: "Antoine" <[EMAIL PROTECTED]> >To: "php list" <[EMAIL PROTECTED]> >Sent: Tuesday, March 18, 2003 3:52 PM >Subject: [PHP] php and javascript > >> I wrote a function to redirect my page to another one. But for some >> reason I keep getting an error. >> here is the function I made >> >> function js_pointer_login($thepage) >> { >> echo '<script language="javascript"> window.location = '$thepage' >> </script>'; >> } >> -- >> Antoine <[EMAIL PROTECTED]> > >Three fundemental flaws: >1) single quotes in PHP denote a litteral string so $thepage will not be >parsed >2) the first single quote before $thepage will end the echo statement >anything after that is a parse error >3) the proper javascript syntax to redirect to a url within the active >window is window.location.href=""; parent.location.href="" works just as fine ... and it's also portable directly to frames sub-files. Oh, and in JavaScript the end-line ; markers aren't used ... they're ignored mostly, but some older browsers caugh and spit at them ... JS standard doesn't require them, but because they're used in Java and JScript, the newer JIT compilers just ignore them... Rene -- Rene Brehmer This message was written on 100% recycled spam. Come see! My brand new site is now online! http://www.metalbunny.net
--- End Message ---
--- Begin Message ---Can anyone recommend a package suitable for editing HTML files on a remote server through a PHP interface? Basically, an online HTML editor. Cheers in advance, Brad
--- End Message ---
--- Begin Message ---Hiya Brad-- We published a news item on this a few days ago; there's a free WYSIWYG editor that works both on IE and Mozilla 1.3 called HTMLArea. You can find it here: http://www.interactivetools.com/products/htmlarea/reviews.html (our news item is at http://phparch.com/newsarchive.php?s=htmlarea). I use it in quite a few applications and it's both very useful and quite stable. Cheers, Marco -- php|architect -- The Magazine for PHP Professionals Get your free copy today at http://www.phparch.com On Tue, 2003-03-18 at 17:50, Brad Hubbard wrote: > Can anyone recommend a package suitable for editing HTML files on a remote > server through a PHP interface? Basically, an online HTML editor. > > Cheers in advance, > Brad
--- End Message ---
--- Begin Message ---On Tue, 2003-03-18 at 21:14, Scott Fletcher wrote: > Groan, I meant 'Basic' not 'Base'...... > > I am trying to figure out how to encrypt the data using the base only. > > The webserver use the base authentication. I have been searching the PHP > > manual and I only saw base64_encode() but it is not the right algorithm. > > Does anyone know the php function for the Base encryption? In basic authentication the password goes across the network in plain text and the server therefore has a choice in how it stores the password. There are different ways of doing this usually involving a). DES b). md5 both injected with a bit of salt. Different implementations use different amounts of salt etc. Anyway, the function you are looking for is probably crypt: http://uk.php.net/manual/en/function.crypt.php Regards, Abdul-Wahid -- Abdul-Wahid Paterson Lintrix Networking & Communications ltd. Web: http://www.lintrix.net/ Tel: +44 7801 070621 Email/Jabber: [EMAIL PROTECTED] -------------------------------------------------------------------- Web-Hosting | Development | Security | Consultancy | Domains --------------------------------------------------------------------signature.asc
Description: This is a digitally signed message part
--- End Message ---
--- Begin Message ---At 21:02 18.03.2003, Liam Gibbs said: --------------------[snip]-------------------- >Is it just as quick to do: > >if($r == 0) { >} else if($r != 0) { >} > >than to do: > >if($r == 0) { >} else { >} > >The reason I like the former method is because, in a large IF-ELSE block, >it's clear what belongs to what IF and what's going on. But does this make >it lag? And, if so, is it really all that noticeable? --------------------[snip]-------------------- Noticeable? Probably not, except you're timing loops of a million or more cycles... but it's clear that the second method needs more time (in terms of cpu cycles) than the first one. In Intel speak, what would a compiler translate these code examples to? if (a == b) {} else {} mov eax, {a} cmp eax, {b} jnz L01 ; the "true" block goes here jmp L02 L01: ; the "false" (else) block goes here L02: As you can see there's two memory operations and one comparison. Your second example: if (a == b) {} else if (a != b) {} mov eax, {a} cmp eax, {b} jnz L01 ; the "true" block goes here jmp L02 L01: mov eax, {a} cmp eax, {b} jz L02 ; the second block goes here L02: There's four memory operations, and two comparisons. As another poster already pointed out, there's also a slight difference comparing something to zero, or to false: if (a == 0) mov eax, {a} cmp eax, 0 jnz L01 if (!a) mov eax, {a} or eax, eax jnz L01 The latter version consumes approx. half of the time (in cpu cycles) compared to the first one. Modern compilers will leverage the need for a to deal with these efforts. The multi-pass optimizers usually detect situations like these and would use the "if (!a) {} else {}" construct, without regard what your original input is. However, PHP is _not_ a compiler, it's an interpreter. It "compiles" code at runtime and has not the ability to perform exhaustive optimizations which would cost far more time than can be gained within a single execution. Additionally there's the time needed to parse the input stream (tokenize, add to symbol table, execute token and expression parser, etc etc). With interpreting languages the differences will rocket skyhigh compared to compiled executables. Well, it's still to be measured in nanoseconds for a single instance, thanks to modern processor power... -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/
--- End Message ---
--- Begin Message ---On Wed, 19 Mar 2003 00:39:11 +0100, Ernest E Vogelsinger wrote about "Re: [PHP] Which is quicker, if-else statements" what the universal translator turned into this: >Noticeable? Probably not, except you're timing loops of a million or more >cycles... but it's clear that the second method needs more time (in terms >of cpu cycles) than the first one. > >In Intel speak, what would a compiler translate these code examples to? > >if (a == b) {} else {} > mov eax, {a} > cmp eax, {b} > jnz L01 >; the "true" block goes here > jmp L02 >L01: >; the "false" (else) block goes here >L02: > >As you can see there's two memory operations and one comparison. I'm totally lost here ... what does that mean??? Reminds me of assembler, except that assembler is more like: 0001 jnp e002 e003 0005 0002 jmp e002 e003 0008 And so on (not sure if that's fully correct ... haven't touched assembler since '92) ... Please ellaborate Ernest ... >However, PHP is _not_ a compiler, it's an interpreter. It "compiles" code >at runtime and has not the ability to perform exhaustive optimizations >which would cost far more time than can be gained within a single >execution. Additionally there's the time needed to parse the input stream >(tokenize, add to symbol table, execute token and expression parser, etc >etc). With interpreting languages the differences will rocket skyhigh >compared to compiled executables. Doesn't PHP precompile the files and shove the result into the cache? Or did I get that wrong ??? Rene -- Rene Brehmer This message was written on 100% recycled spam. Come see! My brand new site is now online! http://www.metalbunny.net
--- End Message ---
--- Begin Message ---As a note Turck mmcache does optimization and also caches the compiled scripts into shared memory. Zend also has the Zend Optimizer and Zend Encoder. Turck mmcache is available at http://www.turcksoft.com/en/e_mmc.htm The benchmarking I did with Turck mmcache showed that Turck was a little over 15% faster than APC for my applications (over 35,000 lines with over 25 classes). Turck comes with a nice web interface where you can disable the cache or optimizer and also view the cached scripts. Jason On Tue, 2003-03-18 at 20:38, -{ Rene Brehmer }- wrote: > On Wed, 19 Mar 2003 00:39:11 +0100, Ernest E Vogelsinger wrote about "Re: > [PHP] Which is quicker, if-else statements" what the universal translator > turned into this: > > >Noticeable? Probably not, except you're timing loops of a million or more > >cycles... but it's clear that the second method needs more time (in terms > >of cpu cycles) than the first one. > > > >In Intel speak, what would a compiler translate these code examples to? > > > >if (a == b) {} else {} > > mov eax, {a} > > cmp eax, {b} > > jnz L01 > >; the "true" block goes here > > jmp L02 > >L01: > >; the "false" (else) block goes here > >L02: > > > >As you can see there's two memory operations and one comparison. > > I'm totally lost here ... what does that mean??? > > Reminds me of assembler, except that assembler is more like: > 0001 jnp e002 e003 0005 > 0002 jmp e002 e003 0008 > > And so on (not sure if that's fully correct ... haven't touched assembler > since '92) ... > > Please ellaborate Ernest ... > > >However, PHP is _not_ a compiler, it's an interpreter. It "compiles" code > >at runtime and has not the ability to perform exhaustive optimizations > >which would cost far more time than can be gained within a single > >execution. Additionally there's the time needed to parse the input stream > >(tokenize, add to symbol table, execute token and expression parser, etc > >etc). With interpreting languages the differences will rocket skyhigh > >compared to compiled executables. > > Doesn't PHP precompile the files and shove the result into the cache? Or > did I get that wrong ??? > > Rene > > -- > Rene Brehmer > > This message was written on 100% recycled spam. > > Come see! My brand new site is now online! > http://www.metalbunny.net -- Jason Sheets <[EMAIL PROTECTED]>
--- End Message ---
--- Begin Message ---hmm now u are talkin about caching , our systems guy is planning on using squid as the caching system is this a good idea ? >===== Original Message From Jason Sheets <[EMAIL PROTECTED]> ===== >As a note Turck mmcache does optimization and also caches the compiled >scripts into shared memory. Zend also has the Zend Optimizer and Zend >Encoder. > >Turck mmcache is available at http://www.turcksoft.com/en/e_mmc.htm > >The benchmarking I did with Turck mmcache showed that Turck was a little >over 15% faster than APC for my applications (over 35,000 lines with >over 25 classes). Turck comes with a nice web interface where you can >disable the cache or optimizer and also view the cached scripts. > >Jason > >On Tue, 2003-03-18 at 20:38, -{ Rene Brehmer }- wrote: >> On Wed, 19 Mar 2003 00:39:11 +0100, Ernest E Vogelsinger wrote about "Re: >> [PHP] Which is quicker, if-else statements" what the universal translator >> turned into this: >> >> >Noticeable? Probably not, except you're timing loops of a million or more >> >cycles... but it's clear that the second method needs more time (in terms >> >of cpu cycles) than the first one. >> > >> >In Intel speak, what would a compiler translate these code examples to? >> > >> >if (a == b) {} else {} >> > mov eax, {a} >> > cmp eax, {b} >> > jnz L01 >> >; the "true" block goes here >> > jmp L02 >> >L01: >> >; the "false" (else) block goes here >> >L02: >> > >> >As you can see there's two memory operations and one comparison. >> >> I'm totally lost here ... what does that mean??? >> >> Reminds me of assembler, except that assembler is more like: >> 0001 jnp e002 e003 0005 >> 0002 jmp e002 e003 0008 >> >> And so on (not sure if that's fully correct ... haven't touched assembler >> since '92) ... >> >> Please ellaborate Ernest ... >> >> >However, PHP is _not_ a compiler, it's an interpreter. It "compiles" code >> >at runtime and has not the ability to perform exhaustive optimizations >> >which would cost far more time than can be gained within a single >> >execution. Additionally there's the time needed to parse the input stream >> >(tokenize, add to symbol table, execute token and expression parser, etc >> >etc). With interpreting languages the differences will rocket skyhigh >> >compared to compiled executables. >> >> Doesn't PHP precompile the files and shove the result into the cache? Or >> did I get that wrong ??? >> >> Rene >> >> -- >> Rene Brehmer >> >> This message was written on 100% recycled spam. >> >> Come see! My brand new site is now online! >> http://www.metalbunny.net >-- >Jason Sheets <[EMAIL PROTECTED]> > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---At 04:38 19.03.2003, -{ Rene Brehmer }- said: --------------------[snip]-------------------- >I'm totally lost here ... what does that mean??? > >Reminds me of assembler, except that assembler is more like: >0001 jnp e002 e003 0005 >0002 jmp e002 e003 0008 > >And so on (not sure if that's fully correct ... haven't touched assembler >since '92) ... > >Please ellaborate Ernest ... --------------------[snip]-------------------- Yup, assembler, specifically Intel x86 using the 32bit registers (I said "Intel speak" before the code). The code you present must be for a different processor that I don't know... well, haven't programmed in asm since - wait let me think - 85? Have still some asm manuals around, but I don't think the timing numbers are still relevant for todays caching cpu's... -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/
--- End Message ---
--- Begin Message ---At 23:04 18.03.2003, Will Bown said: --------------------[snip]-------------------- >I am having trouble verifying if a user is within a specified I.P. range. >The idea is that if a user is at a library within an I.P. range like >231.55.*.* and their I.P. address is 231.55.122.226 a session would be >registered for them. See my code below. This works but only for some I.P.'s >in a range. > >Can anyone suggest a solution or resource that can help me? > >$sql = "select * from customers where ip1 <=\"$remote_address\" and ip2 >>=\"$remote_address\""; >$sql_result = mysql_query($sql,$connection) > or die("Couldn't execute query. AUTO SIGN IN SELECT"); > >while ($row = mysql_fetch_array($sql_result)) { > $ip1 = $row["ip1"]; > $ip2 = $row["ip2"]; > $fname = $row["fname"]; > $lname = $row["lname"]; > $institution = $row["institution"]; > >$num = mysql_num_rows($sql_result); >$sign_in="$fname $lname $institution"; > >if($num>0){ > session_register("sign_in"); > } >else{echo" you can't see this page"} --------------------[snip]-------------------- You need to create a number out of the dotted IP string to use them in valid <= and >= comparisons. This is a valid procedure, since the IP basically _IS_ a number, it's just written in the dotted notation to aid us miserable human beings. $abytes = explode('.', $ip); // explode the IP string $ip = 0; foreach ($abytes as $byte) $ip = ($ip << 8) + $byte; This will give you the valid numeric equivalent of the IP address. -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/
--- End Message ---
--- Begin Message ---> $abytes = explode('.', $ip); // explode the IP string > $ip = 0; > foreach ($abytes as $byte) $ip = ($ip << 8) + $byte; > > This will give you the valid numeric equivalent of the IP address. Isn't that what ip2long() does? Also, the man page on ip2long() has some good notes and code that may help the OP. http://www.php.net/manual/en/function.ip2long.php ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
--- End Message ---
--- Begin Message ---At 02:51 19.03.2003, John W. Holmes said: --------------------[snip]-------------------- >> $abytes = explode('.', $ip); // explode the IP string >> $ip = 0; >> foreach ($abytes as $byte) $ip = ($ip << 8) + $byte; >> >> This will give you the valid numeric equivalent of the IP address. > >Isn't that what ip2long() does? > >Also, the man page on ip2long() has some good notes and code that may >help the OP. > >http://www.php.net/manual/en/function.ip2long.php --------------------[snip]-------------------- Thanks - didn't come around this function yet... -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/
--- End Message ---
--- Begin Message ---Hi, I use the following headers to force open a download dialog box. However, my download files are located in other directories/subdirectories. How can I specify a download path in the header? The 'Content-Location' header does not work in this case. Can someone please help? header("Content-type: application/octet-stream"); header("Content-Length: $filelength"); header("Content-Disposition: attachment; filename=$fname;"); Thanks. Rho
--- End Message ---
--- Begin Message ---On Tue, 2003-03-18 at 23:45, Ruo Zhang wrote: > I use the following headers to force open a download dialog box. However, my > download files are located in other directories/subdirectories. How can I specify a > download path in the header? The 'Content-Location' header does not work in this > case. Can someone please help? > > header("Content-type: application/octet-stream"); > header("Content-Length: $filelength"); > header("Content-Disposition: attachment; filename=$fname;"); > Why don't you do: readfile($filename); straight after your header statements. That will read in the file and pass it straight through to the browser. Regards, AW -- Abdul-Wahid Paterson Lintrix Networking & Communications ltd. Web: http://www.lintrix.net/ Tel: +44 7801 070621 Email/Jabber: [EMAIL PROTECTED] -------------------------------------------------------------------- Web-Hosting | Development | Security | Consultancy | Domains --------------------------------------------------------------------signature.asc
Description: This is a digitally signed message part
--- End Message ---
--- Begin Message ---very cool chris!!! Justin on 19/03/03 2:27 AM, Chris Hayes ([EMAIL PROTECTED]) wrote: > At 14:38 18-3-03, you wrote: >> Ok, I hope this makes sense, >> >> When a user 'registers' with our site, I want to generate their personal >> webpage for them. Currently, I have a webpage where the contents are >> generated from their personal info in the db and I have a drop down to view >> client pages but it is just the same page but I pass in the clientid so it >> will display their data. This is fine but I want the users to be able to >> tell others.."Visit my home page at www.eddiessite.com/Johnny or something >> like that...I don't want them to have to say visit my page >> www.eddissite/client_pages?clientid=43 does that make sense? Should I just >> generate a folder for them with an index page that redirects then to the >> clientpage with their id? > > wow wouldn't that create a huge directory structure! > > this is the way i did it, to be able to make all sorts of fake urls, from > /page/33 to /person/3 or person/jones or even /jones if you want. > You need a server that is setup to read .htaccess files. > > In the .htaccess file for your site, you write > --------------- > ErrorDocument 404 /subdirectories/to/redirect.php > --------------- > This way all the urls that would normally be led to a 404 warning page, are > now first led to a php file. It is VITAL to not use the complete URL but > only the part after www.domain.org, otherwise you loose all existing form > and url information. > > In redirect.php you check your url and split it up. You can do this any way > you like. I'll show some usefull examples: > > --------------- > <?PHP > $basis='http://www.sense.nl/'; //my base url to build the links on. > global $_SERVER; > $path=trim($_SERVER["REQUEST_URI"]); > $path_bits=explode('/',$path); > > switch (strtolower($path_bits[1])) > { > case 'educationworkshop': > Header("Location: > ".$basis."index.php?module=ContentExpress&func=display&ceid=15"); > break; > > case 'news': > Header("Location: > ".$basis."modules.php?op=modload&name=News&file=article&mode=nested&order=0&th > old=0&sid=".trim($path_bits[2]) > ); > break; > > > case 'research': > case 'researcher': > case 'researchers': > case 'researchguide': > case 'research_guide': > Header("Location: > ".$basis."redirect/research.php?".trim($path_bits[2]) ); > break; > > > default: > Header("Location: ".$basis."redirect/404.html"); > > } > > ?> > --------------- > > As you can see i simply split up the url on the slashes. > Some words, for example 'educationworkshop', lead to a fixed page. I have > a whole bunch of these, very useful. Leads to: > http://www.domain.org/educatiionworkshop > > > 'news' expects an extra value like http://www.xx.org/news/11, then leads > directly to the long url. > > 'research' and a couple of lookalike words are forwarded with the extra > data to another PHP file specialized in selecting the descriptions, just as > you want. > > in research.php i then look: > is the extra data a number ? then go to the url.'&ID='.$thenumber > is it a word or phrase? then do a query to find the right number > > The last one is the one you could use. For instance if it finds > http://www.domain.org/research/jones, > a query is made that looks up Joneses. If there is only one Jones, get > the ID number and show the Jones directly. > If not, show a list of Joneses with links made with their respective ID > numbers. > > > Chris > > > > > >
--- End Message ---
--- Begin Message --- Just wondering. I am trying to decide whether to build a FreeBSD server or other... open to suggestions
Thanks, Charles
--- End Message ---
--- Begin Message ---Your hardware will determine your level of performance and in many cases stability (cheap components like generic ram lower stability and performance) but I've had no problems running PHP under FreeBSD 4 or FreeBSD 5 or Slackware Linux and mostly minor problems running under HP-UX 10/11. Everyone has at least one OS of choice (mine is FreeBSD and then OpenBSD) so you will have to weigh opinions, I would decide what you need your server to do and then take a look at a few operating systems. FreeBSD is an excellent all purpose server, OpenBSD is excellent in high threat environments, Linux is good if that is all your IT supports or you are doing very Linux specific things. All the PHP optimizer/caching programs I've used have support for FreeBSD and Linux so that will not be a limiting factor. Basically get good hardware and your performance with PHP should be good under most operating systems, get bad hardware and it doesn't matter anyway. Jason On Tue, 2003-03-18 at 17:55, Charles Kline wrote: > Just wondering. I am trying to decide whether to build a FreeBSD server > or other... open to suggestions > > Thanks, > Charles -- Jason Sheets <[EMAIL PROTECTED]>
--- End Message ---
--- Begin Message ---On 18 Mar 2003 18:20:55 -0700, Jason Sheets wrote about "Re: [PHP] Does PHP run better under any specific unix os?" what the universal translator turned into this: >Everyone has at least one OS of choice (mine is FreeBSD and then >OpenBSD) so you will have to weigh opinions, I would decide what you >need your server to do and then take a look at a few operating systems. Also weigh in which you feel most comfortable in. If you're a DOS hawk, going Linux is said to be easier than BSD ... dunno, never tried BSD, only Linux and BeOS (and you don't really use the command line in BeOS)... But all *nix share the same issue: You need to build the files yourself, from the same source files. So the config is the same nomatter what. Anyways ... I prefer Linux ... but has been a while since I stopped building my own ... they're just too complex these days ... haven't got time to wait ;-) Rene -- Rene Brehmer This message was written on 100% recycled spam. Come see! My brand new site is now online! http://www.metalbunny.net
--- End Message ---
--- Begin Message ---test message
--- End Message ---
--- Begin Message ---Hi people, I want to setup a shopping cart for an ecom site which sells baby clothese but I dont know which to pick, Agora or OSCommerce? any help appreciated, if possible please tell me why you picked the one you pick too... FREE HOSTING. ............................. Reciently I have purchased a large hosting account for a project that didnt go through and now i have one website with a whole lot of space and power which is too much for just me and i want to share it... Heres the plan, I want to offer anybody who is programming in servlets or PHP free hosting, BUT 1) they will have to have a site that is pretty much devoted to programming (e.g. servlets.com, hotscripts, devshed, phpdev, etc). I am offering 5mb space (more on request), java servlets (Tomcat JSP engine), MySql database, PHP (NOT safe mode), CGI-BIN, etc, yourdomain.com or a sub domain. In return they must add my banners to their pages but on the front page it can be just a small button. Now...the banners thing might tick you off a bit but heres the idea, I am toying with the idea of having an indoor banner exchange... eg: all the sites that are being hosted by me display their banners on each others sites...NOTE: this may change in the future depending on how this little experiement goes. heres the PHPINFO page to check the installation. http://www.321go.biz/phpinfo.php NO Spam, no "X" matererial (not even cartoons or dirty jokes) I have only 25 account available for PHP right now.... If interested and you think you qualify, write to me with your details at [EMAIL PROTECTED] with the subject: 'free servlets host'. All comments appreciated. Cheers -Ryan
--- End Message ---
--- Begin Message ---Hi people, I want to setup a shopping cart for an ecom site which sells baby clothese but I dont know which to pick, Agora or OSCommerce? any help appreciated, if possible please tell me why you picked the one you pick too... <?php FREE HOSTING. ?> ............................. Reciently I have purchased a large hosting account for a project that didnt go through and now i have one website with a whole lot of space and power which is too much for just me and i want to share it... Heres the plan, I want to offer anybody who is programming in servlets or PHP free hosting, BUT 1) they will have to have a site that is pretty much devoted to programming (e.g. servlets.com, hotscripts, devshed, phpdev, etc). I am offering 5mb space (more on request), java servlets (Tomcat JSP engine), MySql database, PHP (NOT safe mode), CGI-BIN, etc, yourdomain.com or a sub domain. In return they must add my banners to their pages but on the front page it can be just a small button. Now...the banners thing might tick you off a bit but heres the idea, I am toying with the idea of having an indoor banner exchange... eg: all the sites that are being hosted by me display their banners on each others sites...NOTE: this may change in the future depending on how this little experiement goes. heres the PHPINFO page to check the installation. http://www.321go.biz/phpinfo.php NO Spam, no "X" matererial (not even cartoons or dirty jokes) I have only 25 account available for PHP right now.... If interested and you think you qualify, write to me with your details at [EMAIL PROTECTED] with the subject: 'free servlets host'. All comments appreciated. Cheers -Ryan
--- End Message ---
--- Begin Message ---I have a MySQL query that I am sending the results to text boxes in a form. In the event of a space in the string data, the string is being truncated at the first space. Is there a PHP function that can prevent this string data from being truncated in the form. If I print the query results or send them to a texarea, the data is displayed correctly. Thanks, Jason
--- End Message ---
--- Begin Message ---> I have a MySQL query that I am sending the results to text boxes in a > form. > In the event of a space in the string data, the string is being truncated > at > the first space. Is there a PHP function that can prevent this string data > from being truncated in the form. No, there's no PHP function, but there is an HTML trick that you can use: putting quotes around your values! <input type="text" name="name" value="value"> etc... ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
--- End Message ---
--- Begin Message ---unfortunately i am a rookie with perl, can someone help me convert this little bit of code to php? thanks in advanced. #!/usr/bin/perl print "Content-type: text/html\n\n"; open(LOADAVG, '/proc/loadavg') or die $1; while(<LOADAVG> ) { $loadavg = substr( $_, 0, 4 ); } close(LOADAVG); cheers, - Sebastian
--- End Message ---
--- Begin Message ---<? $fp = fopen ('/proc/loadavg', 'r'); if (!$fp) die ('Failed to open file'); while ($line = fgets ($fp)) { $loadavg = substr ($line, 0, 4); } fclose ($fp); ?> Regards, Daniel On Wed, 19 Mar 2003 13:16, Sebastian wrote: > unfortunately i am a rookie with perl, can someone help me convert this > little bit of code to php? > > thanks in advanced. > > #!/usr/bin/perl > print "Content-type: text/html\n\n"; > open(LOADAVG, '/proc/loadavg') or die $1; > while(<LOADAVG> ) { > $loadavg = substr( $_, 0, 4 ); > } > close(LOADAVG); > > cheers, > - Sebastian
--- End Message ---
--- Begin Message ---If the digest is mailed in the correct format, programs like Forte Agent and Pegasus can split the digest into its seperate messages. Then you can reply to a message inside the digest like it was a normal message. It's kinda neat, but not all (read: few) lists support this, so the ones that don't can be a real pain to go through ... Haven't used digests for lists in 5 years though ... Rene On Wed, 19 Mar 2003 07:39:26 +1100, The Head Sage wrote about "Re: [PHP] Mailing List Digest" what the universal translator turned into this: >All the digest contains is all the normal e-mails all thrown into 1 huge >e-mail. You would recieve about 2 digests per day, instead of 100+ single >e-mails. Although i prefer the single e-mail system... -- Rene Brehmer This message was written on 100% recycled spam. Come see! My brand new site is now online! http://www.metalbunny.net
--- End Message ---
--- Begin Message ---On Tue, 18 Mar 2003 15:11:02 -0500, Erik Price wrote about "Re: [PHP] nstalling PHP" what the universal translator turned into this: >Does the AddType line in httpd.conf so that files ending with the >extension ".php" are processed by the PHP binary? You should have a >section in your httpd.conf that looks something like this: > ><IfModule mod_mime.c> > # a bunch of lines go here > # a bunch of lines go here > # a bunch of lines go here > # a bunch of lines go here > # a bunch of lines go here > AddType application/x-httpd-php .php .php3 #<--- you need this line ></IfModule> You forgot the .phtml extension ... If you want all HTML files to parsed as PHP as well, you'll need to add them here as well... Rene -- Rene Brehmer This message was written on 100% recycled spam. Come see! My brand new site is now online! http://www.metalbunny.net
--- End Message ---
--- Begin Message ---On Tue, 18 Mar 2003 16:19:28 -0500, Tim Thorburn wrote about "[PHP] mass mail and selected mailings" what the universal translator turned into this: >I've just been asked by a client to create a mass mail program in PHP which >the client can use to send a single message to everyone in it's email >database, but also have the option to select which email address the >message will go to. > >I've done a simple script like this before which basically loops through >the database, selects all the email addresses, and then sends out one big >message. The problem with that one, was that the To: field listed all the >email addresses that were sent. For obvious reasons, they do not want all >email addresses included within the To:, CC:, or Bcc: fields. > >Using PHP's mail() function, is it possible to conceal the email addresses >being sent? If there are not, are there any PHP/MySQL based applications >that will do this? Keeping in mind that I am using a shared hosting >provider and do not have direct access to the server itself. Why not just do it in a loop, and plump of one mail in each loop ??? The bulk mailer I've got works this way ... stick it one message, tell it which list of addresses to use, and of it goes .. spittin' out thousands of mails in a few seconds ... This one's a W32 GUI program ... Rene -- Rene Brehmer This message was written on 100% recycled spam. Come see! My brand new site is now online! http://www.metalbunny.net
--- End Message ---
--- Begin Message ---On Tue, 18 Mar 2003 23:19:08 +0100, Chris Hayes wrote about "Re: [PHP] Mail attachment" what the universal translator turned into this: >It may be that the mail receiver expects some content after you put this in >the header: > Content-Type: text/ascii; charset=iso-8859-1\n >If you're sending plain text, and no special (read: non-western) >characters, i don't think you need that part. If you use any highbit characters (>128) you need it, otherwise the recipient's client can't figure out what codetable they're in... Rene -- Rene Brehmer This message was written on 100% recycled spam. Come see! My brand new site is now online! http://www.metalbunny.net
--- End Message ---
--- Begin Message ---$lastDate is a unix time stamp in mySql ... how can i list ONLY the users who have not logged in for 60days? ------ Philip J. Newman. Head Developer [EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---you can use strtotime() example, this will subtract 60 days from the variable you assign to it, in this case it'll subtract it from $lastDate and go from there. strtotime("-60 days"); http://www.php.net/manual/en/function.strtotime.php cheers, - Sebastian ----- Original Message ----- From: "Philip J. Newman" <[EMAIL PROTECTED]> Subject: [PHP] LIsting all the Members who have not loged in for 60 days ... | $lastDate is a unix time stamp in mySql ... how can i list ONLY the users | who have not logged in for 60days? | | | ------ | Philip J. Newman. | Head Developer | [EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---I have a subscription service and am trying to not allow the buyer to proceed purchasing another subscription if one of their subscriptions is over 29 days past due in their payment. I am trying to query each invoice and checking to see if it is past due more than 29 days, if it is I want a message to come up saying that it can not proceed because they account is not current. Can you look at the code below and let me know if you see something wrong. It is not working for me. Thanks. ------START CODE---------------------------------------------------------- $sql_1 ="SELECT * FROM $table_name WHERE buyerid = \"$buyerid\" AND paidinfull is NULL"; $result_1 = @mysql_query($sql_, $connection) or die("Error #" . mysql_errno() . ": " . mysql_error()); if(mysql_num_rows($result_1) > 0){ while($row = mysql_fetch_array($result_1)) { $duedate1 = $row['duedate']; $paiddate1 = $row['paiddate']; $paidinfull = $row['paidinfull']; $duedatestamp = strtotime($duedate1); // due date unix timestamp $difference = time() - $duedatestamp; // diff in seconds $differencedays = $difference / 86400; // 60 x 60 x 24 hours floor rounds the days down $differencedays1 = floor($differencedays); $paiddatestamp = strtotime($paiddate1); // paid date unix timestamp $diffdays = floor(((paiddatestamp - duedatestamp) / 86400)); if (!$paiddate1) { $daysout = $differencedays1; } else { $daysout = $diffdays; } if ($daysout > 29) { echo "You cannot add this product as your account is 30 days past due"; exit; } ----END CODE-------------------------------------------------------------- -------------------------------------------------------------------------- The content of this email message and any attachments are confidential and may be legally privileged, intended solely for the addressee. If you are not the intended recipient, be advised that any use, dissemination, distribution, or copying of this e-mail is strictly prohibited. If you receive this message in error, please notify the sender immediately by reply email and destroy the message and its attachments.
--- End Message ---
--- Begin Message ---You seem to be missing your last bracket for the while loop that you started to state the end of the block. "Ben C." <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I have a subscription service and am trying to not allow the buyer to > proceed purchasing another subscription if one of their subscriptions is > over 29 days past due in their payment. I am trying to query each invoice > and checking to see if it is past due more than 29 days, if it is I want a > message to come up saying that it can not proceed because they account is > not current. Can you look at the code below and let me know if you see > something wrong. It is not working for me. Thanks. > > > ------START CODE---------------------------------------------------------- > > $sql_1 ="SELECT * FROM $table_name > WHERE buyerid = \"$buyerid\" AND paidinfull is NULL"; > $result_1 = @mysql_query($sql_, $connection) or die("Error #" . > mysql_errno() . ": " . mysql_error()); > > if(mysql_num_rows($result_1) > 0){ > while($row = mysql_fetch_array($result_1)) { > > $duedate1 = $row['duedate']; > $paiddate1 = $row['paiddate']; > $paidinfull = $row['paidinfull']; > > $duedatestamp = strtotime($duedate1); // due date unix > timestamp > $difference = time() - $duedatestamp; // diff in seconds > $differencedays = $difference / 86400; // 60 x 60 x 24 hours floor > rounds the days down > $differencedays1 = floor($differencedays); > > $paiddatestamp = strtotime($paiddate1); // paid date unix timestamp > $diffdays = floor(((paiddatestamp - duedatestamp) / 86400)); > > > if (!$paiddate1) > { > $daysout = $differencedays1; > } > else > { > $daysout = $diffdays; > } > > if ($daysout > 29) > { > echo "You cannot add this product as your account is 30 days past due"; > exit; > } > > ----END CODE-------------------------------------------------------------- > > > > -------------------------------------------------------------------------- > The content of this email message and any attachments are confidential and > may be legally privileged, intended solely for the addressee. If you are > not the intended recipient, be advised that any use, dissemination, > distribution, or copying of this e-mail is strictly prohibited. If you > receive this message in error, please notify the sender immediately by reply > email and destroy the message and its attachments. >
--- End Message ---
--- Begin Message ---I've been looking for an answer to this question for ages, but have failed. Hopefully one of you guys can help. I'm looking for a way of finding out what the linux server's country is set to. I notice there's setlocale(), but I want something more like getlocale(), which there doesn't seen to be one. I'm using PHP 4.0.6 TIA Martin
--- End Message ---
--- Begin Message ---Hi Everyone, Does anyone know if it is possible to check the values of a $_GET field and see if the submitted data is numeric or contains any letters. What I want to do is allow users to link to a record in a MySQL db using the record id's and the values of the name field. www.domain.com/showlisting.php?town=1 and www.domain.com/showlisting.php?town=London Both would work by performing a search on different fields in the MySQL SELECT statement. Just an idea to make thing easy for users, any help appreciated. Thanks Stephen
--- End Message ---
--- Begin Message ---Helo, use is_numeric($str) to check whether a string contains all numeric values. Foong "Stephen Of Blank Canvas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi Everyone, > > Does anyone know if it is possible to check the values of a $_GET field > and see if the submitted data is numeric or contains any letters. > > What I want to do is allow users to link to a record in a MySQL db using > the record id's and the values of the name field. > > www.domain.com/showlisting.php?town=1 and > www.domain.com/showlisting.php?town=London > > Both would work by performing a search on different fields in the MySQL > SELECT statement. Just an idea to make thing easy for users, any help > appreciated. > > Thanks > > Stephen >
--- End Message ---
--- Begin Message ---how do I connect securely to a postgres database on another server / DNS name / IP? Some way to do SSL/SSH easily from PHP?
--- End Message ---
--- Begin Message ---You should put this on the postgres general list not here... I've heard a lot of talk about this lately, though I haven't gotten around to implementing it yet.. There is also a section in the online postgres docs on how to do this. And if you're fast someone just posted a question 2 minutes ago on the pgsql-general list that went like this... I'm using redhat 8.0 and postgresql 7.2.4 (rpm from postgresql.org). I want to enable ssl. START QUOTE I have edited postgresql.conf to ssl = true. I also follow the 7.3 manual (from postgresql.org) to create certificates and placed them in /var/lib/pgsql/data/. Then restart the server with /etc/init.d/postgresql restart. The result is [Failed]. What else should I do? Or procedure for 7.3 is different from 7.2.4? Or the rpm does not have ssl enabled when compile? -Jason ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED] END QUOTE I'd suggest hopping onto the postgres list :) Josh. On March 19, 2003 01:25 am, Dennis Gearon wrote: > how do I connect securely to a postgres database on another server / DNS > name / IP? > > Some way to do SSL/SSH easily from PHP? On March 19, 2003 01:25 am, Dennis Gearon wrote: > how do I connect securely to a postgres database on another server / DNS > name / IP? > > Some way to do SSL/SSH easily from PHP?
--- End Message ---
--- Begin Message ---The usage of md5() in PHPLIB show TWO arguments, a seed and the string. Nothing in the online manual shows 2 args. What's the dealio? Line 111 from PHPLIB7.2c - session.inc: $id = $this->that->ac_newid(md5(uniqid($this->magic)), $this->name);
--- End Message ---
--- Begin Message ---First of all, the example you gave is only using one argument to the MD5 function. Secondly, if you *want* to seed/salt the MD5 with a key you can use: http://www.php.net/manual/en/ref.mhash.php
-- Jason k Larson aka: der Ritter
Dennis Gearon wrote:The usage of md5() in PHPLIB show TWO arguments, a seed and the string. Nothing in the online manual shows 2 args. What's the dealio?
Line 111 from PHPLIB7.2c - session.inc:
$id = $this->that->ac_newid(md5(uniqid($this->magic)), $this->name);
--- End Message ---
--- Begin Message ---Hi, I need to get a php script to print out a list of random characters. This is the list: a' b' c' d' e' f' g' a'' b'' c'' d'' e'' f'' g'' They would be printed to a maximum of 50 in a row separated by spaces. Can anyone give me a pointer as to how to do this? Since the rand functions are only for numbers, maybe assign each character group a number? Thanks in advance! Bryan
--- End Message ---
--- Begin Message ---On Wednesday 19 March 2003 15:44, Bryan Koschmann - GKT wrote: > I need to get a php script to print out a list of random characters. This > is the list: [snip] > They would be printed to a maximum of 50 in a row separated by spaces. Can > anyone give me a pointer as to how to do this? Since the rand functions > are only for numbers, maybe assign each character group a number? chr() -- 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 ------------------------------------------ /* The Moral Majority is neither. */
--- End Message ---
--- Begin Message ---I put together the following function to give me a password consisting of random letters and numbers. It should be fairly clear as to how you'd need to tweak it to just give you the characters you'd need interspersed with spaces. Hope this helps - I also hope anybody else is fairly gentle with their criticisms and pointers to whatever is wrong with the script - this is the first time I've ventured to include something like this in a response to an email on the list :-( function get_password() { // Create the password variable as an array $temp_password = array(); // Create an array of the letters of the alphabet $letters = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"); // Get the first three alpha characters of the password for($row = 0; $row < 3; $row ++) { srand ((double) microtime() * 1000000); $rand_number = rand(0, 25); $letter = $letters[$rand_number]; array_push($temp_password, $letter); } // Get five numeric characters to complete the password for($row = 0; $row < 5; $row ++) { srand ((double) microtime() * 1000000); $rand_number = rand(0, 9); array_push($temp_password, $rand_number); } // Convert the array into a single string for ($row = 0; $row < count($temp_password); $row ++) { $password .= $temp_password[$row]; } // Return the password to the script that called the function return $password; } By the way - I put this together one evening after consuming five pints of Jameson's with one arm tied behind my back and whilst wearing a blindfold! Michael Egan -----Original Message----- From: Bryan Koschmann - GKT [mailto:[EMAIL PROTECTED] Sent: 19 March 2003 07:44 To: PHP General Subject: [PHP] random letter/character?[Scanned] Hi, I need to get a php script to print out a list of random characters. This is the list: a' b' c' d' e' f' g' a'' b'' c'' d'' e'' f'' g'' They would be printed to a maximum of 50 in a row separated by spaces. Can anyone give me a pointer as to how to do this? Since the rand functions are only for numbers, maybe assign each character group a number? Thanks in advance! Bryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---Does anybody knows why I get call to undefined function for mysql_connect when running PHP through command shell. but it works fine when accessing the script through web browser. Foong
--- End Message ---
--- Begin Message ---On Wednesday 19 March 2003 16:34, Foong wrote: > Does anybody knows why I get call to undefined function for mysql_connect > when running PHP through command shell. but it works fine when accessing > the script through web browser. Most likely your php binary (CLI, not module) was not compiled with mysql support. -- 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 ------------------------------------------ /* Only people with names beginning with 'A' are getting mail this week (a la Microsoft) */
--- End Message ---
--- Begin Message ---Hi all, I am looking for a PHP-Nuke/Slashdot -type of php-based application, which can run on an Interbase database. On drawback I currently have with the others is that it does not seem to have a listserv type of interface, with subscription/unsubscription requests/archives/digests/etc. Does anyone know about something written in PHP that I can use for this. A modular approach which allows for other things later on (cataloguing/download management/etc) would be useful. Oh, it also needs access control. Anyone??
--- End Message ---
--- Begin Message ---Hi I have a problem whith the mail() function. I have used this function several times, but to day it don't work.. I use it like this: mail( $to, $subjekt, $body, $from ); and i got this warning: Warning: Failed to Connect in \\HQ-ADMIN\mail.php on line 237 Fred
--- End Message ---
--- Begin Message ---Hello guys, we have a strange problem with apache and php. apache 1.3.27 and php 4.23 is running on a solaris-machine with 2 ipadresses. apache serves request at both interfaces. Everything works fine, but every 6 days at one ip-address the clients get no response from apache. Apache logs this requests with statuscode 200 but where normally the transfered bytes stands is a '-', meaning that null bytes are transferred. The same request to the other ipaddress works fine. Only a restart of apache fix the problem. Can anyone help me or give an advice???? best regards fitz
--- End Message ---
--- Begin Message ---Hi Any functions to remove ' from a longstring? Fred
--- End Message ---
--- Begin Message ---> Any functions to remove ' from a longstring? <?php $myLongString = "......'..'.....'....."; $myLongString = str_replace("'", "", $myLongString); ?> et voila! Simple huh ;) For more info, check out: http://www.php.net/str_replace -- Dan Hardiker [EMAIL PROTECTED] ADAM Software & Systems Engineer First Creative
--- End Message ---
--- Begin Message ---Hello, I want have a Apache/PHP/MySQL configuration running on Win2000 (SP3). In my website I have a file-upload page where uses can upload a file. The max size of the upload has to be set in the mysql.ini file but I am not able to do this. I use winMySQLAdmin v1.4. When I add in the tab 'my.ini Setup' under [mysqld] 'max_allowed_packet=8M' to increase the max allowed upload filesize the corresponding value in the tab 'Variables' does not change (it stays at the default value of 1048567). Also when I restart te server (using the same winMySQLAdmintool) this value doesn't change. Funny thing is that in tab 'Environment' under 'Uptime' the value doesn't change - even after restarting the server. Is this tool buggy? Thanks, Marc
--- End Message ---