[PHP] writing files with php
Hey How can I create files with php, I've tried somethings but php always tells me that I don't have access. But the Directory has 777 access and the owner is my webserver. Can somebody help me :-) I need this for to create logfiles Greetings Sven
Re: [PHP] Entering data into MySQL
On Monday 25 February 2002 15:39, Tim Thorburn wrote: Hi, I'm having troubles entering information from a form into a MySQL database. Specifically if the user enters an apostrophe anywhere in the form, all the information is rejected and nothing is entered into the database. After researching a little on php.net I found the addslashes() command - this did help briefly and I was able to use apostrophe's in the form ... but it seems as the problem has resurfaced. To make matters more frustrating, the addslashes() command works perfectly well on my local test machine (Win2k Pro, PHP 4.1.1, MySQL 3.23.44, Apache 1.3.23) but not at all on the server which is hosted by another company (Sun Solaris, PHP 3.0.16, MySQL 3.22.32, Apache 1.3.12). Does anyone have any suggestions as to why the addslashes() command worked for a short time on the webserver and why it stopped? Or better yet, is there a variation of addslashes() that will work on an older version of PHP such as 3.0.16? It could be that the configuration of your local and remote servers are different. Specifically check out the setting magic_quotes_gpc. Run phpinfo() on both to find out their settings. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* grep me no patterns and I'll tell you no lines. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Count
hey Again a small question forgive me but it's monday and the brain is still working on sunday :-) I want to make this sql query visual does anybody have any idea :-) SELECT date_format(t_timestamp_opened,'%Y %m %d'), count(date_format(t_timestamp_opened,'%Y %m %d')) FROM crm.ticket group by date_format(t_timestamp_opened,'%Y %m %d') order by t_timestamp_opened; ++-- -+ | date_format(t_timestamp_opened,'%Y %m %d') | count(date_format(t_timestamp_opened,'%Y %m %d')) | ++-- -+ | 2002 01 15 | 1 | | 2002 01 22 | 1 | | 2002 01 23 | 3 | | 2002 01 25 | 2 | | 2002 01 29 | 2 | | 2002 02 01 | 1 | | 2002 02 06 | 2 | | 2002 02 11 | 1 | | 2002 02 12 | 1 | | 2002 02 15 | 1 | | 2002 02 22 | 2 | ++-- -+
[PHP] FW: PHP Nuke - Datestring
-Original Message- From: Andrew Duck [mailto:[EMAIL PROTECTED]] Sent: Monday, 26 February 2001 8:44 PM To: PHP Gen Subject: PHP Nuke - Datestring I am having trouble trying to convert the current PHP Nuke dateformat for articles into Beats. Does anyone know how to swap the PHP Nuke articles date format into: e.g Sunday, 24 February @ [numberofbeats] Beats Thankyou in advance. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Count
Hi, I want to make this sql query visual does anybody have any idea :-) SELECT date_format(t_timestamp_opened,'%Y %m %d'), count(date_format(t_timestamp_opened,'%Y %m %d')) FROM crm.ticket group by date_format(t_timestamp_opened, '%Y %m %d') order by t_timestamp_opened; Visual? What do you mean? You want to display the results on the page? In that case, just step through using mysql_fetch_array and echo each row. Or did you want something else? Cheers Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] passing variables - php.ini?
Hi guys, Looking for help on how to activate the automatic passing of variables - think i need to change something in my php.ini file maybe? got scripts that work fine on one server, but i've recently got a new virtual server, and it won't pass variables though - example script.. html head titleMatt's PHP/title /head body centerh2Message/h2 form method=post action=?php echo $PHP_SELF? ?php if($message) { echo $message; }else{ ? table width=500 border=0 cellspacing=0 cellpadding=0 tr td message: /td td textarea name=message cols=40 rows=8/textarea /td /tr tr td colspan=2 input type=Submit name=submit value=Send /td /tr /table ?php } ? /form /center /body /html This always just gives the form for entering your message, it never does the bit where it prints it out. hope this is clear enough, cheers, Matt --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.323 / Virus Database: 180 - Release Date: 08/02/02 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Substr and HTML tags - Problem...
Hi, I got a small problem: I need to limit a teaser-text via substr($teaser,0,100). The Problem I now have is, if the last 4 string chars are a html tag like br and this tag will be cut by the substr to something like that: br - it will mess up the webpage... How can I avoid that the html tags are cut by the substr function? Is there a way to make the function know, that it has to leave html tags uncut?? Thanks in advance... Sascha Ragtschaa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DEV] SAP DB
alex black wrote: hi all, One of the binarycloud developers just told me to have a look at the SAP OS database, SAPDB. SAP DB is just another name for AdabasD from a programmers point of view- I'm going to test it tomorrow to see if it actually does what it claims, but this _looks_ like serious OS competition to Oracle, and if it is I would very much like to use it for my next project. So, question: Has anyone used SAPDB with PHP? If so, experiences? And if not, are there plans for drivers? I looked in the manual and I didn't see any mention of SAPDB. http://www.php.net/manual/en/ref.odbc.php Oh, and I just found a mention of PHP on the SAPDB site. Looks like the connection is over ODBC, which I really _really_ dislike... are there plans for anything native? like a sapdb_connect :)? from the link mentinoned above: In addition to normal ODBC support, the Unified ODBC functions in PHP allow you to access several databases that have borrowed the semantics of the ODBC API to implement their own API. Instead of maintaining multiple database drivers that were all nearly identical, these drivers have been unified into a single set of ODBC functions. so the call interface to AdabasD/SapDB looks like ODBC, but you have direct access to the database using PHP, you don't have to deal with ODBC driver management and all the stuff if you don't want you In any case I think this database has a _HUGE_ amount of potential and PHP would benefit if access to SAPDB was possible. as said above: it is all there ... just the documentation could need a little update ... -- Hartmut Holzgraefe [EMAIL PROTECTED] http://www.six.de +49-711-99091-77 Wir stellen für Sie aus auf der CeBIT 2002 und freuen uns in Halle 6 auf Ihren Besuch am Stand H 18 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] accessing flash files using php
Hi Is it possible to access a flash movie and then go to a certain frame within that movie. I know that you can create flash files and then use all manner of flash related functions, but I want to access an already existing movie. Cheers JD
Re: [PHP] Substr and HTML tags - Problem...
Sascha Ragtschaa wrote I need to limit a teaser-text via substr($teaser,0,100). The Problem I now have is, if the last 4 string chars are a html tag like br and this tag will be cut by the substr to something like that: br - it will mess up the webpage... How can I avoid that the html tags are cut by the substr function? Is there a way to make the function know, that it has to leave html tags uncut?? Personally when I'm doing teasers I strip all HTML from the content before using substr: $teaser = strip_tags($content); $teaser = substr($teaser, 0, 100); $teaser .= '...'; // Nice touch to have a '...' on the end :) I can't think of a way of keeping HTML tags but ensuring you don't cut off half way through one - I suppose you could do it by scanning along the string character by character keeping track ofwhether or not you have encountered a without a matching , then if you get to the end and you are half way through a tag running back to the start of the tag and deleting from there. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
AW: [PHP] Substr and HTML tags - Problem...
Thanks, found a way - the PHP function wordwrap does it just perfect (recognizes the tags, too) ... Sometimes it's just good to browse a little bit through PHP.net (*g*) Sascha Ragtschaa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Substr and HTML tags - Problem...
Personally when I'm doing teasers I strip all HTML from the content before using substr: $teaser = strip_tags($content); $teaser = substr($teaser, 0, 100); $teaser .= '...'; // Nice touch to have a '...' on the end :) You don't have a handy way to check that your substr() doesn't cut off half-way through a word, do you? I'm up against this issue myself at the moment and it's a PITA to sort out - I keep getting things like Fnord fnord fnord fnord fnord fno, where the last fnord is missing its rd. It's bound to be a case of stepping back through the string until a space is encountered, and then keeping everything to the left of that, but I haven't worked out an elegant way to do it yet :-) Cheers Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing variables - php.ini?
Hi Matt, Looking for help on how to activate the automatic passing of variables - think i need to change something in my php.ini file maybe? got scripts that work fine on one server, but i've recently got a new virtual server, and it won't pass variables though - example script.. Your suspicions are correct! If you have one of the more recent distributions of PHP then you will either need to amend the php.ini file: register_globals = On or, use the 'newer' way to access global variables. Don't worry, this change is turning others of us schizoid too! Regards, =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] passing variables - php.ini?
thanks a lot! works fine now i've changed register_globals. just out of interest, what is the 'newer' way? is it using sessions etc, or something else i don't know about? or should i rtfm? ;) thanks again, Matt -Original Message- From: DL Neil [mailto:[EMAIL PROTECTED]] Sent: 25 February 2002 12:15 To: matt stewart; [EMAIL PROTECTED] Subject: Re: [PHP] passing variables - php.ini? Hi Matt, Looking for help on how to activate the automatic passing of variables - think i need to change something in my php.ini file maybe? got scripts that work fine on one server, but i've recently got a new virtual server, and it won't pass variables though - example script.. Your suspicions are correct! If you have one of the more recent distributions of PHP then you will either need to amend the php.ini file: register_globals = On or, use the 'newer' way to access global variables. Don't worry, this change is turning others of us schizoid too! Regards, =dn --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.323 / Virus Database: 180 - Release Date: 08/02/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.323 / Virus Database: 180 - Release Date: 08/02/02 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql.default_* when sql.safe_mode is on
Hello, I'd like to provide default database host/user names and passwords for more virtual webs. the php.ini says, if I turn on sql.safe_mode, the variables mysql.default_host, mysql.default_user and mysql.default_password do not apply. Could I change them in this case from httpd.conf via php_admin_flag or not? -- Matus fantomas Uhlar, [EMAIL PROTECTED] ; http://www.fantomas.sk/ Warning: I don't wish to receive spam to this address. Varovanie: Nezelam si na tuto adresu dostavat akukolvek reklamnu postu. Windows found: (R)emove, (E)rase, (D)elete -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PATH INFO urls - replacing GET syntax
Navid, The path info technique is moderately well known. I thought I'd seen an account of it at phpwizard.net, and I would have given you the link, but when I looked just now I couldn't find it. Anyway, this is roughly how it goes:- Background You can add all kinds of stuff at the end of a url pointing to your php script and the php still gets run e.g. http://www.mysite.net/myscript.php/this/and/thatand_the_other will still cause myscript.php to be run. Anything appearing after the path name is know as the path info and is available in a pre-defined global variable $PATH_INFO, (at least with Apache). In this example $PATH_INFO would be /this/and/thatand_the_other, (note the / at the front). Basic Technique === So you can use PATH_INFO to communicate with your script from a link without using a GET string e.g. instead of : /myscript.php?search=findthis, you could just have /myscript.php/findthis. With the first, GET syntax, php automatically sets $search to findthis. If you use the second, path info syntax instead, then you have to do a bit more work to get the value into the variable you want. In this case, you would do something like: list($null,$search) = explode('/',$PATH_INFO); From this line on, it's exactly as if $search was set from the GET information. (The $null variable is simply there to use up the empty variable that explode assigns for what appears before the first /, it is only necessary because I use list() syntax to do all the work of unpacking and assignment in one line. list($search) = explode('/',substr($PATH_INFO,1)); would be an alternative that avoids this dummy variable.) You can pass any number of parameters, but your script needs to know what variables need to be set and in what order, which it doesn't have to do with the GET, since the names of the variables are passed as well as their values on a GET. For example, I've had urls that look like something like this: /product.php/cookers/range/belling as a replacement for /product.php?section_code=cookerstype_code=rangemanufacturer_code=belling To unpack the PATH_INFO version in this case, I use the following code: list($null,$section_code,$type_code,$manufacturer_code) = explode('/',$PATH_INFO); That's about all there is to it. Eliminating the .php = There is a further refinement that I like, which is to get rid of the .php on the end of the script name. So instead of/myscript.php/this you have just /myscript/this, or in my last example : /product/cookers/range/belling. To achieve this you need to tell your web-server that it should treat files with no extension as if they were php files. If you run Apache, you need the following directive in the configuration file. DefaultType application/x-httpd-php (Don't assume I've got the syntax exactly right, check it!) You can set it across your whole server, just some virtual servers or individual directories. This tells Apache that if a file has no type i.e. no extension, treat it as php. The Advantages === Why bother using PATH_INFO, since it is extra work? 1. Elegant URLs Like you, I much prefer elegant urls. My reasoning is that the location of a page has an extremely prominent position within any browser, so it ought to be made as attractive, straightforward and unfrightening for the user as possible. It's as much a part of the design as the rest of the page. Whenever I see horrendous urls, (and some of the supposedly most professional sites are the worst), I get a bad taste in my mouth. I immediately assume that if the location of the page has such unnecessary geekery, there is probably a lot more unnecessary geekery to follow on the body of the page... 2. Search Engines An often quoted reason for using PATH_INFO is that search engines will not follow links which include GET data, whereas they will always follow PATH_INFO based links since there is no way they can distinguish them from real static links. In principle, this means that you can get every page of search results indexed and treated as if it were an individual static page by the search engine. You just need hidden path info based links on your pages that point to searches for all or various sub-sets of the possible results. But search engine placing is a black art, so don't take my word for it ;) 3. Usability Another point, is PATH_INFO urls are generally easy to remember/bookmark/manage, since they have a simpler format and will always use less characters than the GET version. They are, for example, much more likely to be fully visible in the browser's message toolbar during hovers over links. 4. Multi-Output Services There is a more subtle long-term advantage in eliminating the GET portion of your urls. Pure PATH_INFO urls are inherently more standards compliant than urls with GET information. They are significantly more likely to fit in with non-html urls, e.g. satisfying wap or xml requests for data from a service without
Re: [PHP] zend studio 2.0
Zeev, If you find that GUI tools are not overwhelmingly better for C++, Java product development, that does weaken the case for php studios even more. Why so? 1. Conciseness of php php is a high level application development tool so the code is, or at least, should mostly consist of highly specific encapsulated business logic. This is relatively more suited to a general (possibly application progammable) text editor rather than a php-specific studio. 2. The other code php is mostly about integrating other code i.e. html/sql/Javascript/xml/pdf whatever. In the overall application these are just as important as php. The php studios seem to do a good job of bundling in sql and html tools but it's always going to be hard for one studio, however well designed, to cover the needs of several languages. 3. Maintenance vs Development Personally, I've never understood that there are distinct development and maintenance activities. Isn't maintainability the key quality issue for all code? And isn't the best way to ensure maintainability to make sure the developer maintains? In any case, php progamming is particularly likely to be mostly about maintenance. For all the right reasons: good match to business needs = more sensitivity to business needs = more changes; more robust applications = longer life = more changes; easy coding = easy changes = more changes; shorter development cycles = more prototyping = more changes. So there's lots of maintenance style work (i.e. small, short edits) relative to development. Once again this probably favours less structured development tools. 4. Unix Development Platform If my own development platform was Microsoft, I'm sure I'd need a development studio, if only to do all that opening and closing of windows. But if you can have X hundred windows open on K different desktops with G different tools, it isn't such an issue. 5. Testing on Live Servers Even with all these disincentives I'd still be very tempted to use a php development studio, especially for debugging, but the killer problem is how I test code. Typically, even unit testing is done on test domains/databases of live public servers. The advantage is that it greatly reduces the need for deployment/performance testing (and nasty last-minute deployment issues such as discovering you haven't got a live gd library with png). It also means it's very easy to get the end users/customers involved in testing early on and you don't have to worry about setting up access to lots of different platforms for third-parties e.g. html developers. The disadvantage is that there's always a firewall in the way, so it's not so easy, or desirable, to run back-door client connects to sql, debug or even ftp! (Before anyone jumps down my throat on security issues, why else do we have execution timeouts, user aborts, includes from outside document root etc., etc., unless it's to make this sort of thing possible? And isn't it better to have to focus on security right from the start of development?) I guess the bottom line is... Darned if I can see how anyone can make money out of php add-on tools, even top-notch development studios :( php is just too good! George P.S. On the other hand, if someone was asking for sponsorship to make 0.7 + 0.1 == 0.8, I'd get the cheque book out right away... Zeev Suraski wrote: At 05:02 18/02/2002, Peter J. Schoenster wrote: Well, as you said, no point in arguing. Just that I think if someone really wants to develop they should learn some better tools than a GUI but it's a question of balance. That's quite an arguable point. I don't code PHP but C++ and Java, and I can say that I'm much more productive using an advanced GUI (Visual C++, IntelliJ IDEA) than I am using a text editor and aid tools. There are still things I do in a shell (diffing, grepping, patching, even tiny text edits), but to actually write big code portions, and/or refactor existing code portions, IDE's give you tools that simple text editors just don't. Of course, it's a matter of habits and taste, but saying that 'someone who really wants to develop should learn some better tools than a GUI' is simply bogus in my opinion. GUIs are better than text-mode tools in many ways, and text-mode tools sometimes get the job done quicker than GUIs. A good GUI would address 80% of your needs, and you can fill in the gap with the tools you were used to. Zeev -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files | how to avoid submitting twice?
In JavaScript define varaible which is global for this page, name it like page_submited, by default set it to false. On submit event set this variable to true and then from JavaScript submit form. When user second time will try to submit the form do nothig, just leave function code. Your JvaScript code is enabled durring your html page is in browesr so it will have to work. I suppose there isn't any other solution. Here is simple code script language=JavaSript form_submited = 0; function submit_only_one() { if ( form_submited ) { return 1; } else { form_submited = 1; document.forms[ 'name_of_your_formform' ].submit(); } } /script input type=button onclick=JavaScript:submit_only_one() I hope I didn't make any JavaScript code errors, I didn't use it for long time. Good luck Krzysztof Andy wrote: Hi there, I would like to upload files using a form. Unfortunatelly it takes a while till the file is uploaded to the server. During this time the same page with the submit button is viewed. If the user clicks another time on the submit button, I get wrong records and sometimes the same file twice. Is there a way to redirect imediatelly to a waiting page? I tryed to redirect, but somehow the server is first uploading the file before something else happens. Thanx for any help Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: uploading files | how to avoid submitting twice?
Jim Winstead wrote: Andy [EMAIL PROTECTED] wrote: Is there a way to redirect imediatelly to a waiting page? I tryed to redirect, but somehow the server is first uploading the file before something else happens. unfortunately, no. one thing you can do is use javascript to pop up a small window in your form's onsubmit method that tells the user to hang on, and then close that window in the next page's onload method. it isn't easy to do a real progress meter, but even this little bit should help tremendously. you may also want to check the md5 sum of the file contents against previous uploads to detect duplicates. jim I've never tried it, but it may also be possible to disable the submit button once it has been pressed once to stop the second upload e.g. HTML HEAD SCRIPT LANGUAGE=javascript function submitonce() { if (document.form.submitted.value == No) { document.form.submitted.value == Yes; return true; } else { alert(Please wait...); return false; } } /SCRIPT /HEAD BODY FORM OnSubmit=return submitonce(); INPUT TYPE=HIDDEN NAME=submitted VALUE=No INPUT TYPE=FILE NAME=uploadfile INPUT TYPE=SUBMIT OnClick=return submitonce(); /FORM /BODY /HTML N.B. I've set the form's OnSubmit and the submit button's onClick, only because I'm not sure which will work best. I'd expect this to work with a normal form submit but maybe file upload is funny... George -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem about Reading input from a Form
I can't take the variables $user and $address from the form to the php file. Below I have the code.When I test the examble I only see the html text but not the variables. Thank you THE HTML FORM html head titleListing 9.2 /title /head body form action=listing9.3.php input type=text name=user br textarea name=address rows=5 cols=40 /textarea br input type=submit value=hit it! /form /body /html THE PROCCESS OF THE INPUT FORM html head titleListing 9.3 /title /head body ?php print Welcome b$user/bP\n\n; print Your address is:P\n\nb$address/b; ? /body /html The files are in the same directory _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem about Reading input from a Form
You need to add the POST method to your form tag form action=listing9.3.php method=post Cheers JD -Original Message- From: Kostas Karadamoglou [mailto:[EMAIL PROTECTED]] Sent: Monday, February 25, 2002 12:58 PM To: [EMAIL PROTECTED] Subject: [PHP] Problem about Reading input from a Form I can't take the variables $user and $address from the form to the php file. Below I have the code.When I test the examble I only see the html text but not the variables. Thank you THE HTML FORM html head titleListing 9.2 /title /head body form action=listing9.3.php input type=text name=user br textarea name=address rows=5 cols=40 /textarea br input type=submit value=hit it! /form /body /html THE PROCCESS OF THE INPUT FORM html head titleListing 9.3 /title /head body ?php print Welcome b$user/bP\n\n; print Your address is:P\n\nb$address/b; ? /body /html The files are in the same directory _ Chat with friends online, try MSN Messenger: http://messenger.msn.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] GD - dynamic PNG generation
I'm currently using the GD extension to generate dynamic PNG's containing text, that should eventually be coming from a database. the deal is, it seems to take a long time, which is probably my own fault, seeing that I'm generating so much text. I am generating an image containing approx 160 lines of text, and it takes about 20seconds to create, this unfortunatley is too long for me. I was wondering if this is a common time with GD or if I am doing something wrong. Coding wise, I currently read the text in from a file, then put the text into an array, each line being a seperate entry in the array. I then create a PNG image approx 490*1848(i change the image size depending on the amount of text). I dont do anything really strange in my image function, apart from performing a wordwrap on the text before i start displaying it, just to make the image readable. ideally I would like this to come in considerably quicker. that said, if this is going to be used, it will probably done as a cron job, so if need be I will have toaccept it being super slow. any help is appreciated bros Conor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem about Reading input from a Form
On Monday 25 February 2002 12:57, Kostas Karadamoglou wrote: I can't take the variables $user and $address from the form to the php file. Below I have the code.When I test the examble I only see the html text but not the variables. Thank you Whic version of PHP are you using? If it's 4.1 I think php ships with register_globals off. I think you have to access your variables with $_GET $_POST. I'm not too sure as I haven't upgraded yet. m: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing variables - php.ini?
Matt, thanks a lot! works fine now i've changed register_globals. =great! just out of interest, what is the 'newer' way? is it using sessions etc, or something else i don't know about? or should i rtfm? ;) Yes it is quicker for me to say RTFM reference, although I wonder if it isn't perceived as slightly rude when I use the acronym in such a context... Preferred approach is to use: $HTTP_COOKIE_VARS['username'] rather than $username. RTFM security issues in http://www.php.net/manual/en/security.registerglobals.php which gives a good reason NOT to do what I suggested earlier (!?) and shows code illustrating/contrasting the two methods. The annotated manual is (perhaps surprisingly for open source) v.good and easily handled. Chucking globals at the built-in search facility will also render a wealth of further reading - including globals in 'sessions'. Have fun! =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] form submission error trapping
Navid, $SCRIPT_NAME is sometimes a safer alternative than $PHP_SELF. The difference is that $PHP_SELF includes $PATH_INFO while $SCRIPT_NAME is just the name of the actual script running. http://www.php.net/manual/en/language.variables.predefined.php This becomes particularly important if you use $PATH_INFO to implement elegant (and search-engine safe) urls e.g. /search/products/myproduct rather than /search.php?category=productskey=myproduct. George Navid Yar wrote: Simply, to send a form to itself, you can use a special variable called $PHP_SELF. Here's an example of how to use it: if ($somevalue) { header(Location: $PHP_SELF); } else { execute some other code... } Here, if $somevalue holds true, it will call itself and reload the same script/file. This code is not very useful at all, but it gets the point across. If you wanted to pass GET variables to this, then you could easily say: header(Location: $PHP_SELF?var=valuevar2=value2var3=value3); ...and so on. You can also use this approach with Sessions if you wanted to turn the values back over to the form page, assuming you had two pages: one for the form, and one for form checking and entry into a database. There are several ways to check forms, whether you want it on one page or span it out to several pages. You just need to be creative in what tools are avaiable to you. Here is an example of how you can pass session values: header(Location: some_file.php??=SID?); Here, whatever variables you've registered in session_register() will be passed to the php page you specify, in this case some_file.php. Hope this helps. Have fun, and happy coding. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP-JavaScript
Mëòv îçîÎ òsyïn wrote: Is it posible to get values from javascript to PHP? Without having to post the variables.. Thanks //Mårten _ Chatta med vänner online, prova MSN Messenger: http://messenger.msn.se I'm not quite sure what you are trying to do. Javascript is executing on the browser, php executes on the server, therefore to get anything from the Javascript to php your browser will have to communicate with the server via a request. This could be a form submission, which might be a POST or a GET. Alternatively, it is also possible to send data to a php script via a url e.g. myscript.php?myfield=myvalue. That means that wherever you can get Javascript to cause the browser to issue a request for a url, if the target at the other end is a php script then you can send data to that script. I don't know what you are trying to do, and this is all pretty obscure stuff, but you could for example put a hidden 1x1 image in the page and then get your Javascript to change the location of this image to be a php script with a variable passed on e.g. something like dummyimage.location = /myscript.php?myfield=+myjsvalue; As long as you get the php to send back another empty 1x1 pixel, e.g. via a header(Location: 1x1pixel.gif), then your browser page will stay the same as ever. As it happens I do sometimes do just this in Javascript but it's to get a new dynamic image back without reloading a page. Go to http://tandridge.cpfc.co.uk/tables/0222/graph/2/d7 and then select something different in the Team 1 or Team 2 selection box, and watch the graph at the bottom of the page to see this happen. In the source look for the Javascript function chteam_id() to see how it's done here. Good luck, George -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MM Dependency Problem
Hi Trying to install Troels Arvin's php distro on Redhat 7.1 with the default Rackspace setup. When I try to install his mm package, I get the following error: rpm -Uvh mm-1.1.3-6.arvin.rh7.1.i586.rpm error: failed dependencies: libmm.so.11 is needed by apache-1.3.22-1.7.1 This occurs even when Apache is halted. But if I try to install his mod_php package, I get: error: failed dependencies: libmm.so.1 is needed by mod_php-4.0.6-10.arvin.rh7.1 Can anyone explain what this is, and how to solve it? Thanks Geoff Caplan Advantae Ltd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Guestbook question
This example generates previous/next links but could be modified to make links to page 1, 2, 3, 4, etc. This code is not tested what so ever, but it should look something like this: - $rows_to_show = 10; $total_rows = mysql_num_rows(mysql_query(select name, post from guestbook order by id desc, $db)); $result = mysql_query(select name, post from guestbook order by id desc LIMIT $offset, $rows_to_show, $db); while ($myrow = mysql_fetch_row($result)) { echo TRTD$myrow[0]/TD/TR\n; echo TRTD$myrow[1]/TD/TR\n; ++$counter; } if ($offset 0) echo a href=\$PHP_SELF?offset= . ($offset - $rows_to_show) . \Previous/a; if ($offset $total_rows) echo a href=\$PHP_SELF?offset= . ($offset + $rows_to_show) . \Next/a; - Call the page with myscript.php?offset=0 Good luck Joakim -Original Message- From: James Taylor [mailto:[EMAIL PROTECTED]] Sent: Friday, February 22, 2002 8:40 PM To: [EMAIL PROTECTED] Subject: [PHP] Guestbook question I have a really simple guestbook that allows someone to post to the book, then it displays all the entries. Well, there are too many entries now for just one page and it looks kinda wacky, so I wanted to do something where it only displays 10 entries per page, then there are links for pages say 11-20, 21-30, etc. I have no idea how to do this - I only know how to limit the number of entries per page. So, the script that displays all the entries looks something like this: $counter = 0; $result = mysql_query(select name, post from guestbook order by id desc, $db); while (($myrow = mysql_fetch_row($result)) ($counter 10)) { echo TRTD$myrow[0]/TD/TR\n; echo TRTD$myrow[1]/TD/TR\n; ++$counter; } Well, that shows only the latest 10 alright, but what if I wanted to show entries 11-20? I figure I could get the number of posts through mysql_num_rows, I just can't piece it all together. Any suggestions would be really helpful. -- 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] Substr + Text + HTML - Problem
Hi, I still have one problem, which seems to be not solveable in a easy and smooth way: I have a text file like this: $text=This is a html extended textbrwhich needs to be cut after 100 charsbr; Than I do a substring to limit it to only 100 words (teaser-format): $teaser_1=substr($text, 0, 100); $teaser_2=...a[click here for more]/a; The Output of $teaser_1 will sometimes be like this: This is a html extended textbrwhich needs to be cut after 100 charsbr The br is displayed as br and not properly closed due to the limitation of 100 chars, and therefore messes up my whole webpage! Is there a way to let the function recognize, if the last part of the string is a unclosed html tag? Does anyone have a idea how to do it? Tried around a couple of things, but nothing worked out yet... Sascha Ragtschaa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem about Reading input from a Form
I put and the POST method but I have the same problem I don't know why, any ideas? Thank you From: John Day [EMAIL PROTECTED] To: Kostas Karadamoglou [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: [PHP] Problem about Reading input from a Form Date: Mon, 25 Feb 2002 13:00:35 - You need to add the POST method to your form tag form action=listing9.3.php method=post Cheers JD -Original Message- From: Kostas Karadamoglou [mailto:[EMAIL PROTECTED]] Sent: Monday, February 25, 2002 12:58 PM To: [EMAIL PROTECTED] Subject: [PHP] Problem about Reading input from a Form I can't take the variables $user and $address from the form to the php file. Below I have the code.When I test the examble I only see the html text but not the variables. Thank you THE HTML FORM html head titleListing 9.2 /title /head body form action=listing9.3.php input type=text name=user br textarea name=address rows=5 cols=40 /textarea br input type=submit value=hit it! /form /body /html THE PROCCESS OF THE INPUT FORM html head titleListing 9.3 /title /head body ?php print Welcome b$user/bP\n\n; print Your address is:P\n\nb$address/b; ? /body /html The files are in the same directory _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] permision denied when reading directory contents on fat32
Hi all when i do directory listing with readfile('c:\some\dir\name') warning is generated Warning: readfile(c:\temp\) - Permission denied in c:\programming\apache\htdocs\downloads\update.php on line 15 filesystem is fat32 so permissions are fake configuration: php 406 on windows2000 is there any way to do directory listing with php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: form submission error trapping
Jason, You didn't mention Javascript checks. Personally I really dislike having to wati for a page to reload before finding out that I've just failed to fill in a field. The Javascript to do basic on-page checks is all pretty simple stuff. Of course this doesn't mean we can skip checking the data again in the php! Javascript might be switched off, we might have a bug in the Javascript (easy to do), or we (or someone else) might want to simulate form entry via a url link. It's also quite likely that there may be checks e.g. checks for duplicate entries, which cannot be done on a form. Here's some skeleton code that handles a basic form with both php and javascript checks, (I've deliberately tried to keep the php/Javascript as similar as possible). You can try it at http://www.whiffen.net/simple.php if you want. *** simple.php*** SCRIPT LANGUAGE=php if (isset($surname)) { $errormessage = ; if ($surname == ) { $errormessage = $errormessage . brYou must enter a value for surname; } if ($age = 0 or $age != floor($age)) { $errormessage = $errormessage . brAge must be a whole number; } if ($errormessage == ) { // do whatever you have to with the data and maybe finish with // a redirect to a success page } } print ' HTML HEAD SCRIPT LANGUAGE=javascript function check() { var message = ; if (document.myform.surname.value == ) { message = message+\nYou must enter a value for surname; } if (document.myform.age.value != parseInt(document.myform.age.value)) { message = message+\nAge must be a whole number; } if (message != ) { alert(You have the following errors to correct:+message); return false; } else { return true; } } /SCRIPT /HEAD BODY H1MY FORM/H1 FORM name=myform method=post onSubmit=return check(); '; if ($errormessage != ) { print 'You have the following errors to correct'.$errormessage.'BR'; } print ' Surname: INPUT TYPE=TEXT NAME=surname VALUE='.$surname.' BR Age: INPUT TYPE=TEXT NAME=age VALUE='.$age.' BR INPUT TYPE=SUBMIT BR A HREF='.$SCRIPT_NAME.'sSource/A /FORM /BODY /HTML '; /SCRIPT You'll see that http://www.whiffen.net/simple.php?surname=whiffenage=23.2 works perfectly well too. Personally, I'm not a huge fan of Javascript. It always seems to be much more trouble than php for some reason, but it has its place, (as long as you never rely on it!). George Jason Dulberg wrote: I am working on some error trapping for several forms on my site. After visiting a bunch of websites, I've noticed 2 common methods of displaying error messages. 1. display an error box on a new page and force the user to hit the back button 2. display the form again with appropriate error text and pre-filled fields. I have part of the error on the new page working but I'm running into the infamous no contents in the form after going back. There are some useability issues with forcing the user to hit the back button -- some just don't want to bother. Is there a way to display the form w/original contents and error messages 'without' having to code the entire form twice? I have about 5 forms with 50 fields or so each. What would be the best way to go about redrawing the form with the errors shown beside each field? Any suggestions are greatly appreciated. __ Jason Dulberg Extreme MTB http://extreme.nas.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] permision denied when reading directory contents on fat32
On Monday 25 February 2002 16:02, narko wrote: when i do directory listing with readfile('c:\some\dir\name') warning is generated Warning: readfile(c:\temp\) - Permission denied in c:\programming\apache\htdocs\downloads\update.php on line 15 filesystem is fat32 so permissions are fake configuration: php 406 on windows2000 is there any way to do directory listing with php Try using forward slashes or double backslashes -- m: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem about Reading input from a Form
-Original Message- From: Kostas Karadamoglou [mailto:[EMAIL PROTECTED]] Sent: 25 February 2002 14:09 I put and the POST method but I have the same problem I don't know why, any ideas? Thank you -Original Message- From: Kostas Karadamoglou [mailto:[EMAIL PROTECTED]] Sent: Monday, February 25, 2002 12:58 PM I can't take the variables $user and $address from the form to the php file. Which version of PHP? Is register_globals set to Off? If it is, you can either turn it On (if you have control of the server), or (better!) use the $HTTP_POST_VARS (4.0) or $_POST (4.1) array. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] TEST-mail to list - no content - pls. ignore.
Just testing :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem about Reading input from a Form
I set the register_globals On in the php.ini file but when i do php.info it shows that is off.About the better way, How i can manipulate this variables, can you give me an exable. Thank you From: Ford, Mike [LSS] [EMAIL PROTECTED] To: 'Kostas Karadamoglou' [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: [PHP] Problem about Reading input from a Form Date: Mon, 25 Feb 2002 14:30:09 - -Original Message- From: Kostas Karadamoglou [mailto:[EMAIL PROTECTED]] Sent: 25 February 2002 14:09 I put and the POST method but I have the same problem I don't know why, any ideas? Thank you -Original Message- From: Kostas Karadamoglou [mailto:[EMAIL PROTECTED]] Sent: Monday, February 25, 2002 12:58 PM I can't take the variables $user and $address from the form to the php file. Which version of PHP? Is register_globals set to Off? If it is, you can either turn it On (if you have control of the server), or (better!) use the $HTTP_POST_VARS (4.0) or $_POST (4.1) array. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Return values?
Hi, how do i display return values from functions? Ie i want to see whether mail() returns TRUE or FALSE. - D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Return values?
[EMAIL PROTECTED] (Daniel alsén) wrote: Hi, how do i display return values from functions? Ie i want to see whether mail() returns TRUE or FALSE. echo mail(...); shows the return value, then you can do: if (mail(...)) { //sent ok } else { //not sent } -- Henrik Hansen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] using a mysql temporary table.
Hello, I'm trying to use a temporary table in mySQL with PHP. First I tried to create a temporary table and then query it in the same script. But the table didn't persist to the second query in the PHP script. I found this knowledge base entry: http://www.faqts.com/knowledge_base/view.phtml/aid/445 Where it shows to do all the querying in one swoop. The problem I'm having now is that PHP is throwing an error at the first semi-colon. It appears that it doesn't want to run multiple query statements in 1 query function. I'm using the mySQL pear class in my application, I wouldn't think that it would have any effect on the problem. Here is an example of the query I'm attempting. CREATE TEMPORARY TABLE tmp_events SELECT event_id, event_title FROM events; INSERT INTO tmp_events SELECT event_id, event_title FROM special_events; SELECT event_id, event_title FROM tmp_events ORDER BY event_title; But I get an error like: 1064: You have an error in your SQL syntax near '; INSERT INTO tmp_events' If I echo my SQL statement and paste it into mySQL the query works fine. Any suggestions that you can offer would be great. -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] accessing flash files using php
if you have a access to the action-script within the Flash-movie, write there a script like: gotoandplay(_root.myframe); and let the HTML-path be something like: myFlashMovie.swf?myframe=20 Regards, Sumarlidi Einar Dadason SED - Graphic Design -- Tel.4615501 GSM 8960376 E-mail [EMAIL PROTECTED] Website:www.sed.is -- -Original Message- From: John Day [mailto:[EMAIL PROTECTED]] Sent: 25. febrúar 2002 15:36 To: SED Subject: RE: [PHP] accessing flash files using php Yep, specifically going to a certain frame within the movie -Original Message- From: SED [mailto:[EMAIL PROTECTED]] Sent: Monday, February 25, 2002 3:27 PM To: John Day Subject: RE: [PHP] accessing flash files using php Do you mean like gotoandplay() or editing something in some frame? -Original Message- From: John Day [mailto:[EMAIL PROTECTED]] Sent: 25. febrúar 2002 11:41 To: Php-General (E-mail) Subject: [PHP] accessing flash files using php Hi Is it possible to access a flash movie and then go to a certain frame within that movie. I know that you can create flash files and then use all manner of flash related functions, but I want to access an already existing movie. Cheers JD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] creating dropdown lists from fetched arrays.
El dom, 24-02-2002 a las 17:39, Matthew Darcy escribió: Hi, I want to create a dropdown list with options from a table. ie HTML BODY ?php $sql_select = select * from dropdown_options; $results = mysql_query($sql_select); while ($row = mysql_fetch_array($results); { echo option VALUE=$row[col1] NAME=option1 } /BODY /HMTL I know this is basic but it is to give you an idea of what I want. I have tried to find an example of this in the book I am using to learn to no result. I am guessing this is how it works from the info I have read from the book. Can someone put me on the right path. Thanks, Matt. With that semi-colon at the end of the while you are doing an empty loop... so when the script gets to the option... stuff... the array is empty. I would do something like this: HTML BODY select name=myOptions ?php $sql_select = select * from dropdown_options; $results = mysql_query($sql_select); while ($row = mysql_fetch_array($results){ ? option value=? print $row[id] ?? print $row[name] ?/option ? } ? /select /BODY /HMTL _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem about Reading input from a Form
Its not a register_globals issue. You must wrap $user and $address in php print statements rather than just in the html. Your name is ?= $name ?. Your address is ?= $address ?. That will work with either GET or POST. -- Stewart On Mon, 25 Feb 2002, Kostas Karadamoglou wrote: I set the register_globals On in the php.ini file but when i do php.info it shows that is off.About the better way, How i can manipulate this variables, can you give me an exable. Thank you From: Ford, Mike [LSS] [EMAIL PROTECTED] To: 'Kostas Karadamoglou' [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: [PHP] Problem about Reading input from a Form Date: Mon, 25 Feb 2002 14:30:09 - -Original Message- From: Kostas Karadamoglou [mailto:[EMAIL PROTECTED]] Sent: 25 February 2002 14:09 I put and the POST method but I have the same problem I don't know why, any ideas? Thank you -Original Message- From: Kostas Karadamoglou [mailto:[EMAIL PROTECTED]] Sent: Monday, February 25, 2002 12:58 PM I can't take the variables $user and $address from the form to the php file. Which version of PHP? Is register_globals set to Off? If it is, you can either turn it On (if you have control of the server), or (better!) use the $HTTP_POST_VARS (4.0) or $_POST (4.1) array. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] using a mysql temporary table.
Good day, I would have to dig around to find the appropriate note in the documentation, however I seem to recall reading that PHP's MySQL wrappers intentially prohibit a user from using semicolons- basically to prevent one's database from being hacked due to a poorly constructed query using user input. I can't immediately find a reference to this, though. As a workaround, you could execute two separate queries and store all of the results in a 2-D array in memory. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Jeff Bearer [mailto:[EMAIL PROTECTED]] Sent: Monday, February 25, 2002 8:34 AM To: [EMAIL PROTECTED] Subject: [PHP] using a mysql temporary table. Hello, I'm trying to use a temporary table in mySQL with PHP. First I tried to create a temporary table and then query it in the same script. But the table didn't persist to the second query in the PHP script. I found this knowledge base entry: http://www.faqts.com/knowledge_base/view.phtml/aid/445 Where it shows to do all the querying in one swoop. The problem I'm having now is that PHP is throwing an error at the first semi-colon. It appears that it doesn't want to run multiple query statements in 1 query function. I'm using the mySQL pear class in my application, I wouldn't think that it would have any effect on the problem. Here is an example of the query I'm attempting. CREATE TEMPORARY TABLE tmp_events SELECT event_id, event_title FROM events; INSERT INTO tmp_events SELECT event_id, event_title FROM special_events; SELECT event_id, event_title FROM tmp_events ORDER BY event_title; But I get an error like: 1064: You have an error in your SQL syntax near '; INSERT INTO tmp_events' If I echo my SQL statement and paste it into mySQL the query works fine. Any suggestions that you can offer would be great. -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- 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] Problem about Reading input from a Form
-Original Message- From: Kostas Karadamoglou [mailto:[EMAIL PROTECTED]] Sent: 25 February 2002 14:35 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP] Problem about Reading input from a Form I set the register_globals On in the php.ini file but when i do php.info it shows that is off. Did you restart PHP after changing php.ini? About the better way, How i can manipulate this variables, can you give me an exable. Simple: instead of $user and $address, use: * in PHP 4.0: $HTTP_POST_VARS['user'] and $HTTP_POST_VARS['address'] * in PHP 4.1: $_POST['user'] and $_POST['address'] For more information, refer to http://www.php.net/manual/en/language.variables.external.php (which doesn't actually mention the $_* variables), and http://www.php.net/manual/en/language.variables.predefined.php (scroll waaay down until you reach the heading PHP variables). Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] creating dropdown lists from fetched arrays.
while ($row = mysql_fetch_array($results){ ITYM while ($row = mysql_fetch_array ($results)) { Cheers Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] bouncy mail();
hi folks, if i set the return-path of a email to be [EMAIL PROTECTED], will bounced be returned here? thanks! dk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: form submission error trapping
You do not need to use javascript. Simple create a form that submits to itself. And check the values, then reprint the form or redirect. Example: ?php if ($REQUEST_METHOD == POST) { $required = array (surname, age); $err_msg = ; while (list ($key) = each ($required)) { if (!$HTTP_POST_VARS[$key]) { $err_msg .= Please enter a value for $keybr\n; } } if (!empty($err_msg)) print $err_msg; } ? form action=?= $PHP_SELF ? method=POST input type=text name=surname value=?= $surname ?br input type=text name=age value=?= $age ? input type=submit name=Submit /form Hope that helps, -- Stewart On Mon, 18 Feb 2002, George Whiffen wrote: Jason, You didn't mention Javascript checks. Personally I really dislike having to wati for a page to reload before finding out that I've just failed to fill in a field. The Javascript to do basic on-page checks is all pretty simple stuff. Of course this doesn't mean we can skip checking the data again in the php! Javascript might be switched off, we might have a bug in the Javascript (easy to do), or we (or someone else) might want to simulate form entry via a url link. It's also quite likely that there may be checks e.g. checks for duplicate entries, which cannot be done on a form. Here's some skeleton code that handles a basic form with both php and javascript checks, (I've deliberately tried to keep the php/Javascript as similar as possible). You can try it at http://www.whiffen.net/simple.php if you want. *** simple.php*** SCRIPT LANGUAGE=php if (isset($surname)) { $errormessage = ; if ($surname == ) { $errormessage = $errormessage . brYou must enter a value for surname; } if ($age = 0 or $age != floor($age)) { $errormessage = $errormessage . brAge must be a whole number; } if ($errormessage == ) { // do whatever you have to with the data and maybe finish with // a redirect to a success page } } print ' HTML HEAD SCRIPT LANGUAGE=javascript function check() { var message = ; if (document.myform.surname.value == ) { message = message+\nYou must enter a value for surname; } if (document.myform.age.value != parseInt(document.myform.age.value)) { message = message+\nAge must be a whole number; } if (message != ) { alert(You have the following errors to correct:+message); return false; } else { return true; } } /SCRIPT /HEAD BODY H1MY FORM/H1 FORM name=myform method=post onSubmit=return check(); '; if ($errormessage != ) { print 'You have the following errors to correct'.$errormessage.'BR'; } print ' Surname: INPUT TYPE=TEXT NAME=surname VALUE='.$surname.' BR Age: INPUT TYPE=TEXT NAME=age VALUE='.$age.' BR INPUT TYPE=SUBMIT BR A HREF='.$SCRIPT_NAME.'sSource/A /FORM /BODY /HTML '; /SCRIPT You'll see that http://www.whiffen.net/simple.php?surname=whiffenage=23.2 works perfectly well too. Personally, I'm not a huge fan of Javascript. It always seems to be much more trouble than php for some reason, but it has its place, (as long as you never rely on it!). George Jason Dulberg wrote: I am working on some error trapping for several forms on my site. After visiting a bunch of websites, I've noticed 2 common methods of displaying error messages. 1. display an error box on a new page and force the user to hit the back button 2. display the form again with appropriate error text and pre-filled fields. I have part of the error on the new page working but I'm running into the infamous no contents in the form after going back. There are some useability issues with forcing the user to hit the back button -- some just don't want to bother. Is there a way to display the form w/original contents and error messages 'without' having to code the entire form twice? I have about 5 forms with 50 fields or so each. What would be the best way to go about redrawing the form with the errors shown beside each field? Any suggestions are greatly appreciated. __ Jason Dulberg Extreme MTB http://extreme.nas.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] register_shutdown_function
hi, when i use register_shutdown_function in an included or required script, will the function be called after the processing of the included / required script, or after all scripts? i think they are called last, but i'm not sure ... does anyone know? + stefan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: php email question
Terry: I forwarded this to php-general list. Perhaps they can answer your question -Original Message- From: Terry Romine [mailto:[EMAIL PROTECTED]] Sent: Monday, February 25, 2002 10:01 AM To: Subject: php email question I am trying to set up a MIME email that would include an HTML and Plain Text version of content, such that if the recipient's email client did not understand html or have html disabled, that the content would come through as plain text, but if html were accepted, the plain text would be ignored so that it did not show as duplication. What I have currently works good for the html but the plain text shows up as well. The mail class is from PROFESSIONAL PHP PROGRAMMING. Snippet of code is: include(include/plain.inc); // the plain text version -- returns $body include(include/format.inc); // html version -- returns $data $subject = ; $to = [EMAIL PROTECTED]; $from = adfarm; // create an instance $mail = new mime_mail; $mail-from = $from; $mail-to = $to; $mail-subject = $subject; $mail-body = ; $content_type=text/html; charset=us-ascii; $mail-add_attachment($data, , $content_type); $content_type=text/plain; $mail-add_attachment($body, , $content_type); $mail-send(); echo(h2Newsletter has been sent./h2); Thanks in advance. Terry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Delete checked files
Hi everybody, I show a list of files that I upload to the user's folder using the next code: $path= ../clients/$user; $dir = opendir ($root); while ($archivo = readdir ($dir)) { $size = filesize($path/$filename); $size = ($size/1024); $size = intval($size * 100 ) / 100; if ($filename!= . $filename!=..) { echo trtda href='$path/$filename'$filename/a/tdtd$size Kb/td/tr; } } I want to add a checkbox in every file i get in the user's folder. My question is: Is there any way to use some kind of function to delete selected files? I am not sure if i can use javascript to evaluate which is checked and how. And after that evaluation, how to call a unlink ($filename) to delete the files. Any help would be greatly appreciated. Nau -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem about Reading input from a Form
OK, Im an idiot, glad I caught myself before someone else did. I didnt see the PHP print statments. :) Follow mikes advice on the register globals, and restarting the server. Or try using $HTTP_POST_VARS['user'] or $_POST['user']. -- Stewart On Mon, 25 Feb 2002, Stewart G. wrote: Its not a register_globals issue. You must wrap $user and $address in php print statements rather than just in the html. Your name is ?= $name ?. Your address is ?= $address ?. That will work with either GET or POST. -- Stewart On Mon, 25 Feb 2002, Kostas Karadamoglou wrote: I set the register_globals On in the php.ini file but when i do php.info it shows that is off.About the better way, How i can manipulate this variables, can you give me an exable. Thank you From: Ford, Mike [LSS] [EMAIL PROTECTED] To: 'Kostas Karadamoglou' [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: [PHP] Problem about Reading input from a Form Date: Mon, 25 Feb 2002 14:30:09 - -Original Message- From: Kostas Karadamoglou [mailto:[EMAIL PROTECTED]] Sent: 25 February 2002 14:09 I put and the POST method but I have the same problem I don't know why, any ideas? Thank you -Original Message- From: Kostas Karadamoglou [mailto:[EMAIL PROTECTED]] Sent: Monday, February 25, 2002 12:58 PM I can't take the variables $user and $address from the form to the php file. Which version of PHP? Is register_globals set to Off? If it is, you can either turn it On (if you have control of the server), or (better!) use the $HTTP_POST_VARS (4.0) or $_POST (4.1) array. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Frames?
You have to pass the params received in index.php to the rest of the pages in the frames... eg: http://mysite.com/index.php?s=1 so, the index.php script will looks something like this: frameset cols=* rows=25%,* border=1 frameborder=1 frame src=head.php? print ?s=$s ? name=menu; frame src=body.php? print ?s=$s ? name=main; frame src=foot.php? print ?s=$s ? name=foot; /frameset William. El lun, 25-02-2002 a las 03:03, Jason Caldwell escribió: I'm trying to pass vars into a php (html) file that uses FRAMES -- top, main and bottom. The TOP frame has my menu items. The MAIN frame will show the pages, and the BOTTOM frame will have my footer stuff -- Now, when I click on a menu item in the TOP frame I want the TOP and MAIN frames to update. My frame page is named: index.php and it links to head.php (goes in TOP frame), body.php (goes in MAIN frame), and footer.php (goes in BOTTOM frame.) So, what I tried (seems logical enough) is to simply call the INDEX.PHP file with some vars attached, like so a href=http://127.0.0.1/index.php?s=1 target=_topLoad Page/a Within the Index.php Frames Page (which the var gets passed to) the other pages don't seem to recognize the var and simply do nothing -- For example -- in the head.php file I have it update an image if s=1, and in the body.php file, if s=1 a certain page loads -- this all works fine without frames. Any suggestions -- I want to use frames if I can, and avoid Java. Thanks. Jason _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using a mysql temporary table.
DOH, I always figure it out after I post to the mailing list, the user didn't have create table privileges, that's why it didn't persist in my first attempt to do this with separate queries. On Mon, 2002-02-25 at 10:34, Jeff Bearer wrote: Hello, I'm trying to use a temporary table in mySQL with PHP. First I tried to create a temporary table and then query it in the same script. But the table didn't persist to the second query in the PHP script. I found this knowledge base entry: http://www.faqts.com/knowledge_base/view.phtml/aid/445 Where it shows to do all the querying in one swoop. The problem I'm having now is that PHP is throwing an error at the first semi-colon. It appears that it doesn't want to run multiple query statements in 1 query function. I'm using the mySQL pear class in my application, I wouldn't think that it would have any effect on the problem. Here is an example of the query I'm attempting. CREATE TEMPORARY TABLE tmp_events SELECT event_id, event_title FROM events; INSERT INTO tmp_events SELECT event_id, event_title FROM special_events; SELECT event_id, event_title FROM tmp_events ORDER BY event_title; But I get an error like: 1064: You have an error in your SQL syntax near '; INSERT INTO tmp_events' If I echo my SQL statement and paste it into mySQL the query works fine. Any suggestions that you can offer would be great. -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Has anyone created or called a Web Service from PHP? (SOAP)
Yeah, From php, I've called paybox (http://www.paybox.de), which is a mobile phone based payment service. You exchange transactions with them via xml. They have their own cartridge for php, but it's just a perl rewrite and not very wonderful, so I rewrote most of it. The basic approach is simply to open a socket to the service, send out your xml, and/or listen for xml from them. To parse the xml, you could try one of the php xml parsers, or if they are simple, known, messages, you could just parse them yourself with a few regular expressions see ereg. If you want to write an xml server, php may not be your best bet although I guess it could be done. The problem with the server is all about multi-threading so you don't force everyone to queue on the port while you're processing each request. I've done something similar with tcl using a simple looping stub that listened on the port and passed off requests to sub-processes asynchronously But if you only need to call, then the functions you need are: fsockopen(), fputs(), fgets(), fclose() You might also want to tweak with socket_set_blocking, socket_set_timeout and socket_get_status The manual is quite good on all these nowadays, start with http://www.php.net/manual/en/function.fsockopen.php If this is communication with an xml server to execute a payment, (as with Paybox), you have to design your transactions carefully if you want to avoid all the problems of duplicate payments, interrupted payments, user cancels, web server goes down in the middle of a transaction, php bombs out, their xml server goes down in the middle of a transaction etc. If you get this wrong, you WILL end up with discrepancies between your record of transactions and your payment providers sooner or later. The good news is that you can make it very robust with php, and with a lot less work than if you had to use Java, C or some similar language. The main tricks are:- a) Make your communication with the xml server a 2-phase commit, so if either of you goes down mid-way, the other one knows and can rewind. b) Record your own version of the transaction in a database and use that to check for duplicates, user cancel requests, timeouts etc. c) Put up a holding page with an auto-submit to tell the user you've started and give them an option to cancel explicitly in case they see problems. In Paybox's case the user was involved in the payment authorisation loop via their mobile phone, so this was essential. If you do this you can safely wrap your code in an ignore_user_abort to give extra protection, while still giving the user a sensible message and their own option to cancel if they feel they are waiting too long. d) Make your sql transaction updates atomic i.e. when marking your transaction as valid include a where clause on the update to make sure it has the expected status and hasn't for example, already been processed from another browser window. That way even if your database doesn't support transactions, provided the database server at least locks a row during update, you'll be safe from transactions switching back to cancelled after they've actually been completed (and vice-versa). The key point is that you can do just as secure and safe a job of commercial-grade transaction processing with the likes of php/mysql etc., as with the hard-core geek tools, provided you get the design right. You have a very good channce of doing a much better job, since you don't have to waste so much time on all their geekery. George Eric wrote: I have a PHP webstore that I want to call my web service that is running on an IIS machine. The web service returns XML. Has anyone called or written a web service with PHP? TIA Eric -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Q: sessions in a switch block not working
Hello, I'm hoping to get some help with a sessions problem i've ran into. track_vars is enabled and register_globals is off. i'm using PHP 4.0.6 and custom session handlers with ADODB connecting to mysql. at the top: session_start(); if (!isset($HTTP_SESSION_VARS[old_folder])) { echo NOT SETbr\n; $HTTP_SESSION_VARS[old_folder] = 1;; } else { echo IT IS SET: {$HTTP_SESSION_VARS[old_folder]}br\n; } - in the middle of a switch statement: $nasty_folder = $HTTP_GET_VARS[folder]; $HTTP_SESSION_VARS[old_folder] = $HTTP_SESSION_VARS[old_folder] + 444; if (isset($HTTP_SESSION_VARS[old_folder])) { echo ADDED 444: {$HTTP_SESSION_VARS[old_folder]}br\n; } else { echo FAILED TO ADDBR\n; } --- first time through it prints NOT SET. second time, without finding my way into the switch it prints IT IS SET: 1. third time, before going into the case with + 444, it prints IT IS SET: 1, then i make it into the case and promptly prints ADDED 444: 445 as the next line. fourth time, i would expect IT IS SET: 445 without worrying about where i wonder in the switch. can anyone tell me why this isn't working? i do have many lines of code in between but, none deals with HTTP_SESSION_VARS. the only other use i'm making of sessions is setting $uID = $HTTP_SESSION_VARS[uID] well before the switch statement. $HTTP_SESSION_VARS[uID] gets set many pages and other PHP scripts before and i just reuse it (as sessions were intended). any help would be greatly appreciated. thanks, joe -- How do i get rid of those words in my screen that are coming from you? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using sessions
i'm having some trouble using sessions. first of all i have to use php 4.0.6. When i use $HTTP_SESSION_VARS, the session variable isn't being saved. for example: if(!isset($HTTP_SESSION_VARS['id'])){ $HTTP_SESSION_VARS['id'] = 0; } else{ $HTTP_SESSION_VARS['id']++; } echo $HTTP_SESSION_VARS['id']; every time i refresh the browser it returns 0. i have version 4.1.6(i tink. it's the last one)at home and it works fine. but if i use the session_register it all works ok. i've tried to use global $HTTP_SESSION_VARS but nothing changed. could someone help thanks Joel Alexandre Lisboa Portugal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Delete checked files
make a form, one delete-button and put a checkbox before every file. the checkbox's name is 'delete_file['.$filename.']' ... wehen pressed delete open a file which foreach's every entry in delete_file and unlink it. but be careful - this could be a huge security-hole ... + stefan Nautilis [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi everybody, I show a list of files that I upload to the user's folder using the next code: $path= ../clients/$user; $dir = opendir ($root); while ($archivo = readdir ($dir)) { $size = filesize($path/$filename); $size = ($size/1024); $size = intval($size * 100 ) / 100; if ($filename!= . $filename!=..) { echo trtda href='$path/$filename'$filename/a/tdtd$size Kb/td/tr; } } I want to add a checkbox in every file i get in the user's folder. My question is: Is there any way to use some kind of function to delete selected files? I am not sure if i can use javascript to evaluate which is checked and how. And after that evaluation, how to call a unlink ($filename) to delete the files. Any help would be greatly appreciated. Nau -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] get out of frameset?
Hi! I have build a webshop inside a framset using sessions, and move around in my mainframe. I wonder how to get out of the mainframe when I logg out and destroy the session. It doesen´t work with: Header(Location: /naba/logout.php?.SID.); Can I use target or something with Location? Thanks in advance. -- Regards, Jan Grafström Bredsäter 2091 87010 Älandsbro Sweden -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] images with GD
I have been playing around with creating images in php using GD, and I have some questions for the list. How much more processing power does it take to create an image versus just sending the image? Aside from photo album type apps, how are people using GD? Is GD well suited for navigational images? Where are some tuts/resources about GD (I have read the stuff and php.net, zend, and phpbuilder)? Thanks. .jaxn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] get out of frameset?
try this: a href=logout.php target=_topLog out/a or a href=logout.php target=_parentLog out/a William El lun, 25-02-2002 a las 12:00, Jan Grafström escribió: Hi! I have build a webshop inside a framset using sessions, and move around in my mainframe. I wonder how to get out of the mainframe when I logg out and destroy the session. It doesen´t work with: Header(Location: /naba/logout.php?.SID.); Can I use target or something with Location? Thanks in advance. -- Regards, Jan Grafström _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] bouncy mail();
if i set the return-path of a email to be [EMAIL PROTECTED], will bounced be returned here? You may want to investigate the Errors-To header as well (although you never know your luck - have you tried it?) Cheers Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] bouncy mail();
hi.. setting a fifth parameter with (-f ) works.. eg. mail($send_email,$subject,$body,$headers,[EMAIL PROTECTED]); thanks! - Original Message - From: Jon Haworth [EMAIL PROTECTED] Newsgroups: php.general To: 'DigitalKoala' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, February 25, 2002 5:06 PM Subject: RE: [PHP] bouncy mail(); if i set the return-path of a email to be mailto:[EMAIL PROTECTED], will bounced be returned here? You may want to investigate the Errors-To header as well (although you never know your luck - have you tried it?) Cheers Jon _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] multilanguage support
Hi, On our site, we have page with a form a user puts his/her information such as company name, givenname, etc. Currently, if a name entered is anything but English characters, PhP fails. For example, if I enter Norwegian characters lsløæ PhP returns the following errors: Last name field must contain a valid last name etc. Does anyone know how can I make my PhP code ISO-8859-1 compliant? Thank you in advance, Leon --- Leon Zilber HP Internet Operation RD Lab phone: 973.443.78.82 email: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Creating a installer...
Just curious to know if someone already has a approach on that... Are there any experiences on a installer for php projects? Sascha Ragtschaa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why Remember Session ??
BlankHI, i have a problem, When i close the browser the session is NOT killed, when i enter the page that requires login i can enter the page that was previosly entered via login (but i closed it). So it remembers session or cookies i don't know. How to prevent this, How to kill the session when i close the browser In php.ini session.cookie_lifetime is set to 0 and session.cache_expire is set to 180 can somebody help me please Beta -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] getting the URL of a parent frame
Hello! How can i get the url of the main page with a script, that is running in a frame of that page? Thanks, Klaus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using sessions
Just a guess but would using session_register(myvar); instead of registering directly to the global list make any difference? -Original Message- From: Joel Alexandre [mailto:[EMAIL PROTECTED]] Sent: Monday, February 25, 2002 9:39 AM To: Lista de PHP Subject: [PHP] Using sessions i'm having some trouble using sessions. first of all i have to use php 4.0.6. When i use $HTTP_SESSION_VARS, the session variable isn't being saved. for example: if(!isset($HTTP_SESSION_VARS['id'])){ $HTTP_SESSION_VARS['id'] = 0; } else{ $HTTP_SESSION_VARS['id']++; } echo $HTTP_SESSION_VARS['id']; every time i refresh the browser it returns 0. i have version 4.1.6(i tink. it's the last one)at home and it works fine. but if i use the session_register it all works ok. i've tried to use global $HTTP_SESSION_VARS but nothing changed. could someone help thanks Joel Alexandre Lisboa Portugal -- 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] Fetching the values from previous page
Hi all, I have a page that post a lot of variables to the next page. It looks like: form action=next_page.php input type=text name=f_text1 input type=text name=f_text2 select name=f_multiple1[] multiple size=6 option value=1one option value=2two option value=3three /select input type=submit /form On next.php I can access all the values through: $f_text1, $f_text2, and an array $f_multiple1. My question is, how can I pack all of these variables from previous page _without_knowing_ the variables name? I mean, I know I can write: $array = array(text1 = $f_text1, text2 = $f_text2, multiple1 = array($multiple1)); But that is not what I want, it is more like: GetAllFromPrevious(); or in Perl: %params = $q-Vars; And poof, all the values from previous will be inserted into an array. Thanks, --bk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] writing files with php
Try: SITE CHMOD 666 filename Also be sure that the file name in PHP matches the exact file name on disk. Steven J. Walker Walker Effects www.walkereffects.com [EMAIL PROTECTED] On Monday, February 25, 2002, at 12:36 AM, Sven Jacobs wrote: Hey How can I create files with php, I've tried somethings but php always tells me that I don't have access. But the Directory has 777 access and the owner is my webserver. Can somebody help me :-) I need this for to create logfiles Greetings Sven
[PHP] Option for Serial or Comm port communication with PHP?
Hi everyone, I was hoping to work on a hairbrained idea that would allow me to use php to control an X10 or other serial device (security system, irrigation controller, etc,). I have read several hints at using the fopen function to do serial communications but these posts were a year old. Is it possbile to do serial communications using php. What are the options? Thanks in advance for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fetching the values from previous page
Dear Batara, There are global variables that serve this purpose. You must have register_globals turned on: http://www.php.net/manual/en/language.variables.predefined.php $_POST An associative array of variables passed to the current script via the HTTP POST method. Automatically global in any scope. Introduced in PHP 4.1.0. I believe that you can also use getenv() if the register_globals is not on. Steven J. Walker Walker Effects www.walkereffects.com [EMAIL PROTECTED] On Monday, February 25, 2002, at 09:48 AM, Batara Kesuma wrote: Hi all, I have a page that post a lot of variables to the next page. It looks like: form action=next_page.php input type=text name=f_text1 input type=text name=f_text2 select name=f_multiple1[] multiple size=6 option value=1one option value=2two option value=3three /select input type=submit /form On next.php I can access all the values through: $f_text1, $f_text2, and an array $f_multiple1. My question is, how can I pack all of these variables from previous page _without_knowing_ the variables name? I mean, I know I can write: $array = array(text1 = $f_text1, text2 = $f_text2, multiple1 = array($multiple1)); But that is not what I want, it is more like: GetAllFromPrevious(); or in Perl: %params = $q-Vars; And poof, all the values from previous will be inserted into an array. Thanks, --bk -- 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] HTML Email Has Random '!'
Thanks Martin, That was indeed the problem! I simply added a '\n' to the end of each line. And since html doesn't recognize it, it does no harm to the formatting. Steven J. Walker Walker Effects www.walkereffects.com [EMAIL PROTECTED] On Sunday, February 24, 2002, at 06:26 PM, Martin Towell wrote: it's to do with the length of a line - I think it's 1024 - if a lines longer than that, an ! is put there and a new line is made Martin -Original Message- From: Steven Walker [mailto:[EMAIL PROTECTED]] Sent: Monday, February 25, 2002 1:18 PM To: [EMAIL PROTECTED] Subject: [PHP] HTML Email Has Random '!' Hi, Has anybody every had problems with random characters showing up in HTML email messages? I've set up an auto-responding email system for product purchasing and registration. The system sends multipart HTML and plain text messages using mail(). However, exclamation points are showing up in random places. I have no idea where they come from... over and over I've looked at my source code but can't find any correlation. For example, here's a clip from an email message: Support: If you need any assistance, or would like to arrange another method of delivery, please conta! ct: And the code that generates this text looks like: $email_html .= /b/fontfont face=\Verdana, Arial, Helvetica, sans-serif\ size=\2\ color=\#33\; $email_html .= If you need any assistance, or would like to arrange another method ofbrdelivery, please contact:; $email_html .= /font/ppa href=\mailto:[EMAIL PROTECTED]\;; Sorry this is so hard to read... but the point is that the '!' is not in my code. When I make subtle changes to the code, the '!' shows up in other places. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: GD - dynamic PNG generation
Holy cow that's a big graphic. 20 seconds does sound a tad long, but might not be depending on the server and memory - what are the specs? What might possibly speed it up a bit is to create multiple small versions first (20 one line graphics, for example) and build them all together at the end by loading and copying into the final large area - this MIGHT cut down time a bit, because all the drawing operations would take place against a smaller memory area. Just a hunch though. Conor McTernan wrote: I'm currently using the GD extension to generate dynamic PNG's containing text, that should eventually be coming from a database. the deal is, it seems to take a long time, which is probably my own fault, seeing that I'm generating so much text. I am generating an image containing approx 160 lines of text, and it takes about 20seconds to create, this unfortunatley is too long for me. I was wondering if this is a common time with GD or if I am doing something wrong. Coding wise, I currently read the text in from a file, then put the text into an array, each line being a seperate entry in the array. I then create a PNG image approx 490*1848(i change the image size depending on the amount of text). I dont do anything really strange in my image function, apart from performing a wordwrap on the text before i start displaying it, just to make the image readable. ideally I would like this to come in considerably quicker. that said, if this is going to be used, it will probably done as a cron job, so if need be I will have toaccept it being super slow. any help is appreciated bros Conor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Forms
I have the following php code to asks for a new student to fill out a registration form. Using php, take what the user enters and put it into the students table. But when i select * from students in mysql, it didn't show, why? HTML BODY bgColor=#ff ?php if ($submit) { // process form $db = mysql_connect (localhost, root, mollier); $select=mysql_select_db (mydb); $sql = INSERT INTO students (student_id, firstname,lastname, address) VALUES ('$student_id', '$firstname', '$lastname', '$address'); $result = mysql_query($sql); echo Thank you! Information entered.\n; } else{ // display form ? FORM onsubmit=return formvalidation(this) action=?php echo $PHP_SELF? method=postINPUT type=hidden value=New Student Registration - BBS name=FORM_NAME P style=LINE-HEIGHT: 100%; BACKGROUND-COLOR: #ff align=centerBFONT color=#ff size=5BRREGISTRATION FORMBRBR/FONT/B/P PREB FONT color=#ffREQUIRED QUESTIONS:/FONT/B BR 1. What is your student id number?nbsp;INPUT tabIndex=2 maxLength=46 size=46 name=student_idBR 2. What is your name?BR First name:input type=Text name=firstnamebr Last name:input type=Text name=lastnamebr Address: input type=Text name=address size=60BR /PRE UL LI P style=BACKGROUND-COLOR: #fffont color=#FF3300Please click the Submit Button only once/font /P LI P style=BACKGROUND-COLOR: #fffont color=#FF3300Then wait for your confirmation screen/font /P LI P style=BACKGROUND-COLOR: #fffont color=#FF3300Save the confirmation screen because it has information you will need/font /P /LI/UL P style=BACKGROUND-COLOR: #ffINPUT type=submit value=Submit Registrationnbsp;/P P style=BACKGROUND-COLOR: #ff align=centerEnd of Form-Thank You!/P/FORM HR H5 style=BACKGROUND-COLOR: #ff /H5 ?php } // end if ? /BODY/HTML
Re: [PHP] Re: GD - dynamic PNG generation
hmm, sounds like a good idea, i'll give it a try. it seems too, that if i dont break up my text, i.e. print all of it in one long line, it runs a lot faster i'm running this under Win2k, i got a PIII i dunno how many mhz(it's a college PC, and everything is locked down on me) but i'd guess at 800mhz or something like that. i think i'm also running about 256mb or ram. so my specs are pretty good, i would imagine. i'll look into the multiple images soloution. cheers i'll get back to y'all with my results. Conor On Mon, Feb 25, 2002 at 01:21:42PM -0500, Michael Kimsal wrote: Holy cow that's a big graphic. 20 seconds does sound a tad long, but might not be depending on the server and memory - what are the specs? What might possibly speed it up a bit is to create multiple small versions first (20 one line graphics, for example) and build them all together at the end by loading and copying into the final large area - this MIGHT cut down time a bit, because all the drawing operations would take place against a smaller memory area. Just a hunch though. Conor McTernan wrote: I'm currently using the GD extension to generate dynamic PNG's containing text, that should eventually be coming from a database. the deal is, it seems to take a long time, which is probably my own fault, seeing that I'm generating so much text. I am generating an image containing approx 160 lines of text, and it takes about 20seconds to create, this unfortunatley is too long for me. I was wondering if this is a common time with GD or if I am doing something wrong. Coding wise, I currently read the text in from a file, then put the text into an array, each line being a seperate entry in the array. I then create a PNG image approx 490*1848(i change the image size depending on the amount of text). I dont do anything really strange in my image function, apart from performing a wordwrap on the text before i start displaying it, just to make the image readable. ideally I would like this to come in considerably quicker. that said, if this is going to be used, it will probably done as a cron job, so if need be I will have toaccept it being super slow. any help is appreciated bros Conor -- 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] Fetching the values from previous page
On Mon, 25 Feb 2002 10:04:07 -0800 Steven Walker [EMAIL PROTECTED] wrote: Dear Batara, There are global variables that serve this purpose. You must have register_globals turned on: http://www.php.net/manual/en/language.variables.predefined.php $_POST An associative array of variables passed to the current script via the HTTP POST method. Automatically global in any scope. Introduced in PHP 4.1.0. Steven, Thank you for the URL, since I am on 4.0.6 I think I will use: $HTTP_POST_VARS An associative array of variables passed to the current script via the HTTP POST method. $HTTP_GET_VARS An associative array of variables passed to the current script via the HTTP GET method. --bk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php - assigning date variables
$query = mysql_query(SELECT * FROM table WHERE date LIKE '%. $query .%'); // returns all items in database $query = 2001-01-01 mysql_query(SELECT * FROM table WHERE date LIKE '%. $query .%'); // returns all rows that have 2001-01-01 as the date What is proper way to define a variable to include all dates newer than 1995-01-01? $query = ??? What is proper way to define a variable to include all dates older than 1995-01-01? $query = ??? What is proper way to define a variable to include all dates between 1995-01-01 and 1998-12-31? $query = ??? Everything I tried gives me a error. This has to be simple, but I must be overlooking something. Where would I find the answer? Thanks Craig [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] magic_quotes_gpc
Hi, Is it possible to activate magic_quotes_gpc on a server running PHP 3.0.16 without the php.ini settings being physically altered? I ask became my hosting company is hesitant to activate it for some unknown reason - however without it I cannot enter information into a database for a content management system I'm working on. Thanks -Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php - assigning date variables
Hi there :) 1. mysql_query(SELECT * FROM table WHERE date ='$mydate'); # where date is same 2. mysql_query(SELECT * FROM table WHERE date '$mydate'); # where date is newer 3. mysql_query(SELECT * FROM table WHERE date '$mydate'); # where date is older 4.mysql_query(SELECT * FROM table WHERE date BETWEEN '$myfirstdate' AND '$myseconddate'); # where date is between 2 dates Hope this helps, Joe :) Craig Westerman [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... $query = mysql_query(SELECT * FROM table WHERE date LIKE '%. $query .%'); // returns all items in database $query = 2001-01-01 mysql_query(SELECT * FROM table WHERE date LIKE '%. $query .%'); // returns all rows that have 2001-01-01 as the date What is proper way to define a variable to include all dates newer than 1995-01-01? $query = ??? What is proper way to define a variable to include all dates older than 1995-01-01? $query = ??? What is proper way to define a variable to include all dates between 1995-01-01 and 1998-12-31? $query = ??? Everything I tried gives me a error. This has to be simple, but I must be overlooking something. Where would I find the answer? Thanks Craig [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why Remember Session ??
Well, you have to destroy the session... see session_destroy() I never tried this, but you can call a PHP script on the onUnLoad event of the body page... so when the window is closed, it calls a given script and this script destroy the session. William. El lun, 25-02-2002 a las 12:29, Beta escribió: BlankHI, i have a problem, When i close the browser the session is NOT killed, when i enter the page that requires login i can enter the page that was previosly entered via login (but i closed it). So it remembers session or cookies i don't know. How to prevent this, How to kill the session when i close the browser In php.ini session.cookie_lifetime is set to 0 and session.cache_expire is set to 180 can somebody help me please Beta _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php, win32, xml bug?
hi, when im using xsl:output encoding=ISO-8859-1 i get Sablotron error on line 1: unknown encoding 'ISO-8859-1' in on line ... but i think iso-8859-1, utf-8, etc. support must be build in. in addition, when i try to include an external xsl with xsl:include href=... / or a xml file with document(), no matter what encoding the target-file has, i get the following error: Sablotron error on line 1: unknown encoding '' in on line ... yes, the position where the unknown encoding has to appear is empty, he says he does not know an unknown encoding ... how can i use the including functions, and how can i use iso-8859-1 as output encoding (the only workarround would be to convert the output encoding from utf-8 to iso-8859-1 with iconv, but this isnt the way i thought a xml-parser has to work ...) configuration: apache: Server Version: Apache/1.3.23 (Win32) PHP/4.1.1 DAV/1.0.3-dev Server Built: Jan 24 2002 20:30:48 server: Windows 2000 Server, SP2 2 GB RAM, dual-xeon 933 mhz php-info: System: Windows NT 5.0 build 2195 Build Date: Dec 30 2001 Thread Safety: enabled ZEND_DEBUG: enabled Configuration File (php.ini) Path: C:\WINNT\php.ini Virtual Directory Support: enabled This program makes use of the Zend Scripting Language Engine: Zend Engine v1.1.1, Copyright (c) 1998-2001 Zend Technologies with Zend Optimizer v1.2.0, Copyright (c) 1998-2001, by Zend Technologies XSLT support: enabled iconv support: enabled XML Support: active XML Namespace Support: active EXPAT Version: 1.95.2 ;Windows Extensions ;Note that MySQL and ODBC support is now built in, so no dll is needed for it. ; ;extension=php_bz2.dll ;extension=php_ctype.dll extension=php_cpdf.dll extension=php_curl.dll ;extension=php_cybercash.dll ;extension=php_db.dll ;extension=php_dba.dll ;extension=php_dbase.dll ;extension=php_dbx.dll extension=php_domxml.dll ;extension=php_dotnet.dll ;extension=php_exif.dll ;extension=php_fbsql.dll ;extension=php_fdf.dll ;extension=php_filepro.dll ;extension=php_gd.dll ;extension=php_gettext.dll ;extension=php_hyperwave.dll extension=php_iconv.dll ;extension=php_ifx.dll ;extension=php_iisfunc.dll ;extension=php_imap.dll ;extension=php_ingres.dll ;extension=php_interbase.dll ;extension=php_java.dll ;extension=php_ldap.dll ;extension=php_mbstring.dll ;extension=php_mcrypt.dll extension=php_mhash.dll extension=php_ming.dll ;extension=php_mssql.dll ;extension=php_oci8.dll ;extension=php_openssl.dll ;extension=php_oracle.dll extension=php_pdf.dll ;extension=php_pgsql.dll ;extension=php_printer.dll ;extension=php_sablot.dll ;extension=php_shmop.dll ;extension=php_snmp.dll extension=php_sockets.dll ;extension=php_sybase_ct.dll extension=php_xslt.dll ;extension=php_yaz.dll extension=php_zlib.dll thanks in advance alex __ alexander gräf [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: php - assigning date variables
Joe, I don't want to change the query itself like you show. I want to use this query $query = mysql_query(SELECT * FROM table WHERE date LIKE '%. $query .%'); and change only the variable $query = I use $query throughout script for other things. Thanks Craig [EMAIL PROTECTED] Hi there :) 1. mysql_query(SELECT * FROM table WHERE date ='$mydate'); # where date is same 2. mysql_query(SELECT * FROM table WHERE date '$mydate'); # where date is newer 3. mysql_query(SELECT * FROM table WHERE date '$mydate'); # where date is older 4.mysql_query(SELECT * FROM table WHERE date BETWEEN '$myfirstdate' AND '$myseconddate'); # where date is between 2 dates Hope this helps, Joe :) Craig Westerman [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... $query = mysql_query(SELECT * FROM table WHERE date LIKE '%. $query .%'); // returns all items in database $query = 2001-01-01 mysql_query(SELECT * FROM table WHERE date LIKE '%. $query .%'); // returns all rows that have 2001-01-01 as the date What is proper way to define a variable to include all dates newer than 1995-01-01? $query = ??? What is proper way to define a variable to include all dates older than 1995-01-01? $query = ??? What is proper way to define a variable to include all dates between 1995-01-01 and 1998-12-31? $query = ??? Everything I tried gives me a error. This has to be simple, but I must be overlooking something. Where would I find the answer? Thanks Craig [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Forms
On Tuesday 26 February 2002 02:31, Chiew, Richard wrote: I have the following php code to asks for a new student to fill out a registration form. Using php, take what the user enters and put it into the students table. But when i select * from students in mysql, it didn't show, why? HTML BODY bgColor=#ff ?php if ($submit) { // process form $db = mysql_connect (localhost, root, mollier); $select=mysql_select_db (mydb); $sql = INSERT INTO students (student_id, firstname,lastname, address) VALUES ('$student_id', '$firstname', '$lastname', '$address'); $result = mysql_query($sql); echo Thank you! Information entered.\n; Try adding some debug code. Look at the examples in the manual chapter MySQL functions. echo $sql to see what it contains. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* Your picture of the world often changes just before you get it into focus. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] when to use htmlspecialchars()
I was wondering if anyone could give me some advice in deciding the most appropriate time to use htmlspecialchars(): When user input is accepted and error-checked and ready to be inserted into the database? Or when user input is pulled from the database and ready to be displayed to the screen? It seems that running htmlspecialchars() BEFORE the data goes into the database is the safest way to do it, so that potentially malicious characters and tags never actually make it past the script. But upon thinking about the implications of this, it strikes me that this will affect the integrity of my data -- ideally, I want to keep the data as pristine as possible while it is in the database, since it might end up being parsed by something other than a browser someday, in which case it would be best to leave the data as is. I'm leaning toward the second method, but I want to make sure that doing so won't expose me to any risks that I haven't considered. Please give me your thoughts on this. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Forms
Your submit button does not have name=submit set. So $submit is never being set. Also your html is full of errors, I would clean that up and put it thru a validator, try html tidy (www.w3c.org). And, make sure that formvalidation() is passing true, is that fails the form will never be submitted. -- Stewart On Mon, 25 Feb 2002, Chiew, Richard wrote: I have the following php code to asks for a new student to fill out a registration form. Using php, take what the user enters and put it into the students table. But when i select * from students in mysql, it didn't show, why? HTML BODY bgColor=#ff ?php if ($submit) { // process form $db = mysql_connect (localhost, root, mollier); $select=mysql_select_db (mydb); $sql = INSERT INTO students (student_id, firstname,lastname, address) VALUES ('$student_id', '$firstname', '$lastname', '$address'); $result = mysql_query($sql); echo Thank you! Information entered.\n; } else{ // display form ? FORM onsubmit=return formvalidation(this) action=?php echo $PHP_SELF? method=postINPUT type=hidden value=New Student Registration - BBS name=FORM_NAME P style=LINE-HEIGHT: 100%; BACKGROUND-COLOR: #ff align=centerBFONT color=#ff size=5BRREGISTRATION FORMBRBR/FONT/B/P PREB FONT color=#ffREQUIRED QUESTIONS:/FONT/B BR 1. What is your student id number?nbsp;INPUT tabIndex=2 maxLength=46 size=46 name=student_idBR 2. What is your name?BR First name:input type=Text name=firstnamebr Last name:input type=Text name=lastnamebr Address: input type=Text name=address size=60BR /PRE UL LI P style=BACKGROUND-COLOR: #fffont color=#FF3300Please click the Submit Button only once/font /P LI P style=BACKGROUND-COLOR: #fffont color=#FF3300Then wait for your confirmation screen/font /P LI P style=BACKGROUND-COLOR: #fffont color=#FF3300Save the confirmation screen because it has information you will need/font /P /LI/UL P style=BACKGROUND-COLOR: #ffINPUT type=submit value=Submit Registrationnbsp;/P P style=BACKGROUND-COLOR: #ff align=centerEnd of Form-Thank You!/P/FORM HR H5 style=BACKGROUND-COLOR: #ff /H5 ?php } // end if ? /BODY/HTML -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] when to use htmlspecialchars()
If you will be using the data elsewhere then use it when it is displayed on the screen, or your other program will have to parse it. It is a good idea to always run htmlspecialchars when outputting text to the browser that came from a form. -- Stewart On Mon, 25 Feb 2002, Erik Price wrote: I was wondering if anyone could give me some advice in deciding the most appropriate time to use htmlspecialchars(): When user input is accepted and error-checked and ready to be inserted into the database? Or when user input is pulled from the database and ready to be displayed to the screen? It seems that running htmlspecialchars() BEFORE the data goes into the database is the safest way to do it, so that potentially malicious characters and tags never actually make it past the script. But upon thinking about the implications of this, it strikes me that this will affect the integrity of my data -- ideally, I want to keep the data as pristine as possible while it is in the database, since it might end up being parsed by something other than a browser someday, in which case it would be best to leave the data as is. I'm leaning toward the second method, but I want to make sure that doing so won't expose me to any risks that I haven't considered. Please give me your thoughts on this. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] downloading text files stored in database?
Hi, I wonder if someone can point me in the direction of an example and / or some documentation for the following task: I have a DB table containing the name and contents of plain text files that users have uploaded. I have a facility which allows users to view these, but I would also like the users to be able to *download* these files (i.e. display an 'open from present location / save to disk' dialogue). I am thinking that this would be accomplished by including a few META data lines at the top of a .php script, but would this allow me to specify the default saved name? e.g. there is record in the DB for a file called test.dat. I have a form that will submit to something like download_file.php, which will then (given the file id) obtain the appropriate data from the database and prompt the user whether they wish to open the file or save it (this will be the built-in dialogue with the browser). On selecting the save option, the default file name will appear as test.dat as opposed to download_file.php. Any information would be greatly appreciated. Thank very much in advance. - Best regards, Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: sometimes browser just recieves half the page
[EMAIL PROTECTED] wrote: Gary wrote: John Ericson wrote: Im programming a page where I have a java-tree-menu that gets generated from a db. The code works perfectly but sometimes when a browser reads the page I just get half of the page. I have noticed this behaivour on many different browsers such as mozilla, netscape, galeon, explorer and even wget sometimes. The page is here so you can try it yourself (Its a frameset page actually, the page with the problem is to the left): http://www.rskhq.2y.net/~nacka/ The actual php page that has the problem is: http://www.rskhq.2y.net/~nacka/vr_navbar.php The javascript showing up in the left frame is not showing the same as your link to it. The page showing up in the frame is broken. The javascript tags are closed before the script script language=JavaScript/script The thing is that it is the same file. I checked through my code for what you described. Does it look like this for you?: script language=JavaScript/script !-- function generateTree() { .. I get that in my mozilla but I belive that mozilla tries to fix the code since it doesnt get the complete script. The code from the file (vr_navbar.php) looks like this: html head titleNackademin/title script language=JavaScript !-- ?php/* generateBranch(id, caption, level, open) id: uniqe value. caption: text. level: 0 is root. open: 1 its open. 0 its closed. generateNode(href, caption, level, flag) href: URL or href. caption: text. level: 0 is root. flag: Dont know. Set it to always be 0. */? function generateTree() { .. If you have a utility such as wget you could try fetching the vr_navbar.php file with that. With that you can check out the code with any editor. Try an experiment. Take all the JS off the page and link it back, except what is need to print. If you have the same problem try Netcapes tree widget and see if that works. If it doesn't then you know to look else where. http://developer.netscape.com/evangelism/docs/api/xbTreeWidgetStatic/ Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Apache is not parsing my php...sometimes...
I've got an exceedingly wierd issue. I'm running a default installation of Linux Slackware 8.0. I've got the apache and mod_php modules installed. If I access my php document as follows, everything is parsed correctly: http://www.example.net/mypage.php However, if I access the page with the following, the code is not parsed and the php is placed in my html as plain text (bad because I have MySQL passwords in there): http://www.example.net/mypage Is anyone familiar with this problem. Is it a httpd config problem, perhaps a problem with how the php module was configured? Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SOAP status
[EMAIL PROTECTED] (Robert Mena) wrote: Hi, I was wondering if anyone has developed web services using SOAP with php. I'd like to use it in a future project but was wondering which tools (classes, exemples) do we have and how stable are they. I think something is cooking in the PEAR project, maybe ask on pear-general? -- Henrik Hansen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Converting arrays
$d = array(); $l = array(); $l[0] = array(1, -360, 1, CHICAGO); $l[1] = array(1, -420, 1, EDMONTON); $l[2] = array(1, -540, 1, FAIRBANKS); - Original Message - From: Gary [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, February 25, 2002 4:15 PM Subject: [PHP] Converting arrays Hi All, I am not too bad at building arrays in php but I need to convert a javascript form into php. How wuld I conver the small snippit here? var d = new Array(), l = new Array(); l[0] = new Array(1, -360, 1, CHICAGO); l[1] = new Array(1, -420, 1, EDMONTON); l[2] = new Array(1, -540, 1, FAIRBANKS); TIA Gary -- 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] Converting arrays
Gary wrote: Hi All, I am not too bad at building arrays in php but I need to convert a javascript form into php. How wuld I conver the small snippit here? var d = new Array(), l = new Array(); l[0] = new Array(1, -360, 1, CHICAGO); l[1] = new Array(1, -420, 1, EDMONTON); l[2] = new Array(1, -540, 1, FAIRBANKS); TIA Gary ?php $l = array(); $d = array(); $l[] = array(1, -360, 1, CHICAGO); $l[] = array(1, -420, 1, EDMONTON); $l[] = array(1, -540, 1, FAIRBANKS); ? The code won't be much use without knowing how it will be used though. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How many files can be in one directory?
Hi there, I am building a web application which is storing pictures. Is there a limit of files in one directory on LINUX systems? Perhaps it might end in a problem after having 3 files in the same dir? Performance issues ore something else. Has anybody got experiance on that? Thanx for any comment, Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: grab a file from location and save it to server
[EMAIL PROTECTED] (Mike Krisher) wrote: Is there a way with PHP to grab a file from an external server (http://www.domain.com/image.jpg) and save/upload it onto my local server? use fopen() -- Henrik Hansen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] grab a file from location and save it to server
On Mon, 2002-02-25 at 13:03, Mike Krisher wrote: Is there a way with PHP to grab a file from an external server (http://www.domain.com/image.jpg) and save/upload it onto my local server? Thanks in advance, __ Mike Krisher http://www.php.net/curl Cheers, Torben -- Torben Wilson [EMAIL PROTECTED] http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Converting arrays
Simon Willison wrote: Gary wrote: Hi All, I am not too bad at building arrays in php but I need to convert a javascript form into php. How wuld I conver the small snippit here? var d = new Array(), l = new Array(); l[0] = new Array(1, -360, 1, CHICAGO); l[1] = new Array(1, -420, 1, EDMONTON); l[2] = new Array(1, -540, 1, FAIRBANKS); TIA Gary ?php $l = array(); $d = array(); $l[] = array(1, -360, 1, CHICAGO); $l[] = array(1, -420, 1, EDMONTON); $l[] = array(1, -540, 1, FAIRBANKS); ? The code won't be much use without knowing how it will be used though. Thanks! in the end it is going to be a kind of time converter for internet time. Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How many files can be in one directory?
On Mon, 25 Feb 2002, Andy wrote: Hi there, I am building a web application which is storing pictures. Is there a limit of files in one directory on LINUX systems? Perhaps it might end in a problem after having 3 files in the same dir? Performance issues ore something else. The limit depends on how many inodes you have on the filesystem this dir resides on. This is a parameter when first mke3fs was ran to create the fs. Usually you'll have 1 i-node every 4096 bytes and you need 1 inode per file. So do your calculations depending on the size of your partition. cheers, thalis Has anybody got experiance on that? Thanx for any comment, Andy -- 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] Freeing up locked table?
Sometimes when using PHP/mySQL I have encountered a locked table. I have no idea why it occurs, I am not explicitly locking the tables but sometimes in phpmyadmin it says in use. Is there a way to unlock this table using PHP? Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Freeing up locked table?
This is mysql doing the locking, you will need to look into your mysql configuration. Ray Hunter Firmware Engineer ENTERASYS NETWORKS -Original Message- From: Jeff Lewis [mailto:[EMAIL PROTECTED]] Sent: Monday, February 25, 2002 2:41 PM To: [EMAIL PROTECTED] Subject: [PHP] Freeing up locked table? Sometimes when using PHP/mySQL I have encountered a locked table. I have no idea why it occurs, I am not explicitly locking the tables but sometimes in phpmyadmin it says in use. Is there a way to unlock this table using PHP? Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] downloading text files stored in database?
In the download_file.php put a header() function which redirects the browser to the file, like header(Location: test.dat). After that it should show the dialog screen. Balazs On Mon, 25 Feb 2002, Lee P Reilly wrote: Hi, I wonder if someone can point me in the direction of an example and / or some documentation for the following task: I have a DB table containing the name and contents of plain text files that users have uploaded. I have a facility which allows users to view these, but I would also like the users to be able to *download* these files (i.e. display an 'open from present location / save to disk' dialogue). I am thinking that this would be accomplished by including a few META data lines at the top of a .php script, but would this allow me to specify the default saved name? e.g. there is record in the DB for a file called test.dat. I have a form that will submit to something like download_file.php, which will then (given the file id) obtain the appropriate data from the database and prompt the user whether they wish to open the file or save it (this will be the built-in dialogue with the browser). On selecting the save option, the default file name will appear as test.dat as opposed to download_file.php. Any information would be greatly appreciated. Thank very much in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php