[PHP] Help needed: Failed opening '' for inclusion
Hi, To test a new php installation I accessed a page called index.php that contains only ?php phpinfo(); ? but that produces this error: Warning: Failed opening '' for inclusion (include_path='.:/usr/local/lib/php:/usr/local/include/php:/usr/local/bin/ph p') in Unknown on line 0 This seems very odd given that: a) the error does not specify any filename that failed opening, only '', and b) permissions of the index.php file and the include path directories are readable by all users. I have even started the php fastcgi runner as root to double-check the permissions aspect of this. The setup is php 4.0.6 with Zeus webserver version 4 using FastCGI on Solaris 2.6. Any ideas? Help of any sort would be greatly appreciated. Thanks, Dave De Graff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Classes
Hi Can anyone explain classes to me please? On many sites have I seen classes, I'm not sure how these work, or how to use them. I'm still learning about php, and I get it going nicely. Is a class something like a variable (but as a whole script) that I simply include into my other scripts? Your help would be grateful as I'm still learning, and all info or knowledge helps Regards Rudi Ahlers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Help needed: Failed opening '' for inclusion
To test a new php installation I accessed a page called index.php that contains only ?php phpinfo(); ? Perhaps you want to: ?phpinfo();? Not sure if anything else should produce errors.. Bye, B. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Can php do this?
I've followed this with interest, but unless you specifically need some properties of PHP to do this, use an easier tool. Python has modules for both MySQL and PHP. They are easily invoked and don't involve calling Lynx feeding it the script. Here's some code, you might want to think about it as an alternative. I hope the indents preserve, as Python reliese on indentation and a CR ends it's line. Miles Thompson #! /usr/bin/python Mails Passwords from sub_list, a MySQL database import sys, MySQLdb, traceback import rfc822, string, sys import smtplib # MySQLdb allows connection to the MySQL database # This connects to the database, all parameters must be explicitly named try: db = MySQLdb.connect( db='sub_list' ) except: traceback.print_exc() sys.exit() # create connection to the database object try: pcursor = db.cursor() except: traceback.print_exc() sys.exit() #let's display some information print db.get_host_info() print db.stat() #let's fetch our data, mailing to everyone who has not been emailed a password try: pcursor.execute(select * from subscriber where lpasswd_mailed = 0 and email !='';) resultset = pcursor.fetchall() except: traceback.print_exc() sys.exit() #let's build the message fromaddr = '[EMAIL PROTECTED]' toaddr = '[EMAIL PROTECTED]' username = password = msgFirstPart = Thanks for subscribing. Passwords have been\n\ updated as part of our security schedule to protect your subscription. \n\ Your name and new password are: \n\n msgEndPart = Please contact us at (555) 555- or 555-5556 for help with your subscription, \n\ or email us at [EMAIL PROTECTED]\n\ \n\ Best regards, \n\ John Doe # we've gotten this far, so let's open the SMTP connection server = smtplib.SMTP('smtp.domain.com',25) server.set_debuglevel(2) # for each record in the cursor # set toaddr, username and password # then send the message # here in the for loop we send the mail message #server.sendmail( fromaddr, toaddr, msg, Subject: Your new password )[D for cursorRecord in resultset: toaddr = cursorRecord[ 3 ] first_name =First name: + cursorRecord[ 2 ] + \n last_name =Last name: + cursorRecord[ 1 ] + \n password =Password : + cursorRecord[ 4 ] + \n\n msgMail = msgFirstPart + first_name + last_name + password + msgEndPart print msgMail server.sendmail( fromaddr, toaddr, msgMail, Subject: Password for ALLnovascotia.com ) # build the update query upd_query = update subscriber set lpasswd_mailed = 1 where email =' + cursorRecord[ 3 ] + '; try: #pcursor.execute( update subscriber set lpasswd_mailed = 1 where email = c_email;) pcursor.execute( upd_query ) except: traceback.print_exc() sys.exit() print \n\n print All records printed #close the smpt connection #server.quit() # close the database try: db.close() except: traceback.print_exc() sys.exit() # All done print **30 print print mailpass.py completed print print **30 At 02:58 AM 11/25/2001 -0500, you wrote: Thanks guys I just want to confirm one last thing, as it's been a while since I needed cron After I create this file (cron.file) for ex and use crontab cronfile (I do this as root, if it matters) do permissions need to be set? I really can't recall I would think that would do it as I am not uploading it and do it as root Thanks for the help, GREAT help and it's appreciated Now I just need to get freetype 2 installed right on my raq 3 and I can live like a king Joel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Classes
Miles, I have come from a QBASIC to VFP to VC++ to PHP (VFP and PHP are my primary languages), so I'll try to clear it up a bit. In VFP, there is no constructor. I believe that the equivalent is the init() method. The init() method, or the constructor (in PHP, C++, etc) are useful for doing stuff that needs to be done when an object is created. Likewise in true object oriented languages (PHP is not one of them yet), there is a Destructor that is called when an object goes out of scope or is deleted. In VFP, there is a Destroy() method to simulate this behavior. In VFP, there is the notion of Public, Private, and Hidden properties. PHP does not yet support this behavior. In PHP, especially since it is such a loosely typed language, you can add and remove properties on the fly. Generally when programming in PHP, I like to identify private properties and methods by placing a single underscore before their name. This makes it clear for someone using the class not to ever reference these entities. If you want to see a neat example of object oriented programming in action (not that I like M$ or anything), check out how the Microsoft Foundation Classes (MFC) work. They effectively demonstrate public and private class members, inheritance, constructors, destructors, parent objects, etc... Hope it Helped... -Jason Garber IonZoft.com At 09:10 AM 11/25/2001 -0400, Miles Thompson wrote: Chris, Not such a useless explanation at all, in fact a damned good one. Tight concise, and you immediately related the functions to code examples, along with an easy-to-visualize object, the chair. But I have two questions: 1. Why is a constructor class needed? My OO background is Visual FoxPro, and all it requires is a declaration of the class, it' methods and properties. 2. Are the chairs properties exposed, or are they private? You use functions to both set and retrieve them, which implies that they are private. Even so, PHP's syntax is much cleaner than the tortured syntax used in VB. Miles Thompson At 03:28 AM 11/25/2001 -0800, you wrote: On Sun, 25 Nov 2001, Rudi Ahlers wrote: Can anyone explain classes to me please? On many sites have I seen classes, There are people earning PHD's while explaining classes. I know your question originates from using PHP, and this is a PHP general mailing list ... but your question is just a tad too general for this list. I'm not sure how these work, or how to use them. I'm still learning about Classes aren't unique to PHP. You need to learn a true object-oriented programming language (C++, Java, ... etc.) to really learn classes. Truly gifted individuals can learn object-oriented programming w/o too much help, but they'd first have a firm grip on programming. I'd expect the average, novice programmer to need a good amount of help learning understanding objecte-oriented programming ... like that attained from a University, a good High School, or a lot of independent study and time experimenting with code. That said ... You weren't completely missing the boat with your analogy of a class to a variable, but in the same breath, that idea is totally missing the boat (I can see from where you're coming, and to where you're headed). Classes are an IDEA. They're not actually anything. They're the definition of private and public data members and methods that should make up an object. When a class is instantiated, an object is created with the defined data members and methods available. You can then use the objects' methods to set, get, alter, or otherwise interact with its data members, or to simply perform a set of related operations. Insert a couple semesters of theory here. That's my feeble attempt to explain classes. It's abstract, I know, and possibly not a help at all. But it's because of the paragraph above this one. Let's look at some petty code: class chair{ // DATA var num_legs; var color; var num_arms; // METHODS function chair( $legs = 3, $arms = 0 ){ //CONSTRUCTOR $this-num_legs = $legs; $this-num_arms = $arms; } function setLegs( $legs ){ $this-num_legs = $legs; return; } function getLegs( ){ return $this-num_legs; } // ... *clip* ... } Above is the [incomplete] definition of a chair class. As you can see, the class is useless. But you can instantiate the class, and create a useable object ... you can now create a chair. $myChair = new chair( 4, 2 ); Now I have a chair [object] with 4 legs and 2 arms, called $myChair. Let's have the chair tell us how many legs it has ... $numLegsOnMyChair = $myChair-getLegs(); print( My Chair has $numLegsOnMyChair legs. ); Lets change how many legs the chair has ... $myChair-setLegs( 7 ); // very odd, seven-legged chair We should have a chair with 7 legs now, instead of 4.
Re: [PHP] Classes
Miles, I have come from a QBASIC to VFP to VC++ to PHP (VFP and PHP are my primary languages), so I'll try to clear it up a bit. In VFP, there is no constructor. I believe that the equivalent is the init() method. The init() method, or the constructor (in PHP, C++, etc) are useful for doing stuff that needs to be done when an object is created. Likewise in true object oriented languages (PHP is not one of them yet), there is a Destructor that is called when an object goes out of scope or is deleted. In VFP, there is a Destroy() method to simulate this behavior. In VFP, there is the notion of Public, Private, and Hidden properties. PHP does not yet support this behavior. In PHP, especially since it is such a loosely typed language, you can add and remove properties on the fly. Generally when programming in PHP, I like to identify private properties and methods by placing a single underscore before their name. This makes it clear for someone using the class not to ever reference these entities. If you want to see a neat example of object oriented programming in action (not that I like M$ or anything), check out how the Microsoft Foundation Classes (MFC) work. They effectively demonstrate public and private class members, inheritance, constructors, destructors, parent objects, etc... Hope it Helped... -Jason Garber IonZoft.com At 09:10 AM 11/25/2001 -0400, Miles Thompson wrote: Chris, Not such a useless explanation at all, in fact a damned good one. Tight concise, and you immediately related the functions to code examples, along with an easy-to-visualize object, the chair. But I have two questions: 1. Why is a constructor class needed? My OO background is Visual FoxPro, and all it requires is a declaration of the class, it' methods and properties. 2. Are the chairs properties exposed, or are they private? You use functions to both set and retrieve them, which implies that they are private. Even so, PHP's syntax is much cleaner than the tortured syntax used in VB. Miles Thompson At 03:28 AM 11/25/2001 -0800, you wrote: On Sun, 25 Nov 2001, Rudi Ahlers wrote: Can anyone explain classes to me please? On many sites have I seen classes, There are people earning PHD's while explaining classes. I know your question originates from using PHP, and this is a PHP general mailing list ... but your question is just a tad too general for this list. I'm not sure how these work, or how to use them. I'm still learning about Classes aren't unique to PHP. You need to learn a true object-oriented programming language (C++, Java, ... etc.) to really learn classes. Truly gifted individuals can learn object-oriented programming w/o too much help, but they'd first have a firm grip on programming. I'd expect the average, novice programmer to need a good amount of help learning understanding objecte-oriented programming ... like that attained from a University, a good High School, or a lot of independent study and time experimenting with code. That said ... You weren't completely missing the boat with your analogy of a class to a variable, but in the same breath, that idea is totally missing the boat (I can see from where you're coming, and to where you're headed). Classes are an IDEA. They're not actually anything. They're the definition of private and public data members and methods that should make up an object. When a class is instantiated, an object is created with the defined data members and methods available. You can then use the objects' methods to set, get, alter, or otherwise interact with its data members, or to simply perform a set of related operations. Insert a couple semesters of theory here. That's my feeble attempt to explain classes. It's abstract, I know, and possibly not a help at all. But it's because of the paragraph above this one. Let's look at some petty code: class chair{ // DATA var num_legs; var color; var num_arms; // METHODS function chair( $legs = 3, $arms = 0 ){ //CONSTRUCTOR $this-num_legs = $legs; $this-num_arms = $arms; } function setLegs( $legs ){ $this-num_legs = $legs; return; } function getLegs( ){ return $this-num_legs; } // ... *clip* ... } Above is the [incomplete] definition of a chair class. As you can see, the class is useless. But you can instantiate the class, and create a useable object ... you can now create a chair. $myChair = new chair( 4, 2 ); Now I have a chair [object] with 4 legs and 2 arms, called $myChair. Let's have the chair tell us how many legs it has ... $numLegsOnMyChair = $myChair-getLegs(); print( My Chair has $numLegsOnMyChair legs. ); Lets change how many legs the chair has ... $myChair-setLegs( 7 ); // very odd, seven-legged chair We should have a chair with 7 legs now, instead of 4.
[PHP] gnupg, running php as a cgi script
I am trying to use php and gnupg on my virtual host to send user input to myself in encryptd form. The problem I am having is that I have installed gnupg in my user account and it is functional, but the keyring and keys that I have generated are under my user name for the account. Php runs under the user name nobody and does not have access to the keys for encryption. I have spoken to a tech at the company who said that I would not be allowed to install keys under nobody. I'm not quite sure I believe this. Anyway, as a way to get around this, I have tried to run the php script as cgi, by putting the script into the cgi-bin in my user directory. This way the scripts should run as my username. Here is the script: #!/usr/local/bin/php $filename = /home/gildedpg/public_html/mydata.txt; $newfile = fopen($filename, w+) or die(Couldn't create file.); fclose($newfile); $msg = pFile created!/p; html head title/title /head body ? echo $msg; ? /body /html This is the error I get: CGIwrap Error: System Error: execv() failed Error: No such file or directory (2) If anyone could tell me why this script will not run, or better yet, make any suggestions to make this process workwithout using cgi, I would appreciate it. Thanks, SW -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Redirect upon execution of script...
Hi, is there a way to redirect after a script has run? I have a form whos result is being put into a database. When, or if, the operation is sucessful i set a variable $done to 1. Now, i need a redirection from here (if $done is 1). But since i cant send out headers that far down on the page - what do i do? Regards # Daniel Alsén| www.mindbash.com # # [EMAIL PROTECTED] | +46 704 86 14 92 # # ICQ: 63006462 | # -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Creating $key, $value pairs
OK, I took a stab at this using your post for input and it should be a good enough starting point for you ... if you do have extraneous ':'s elsewhere in the message then you'll need to be a little more picky with your regex stuff to only pick out what you want -- for example, your post has a couple of sentences that end with ':' before an example ... the script as written picks those up as key value pairs, but since you'll unlikely have those in your order messages I figure you're on safe ground for now -- Of course the really easy way to do this is just to process the form output directly then you have your key/values nice and neat in $HTTP_POST_VARS already:) ... but I'm assuming this is on and processed by a separate server, or with a canned script that only gens emails, so this is what you need to do. Here's the code: #!/usr/bin/php4 -q ? // OK, I assume you use this as a filter, so we're reading from // php://stdin -- $fp = fopen(php://stdin,r); // Initialize a counter for the order items $itemcnt=0; while(!feof($fp)) { $buffer = fgets($fp,8192); // Simple regex effectively 'splitting' on colon(:) with capture if(preg_match('/([^:]+):\t*(.*)/',$buffer,$matches)) { // strip out spaces and /'s in the variable name $matches[1] = preg_replace(/[ \/\]/,,$matches[1]); // create an entry for it in $billinginfo array $billinginfo[$matches[1]] = $matches[2]; } // Regex to match order items (INCOMPLETE!!!) only matches order // number and quantity so far -- Hey I had to leave something for you // to do:) if(preg_match('/([0-9]+x[0-9.]+)\s+([0-9]+).*/',$buffer,$orderitem)) { // since we don't have field ids in the matches, we create our own $order[$itemcnt][Itemnum] = $orderitem[1]; $order[$itemcnt++][Quantity] = $orderitem[2]; } } fclose($fp); // just for testing, dump the arrays -- while(list($key,$val) = each($billinginfo)) { echo $key - $val \n; } echo ORDER HERE!!!\n; for($x=0; $x$itemcnt; $x++) { echo Item: $x \n; while(list($k,$v) = each($order[$x])) { echo $k - $v \n; } echo \n; } ? On Sat, Nov 24, 2001 at 10:20:45PM -0700, Ashley M. Kirchner wrote: I need to convert the following: --- Todays Date: 20-Nov-2001 10:58:24AM Order ID: W25 Customer Email: [EMAIL PROTECTED] Email Promotions: Ok BILL TO: Business Name: Contact Name: Ashley M. Kirchner Day Number: 800 555-1212 Evening Number: 303 555-1212 Fax Number: Address: 3550 Arapahoe Ave #6 Address: Address: City: Boulder State/Province: CO Zip/Postal Code: 80303 Country: USA Payment Method: CC Card Number: 991234 Expiration Date: 01/71 Shipping Method: PICKUP Order Comment: Gift Message: Shipping Instruction: --- ...into $key, $value pairs. Ideally, I'd like to be able to name/use my own names for $key so I can end up with something like: $BillToContact = 'Ashley M. Kirchner' $BillToDayPhone = '800 555-1212' $BillToEvePhone = '303 555-1212' etc. (or maybe with something like: $bill['contact'] = 'Ashley M. Kirchner' $bill['dayphone'] = '800 555-1212' $bill['evephone'] = '303 555-1212' etc.) All of these variables will eventually be shoved into a DB once the entire form has been parsed. And then, at the bottom of that same (submitted) form, there's the actual information on the order, which looks something like this (the spacing is slightly different): (unfortunately, this will wrap rather ugly) --- ORDER NO. QTY UNIT DESCRIPTIONPRICE TOTAL 4x614x6 Standard Print (full-frame from 35mm).75 $0.75 4x614x6 Standard Print (full-frame from 35mm).75 $0.75 5x7.5 15x7.5 Image:Uploaded Image 3 4.25 $4.25 8x12 18x12 Classic Full Frame Image:Uploaded Image 4 10.25 $10.25 SUBTOTAL: $16.00 TAX: $1.18 SHIPPING: $0.00 TOTAL: $17.18 --- This part again I'd like to break up into separate lines, and separate variables for the product no., the quantity, unit, decription, price, total (per line), then the subtotal, tax,
Re: [PHP] Can php do this?
At 09:22 AM 11/25/2001 -0400, Miles Thompson wrote: I've followed this with interest, but unless you specifically need some properties of PHP to do this, use an easier tool. Python has modules for both MySQL and PHP. They are easily invoked and don't involve calling Lynx feeding it the script. Here's some code, you might want to think about it as an alternative. I hope the indents preserve, as Python reliese on indentation and a CR ends it's line. Thanks for the code! The easiest way for me personally to learn a new language is to think of a task that needs to be done then look at some sample code. I'm not quite ready to learn Python (yet) but I'm saving this into the archive for when I'm ready. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
php-general Digest 25 Nov 2001 15:56:18 -0000 Issue 1015
php-general Digest 25 Nov 2001 15:56:18 - Issue 1015 Topics (messages 75632 through 75652): Re: what the best version PHP + APACHE on Solaris8 75632 by: Justin England Re: Can php do this? 75633 by: Michael Sims 75634 by: Michael A. Peters 75636 by: Casey Allen Shobe 75637 by: Joelmon2001.aol.com 75643 by: Miles Thompson 75651 by: Michael Sims Creating $key, $value pairs 75635 by: Ashley M. Kirchner 75650 by: Hank Marquardt Help needed: Failed opening '' for inclusion 75638 by: David De Graff 75640 by: B. van Ouwerkerk Classes 75639 by: Rudi Ahlers 75641 by: Christopher William Wesley 75642 by: Miles Thompson 75645 by: Jason G. 75646 by: Jason G. 75647 by: Jason G. Re: [php] telnet describe command for mysql 75644 by: Jason G. gnupg, running php as a cgi script 75648 by: Scott Redirect upon execution of script... 75649 by: Daniel Alsén 75652 by: Miles Thompson 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--- Just grap the lastest stable version. As of now: Apache ver 1.3.22 PHPver 4.0.6 Most all of my Sparc Solaris8 machines are running Apache 1.3.19/PHP 4.0.6 Hope this helps. Justin England [EMAIL PROTECTED] Network Administrator E-Net Information Services http://www.enetis.net Tel: 605-341-3638 Fax: 605-341-8880 On Thu, 22 Nov 2001, Evgeny Rachlenko wrote: Dir Justin England, Could you tell me what the version of apache and php do you prefer for Solaris 8 . thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] ---End Message--- ---BeginMessage--- At 10:04 PM 11/24/2001 -0500, [EMAIL PROTECTED] wrote: [snip] Sort of like cron doing what you would do if you visited page.php and once it's hit, it emails specified users in a database Would I need path to php in the cron script to do this? Or am I just living a dream? It sure can. There's a couple of ways to accomplish this. I personally think the easiest way is to code your page like normal, then call it in a cron job via lynx. Let's say you have a page called page.php that connects to your database, retrieves the email addresses, and sends the emails. To call it from a cron job add the following to your crontab: 0 8 * * * /usr/bin/lynx -dump http://localhost/page.php /path/to/logfile/or/dev/null Of course this means your script is in your public web space, so theoretically could be called by anyone who knew the name of the page. You could put the page in a subdirectory and add an .htaccess file that restricts access to only 127.0.0.1 to take care of that if it concerns you. If you have PHP installed as a CGI then you could also write your page as a shell script. As the first line of your script put the line: #!path to php -q I haven't personally used this method because I have PHP installed as an apache module and I was too lazy to compile the CGI version. Using lynx in the above configuration works fine for me... ---End Message--- ---BeginMessage--- If you have built the php standalone binary then its easy- #!/usr/local/bin/php ?php // your php code here ? What I do when I build php is build it twice. First I build it with all my options EXCEPT for with-apxs=/blah That builds the standalone binary, and I install that in /usr/local/bin Then, I build the apache module and install that where my apache modules go. This allows me to use php as a regular unix scripting language, so I can do stuff from the crontab. btw- I'm actually doing a very similar thing- I have some customer support software that pops my support e-mail address and puts the message in a MySQL database. I have a cron job that calls a php shell script that pops the e-mail for me every 15 minutes. That way I don't have to log on to the support application as often, and the customers get an automated response fairly quickly, giving them a unique case ID etc. On Sat, 24 Nov 2001 22:04:21 EST [EMAIL PROTECTED] mentioned: Thanks for your time . *This* = create follow up autoresponders Or at least have php run with cron, so I can daily hit a mysql db and use php to email those people at a specified time, like every 3 days. Just so when I have users to the site who register and their name/email is in a table users in db data, php/cron can be used to pull the name/email from mysql and (with unsubscribe message at bottom) email them when I say to do so in cron. Getting
Re: [PHP] Can PHP take input from the command prompt interactively?
An example for ya #!/usr/local/bin/php -q ?php /* file name: shellexample.php created by: dan mccullough date created: 10/26/01 purpose: just to do a simple shell script that takes the input and places its output on the screen For more information contact Dan McCullough at 603.444.9808 To use this on the command line type [root@ns web]# php shellexample.php then type your line of text. */ function read() { $fp=fopen(/dev/stdin, r); $input=fgets($fp, 255); fclose($fp); return $input; } print(Please input your text? ); $input = read(); $string = $input; $string = preg_replace (/(.)/, \\1\n, $string); print ($string); ? --- David Yee [EMAIL PROTECTED] wrote: Can I write a command line PHP script like the following: php -q test.php Output: == 1)choice A 2)choice B 3)choice C Please enter an option: 1 == Thanks. David = Dan McCullough --- Theres no such thing as a problem unless the servers are on fire! h: 603.444.9808 w: McCullough Family w: At Work __ Do You Yahoo!? Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. http://geocities.yahoo.com/ps/info1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Installing PHP 4 on a RAQ3
Hi, As I have only ever worked on a Windows platform, installing PHP MySQL on a RAQ3 is completely alien to me. I attempted to install the binaries by following instructions I dug up somewhere, and it all went badly wrong :o( I have since had the RAQ reset so I could start again. This time round I installed the RaQ3-RaQ4-MySQL-3.23.37-1.pkg from cobalt, this went on OK, but now I need to install PHP. As there is no .pkg for the RAQ3, I have been advised that I do need to install the binaries for PHP 4. Do I need to give a path for the --with mysql option, and if so where does the .pkg install MySQL? Any idiot proof step by step instructions will be greatly appreciated, along with which is the best/most stable version of PHP 4?, and where is best to install it? Thanks in advance, Phil. - Phil Ewington Cold Fusion Developer - T: 01344 643138 E: mailto:[EMAIL PROTECTED] - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Redirect upon execution of script...
2. User fills in a form, clicks submit which calls the same script, passing itself the values. Depending on the value passed by the submit button, the script processes the information (INSERT or UPDATE) and sets $done = 1 if successful. The second scenario is easier to handle. Call the same script, passing it $done, and depending on whether or not $done is set you redirect. Juli Meloni has done an excellent tutorial on just this at http://www.thickbook.com. look in the tutorials for something like Form With Error Message. You just have to adapt the logic to suit your needs. The second scenario is correct. I am actually already using the method in Melonis tutorial for error messages. But i can´t do a redirection that way since $done isn´t set until after the db INSERT. My if-statement for the header is at the top of the page (wich is the only place i can put it) and will never know if $done is set or not below. - Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Redirect upon execution of script...
I think I really don't understand what do you want... hehehe :) which is fine! but take that code I sent ya... now I'll explain the functions... then tell me if I'm right: function ShowHeader { ? html titleSomething/title body ? } function ShowFooter() { ? /body /html ? } function ShowForm() { global $SCRIPT_NAME: ? form ... bla bla bla action=?=$SCRIPT_NAME? input type=hidden name=action value=process-form ? } function ProcessForm() { if( !ValidateFormFields() ) return false; else { if( !ExecuteDBInsert() ) return false; else return true; } } wouldn't that work? there's no $done variable here... the return of the function is all you need... if it's true redirect, if not display error... At 19:03 25/11/01 +0100, Daniel Alsén wrote: Hmm...either i don´t really get what you mean, or you missed the problem. This is the situation: I have a form which results is to be inserted in a db. When the form is submitted the page calls itself and does a db INSERT based on if a couple of statements is true - otherwise it displays a proper error message. So far everything is fine and is working like a charm. But: I want a redirection after a successfull db INSERT. After the INSERT is made (which is what the page is for) i set a variable, $done, to 1. Right now i only use $done to display a message at the bottom of the screen saying that the INSERT worked. But i want the page to redirect itself as soon as $done is set to 1. The problem i have is: I can only send headers (wich i use for redirection - right??) at the top of the page - before all the other code. But since $done is set far down in the code, after my form and db-statements, the header will never know when to be sent. Is there a way of calling a headerfunction in the top of the page? - Daniel -Original Message- From: Christian Dechery [mailto:[EMAIL PROTECTED]] Sent: den 25 november 2001 18:41 To: Daniel Alsén; PHP; Miles Thompson Subject: RE: [PHP] Redirect upon execution of script... sorry if I'm not understanding correctly your problem... but it seems quite simple to me... I've created like 10.000 php forms that does that... I don't see a prob... what do you want to do? process a form: if something's wrong, print error message and go back if everything is fine go to another page... that's it? well... database inserts has nothing to do with headers... you can easily do something like ?php switch ($action) { case process-form:if( ProcessForm() ) header(Location: next-page.php); else { ShowHeader(); // function to display all the HTML you want printErrMessage(); ShowFooter(); } break; default:ShowForm(); break; } ? where ProcessForm returns true or false depending on the DB operation... of course there cannot be any output before the switch? did it help? At 18:24 25/11/01 +0100, Daniel Alsén wrote: 2. User fills in a form, clicks submit which calls the same script, passing itself the values. Depending on the value passed by the submit button, the script processes the information (INSERT or UPDATE) and sets $done = 1 if successful. The second scenario is easier to handle. Call the same script, passing it $done, and depending on whether or not $done is set you redirect. Juli Meloni has done an excellent tutorial on just this at http://www.thickbook.com. look in the tutorials for something like Form With Error Message. You just have to adapt the logic to suit your needs. The second scenario is correct. I am actually already using the method in Melonis tutorial for error messages. But i can´t do a redirection that way since $done isn´t set until after the db INSERT. My if-statement for the header is at the top of the page (wich is the only place i can put it) and will never know if $done is set or not below. - Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] _ . Christian Dechery . . Gaita-L Owner / Web Developer . . http://www.webstyle.com.br . . http://www.tanamesa.com.br _ . Christian
Re: [PHP] Installing PHP 4 on a RAQ3
Hello Phil, I've seen this come up a few times, search the archives for a bit: http://marc.theaimsgroup.com/?l=php-generals=raq The following comes up and may be useful. Don't hesitate to reply back on how helpful it is, perhaps eventually some raq instructions can make their way into installation section of manual. Try: HOWTO: Installation on Cobalt RaQ (RaQ3 or RaQ4) : http://marc.theaimsgroup.com/?l=php-generalm=98039640119670 Also, the manual's install instructions should be of some use: http://www.php.net/manual/en/install.unix.php regards, Philip Olson On Sun, 25 Nov 2001, Phil Ewington wrote: Hi, As I have only ever worked on a Windows platform, installing PHP MySQL on a RAQ3 is completely alien to me. I attempted to install the binaries by following instructions I dug up somewhere, and it all went badly wrong :o( I have since had the RAQ reset so I could start again. This time round I installed the RaQ3-RaQ4-MySQL-3.23.37-1.pkg from cobalt, this went on OK, but now I need to install PHP. As there is no .pkg for the RAQ3, I have been advised that I do need to install the binaries for PHP 4. Do I need to give a path for the --with mysql option, and if so where does the .pkg install MySQL? Any idiot proof step by step instructions will be greatly appreciated, along with which is the best/most stable version of PHP 4?, and where is best to install it? Thanks in advance, Phil. - Phil Ewington Cold Fusion Developer - T: 01344 643138 E: mailto:[EMAIL PROTECTED] - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Redirect upon execution of script...
Daniel, See below Miles At 06:24 PM 11/25/2001 +0100, Daniel Alsén wrote: 2. User fills in a form, clicks submit which calls the same script, passing itself the values. Depending on the value passed by the submit button, the script processes the information (INSERT or UPDATE) and sets $done = 1 if successful. The second scenario is easier to handle. Call the same script, passing it $done, and depending on whether or not $done is set you redirect. Juli Meloni has done an excellent tutorial on just this at http://www.thickbook.com. look in the tutorials for something like Form With Error Message. You just have to adapt the logic to suit your needs. The second scenario is correct. I am actually already using the method in Melonis tutorial for error messages. But i can´t do a redirection that way since $done isn´t set until after the db INSERT. My if-statement for the header is at the top of the page (wich is the only place i can put it) and will never know if $done is set or not below. - Daniel Before this a whole bunch of processing has been done, either: A username/login has been entered and checked and a checkval generated and stored or A cookie has been read and its value checked in the database If everything is OK, then $REaderOK is set true (1). No output has been sent to the browser Now this is encountered ... if( $ReaderOK == 1 ) { //header(Location: $PHP_SELF?member_id=$member_idcLangCode=$cLangCodeReaderOK=$ReaderOK\n); header(Location: $origin?member_id=$member_idcLangCode=$cLangCodeReaderOK=$ReaderOK\n); } else { include(user_logon_title.inc); echo a href = \$PHP_SELF?cLangCode=$cLangCode\ . $ErrorAndReturnMsg ./a /center; } This is just about the end of all the logic stuff, and now the display portion of the page runs. Note that in the else part of the code fragment, that the normal part of the display code is never reached because the page is calling itself with with an error message to the user. If everything is ok, the user is sent back to the page ($origin) which called the logon script. That value was set thusly: ? session_start(); session_register( origin ); $origin=$PHP_SELF; . . //after some checking if the user is not logged on the logon script is called here . ? Miles Thompson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] I thought it wise to offer to my relatives and friends first the items I have on auction at ebay.
1. Elegant, collector's 8 stainless steel knife. Never been used although I had it for over ten (10) years. click: http://cgi.ebay.com/aw-cgi/eBayISAPI.dll?ViewItemitem=1038281683 2. NEC MULTISYNC XV17+ SVGA 17 MONITOR. EXCELLENT (LIKE NEW). . click: http://cgi.ebay.com/aw-cgi/eBayISAPI.dll?ViewItemitem=1301841765 I hope you are enjoying your long Thanksgiving holiday weekend. Jess Jess Ragaza, President, Internet Architecture Inc.; Principal, JR Associates; P.O. Box 2766, Washington, D.C. 20013;[EMAIL PROTECTED] http://www.internetarchitecture.com/ With shopping and entertainment an experience in great deals, ease and comfort: Disney, amazon.com, eBay, AOL, CarsDirect, Sony, Franklin Mint, Playboy and others; Where everybody is given a chance to work profitably at home with Multilevel Marketing and Residual Income Galore; Watch for the next IPO that will reap rewards beyond your imagination! - Do You Yahoo!? Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
RE: [PHP] Safely Storing Delivering PDFs
If you have access to the Apache server why not set up auth-mysql as the authentication method? It checks for authentication login/password pairs out of MySQL. mark C. -Original Message- From: Miles Thompson [mailto:[EMAIL PROTECTED]] Sebastian, I believe I have to do what you do, but from your cryptic msg I've not been able to figure it out. We have a subscription site, and if a subscriber wants a PDF, the link which requests it checks for a session cookie. If it's not set the user is directed to a logon script which checks username/password against a database and sets the session cookie if everything is OK. It automatically redirects to the calling script, and because the session id is now present the PDF can be accessed. To my horror, I discovered on Friday that if I just type in the URL with the name of the PDF it's delivered with no checking at all. I have to move them to a safe place, either outside the web tree or to a directory protected by htaccess. This is where I'm stuck. If I use .htaccess, I don't want to maintain a separate .htaccess file in addition to the subscriber table in the database. Can I set have my logon script set an Apache variable that will give access to the protected directory which store the PDf's? Or do they have to be passed? If so how? Would that mean that I'd need only one or a few username/password pairs in htaccess? or Is htaccess (or Apache's security) somehow satisfied by setting the variables? Regards - Miles Thompson At 01:19 PM 10/19/2001 +0200, you wrote: Hi George I had the same problem a while ago. The only solution i found was to change the link to : www.blabla.com/pdffile/test.pdf test.pdf does not exist, but in /pdffile/ there is a .htaccess which redirects the 404 to the php script that reads/generates the pdfs. And for my purpose checks if user is authorized to get these files. sebastian George's part is snipped, as it doesn't matter to me if the filename is preserved. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] automatic serial/unserializing with sessions
Sessions do automatically serialize and unserialize it's variables? How is it done??... is it via session_register() that calls serialize() ?? and then session_start() unserializes it all? /* I'm just guessing here */ can someone explain me how does this work? _ . Christian Dechery . . Gaita-L Owner / Web Developer . . http://www.webstyle.com.br . . http://www.tanamesa.com.br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Creating $key, $value pairs
OK, probably the easiest thing to do would be to add some kind of state functionality to the loop and use different logic/regex stuff based on where in the process you are ... first test each line for '/^SHIP TO/', '/^BILL TO/' or /^ORDER NO./ ... that could set your 'state' for the script, then you can process each line properly (and it would get around the ':' in an order line problem as you wouldn't execute on that basis ... in my head anyway that would make the main loop into a case construct: switch($stateofscript) { case SHIP: $shippinginfo[$matches[1]] = $matches[2]; break; case BILL: $billinginfo[$matches[1]] = $matches[2]; break; case ORDER: // split your order lines break; default; // must not have hit the SHIPPING INFO yet so do nothing } The other thing you'll need to fix is that you have the generic 'address' tag for 3 different lines in both shipping and billing ... so the logic will need to include a if(isset($shippinginfo[$matches[1]])) thing to prepend or postfix an integer or something onto the index to keep the lines straight. I'd say you're getting there though. Hank On Sun, Nov 25, 2001 at 02:06:52PM -0700, Ashley M. Kirchner wrote: Hank Marquardt wrote: Actually you're OK here (I think ...) if a few of them end up blank, that's OK, just ignore them, you'll know the ones you want based on the real email you receive ... as for the folks putting To: someone, From: someone ... I wrote the regex to accomodate that ... it takes anything up to the first ':' and claims that as the variable name, then discards the ':' after and finally grabs the rest of the line (.*) as the remainder ... that can include ':' without problem ... in fact if you look at your example, it handles the first 'timestamp' field just fine:) Yeap, I noticed that as soon as I ran the first (full) email through it. And of course, there're some problems. The incoming email has two sections in it which will contain the same variables. What I posted only contained a 'BILL TO:' section. The full email also contains a 'SHIP TO:' section. But because the script creates variables based on the fields in the email, it overwrites the first section: SHIP TO: Business Name: Contact Name: PhotoCraft Day Number: 303.442.6410 Evening Number: Fax Number: Address: 3550 Arapahoe Ave Address: Suite 6 Address: City: Boulder State/Province: CO Zip/Postal Code: 80303 Country: USA BILL TO: Business Name: Contact Name: Ashley M. Kirchner Day Number: 800 555-1212 Evening Number: 303 555-1212 Fax Number: Address: 3550 Arapahoe Ave #6 Address: Address: City: Boulder State/Province: CO Zip/Postal Code: 80303 Country: USA This is part of why I asked whether it was possible to use my own variable naming, so I could end up with one of: $ShipToContact$BillToContact $ShipToDayPhone $BillToDayPhone $ShipToEvePhone $BillToEvePhone or: $ShipTo['contact']$BillTo['contact'] $ShipTo['DayPhone'] $BillTo['dayphone'] $ShipTo['EvePhone'] $BillTo['evephone'] And then there's still the order items themselves. Right now, the script is cutting the lines because of the : matching. So, a line like this (wrapping alert): ORDER NO. QTY UNIT DESCRIPTION PRICE TOTAL 4x6 1 4x6 Standard Print (full-frame from 35mm) Image:Uploaded Image 1 .75$0.75 ...will end up: $key: 4x614x6StandardPrint(full-framefrom35mm)Image $val: 'Uploaded Image 1 .75 $0.75' ORDER HERE: Item: 0 Itemnum - 4x6 Quantity - 1 Not quite what it should be. I think I'm going to limit where it should do the $key - $value matching, and figure something else out for the rest of the message. the whole thing would be a lot easier in the last one if they actually tab delimit the fields, then a simple split() call would handle it nicely but what you posted was spaces. Yeah, the original incoming email is a mess really. No tab delimited anything, and some of the fields have extraneous spaces after each value, some just have a row of spaces (if the value's blank), some 80 characters long. -- H | Life is the art of drawing without an eraser. - John Gardner + Ashley M. Kirchner mailto:[EMAIL PROTECTED] . 303.442.6410 x130 Director of Internet Operations / SysAdmin. 800.441.3873 x130 Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave, #6 http://www.pcraft.com . . .. Boulder, CO
[PHP] User access rights..
Hello, I have a machine which is running Php4 on Apache 1.3 And I want to make a hosting site that the users can register themselves online. They will have a home directory and so they will be able to put their web files (html, php, images etc.) under there. I want to keep their information on Mysql. That is, if possible I don't want to create real system accounts. I'll do all this work (create user, its home etc) with PHP. There is no problem at this point. The problem is... using PHP, they can open any file that is readable to nobody account (Apache user).. So it can read and even edit other users' files.. Consquently, the users should be able to access only and only their home directories. How can I do this? Thanks in advance.. Ali Pakkan E-mail: [EMAIL PROTECTED] Gsm: +90542 3268742 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] User access rights..
On Sunday 25 November 2001 03:30 pm, you wrote: The problem is... using PHP, they can open any file that is readable to nobody account (Apache user).. So it can read and even edit other users' files.. Consquently, the users should be able to access only and only their home directories. Short answer; you can't. Long answer; if users have shell accounts, there is no way you can do what you're trying to do. If you limit users to FTP access and PHP *only* (i.e. no telnet, ssh, custom CGI, Perl or other languages that can access the file system) then you can use PHP safe mode to at least protect PHP. Read the Security chapter in the PHP manual. (chapter 4, I believe) This topic has been discussed extensively before on the list, so you may also want to search the list archives for more details. --kurt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Redirect upon execution of script...
Thanks for all the help guys! I am sure i will solve this when i have a go at it again :) - Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] User access rights..
I should explain a bit more in detail.. Actually, the users can have php files. And these php files can access other users' stuff. And consider they are real users, then how will i tell Apache server to run as the user owning the file? Is it impossible for a real solution? On Sun, 25 Nov 2001, Hank Marquardt wrote: I want to keep their information on Mysql. That is, if possible I don't want to create real system accounts. The problem is... using PHP, they can open any file that is readable to nobody account (Apache user).. So it can read and even edit other users' files.. These two statements seem at odds with each other (to me anyway) .. if you're completely managing the user 'virtually' within mysql you could manage all your permissions and access within the database with sessions and a user id ... if on the other hand you are creating accounts on the system just with a nologin shell, then you're in a pickle with no real solution ... if the 'nobody' group needs read permission then you're correct that most anyone can read anyone else's work ... you're only real option is to create some kind of wrapper script for accessing the files that checks the db perms first. BTW, there are *lots* of ISPs offering shell access (and web accounts) out there where this is an issue ... the entire /home tree is 0755 permed and user a can read/execute user b's stuff. even a 0750 doesn't fix it most of the time as the users share a common group ... I guess you could go with 0750, set uid=gid and then add 'nobody' to everyone's groups though ... ... enough, I'm just thinking out loud now. Hank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] error on update
Hi everyone, I'm connecting to a SQL SVR 2000 database and get an error that I haven't been able to resolve. The following code generates an error Incorrect syntax near 'longer'; SQL state 3700 in SQLExecDirect I read some where that it might be due to a reserved word in column names, but this isn't the case. Here is the code: print(QID: $qIDbrQuestion to be updated to: $updateQuest); $updateQuest = cleanUpText($updateQuest); $query = update tbl_question ; $query .= set question = '$updateQuest' ; $query .= where questID = '$qID';; print(brbQuery/b= $querybr); print(Cleaned up: $updateQuestbr); $result = odbc_exec($conn, $updateQuest); unset($updateQuest); I can copy and paste the resultant SQL and execute it fine in the query analyser. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Ojects and sessions
I'm trying to store some classes that I created in session variables. I want to test for the object at the beginning of each page and if it does not exist I want to create it. I have the class definitions in a separate file that is included before session_start() But when I try to access the object I get an error. Here is what I am trying right now. This is from an example in the Docs. ? include_once('class.inc'); session_start(); if(session_is_registered(a)) { $a = $HTTP_SESSION_VARS[a]; } else { $a = new cart(); session_register(a); $HTTP_SESSION_VARS[a] = $a; } ? Can some one please point me in the right direction on how to get objects stored in my session vars. Greg Sidelinger
RE: [PHP] EXAMPLE: Redirect upon execution of script...
Doing this is very simple, although a pain in the rear... For those of you that have any confusion on this issue, pay very close attention to this script. It effectivly demonstrates how to deal with a form, and display intellegent errors WITHOUT any of that ...Please click your browsers back button... crap. Have a hidden field in your form - ACTION=SAVE This will tell your script when to look for input. Write your script like this ? //Make sure your ID is of int type. //If ID 0 then you are in UPDATE mode. if ID == 0 then you are in INSERT MODE $ID = intval($ID); //The main reason that I use a switch instead of an IF is that you can break out at any time. switch($ACTION) case 'SAVE': { //Validate all fields here if(empty($field1)) $oErr-field1 = 'Required'; if(empty($field2)) $oErr-field2 = 'Required'; //If the variable $oErr is set, then break if(isset($oErr)) break; //We are okay, add slashes to all fields... $field1 = addslashes($field1); $field2 = addslashes($field2); if($ID) { //UPDATE MODE $sQuery = UPDATE table SET field1='field1', field2='field2 WHERE id=$ID; //Do the UPDATE query here (however you do that) } else { //INSERT MODE $sQuery = INSERT INTO table VALUES ('field1', 'field2'); //Do the INSERT query here (however you do that) //Grab the newly inserted ID $ID = mysql_insery_id(); } //We have success, Do the redirect here header(Location: http://www.yourdomain.com/nextscript.php?ID=$ID;); exit; } ? html body form name=frmInput action=?= $PHP_SELF ? method=post input type=hidden name=ACTION value=SAVE input type=hidden name=ID value=?= $ID ? Field 1: ? if(isset($oErr-field1)) echo($oErr-field1); ?br input type=text name=field1 value=?= addslashes($field1) ? Field 2: ? if(isset($oErr-field2)) echo($oErr-field2); ?br input type=text name=field2 value=?= addslashes($field2) ? /form /body /html ** At 06:24 PM 11/25/2001 +0100, Daniel Alsén wrote: 2. User fills in a form, clicks submit which calls the same script, passing itself the values. Depending on the value passed by the submit button, the script processes the information (INSERT or UPDATE) and sets $done = 1 if successful. The second scenario is easier to handle. Call the same script, passing it $done, and depending on whether or not $done is set you redirect. Juli Meloni has done an excellent tutorial on just this at http://www.thickbook.com. look in the tutorials for something like Form With Error Message. You just have to adapt the logic to suit your needs. The second scenario is correct. I am actually already using the method in Melonis tutorial for error messages. But i can´t do a redirection that way since $done isn´t set until after the db INSERT. My if-statement for the header is at the top of the page (wich is the only place i can put it) and will never know if $done is set or not below. - Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] ZIP Files?
Hi people, I´m looking for alternatives in using zip files. Our users should upload into our server zipped files and we need to unzip this files and process it. I have read there is a library that could be used like an extension, but I´ve tried to use it from NT and don´t seems like the extension was added and when I try to use the commands PHP says that don´t recognoice the commands. In the other hand somebody has told me that PHP must be recompiled for using this library. Our platform is Windows NT but in the future could be Solaris. Anybody could send me your experience? Thanks in advance. Emiliano -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Pulling information out of a MySQL database
Hi, I'm having some new troubles pulling information out of a MySQL database. The page I'm currently working on has a simple form, that asks the user to select a month and year from two dropdown menu's then forwards their choices on to a new page which displays community events for the chosen month and year. This all works great. However, this new page that displays the community events along with their date allows the user to click on the name of the event for a more detailed list (location, time, description, etc) - this is the part that isn't working. The problem seems to be that the script forgets the previously chosen month and year when it goes to display the event in greater detail. How can I get the script to remember the month and year so it will display the proper information? My immediate thought is a cookie, but I have no idea how to do this ... can anyone offer any other suggestions, or if a cookie is the way to go - can someone point me in the right direction? The site is hosted on a Sun Solaris box with PHP 3.0.16 and MySQL 3.23.31 Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Pulling information out of a MySQL database
On Sun, 25 Nov 2001, Tim Thorburn wrote: the proper information? My immediate thought is a cookie, but I have no idea how to do this ... can anyone offer any other suggestions, or if a cookie is the way to go - can someone point me in the right direction? Hidden form variable, assign the previous values. -- Sapere aude My mind not only wanders, it sometimes leaves completely. Never attribute to malice that which can be adequately explained by stupidity. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] GD, PNG
thats right just untar somewhere, when you do the make install it should create the directory /usr/local/freetype2 for you, it is a bit of a strange one they also made it to use jam which is another make file system, I don't know whats wrong with the old ./configure, make, make install at least it is a standard :) Good luck with the install. Regards, Joseph -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, 26 November 2001 9:11 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] GD, PNG Interesting. Thanks So after untar, I will use that sequence you typed I presume I can untar and do that or need to rename folder to freetype 2 go in, and then the process you stated? It's funny how freetype throws me off but I am confident in installing gd and everything else. It's like the sun , without it, everything else falls apart Thanks Joel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Pulling information out of a MySQL database
On Mon, 26 Nov 2001 13:17, Tim Thorburn wrote: Hi, I'm having some new troubles pulling information out of a MySQL database. The page I'm currently working on has a simple form, that asks the user to select a month and year from two dropdown menu's then forwards their choices on to a new page which displays community events for the chosen month and year. This all works great. However, this new page that displays the community events along with their date allows the user to click on the name of the event for a more detailed list (location, time, description, etc) - this is the part that isn't working. The problem seems to be that the script forgets the previously chosen month and year when it goes to display the event in greater detail. How can I get the script to remember the month and year so it will display the proper information? My immediate thought is a cookie, but I have no idea how to do this ... can anyone offer any other suggestions, or if a cookie is the way to go - can someone point me in the right direction? The site is hosted on a Sun Solaris box with PHP 3.0.16 and MySQL 3.23.31 Thanks Presumably each event will have a unique ID? Then pass that ID as part of the URL on the link for the detailed information, and use the ID to select the detailed information. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA A cat is the universe's way of showing us perfection. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] ADVERTISE TO 11,759,000 PEOPLE FREE!
Dear [EMAIL PROTECTED], *** Would you like to send an Email Advertisement to OVER 11 MILLION PEOPLE DAILY for FREE? *** Do you have a product or service to sell? Do you want an extra 100 orders per week? NOTE: (If you do not already have a product or service to sell, we can supply you with one). = 1) Let's say you... Sell a $24.95 PRODUCT or SERVICE. 2) Let's say you... Broadcast Email to only 500,000 PEOPLE. 3) Let's say you... Receive JUST 1 ORDER for EVERY 2,500 EMAILS. CALCULATION OF YOUR EARNINGS BASED ON THE ABOVE STATISTICS: [Day 1]: $4,990 [Week 1]: $34,930 [Month 1]: $139,720 To find out more information, Do not respond by email. Instead, Please visit our web site at: http://www.bigcashtoday.com/package1.htm List Removal Instructions: We hope you enjoyed receiving this message. However, if you'd rather not receive future e-mails of this sort from Internet Specialists, send an email to [EMAIL PROTECTED] and type remove in the subject line and you will be removed from any future mailings. We hope you have a great day! Internet Specialists -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Pulling information out of a MySQL database
Hi again, Ok, I've heard some suggestions to my problem ... but I'm not entirely certain how to incorporate them, perhaps taking a look at the code would be helpful. Again, the problem I'm having is as follows. I have a simple form in which the user selects a month and year from two drop down menu's - based on their choice, the following PHP script searches a MySQL database and displays a basic listing (event name and date) for the selected month. Then the user has the option to click an event name and receive a more detailed listing of the event - this is the portion that isn't working. It seems that the script is forgetting the values entered by the user - I have come to this conclusion as when I replaced .$month. and .$year. with an actual month and year ie. 'November' and '2001' respectively, the detailed display works perfectly. How can I get both the basic and detailed event listings working at the same time? Thanks -Tim ? $db = mysql_connect(localhost, login, password); mysql_select_db(edoinfo,$db); if ($id) { // query for extented information $result = mysql_query(SELECT *, DATE_FORMAT(EventStartDate, '%W %M %D %Y') AS FormattedEventStartDate, DATE_FORMAT(EventEndDate, '%W %M %D %Y') AS FormattedEventEndDate, TIME_FORMAT(EventStartTime, '%r') AS FormattedEventStartTime, TIME_FORMAT(EventEndTime, '%r') AS FormattedEventEndTime FROM comcal WHERE id=$id and EventMonth='.$month.' and EventYear='.$year.',$db); $myrow = mysql_fetch_array($result); //display extended information echo table width='65%' border='0' cellspacing='2' cellpadding='2'; echo tr; echo td valign='top' align='left'bEvent: /b/td; echo td valign='top' align='left'; echo ($myrow[EventName]); echo /td; echo /tr; echo tr; echo td valign='top' align='left'bLocation: /b/td; echo td valign='top' align='left'.($myrow[EventLocation])./td; echo /tr; echo tr; echo td valign='top' align='left'bCity: /b/td; echo td valign='top' align='left'.($myrow[EventCity])., .($myrow[EventState])./td; echo /tr; echo tr; echo td valign='top' align='left'bTime: /b/td; echo td valign='top' align='left'.($myrow[FormattedEventStartTime])./td; echo /tr; echo tr; echo td valign='top' align='left'bDate: /b/td; echo td valign='top' align='left'.($myrow[FormattedEventStartDate])./td; echo /tr; echo tr; echo td valign='top' align='left'bContact Person(s): /b/td; echo td valign='top' align='left'.($myrow[EventC1FN]). .($myrow[EventC1LN]).br.($myrow[EventC2FN]). .($myrow[EventC2LN])./td; echo /tr; echo tr; echo td valign='top' align='left'bPhone: /b/td; echo td valign='top' align='left'.($myrow[EventC1ACPhone])...($myrow[EventC1ExcPhone])...($myrow[EventC1ExtPhone]). ; echo br.($myrow[EventC2ACPhone])...($myrow[EventC2ExcPhone])...($myrow[EventC2ExtPhone]). ; echo /td; echo /tr; echo tr; echo td valign='top' align='left'bFax: /b/td; echo td valign='top' align='left'.($myrow[EventACFax])...($myrow[EventExcFax])...($myrow[EventExtFax])./td; echo /tr; echo tr; echo td valign='top' align='left'bCell: /b/td; echo td valign='top' align='left'.($myrow[EventACCell])...($myrow[EventExcCell])...($myrow[EventExtCell])./td; echo /tr; echo tr; echo td valign='top' align='left'bEmail: /b/td; echo td valign='top' align='left'a href='mailto:;.($myrow[EventEmail]).'.($myrow[EventEmail])./a/td; echo /tr; echo tr; echo td valign='top' align='left'bWeb: /b/td; echo td valign='top' align='left'a href='.($myrow[EventWeb]).'.($myrow[EventWeb])./a/td; echo /tr; echo tr; echo td valign='top' align='left'bDescription: /b/td; echo td valign='top' align='left'.($myrow[EventDescription])./td; echo /tr; echo tr; echo td valign='top' align='left'bCost: /b/td; echo td valign='top' align='left'.($myrow[EventCost])./td; echo /tr; echo tr; echo td valign='top' align='left'b/b/td; echo td valign='top' align='left'nbsp;/td; echo /tr; echo tr; echo td valign='top' align='left'b/b/td; echo td valign='top' align='left'nbsp;/td; echo /tr; echo /table; } else { //display basic information from
RE: [PHP] Pulling information out of a MySQL database
If id is unique, you can change the first sql from: $result = mysql_query(SELECT *, DATE_FORMAT(EventStartDate, '%W %M %D %Y') AS FormattedEventStartDate, DATE_FORMAT(EventEndDate, '%W %M %D %Y') AS FormattedEventEndDate, TIME_FORMAT(EventStartTime, '%r') AS FormattedEventStartTime, TIME_FORMAT(EventEndTime, '%r') AS FormattedEventEndTime FROM comcal WHERE id=$id and EventMonth='.$month.' and EventYear='.$year.',$db); to: $result = mysql_query(SELECT *, DATE_FORMAT(EventStartDate, '%W %M %D %Y') AS FormattedEventStartDate, DATE_FORMAT(EventEndDate, '%W %M %D %Y') AS FormattedEventEndDate, TIME_FORMAT(EventStartTime, '%r') AS FormattedEventStartTime, TIME_FORMAT(EventEndTime, '%r') AS FormattedEventEndTime FROM comcal WHERE id=$id,$db); in other words: remove the month and year from the where clause Martin -Original Message- From: Tim Thorburn [mailto:[EMAIL PROTECTED]] Sent: Monday, November 26, 2001 3:58 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Pulling information out of a MySQL database Hi again, Ok, I've heard some suggestions to my problem ... but I'm not entirely certain how to incorporate them, perhaps taking a look at the code would be helpful. Again, the problem I'm having is as follows. I have a simple form in which the user selects a month and year from two drop down menu's - based on their choice, the following PHP script searches a MySQL database and displays a basic listing (event name and date) for the selected month. Then the user has the option to click an event name and receive a more detailed listing of the event - this is the portion that isn't working. It seems that the script is forgetting the values entered by the user - I have come to this conclusion as when I replaced .$month. and .$year. with an actual month and year ie. 'November' and '2001' respectively, the detailed display works perfectly. How can I get both the basic and detailed event listings working at the same time? Thanks -Tim ? $db = mysql_connect(localhost, login, password); mysql_select_db(edoinfo,$db); if ($id) { // query for extented information $result = mysql_query(SELECT *, DATE_FORMAT(EventStartDate, '%W %M %D %Y') AS FormattedEventStartDate, DATE_FORMAT(EventEndDate, '%W %M %D %Y') AS FormattedEventEndDate, TIME_FORMAT(EventStartTime, '%r') AS FormattedEventStartTime, TIME_FORMAT(EventEndTime, '%r') AS FormattedEventEndTime FROM comcal WHERE id=$id and EventMonth='.$month.' and EventYear='.$year.',$db); $myrow = mysql_fetch_array($result); //display extended information echo table width='65%' border='0' cellspacing='2' cellpadding='2'; echo tr; echo td valign='top' align='left'bEvent: /b/td; echo td valign='top' align='left'; echo ($myrow[EventName]); echo /td; echo /tr; echo tr; echo td valign='top' align='left'bLocation: /b/td; echo td valign='top' align='left'.($myrow[EventLocation])./td; echo /tr; echo tr; echo td valign='top' align='left'bCity: /b/td; echo td valign='top' align='left'.($myrow[EventCity])., .($myrow[EventState])./td; echo /tr; echo tr; echo td valign='top' align='left'bTime: /b/td; echo td valign='top' align='left'.($myrow[FormattedEventStartTime])./td; echo /tr; echo tr; echo td valign='top' align='left'bDate: /b/td; echo td valign='top' align='left'.($myrow[FormattedEventStartDate])./td; echo /tr; echo tr; echo td valign='top' align='left'bContact Person(s): /b/td; echo td valign='top' align='left'.($myrow[EventC1FN]). .($myrow[EventC1LN]).br.($myrow[EventC2FN]). .($myrow[EventC2LN])./td; echo /tr; echo tr; echo td valign='top' align='left'bPhone: /b/td; echo td valign='top' align='left'.($myrow[EventC1ACPhone])...($myrow[EventC1ExcPhone]).. .($myrow[EventC1ExtPhone]). ; echo br.($myrow[EventC2ACPhone])...($myrow[EventC2ExcPhone])...($myro w[EventC2ExtPhone]). ; echo /td; echo /tr; echo tr; echo td valign='top' align='left'bFax: /b/td; echo td valign='top' align='left'.($myrow[EventACFax])...($myrow[EventExcFax])...($myro w[EventExtFax])./td; echo /tr; echo tr; echo td valign='top' align='left'bCell: /b/td; echo td valign='top' align='left'.($myrow[EventACCell])...($myrow[EventExcCell])...($my row[EventExtCell])./td; echo /tr; echo tr; echo td valign='top' align='left'bEmail: /b/td; echo td valign='top' align='left'a
Re: [PHP] Installing PHP 4 on a RAQ3
Miles Thompson [EMAIL PROTECTED] wrote: You mentioned .pkg files, might Cobalt be using a Debian distribution? Log in and try executing dpkg or dselect -- it could be that Cobalt have the installation pointing only to their server. If so, go to the Debian web site and locate some additional servers. Cobalt (which became a division of Sun earlier this year) runs a modified Redhat distribution. The RaQ4 runs 6.2, RaQ2 runs 5.2 and I'm not sure on the RaQ3, but I believe it's 6.1 (again, a modified version, not the full standard version). The pkg file is not a Debian format. Instead of searching the PHP archives I'd recommend searching the cobalt-users archives and joining the cobalt-users list. The AIMS Group site has a searchable archive of the list. Instructions, hints and tips have been posted there many times. I've installed PHP countless times on dozens of Cobalt boxes so it definitely can be done. -- Steve Werby President, Befriend Internet Services LLC http://www.befriend.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: failure notice
For those running php 4 on raq 3, how did you compile freetype? ./configure make make install or just 2 make's? Just curious