[PHP] PHP Program as Daemon
I would like to know how to run a PHP Program as a Daemon on my Linux Box. What I am planing to make is a Server that will make use of the Wonderful sockets _ Nigel Jones [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Certificate failure for (IMAP)
Dear Jason, I am using following code; require classes.php; $u = $_GET['u']; $p = $_GET['p']; $uex = explode(@, $u); $u = $uex[0]; $domain = $uex[1]; require vars.php; $MainSettings = new GlobalInit(); $TransIDEnabled = $MainSettings-INIGet('session.use_trans_sid'); session_start(); if ((!isset($_SESSION['sess_u'])) (!isset($_SESSION['sess_p']))) { $newlogin = 1; $_SESSION['sess_u'] = $u; $_SESSION['sess_p'] = $p; $newsession['sess_u'] = $u; $newsession['sess_p'] = $p; } else { $newsession = $_SESSION; } $IMAPConnection = new WM_IMAPConnection( $newsession, $servertype, $IMAPPort, $defaultIMAP, $WAPimapserver ); $OutputWML = new SetWML(); echo (wml head\n); $OutputWML-SetHead(); echo (/head\n); $OutputWML-SetCard(); $mailbox = $IMAPConnection-WM_IMAPConnect(); if (!$mailbox) { $servererrors = implode(br/\n, $IMAPConnection-_mailboxerror); if (strstr($servererrors, invalid remote specification)) { $servererrors .= br/br/It's possible that this server does not support this protocol; } echo (p\n); echo (Error: Sorry your login failed. Your server reported: $servererrors/p\n); echo (/card/wml\n); exit; } $numberofmessages = $IMAPConnection-WM_IMAPNumMessages2(); echo (pW-mail litebr//p\n); echo (pa href=\mailbox.php); $MainSettings-SessAppend($TransIDEnabled, 1); echo (\INBOX/a . $numberofmessages-Nmsgs . ( . $numberofmessages-Recent . new)/p\n); echo (pa href=\index.php?do=logout); $MainSettings-SessAppend($TransIDEnabled, 0); echo (\Exit/a/p\n); $IMAPConnection-WM_IMAPClose(); echo (/card\n/wml); Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sunday 23 November 2003 18:49, QT wrote: I try to connect to email inbox via IMAP but I am getting folowing error: Certificate failure for xx self signed certificate: /C=--/ST=SomeState/L=SomeCity What code are you using? And have you studied the examples for imap_open()? -- 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 -- /* 17. ...and if we just swap these two disc controllers like _this_... --Top 100 things you don't want the sysadmin to say */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why MySql doesn't free space when erasing BLOB fields?
OPTIMIZE TABLE tbl_name M wrote: Hello, sorry this mysql question here, but I cant't answer this one. I have database with BLOB fields to hold pictures (60-90 kb each). Actually I am erasing these BLOB fields (move '' into and update rcord) to free some space from my DB, but space is not released by mysql. I verified BLOB fields really were erased. How can I tell mysql recover these space? Thanks Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Certificate failure for (IMAP)
Dear Jason, I try your advise which is imap open sample like follows and I get; Warning: imap_open(): Couldn't open stream {mail.smsavantaj.com:110/pop3 $mbox = imap_open ({mail.test.com:110}, [EMAIL PROTECTED], 1234); echo ph1Mailboxes/h1\n; $folders = imap_listmailbox ($mbox, {mail.smsavantaj.com:110}, *); if ($folders == false) { echo Call failedbr\n; } else { while (list ($key, $val) = each ($folders)) { echo $val.br\n; } } echo ph1Headers in INBOX/h1\n; $headers = imap_headers ($mbox); if ($headers == false) { echo Call failedbr\n; } else { while (list ($key,$val) = each ($headers)) { echo $val.br\n; } } imap_close($mbox); Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sunday 23 November 2003 18:49, QT wrote: I try to connect to email inbox via IMAP but I am getting folowing error: Certificate failure for xx self signed certificate: /C=--/ST=SomeState/L=SomeCity What code are you using? And have you studied the examples for imap_open()? -- 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 -- /* 17. ...and if we just swap these two disc controllers like _this_... --Top 100 things you don't want the sysadmin to say */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Detecting Server API (CGI or Apache) at runtime?
Hi all, is there a way to tell at runtime if PHP is running as an Apache module or through CGI? phpinfo() shows this piece of information (Server API on the first page). But is it available as a server variable or a constant or whatever? I want to know this because I want to set the HTTP status code for a PHP script, and AFAICT this has to be done differently, depending on the server API: header(HTTP/1.1 304 Not modified); for the Apache module header(Status: 304 Not modified); for the CGI interface If this can be done with the same PHP code on both server APIs, that would solve my problem too. Thanks in advance, Richard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] file paths and binaries
Greetings all, I'm looking for a tutorial or some assistance in explaning how store and then open and read a binary file using php/mysql. I've got a few tutorials about storing the binary data _within_ a mysql table from Kevin Yank, phpbuilder, etc. but I've heard that it's sometime better to keep your binaries on the server and not in the database. Thus, if the developer just keeps the file path in a VARCHAR column like: C:\apache\images\house.jpg C:\apache\images\tree.jpg etc... and then directs that file be fopen() fread(), etc. it will work without the added overhead. I'm a bit lost in what happens after the filepaths are inserted into the database and what steps follow in the script so that they can be opened and read. Any help, URL's or tutorials will be of assistance. Thank you. TR -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] is it safe to store username and password for mysql connection in session variables?
Hi, In the ini-files for my php-projects, I store various settings. Two of them is username and password for my mysql-connections. Is it safe to load these two into session variables when a user logs in to my application? Or is it better to access the ini-file each time a mysql-connection is needed? What I don't understand, and hence the questions, is wether session variables are accessible by my website's visitors, or just to the php-scripts on the server. -- anders thoresson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A loop for the hours in a working day
Hi, I need a loop that will print the hours in a day separated by every fifteen minutes between 0700 and 1900 e.g. 07:00 07:15 07:30 07:45 08:00 08:15 ... 19:00 How could I do this? Thanks for your help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 23 Nov 2003 15:34:15 -0000 Issue 2432
php-general Digest 23 Nov 2003 15:34:15 - Issue 2432 Topics (messages 170697 through 170718): Re: Execute programs 170697 by: Eric Wood Re: $_GET String Edit 170698 by: Chris Shiflett 170699 by: Jed R. Brubaker 170701 by: Chris Shiflett ldap_search() question 170700 by: Schechter, Ricky function that appends dollar symbol 170702 by: Joffrey Leevy 170703 by: John Nichel 170704 by: Robert Cummings 170709 by: Ryan A Why MySql doesn't free space when erasing BLOB fields? 170705 by: M 170707 by: Nigel Jones 170713 by: Marek Kilimajer Temporarily signing off 170706 by: Becoming Digital Re: Certificate failure for (IMAP) 170708 by: Jason Wong 170712 by: QT 170714 by: QT Re: passthru gives error in httpd/error_log 170710 by: Jason Wong PHP Program as Daemon 170711 by: Nigel Jones Detecting Server API (CGI or Apache) at runtime? 170715 by: Richard Cyganiak file paths and binaries 170716 by: Anthony Ritter is it safe to store username and password for mysql connection in session variables? 170717 by: anders thoresson A loop for the hours in a working day 170718 by: Shaun 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] -- ---BeginMessage--- - Original Message - If you start a program using this function and want to leave it running in the background, you have to make sure that the output of that program is redirected to a file or some other output stream or else PHP will hang until the execution of the program ends. Use system() and background it with : $cmd = tail -f /var/log/messages ; system($cmd); -eric ---End Message--- ---BeginMessage--- --- Jed R. Brubaker [EMAIL PROTECTED] wrote: I am trying to make a page navigation menu (we have all seen them, Page: 1 2 3...), and I would like to continue doing this via the URL variables. Right now, each of the page numbers is a hyper link is set like this: page.php?.$_SERVER[QUERY_STRING].more variables here. The problem, however, is that those variables are a string. If the variables that the menu defines are already in the string, it doesn't update them, it just adds more definitions to the URL. I had a hard time interpreting your question, but I think you're saying that you are generating URLs like this: /page.php?foo1=bar1foo2=bar2foo1=bar3foo2=bar4 And, you're wanting to not duplicate variables in your URL, correct? You could always keep your query string in an array or something. This would allow you to update values in the array prior to the end of your script. You can start this array using $_GET: $query = $_GET; Of course, you might want to rather filter this data on each page, so that you don't spread tainted data more than necessary. Regardless, this will allow you to update values in your query string. If you want to update foo1, you don't have to care whether it's already set: $query['foo1'] = 'newvalue'; Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp ---End Message--- ---BeginMessage--- Sorry for the confusing initial request. You were correct in assuming that I am generating URLs like: page.php?foo1=bar1foo2=bar2foo1=bar3foo2=bar4 So I suppose the consise follow-up question is how can I get a hyperlink to change one of those varibles in the string. In the past I have just tacked a varible on to the end of the string, but I don't want to be redundant. Thanks again. Chris Shiflett [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] --- Jed R. Brubaker [EMAIL PROTECTED] wrote: I am trying to make a page navigation menu (we have all seen them, Page: 1 2 3...), and I would like to continue doing this via the URL variables. Right now, each of the page numbers is a hyper link is set like this: page.php?.$_SERVER[QUERY_STRING].more variables here. The problem, however, is that those variables are a string. If the variables that the menu defines are already in the string, it doesn't update them, it just adds more definitions to the URL. I had a hard time interpreting your question, but I think you're saying that you are generating URLs like this: /page.php?foo1=bar1foo2=bar2foo1=bar3foo2=bar4 And, you're wanting to not duplicate variables in your URL, correct? You could always keep your query string in an array or something. This would allow you to update values in the array prior to the end of your script. You can start this array using $_GET: $query = $_GET; Of course, you might want to rather
[PHP] Re: is it safe to store username and password for mysql connection in session variables?
[EMAIL PROTECTED] Anders Thoresson: Hi, In the ini-files for my php-projects, I store various settings. Two of them is username and password for my mysql-connections. Is it safe to load these two into session variables when a user logs in to my application? Or is it better to access the ini-file each time a mysql-connection is needed? What I don't understand, and hence the questions, is wether session variables are accessible by my website's visitors, or just to the php-scripts on the server. AFAIK only to the scripts. But then again it's always good to be secure. Read the ini file. -- Comex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A Tricky Time Calculation
Hi, Given the time range: 09:15 - 17:30 how can I tell how many 15 minute intervals occur between these two times? Obviously here I can work it out, but I need a calculation that will perform the maths for any two time ranges... Thanks for your help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: A loop for the hours in a working day
Sorry, worked it out, here it is if anyone needs it :) $minutes = array(00, 15, 30, 45); $hours = array(07, 08, 09, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19); for ($x = 0; $x 13; $x++ ) { for ($y = 0; $y 4; $y++ ) { echo tr td.$hours[$x].'.'.$minutes[$y]./td /tr; } } Shaun [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I need a loop that will print the hours in a day separated by every fifteen minutes between 0700 and 1900 e.g. 07:00 07:15 07:30 07:45 08:00 08:15 ... 19:00 How could I do this? Thanks for your help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php daemon
I have just been trying to work out the behaviour of running a php programm from BASH. If i execute ./my_program.php /var/log/mylog 21 and then terminate the controlling terminal I get a background process which has no controlling terminal, a parent process id of 1 and the process becomes a session leader and process group leader. Everything looks in order as far as this being a proper daemon. So, my question is, is this all correct and the same as running a daemon in say C? Just opening a discussion really to help in my education. regards Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] xml parser und bestehende variablen - multilinguale app
Hallo zusammen, ich möchte gerne meine bestehende app in mehreren Sprachen anbieten. Dazu habe ich mir ein xml parser package installiert welches in der Lage ist aus xml dateien inhalte einzufügen. Zum Bsp sieht das xml file so aus: enexample/en debeispiel/de Das funktioniert so weit. Das PROBLEM allerdings is, wenn ich eine varible innerhalb dieses textes habe und nicht alles zerstückeln möchte, parst php diese inhalte nicht. Beispiel: $no = 10; enexample '.$no.'/en debeispiel '.$no.'/de In diesem Fall bekommt man den Inhalt der Variable nicht angegeben, sondern einfahc den '.$no.' string. Was kann man da tun? Ich kann unmöglich alle texte aufsplitten. Das auslagern in eine xml datei ist ganz praktisch vor allem wenn es mehrere Sprachen werden. Hat hier jemand einen guten Tipp? vielen Dank im voraus, Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: A loop for the hours in a working day
On Sun, 23 Nov 2003, Shaun wrote: Sorry, worked it out, here it is if anyone needs it :) $minutes = array(00, 15, 30, 45); $hours = array(07, 08, 09, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19); for ($x = 0; $x 13; $x++ ) { for ($y = 0; $y 4; $y++ ) { echo trtd.$hours[$x].'.'.$minutes[$y]./td/tr; } } That works, but it's a little unweildy.. especially if you want to change the range later (changing the array may not be so bad, but then you've got to figure out how many iterations your loops must do, etc). How about something like this: $hstart = 7; $hend = 19; $interval = 15; for($h=$hstart; $h $hend; $h++) { for($m=0; $m 60; $m += $interval) { echo sprintf(%d:%02d,$h,$m); } } Used sprintf in order to make 0 minutes display as 00. This would be a great candidate for something to make into a function... -- Kelly Hallman // Ultrafancy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ldap_search() question
On Sat, 22 Nov 2003, Schechter, Ricky wrote: Do I use ldap_search to authenticate users in LDAP? I can successfully search the LDAP and retrieve user's data based on a search criteria like (cn=something). If I use (password=somepass) or (userPassword=somepass) in the search criteria it comes back with no hits. How should this be done? Do I have to encrypt the password somehow? You probably need to use ldap_compare() to verify the password. Most LDAP servers won't send back the password field contents. Hope that helps! -- Kelly Hallman // Ultrafancy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: function that appends dollar symbol
Please, see: http://www.php.net/manual/en/function.localeconv.php and http://www.php.net/manual/en/function.setlocale.php - zerof - Joffrey Leevy [EMAIL PROTECTED] escreveu na mensagem news:[EMAIL PROTECTED] The money_format function does not do it for me. Is there a simple php function which appends the '$' symbol to a string value. Example -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Advice: GET vs. POST vs. SESSION
I was hoping that some of you would be able to give me some advice. I have started creating a web application that makes heavy use of URL GET variables in order to solve a problem that I have had with POST in the past - namely, having to refresh the document and repost the variables when you use the browser's back button. So I enthusiastically have embraced GET variables, but am now having a struggle editing the URL variable string. So this is my question: is using URL GET variables that best way to avoid that browser back button effect? I have thought about using session variable extensively, but that I am going to have to be unsetting them all over the place. So - anyone have any advice? Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Advice: GET vs. POST vs. SESSION
On Sun, 2003-11-23 at 14:27, Jed R. Brubaker wrote: I was hoping that some of you would be able to give me some advice. I have started creating a web application that makes heavy use of URL GET variables in order to solve a problem that I have had with POST in the past - namely, having to refresh the document and repost the variables when you use the browser's back button. So I enthusiastically have embraced GET variables, but am now having a struggle editing the URL variable string. So this is my question: is using URL GET variables that best way to avoid that browser back button effect? It can be a good way, but I believe the spec for GET based parameters only guarantee processing of 1024 characters (this may be the wrong number but there is a limit on the guarantee). I have thought about using session variable extensively, but that I am going to have to be unsetting them all over the place. If you are worried about unsetting them all, maybe it would help to use a two level array to hold your form data. Perhaps the following: $_SESSION['formName']['email'] = $_POST[['email']; Then when you want to clear the form you can do a simple: unset( $_SESSION['formName'] ); HTH, 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] Re: A loop for the hours in a working day
On Sun, 23 Nov 2003 10:49:58 -0800 (PST), you wrote: That works, but it's a little unweildy.. especially if you want to change the range later (changing the array may not be so bad, but then you've got to figure out how many iterations your loops must do, etc). How about something like this: $hstart = 7; $hend = 19; $interval = 15; for($h=$hstart; $h $hend; $h++) { for($m=0; $m 60; $m += $interval) { echo sprintf(%d:%02d,$h,$m); } } Used sprintf in order to make 0 minutes display as 00. This would be a great candidate for something to make into a function... Couple of suggestions on top: replace echo sprintf with a simple printf. the above won't work across midnight, and returns time values in only one format (hh:mm). If I was going to bother to use a function here, I'd work with unix timestamps and strftime() (http://www.php.net/strftime) so my function would return values in pretty much any format, and at 1 second resolution. Eg: ? $now = time(); print_r (time_array ($now - 14400, $now, 15*60, '%H%M')); print_r (time_array ($now - 14400, $now, 15*60, '%I:%M %p')); function time_array ($start, $end, $interval, $format) { $output = array(); while ($start $end) { $output [] = strftime ($format, $start); $start = $start + $interval; } return ($output); } ? Anyone want to suggest some more embellishments? The ability to return blocks of time, maybe: 12:45 - 13:00, 13:00 - 13:15, etc. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Encoders
Jerry [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have always been a little bit reluctant to use obfuscators since the source code does not actually disappear and it should not be too difficult to find the correct patterns and algorythms to map and restore the scrambled code. One could possibly write a good piece of code that would do exactly that. I don't know what you mean by restore the scrambled code after obfuscation. The comments are gone, so no tool or person can restore them without essentially simply guessing. The identifier names are meaningless, and restoring them to something sensible means you pretty have much have to understand what the code is doing in order to choose a good name. So I don't think you can write a tool to do this at all. (Another poster observed that you *can* use a tool to reformat obfuscated text so its block structure is visible. Our tool also can format and so can be used for that purpose too, but the real value in the obfsucation is the removal of comments and scrambling of names). If you have a really small applicaiton, obfuscation won't hide it very well. If you have a really big application, in our opinion, the number of names that have to regenerated becomes pretty daunting for would-be reverse-engineer. Instead the e.g. ioncube encoder really encodes the scripts and requires only one file (the runtime-loader) to be uploaded along with the encrypted scripts onto the server to make the scripts executable. Since the scripts run as a compiled application they are even faster than unencrypted PHP scripts. So, this seems an interesting alternative to me. Encoding the script doesn't prevent reverse engineering. It just raises the effort level required to decode it. (I'll cheerfully admit it raises it somewhat higher than obfuscated source.) Ultimately, if somebody wants to reverse engineer your code, they can. So the real question is, what's enough protection? Most people don't use a bank vault locks on their front door. Deadbolts are good enough for the majority. Costs: Your obfuscator costs US$150.00. The ioncube encoder starts at US$199.00 Personally, I find it's worth the difference. OK. Everybody makes their choice. We chose to provide source obfuscation because while you may have a customer for your PHP source code, you can't always tell your customer what he must run on his server. Of course, if your customer *wants* to run with a PHP compiler, he can do that with obfuscated source, too, but now it is his choice, not yours. What is your take on that? Thank you for your help and opinion. Jerry -- Ira D. Baxter, Ph.D., CTO 512-250-1018 Semantic Designs, Inc. www.semdesigns.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP with Java extension
Hello, I am completely new to PHP and due to some disparate components in our system I am trying to integrate PHP with Java. I have followed the instructions in the README file (under the ext/java folder in the PHP bundle) but I have hit a snag two days now. I have done several changes in my php.ini file but none of them seems to work. Apache seems to be able to find the JVM butu nfortunatelly the page does not load. With Opera 6.1 it just goes into a spastic fit and tries to connect and reconnect all the time (a problem similar to this URL: http://www.phpbuilder.com/annotate/message.php3?id=1014708.) with no error messages on the apache logs. If I use Netscape I just get the error message that the browser cannot load an empty document. If I use Mozilla it loads the page up fine but when I do view source it is an empty document (only the html and body tags are there, nothing else). I have tried every hack described on php.net and phpbuilder.com but to no avail, so you are my last hope. Any ideas and recommendations are more than welcome. Additional info: php.ini: extension_dir=/usr/local/lib/php/extensions/no-debug-non-zts-20020429 extension=libphp_java.so java.class.path=/usr/local/apache/php/lib/php/php_java.jar java.home=/homa/panos/java/j2sdk1.4.0 java.library=/home/panos/java/j2sdk1.4.0/jre/lib/i386/server/libjvm.so java.library.path=/usr/local/lib/php/extensions/no-debug-non-zts-20020429 php file I am using for testing: ?php print testing...; $systemInfo = new Java(java.lang.System); print Total seconds since January 1, 1970:.$systemInfo-currentTimeMillis(); ? os: Mandrake Linux 8.1 with kernel 2.4.8-26mdk php: 4.3.1 apache: 2.0.43 java: 1.4.0 Thank you. __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] secure query string before sending it to mysql
Hi, I'm working on a database class of my own. I've got the following method: /** * query() performs a query on the selected database */ function query($dbQuery) { if (is_string($dbQuery)) $this-dbQuery = $dbQuery; else die(The submitted query isn't a string); $this-queryResult = mysql_query($this-dbQuery) or die(Couldn't perform the query: . mysql_error()); } In the best of all words, variables that are part of the query string has been validated before going into the query. But if I sometimes forget to verify that user input doesn't contain dangerous code, I want to add some validating mechanism into the method above as well. $dbQuery will be query string like INSERT INTO $article_table SET a_header = '$a_header'. Is there anything I can do, inside the method, to increase security? -- anders thoresson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A Tricky Time Calculation
On Sun, Nov 23, 2003 at 03:42:58PM -, Shaun wrote: : : Given the time range: 09:15 - 17:30 how can I tell how many 15 minute : intervals occur between these two times? Obviously here I can work it out, : but I need a calculation that will perform the maths for any two time : ranges... $time1 = '09:15'; $time2 = '17:30'; $intervals = floor((strtotime($time2) - strtotime($time1)) / 900); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] xml parser und bestehende variablen - multilinguale app
How are you parsing the XML? If you read the values into a PHP variable, and you're confident in the contents of the string, you could use eval()... Also, preg_replace_callback() may be useful. If you provide a bit more example, it may be more easy to help. In any case, I think your variable variables are a bit out of whack. Read http://us3.php.net/manual/en/language.variables.variable.php That may be your problem if it's outputting something like 'beispiel ', and not 'beispiel $no'. Try doing error_reporting(E_ALL) and see what happens. - Babelfish says... (my reply:) Wie analysieren Sie das XML? Wenn Sie die Werte in eine PHP Variable lesen und Sie im Inhalt der Zeichenkette überzeugt sind, konnten Sie eval() benutzen... Auch preg_replace_callback() kann nützlich sein. Wenn Sie eine Spitze mehr Beispiel zur Verfügung stellen, zu helfen kann einfacher sein. In jedem möglichem Fall denke ich, daß Ihre variablen Variablen eine Spitze aus whack heraus sind. Lesen Sie http://us3.php.net/manual/en/language.variables.variable.php Das kann Ihr Problem, wenn es etwas wie ' beispiel ' ausgibt, und nicht ' beispiel $no'. Versuchen Sie, error_reporting(E_ALL) zu tun und sehen Sie, was geschieht. (orignal message:) Hello together, I would like to offer gladly my existing app in several languages. In addition I have me xml more parser package installed a which in the situation am out xml files of contents to be inserted. To the Bsp xml the file looks in such a way: enexample/en debeispiel/de Functions so far. The PROBLEM however is, if I have a varible within this text and not everything to carve up liked, does not parst php these contents. Example: $$no = 10; enexample ' $no.'/en debeispiel ' $no.'/en In this case one gets the contents of the variable not indicated, but einfahc the ' $no.' stringer. What there can one do? I can not possibly all write the text split up. That out page into one xml file is completely practically above all if it several languages become. Here does someone have a good taps? thank you in advance, Andy -- Evan Nemerson [EMAIL PROTECTED] http://coeusgroup.com/en -- If there is no higher reason--and there is none--then my own reason must be the supreme judge of my life. -Leo Nikolaevich Tolstoy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] basic auth question
Please CC me, I am on digest -- If I have a directory like: $HOME/www/ (document root) It has a auth section in the .htaccess file $HOME/www/.htaccess another directory like: $HOME/www/want_to_be_public/ How can I defeat the auth section in the $HOME/www/.htaccess file by commands in the: $HOME/www/want_to_be_public/.htaccess file? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] String returned from forms and such
Good afternoon. I'm having a problem handling strings with spaces being passed from a form by HREF to a PHP program. Example: A HREF=buttons.php?state_name=New Mexicobutton code/A When the 'New Mexico' gets to phpinfo, it says the string is 'New+Mexico' and that's not what I need. I used htmlspecialchars to add the %20 to the string but didn't get it. What am I doing wrong or missing?? Any help is VERY appreciated!! Robin 'Sparky' Kopetzky Black Mesa Computers/Internet Service Grants, NM 87020 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] String returned from forms and such
On Sun, 23 Nov 2003 15:19:23 -0700, you wrote: When the 'New Mexico' gets to phpinfo, it says the string is 'New+Mexico' and that's not what I need. I used htmlspecialchars to add the %20 to the string but didn't get it. What am I doing wrong or missing?? That sounds like the behaviour of urlencode, not htmlspecialchars. Try rawurlencode. BTW, there is a urldecode function... http://www.php.net/manual/en/ref.url.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] basic auth question
Please CC me, I am on digest -- If I have a directory like: $HOME/www/ (document root) It has a auth section in the .htaccess file $HOME/www/.htaccess another directory like: $HOME/www/want_to_be_public/ How can I defeat the auth section in the $HOME/www/.htaccess file by commands in the: $HOME/www/want_to_be_public/.htaccess file? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] basic auth question
Please CC me, I am on digest -- If I have a directory like: $HOME/www/ (document root) It has a auth section in the .htaccess file $HOME/www/.htaccess another directory like: $HOME/www/want_to_be_public/ How can I defeat the auth section in the $HOME/www/.htaccess file by commands in the: $HOME/www/want_to_be_public/.htaccess file? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] User/Pwd Management Package?
Friends, I'm interesting in finding a PHP package that implements functions for managing user names passwords controlling access to specific parts of a site. Of course, free is best. But cheap is good. And, even not-so-cheap is fine, as long as it provides good functionality. Any pointers appreciated. -- Jonathan Rosenberg President Founder, Tabby's Place http://www.tabbysplace.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: User/Pwd Management Package?
There are a number of open-source PEAR packages that can help you manage usernames, passwords, and user preferences. Check out: http://pear.php.net/packages.php?catpid=1catname=Authentication Hope it helps, Al Jonathan Rosenberg [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Friends, I'm interesting in finding a PHP package that implements functions for managing user names passwords controlling access to specific parts of a site. Of course, free is best. But cheap is good. And, even not-so-cheap is fine, as long as it provides good functionality. Any pointers appreciated. -- Jonathan Rosenberg President Founder, Tabby's Place http://www.tabbysplace.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] String Manip. - Chop Equivalent
Does PHP have an equivalent to PERL's chop - that is, a way to get rid of the last character in a string? Hello World to Hello Worl Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQLITE
* Thus wrote Bronislav Kluèka ([EMAIL PROTECTED]): Hi, I've got questions: I've got sqlite like PHP module (under windows). I tried this: a)execute script 1 (selecting from some table), it tooks 2 minutes b)execute script 2 , it tooks 3 minutes c)execute them both at the same time (from different browser windows), both of them stopped also at the same time and it tooks 5 minutes Read the sqlite faq: http://sqlite.org/faq.html#q7 Curt -- My PHP key is worn out PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: String Manip. - Chop Equivalent
Jed R. Brubaker wrote: Does PHP have an equivalent to PERL's chop - that is, a way to get rid of the last character in a string? Hello World to Hello Worl Thanks in advance. this might work, haven't tested it... second param is optional function chop($strSubject, $intWastage = 1) { $strRes = ; $len = strlen($strSubject); if($intWastage = $len $intWastage = ($len * (-1))) $strRes = substr($strSubject,0,$len - $intWastage); return $strRes; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: String Manip. - Chop Equivalent
From the PHP Manual notes (http://us2.php.net/manual/en/function.chop.php): $string = substr($string, 0, -1); Al Jed R. Brubaker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Does PHP have an equivalent to PERL's chop - that is, a way to get rid of the last character in a string? Hello World to Hello Worl Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ldap_search() question
Schechter, Ricky [EMAIL PROTECTED] wrote: Do I use ldap_search to authenticate users in LDAP? I can successfully search the LDAP and retrieve user's data based on a search criteria like (cn=something). If I use (password=somepass) or (userPassword=somepass) in the search criteria it comes back with no hits. How should this be done? Do I have to encrypt the password somehow? Thank you! Hi Ricky, Apologies if someone's already answered this, I get php-general in digest form and havn't seen an answer yet. Dunno if this is the standard way of authenticating via LDAP, but where I am I try to bind to the LDAP directory using the user's name and password. If it works, they're a valid user -- I can then release the binding, reconnect anonymously, and get the info I want about them.. Eventually I plan on moving to LiveUser (all these great packages weren't around when I built my system!) Cheers Daniel -- = Daniel Baird JCU Bookshop = = Systems AdministratorJames Cook University = = [EMAIL PROTECTED] Townsville Q 4811 = = http://bookshop.jcu.edu.au = Australia = -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] preg_replace() issue
1) function filter() { if($this-post['a'] == savenews) { $this-post['summary'] = preg_replace(!\[url\](.*)\[/url\]!,a href=\\\1\\\1/a, $this-post['summary']); } --- 2) global $nwedst; $nwedst = str_replace(br\n, '', $dat-summary); nwedst = preg_replace(!\a href=\http://(.*)\(.*)\/a!,[url]http://\\1[/url];, $nwedst); 1 takes a full news post and changes [url]...[/url] into a href=../a and saves the news post 2 takes the full news post and recalls it, changes a href=../a... into [url]...[/url] 1 is used when making a new news post, 2 is used when editing a news post (making the post user friendly and easy to edit) 2 seems to only replace the first a href=... and the last /a when there are multiple links. That's the first of my problems. The second is that I would like to change my code so that it changes [url=$1]$2[/url] into a href=$1$2/a and back again but i don't know how to change multiple things with preg_replace(). plz help, Darkstar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: String Manip. - Chop Equivalent
On Sun, 2003-11-23 at 20:02, Al wrote: From the PHP Manual notes (http://us2.php.net/manual/en/function.chop.php): $string = substr($string, 0, -1); You'd be better off with: $string = substr( $string, 0, -1 ); to avoid unnecessary interpolation overhead. 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] PHP to get mail headers
I run a small ISP and am looking at ways to automate grabbing the headers from email. I currently copy all email to a BSD box, then use Pine in header mode to get the IP addresses from which I build my spam filters. A search did not yield much in what I am trying to do: 1)Open the mailbox and extract the Received, From and Subject headers. 2)Drop those into a database that I can manage from the browser. Sounds simple enough and I am sure I am making it harder than it really is, but if you know of a project please let me know. Thanks! -Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] download from mysql script
I'm trying to receive data from a mysql database through php. Using the command line at mysql listed below gives me a result set. I am able to connect to the database through php, however, when using the following script, I receive no data when the data is in the table called pictures in the db called sitename. ? if($ID) { @MYSQL_CONNECT(localhost,root,thepassword); @mysql_select_db(sitename); $query = select bin_data,filetype from pictures where ID=$ID; $result = @MYSQL_QUERY($query); $data = @MYSQL_RESULT($result,0,bin_data); $type = @MYSQL_RESULT($result,0,filetype); Header( Content-type: $type); echo $data; } ? // In browser window it reads: // http://localhost/download.php?filename=7 //...and on the Command Line using the following query: // SELECT filetype FROM pictures where ID=$ID // gives me a image/pjpeg as the result set. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A loop for the hours in a working day
On Monday, November 24, 2003, at 02:34 AM, Shaun wrote: Hi, I need a loop that will print the hours in a day separated by every fifteen minutes between 0700 and 1900 e.g. 07:00 07:15 07:30 07:45 08:00 08:15 ... 19:00 How could I do this? ? $start = 7; $end = 19; $h = $start; while($h = $end) { if($h != $end) { echo {$h}:00\n; echo {$h}:15\n; echo {$h}:30\n; echo {$h}:45\n; } else { echo {$h}:00\n; } $h++; } ? There's plenty of ways, this is just one to get your head on the right track :) Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is it safe to store username and password for mysql connection in session variables?
On Monday, November 24, 2003, at 01:54 AM, anders thoresson wrote: Is it safe to load these two into session variables when a user logs in to my application? Or is it better to access the ini-file each time a mysql-connection is needed? I include the file with unames and passwords as needed. I believe session information should be used for storing user-specific data. If you have 100 sessions open on the server, that's 100 copies of your MySQL username and password being stored as session data -- it just doesn't make sense. What I don't understand, and hence the questions, is wether session variables are accessible by my website's visitors, or just to the php-scripts on the server. Session variables are stored on the server, and are only made visible to the user if you choose to do so. In theory, this should alleviate your concerns, but the catch is how well you build your scripts... for example, you might have put a print_r($_SESSION) somewhere in your script for debugging purposes, which would spew the entire contents of their session onto the screen -- this is obviously bad. So, IMHO, that's two reasons why your MySQL u/p details shouldn't be in the session :) Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: A loop for the hours in a working day
On Sun, 23 Nov 2003, David Otton wrote: How about something like this: $hstart = 7; $hend = 19; $interval = 15; for($h=$hstart; $h $hend; $h++) { for($m=0; $m 60; $m += $interval) { echo sprintf(%d:%02d,$h,$m); } } Couple of suggestions on top: replace echo sprintf with a simple printf. Yes.. I thought it would be more illustrative to use sprintf, as printf alone might look more foreign and is less versatile in this case (especially were it made into a function)... If I was going to bother to use a function here, I'd work with unix timestamps and strftime() (http://www.php.net/strftime) so my function would return values in pretty much any format, and at 1 second res... Well, sure.. but that would be overkill for a simple select list of the type described. As for coding it as a function, I was only trying to suggest this is the type of thing that makes a good function--not that what I put down there would make the ultimate function of this type. I thought taking it further and making it into a function myself 1) might seem like I was trying to be showy and 2) feared the example would start losing it's demonstrative value with extra functionality. -- Kelly Hallman // Ultrafancy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP to get mail headers
Scott St. John [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] A search did not yield much in what I am trying to do: 1)Open the mailbox and extract the Received, From and Subject headers. 2)Drop those into a database that I can manage from the browser. There are two PEAR packages that can help you with this: 1) Mail_Mbox will parse and manipulate mbox files so you can traverse your mail file and pull out individual messages. http://pear.php.net/package/Mail_Mbox 2) Mail_Mime contains classes for decoding and parsing individual messages. http://pear.php.net/package/Mail_Mime Hope it helps. Al -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Duplicate Images
Hi All, Please give me a hand with this, ive been trying to do this for the best part of today but i have got no where! I have two arrays both have 161 elements, each has a list of filenames on my server (images) now the idea here is to take the image name from array 1 copy it and re-name it to that of array 2. for example $array_A[$i] = 123097 $array_B[$i] = 684547 I need to keep the original image as well as duplicate it rename. Many thanks R -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] when to use \n in forms
Hi: Can someone shed some light on this please? To me when doing a form in php using \n or not using \n makes no difference. I still get the form in my browser to work. For instance, ?php echoform action='processform_2b.php' method='post'\n select name='animal'\n OPTION value='cat'cat\n OPTION value='dog'dog\n OPTION value='rat'rat\n etc. and ?php echoform action='processform_2b.php' method='post'\n select name='animal' OPTION value='cat'cat OPTION value='dog'dog OPTION value='rat'rat etc. produce the same select menu in my browser. So is using \n really that critical for this case? Thanks __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 24 Nov 2003 03:41:07 -0000 Issue 2433
php-general Digest 24 Nov 2003 03:41:07 - Issue 2433 Topics (messages 170719 through 170756): Re: is it safe to store username and password for mysql connection in session variables? 170719 by: Comex 170752 by: Justin French A Tricky Time Calculation 170720 by: Shaun 170734 by: Eugene Lee Re: A loop for the hours in a working day 170721 by: Shaun 170725 by: Kelly Hallman 170730 by: David Otton 170751 by: Justin French 170753 by: Kelly Hallman Re: SQLITE 170722 by: Curt Zirzow php daemon 170723 by: Jon Hill xml parser und bestehende variablen - multilinguale app 170724 by: Merlin 170735 by: Evan Nemerson Re: ldap_search() question 170726 by: Kelly Hallman 170746 by: Daniel Baird Re: function that appends dollar symbol 170727 by: zerof Advice: GET vs. POST vs. SESSION 170728 by: Jed R. Brubaker 170729 by: Robert Cummings Re: PHP Encoders 170731 by: Ira Baxter PHP with Java extension 170732 by: Panos Konstantinidis secure query string before sending it to mysql 170733 by: anders thoresson basic auth question 170736 by: Dennis Gearon 170739 by: Dennis Gearon 170740 by: Dennis Gearon String returned from forms and such 170737 by: Robin Kopetzky 170738 by: David Otton User/Pwd Management Package? 170741 by: Jonathan Rosenberg 170742 by: Al String Manip. - Chop Equivalent 170743 by: Jed R. Brubaker 170744 by: Terence 170745 by: Al 170748 by: Robert Cummings preg_replace() issue 170747 by: Darkstar PHP to get mail headers 170749 by: Scott St. John 170754 by: Al download from mysql script 170750 by: Anthony Ritter Duplicate Images 170755 by: Erin when to use \n in forms 170756 by: Joffrey Leevy 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] -- ---BeginMessage--- [EMAIL PROTECTED] Anders Thoresson: Hi, In the ini-files for my php-projects, I store various settings. Two of them is username and password for my mysql-connections. Is it safe to load these two into session variables when a user logs in to my application? Or is it better to access the ini-file each time a mysql-connection is needed? What I don't understand, and hence the questions, is wether session variables are accessible by my website's visitors, or just to the php-scripts on the server. AFAIK only to the scripts. But then again it's always good to be secure. Read the ini file. -- Comex ---End Message--- ---BeginMessage--- On Monday, November 24, 2003, at 01:54 AM, anders thoresson wrote: Is it safe to load these two into session variables when a user logs in to my application? Or is it better to access the ini-file each time a mysql-connection is needed? I include the file with unames and passwords as needed. I believe session information should be used for storing user-specific data. If you have 100 sessions open on the server, that's 100 copies of your MySQL username and password being stored as session data -- it just doesn't make sense. What I don't understand, and hence the questions, is wether session variables are accessible by my website's visitors, or just to the php-scripts on the server. Session variables are stored on the server, and are only made visible to the user if you choose to do so. In theory, this should alleviate your concerns, but the catch is how well you build your scripts... for example, you might have put a print_r($_SESSION) somewhere in your script for debugging purposes, which would spew the entire contents of their session onto the screen -- this is obviously bad. So, IMHO, that's two reasons why your MySQL u/p details shouldn't be in the session :) Justin French ---End Message--- ---BeginMessage--- Hi, Given the time range: 09:15 - 17:30 how can I tell how many 15 minute intervals occur between these two times? Obviously here I can work it out, but I need a calculation that will perform the maths for any two time ranges... Thanks for your help ---End Message--- ---BeginMessage--- On Sun, Nov 23, 2003 at 03:42:58PM -, Shaun wrote: : : Given the time range: 09:15 - 17:30 how can I tell how many 15 minute : intervals occur between these two times? Obviously here I can work it out, : but I need a calculation that will perform the maths for any two time : ranges... $time1 = '09:15'; $time2 = '17:30'; $intervals = floor((strtotime($time2) - strtotime($time1)) / 900); ---End Message--- ---BeginMessage--- Sorry, worked it out, here it is if anyone needs it :) $minutes = array(00, 15, 30, 45); $hours =
Re: [PHP] Duplicate Images
Erin wrote: Hi All, Please give me a hand with this, ive been trying to do this for the best part of today but i have got no where! I have two arrays both have 161 elements, each has a list of filenames on my server (images) now the idea here is to take the image name from array 1 copy it and re-name it to that of array 2. for example $array_A[$i] = 123097 $array_B[$i] = 684547 I need to keep the original image as well as duplicate it rename. Many thanks Use the manual, Luke. http://www.php.net/manual/en/function.copy.php -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] when to use \n in forms
Joffrey Leevy wrote: Hi: Can someone shed some light on this please? To me when doing a form in php using \n or not using \n makes no difference. I still get the form in my browser to work. For instance, ?php echoform action='processform_2b.php' method='post'\n select name='animal'\n OPTION value='cat'cat\n OPTION value='dog'dog\n OPTION value='rat'rat\n etc. and ?php echoform action='processform_2b.php' method='post'\n select name='animal' OPTION value='cat'cat OPTION value='dog'dog OPTION value='rat'rat etc. produce the same select menu in my browser. So is using \n really that critical for this case? Thanks HTML ignores whitespace (new lines included). You can create your entire HTML document on one line, but debugging it would be a bitch. Throwing new lines in there isn't for the browser...but it can help you in the long run. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] when to use \n in forms
No Diff, Plus i think that HTML is wrong Use: OPTION value='cat'cat/OPTION OPTION value='dog'dog/OPTION OPTION value='rat'rat/OPTION Just for that HTML standards sake :P _ Nigel Jones [EMAIL PROTECTED] -Original Message- From: Joffrey Leevy [mailto:[EMAIL PROTECTED] Sent: Monday, November 24, 2003 4:41 PM To: [EMAIL PROTECTED] Subject: [PHP] when to use \n in forms Hi: Can someone shed some light on this please? To me when doing a form in php using \n or not using \n makes no difference. I still get the form in my browser to work. For instance, ?php echoform action='processform_2b.php' method='post'\n select name='animal'\n OPTION value='cat'cat\n OPTION value='dog'dog\n OPTION value='rat'rat\n etc. and ?php echoform action='processform_2b.php' method='post'\n select name='animal' OPTION value='cat'cat OPTION value='dog'dog OPTION value='rat'rat etc. produce the same select menu in my browser. So is using \n really that critical for this case? Thanks __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] when to use \n in forms
Nigel Jones wrote: No Diff, Plus i think that HTML is wrong Use: OPTION value='cat'cat/OPTION OPTION value='dog'dog/OPTION OPTION value='rat'rat/OPTION Just for that HTML standards sake :P Most (if not all) browsers of today with handle it fine without the closing /option tag, but you're right for the standards sake. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Setting counter in variable name within foreach loop
Is this possible? I've been messing with this for about an hour now, searching on google for about half hour. Here is what I want to do: foreach ($array as $key = $value) { $value = explode(|, $value); $counter = 0; if ($value[7] == Yes) { $counter++; $date_$counter = $value[1]; -- this is line 33 $dest_$counter = $value[3]; $dep_$counter = $value[4]; } } Then later, I would like to do: for ($i = 0; $i $counter; $i++) { echo $date_$i, $dest_$i, $dep_$ibr\n; } But, I get an error: Parse error: parse error, unexpected T_VARIABLE in /var/www/secure/travelrequest/travel7.php on line 33 Is there a way I can do this? Thanks, Jake McHenry Nittany Travel MIS Coordinator http://www.nittanytravel.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] when to use \n in forms
How I take it is the fact that most is not all, it's best if possible to do for all hence why I try to keep away from DHTML and Javascript _ Nigel Jones [EMAIL PROTECTED] -Original Message- From: John Nichel [mailto:[EMAIL PROTECTED] Sent: Monday, November 24, 2003 4:52 PM Cc: [EMAIL PROTECTED] Subject: Re: [PHP] when to use \n in forms Nigel Jones wrote: No Diff, Plus i think that HTML is wrong Use: OPTION value='cat'cat/OPTION OPTION value='dog'dog/OPTION OPTION value='rat'rat/OPTION Just for that HTML standards sake :P Most (if not all) browsers of today with handle it fine without the closing /option tag, but you're right for the standards sake. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] when to use \n in forms
Nigel Jones wrote: How I take it is the fact that most is not all, it's best if possible to do for all hence why I try to keep away from DHTML and Javascript I agree totally. Besides, I leave all that DHTML and JS to the 'Web Designers' ;) -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Setting counter in variable name within foreach loop
$date_$counter = $value[1]; -- this is line 33 $dest_$counter = $value[3]; $dep_$counter = $value[4]; you can't do that you'd have to do something like $mydate[$counter] = $value[1]; _ Nigel Jones [EMAIL PROTECTED] -Original Message- From: Jake McHenry [mailto:[EMAIL PROTECTED] Sent: Monday, November 24, 2003 4:55 PM To: [EMAIL PROTECTED] Subject: [PHP] Setting counter in variable name within foreach loop Is this possible? I've been messing with this for about an hour now, searching on google for about half hour. Here is what I want to do: foreach ($array as $key = $value) { $value = explode(|, $value); $counter = 0; if ($value[7] == Yes) { $counter++; $date_$counter = $value[1]; -- this is line 33 $dest_$counter = $value[3]; $dep_$counter = $value[4]; } } Then later, I would like to do: for ($i = 0; $i $counter; $i++) { echo $date_$i, $dest_$i, $dep_$ibr\n; } But, I get an error: Parse error: parse error, unexpected T_VARIABLE in /var/www/secure/travelrequest/travel7.php on line 33 Is there a way I can do this? Thanks, Jake McHenry Nittany Travel MIS Coordinator http://www.nittanytravel.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] when to use \n in forms
Not to offend anyone BUT What the is DHTML and JS (and VB for that matter) meant to do, we can use PHP instead who needs onLoad=Gimmethedampopups() - not me anyway i Perfer not to have popups :) _ Nigel Jones [EMAIL PROTECTED] -Original Message- From: John Nichel [mailto:[EMAIL PROTECTED] Sent: Monday, November 24, 2003 5:01 PM Cc: [EMAIL PROTECTED] Subject: Re: [PHP] when to use \n in forms Nigel Jones wrote: How I take it is the fact that most is not all, it's best if possible to do for all hence why I try to keep away from DHTML and Javascript I agree totally. Besides, I leave all that DHTML and JS to the 'Web Designers' ;) -- By-Tor.com It's all about the Rush http://www.by-tor.com -- 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] Parse WebCT quiz
Can someone help me get started? Anyone ever use WebCT? It uses quizzes, field types described here. https://online.csus.edu/web-ct/help/en/designer/quiz/quiz_transfer.html#formats Can someone help me parse them out please? I don't want to pay for WebCT. It was a GNU project gone commercial. It is a good project, but I can do better. I have an offlire quiz generator that will export to WebCT format. I want to use that export type to import. I've learned how to parse stuff using explode http://www.php.net/manual/en/function.explode.php But this is a little beyond that. Here are some fields I'm trying to find. See WebCT code below. Can someone help me get started please? Here are my field types $TYPE $TITLE $QUESTION which iwll give me H or T The I need the question, itself, which is one the next line. $ANSWERS $CASE $ANSWER1 $ANSWER2 but here could be up to $ANSWER1-10 $ANSWERS does not count them. $ANSWERS is That is just one quiz :TYPE: Quiz.txt might contain another quiz question :TYPE:. https://online.csus.edu/web-ct/help/en/designer/quiz/quiz_transfer.html#formats explains 5 quiz types. if $TYPE = MC, there are three fields to add: :TYPE:MC:1:0:C $possible_number_of_correct_answers $no_negative_scores $cumulative_score_will_be_used -quiz.txt-- :TYPE:S :TITLE:Sample Exercise JQuiz 2 (2) :CAT:Sample Exercise 2 :QUESTION:H I have come here ua lot/u. :ANSWERS:1 :CASE:0 :ANSWER1:How often have you come here?:100:0:0 :ANSWER2:How often have I come here?:100:0:0 :TYPE:MC:1:0:C :TITLE:Sample JBC Exercise 1 (1) :CAT:Sample Exercise 1 :QUESTION:H Which if the following sentences is incorrect? :ANSWER1:0:H That's not a very funny joke. :REASON1:H :ANSWER2:0:H The book I'm reading is quite long. :REASON2:H :ANSWER3:0:H He's much taller than me. :REASON3:H :ANSWER4:100:H Anna is more younger than Halley. :REASON4:H The corrct response is: Anna is younger than Halley. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] odbc_tables
This function doesn't work for me following the API, but I solve partially my problem using this: $tablelist=odbc_result_all(odbc_tables($conn)); instead of : $tablelist=odbc_tables($conn); $tablelist=odbc_result_all($tablelist); but I need to put the table names in a select field; so I need to get only the field TABLE_NAME. can somebody tell me how can I extract this field only?. I tried with $tablelist=odbc_result(odbc_tables($conn),TABLE_NAME); but it doesn't work because I get only the first row and nothing else. Thanks and best regards. Sorry for my english, I hope you understand. Nicolas Gomez _ Do You Yahoo!? Información de Estados Unidos y América Latina, en Yahoo! Noticias. Visítanos en http://noticias.espanol.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse WebCT quiz
I have done this (below) already. I suppose. I will have to explode by \n. One of my problems is that with :QUESTION:{H|T}, the question is on the next line. Exploding by \n puts my question text into the next line_field[]. Note: Multiple lines of text are permitted. Getting that variabnle confuses me, for example. https://online.csus.edu/web-ct/help/en/designer/quiz/quiz_transfer.html#formats Tested: http://ccl.flsh.usherbrooke.ca/~johj2201/webct_import.php $fileContents=fread($fh, filesize($_FILES['userfile']['tmp_name'])); fclose($fh); $lines=explode(\n,$fileContents); foreach($lines as $line) { echo $line.hr; } -quiz.txt-- :TYPE:S :TITLE:Sample Exercise JQuiz 2 (2) :CAT:Sample Exercise 2 :QUESTION:H I have come here ua lot/u. :ANSWERS:1 :CASE:0 :ANSWER1:How often have you come here?:100:0:0 :ANSWER2:How often have I come here?:100:0:0 :TYPE:MC:1:0:C :TITLE:Sample JBC Exercise 1 (1) :CAT:Sample Exercise 1 :QUESTION:H Which if the following sentences is incorrect? :ANSWER1:0:H That's not a very funny joke. :REASON1:H :ANSWER2:0:H The book I'm reading is quite long. :REASON2:H :ANSWER3:0:H He's much taller than me. :REASON3:H :ANSWER4:100:H Anna is more younger than Halley. :REASON4:H The corrct response is: Anna is younger than Halley. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php