[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.. Matt's PHP Message message: 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 and this tag will be cut by the substr to something like that: 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 and this tag >will be cut by the substr to something like that: 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=cookers&type_code=range&manufacturer_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
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 form_submited = 0; function submit_only_one() { if ( form_submited ) { return 1; } else { form_submited = 1; document.forms[ 'name_of_your_formform' ].submit(); } } 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. function submitonce() { if (document.form.submitted.value == "No") { document.form.submitted.value == "Yes"; return true; } else { alert("Please wait..."); return false; } } 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 Listing 9.2 THE PROCCESS OF THE INPUT FORM Listing 9.3 $user\n\n"; print "Your address is:\n\n$address"; ?> 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 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 Listing 9.2 THE PROCCESS OF THE INPUT FORM Listing 9.3 $user\n\n"; print "Your address is:\n\n$address"; ?> 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 ", 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=products&key=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=value&var2=value2&var3=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?"); > > 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 "$myrow[0]\n"; echo "$myrow[1]\n"; ++$counter; } if ($offset > 0) echo "Previous"; if ($offset < $total_rows) echo "Next"; - 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 "$myrow[0]\n"; >echo "$myrow[1]\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 textwhich needs to be cut after 100 chars"; Than I do a substring to limit it to only 100 words (teaser-format): $teaser_1=substr($text, 0, 100); $teaser_2="...[click here for more]"; The Output of $teaser_1 will sometimes be like this: "This is a html extended textwhich needs to be cut after 100 chars is displayed as 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 > > > >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 > > >Listing 9.2 > > > > > > > > > > > > > > >THE PROCCESS OF THE INPUT FORM > > >Listing 9.3 > > >print "Welcome $user\n\n"; >print "Your address is:\n\n$address"; >?> > > > >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*** if (isset($surname)) { $errormessage = ""; if ($surname == "") { $errormessage = $errormessage . "
You must enter a value for surname"; } if ($age <= 0 or $age != floor($age)) { $errormessage = $errormessage . "
Age 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 '