Re: [PHP] Reliability of sessions
I hope you don't live in Bethlehem Erik Price wrote: > On Thursday, April 4, 2002, at 04:40 PM, Thomas Deliduka wrote: > > > I have a quick question for a veteren of sessions out there. > > I'd trust sessions with my life. > > > > 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] PHP and DOM XML
I have one question about operations that can be done with XML. What I need to do is build a web site which stores some data in XML files and retrieve that data. It's basically the system that allows users to register, login and upload and download some files. It needs to use XML. The question is: If there are simultaneos approaches to register or upload (registration and upload data are all stored in the single XML file), using DOM will make me problems. DOM loads the whole document into memory, and writes it whole to disk. The question is how to avoid this? Since if, for example, two users register at the same time, they both get their copy of document, and the later that writes itself to the file will overwrite the changes made by the first one. How to avoid this and still use DOM? I am using PHP 4.1.2 and libxml 2.4.19. Any advice is wellcome. Tnx in advance. Armin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session with or not cookies
Hello, I'm working with sessions. It's work fine with PHP 4.0.6 and when I update to 4.1.2. I've seen a strange thing, I canno't explain: Before when a client consult our webserver with no cookies enabled, the PHPSESSID was been add in the URL automatly and when the cookies are enable, the PHPSESSID was save in the cookie. This work fine But now, with no cookie enabled, the PHPSESSID was not add in the end of the URL. So I loose the session and the session variable. It is a change in this new version ? Do I make a change in my program ? I'm working on MacOs X.1.3 with PHP 4.1.2. Thanks for your answer. Best regards, Philippe B. http://www.allovac.com France -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strip spaces from inside string
the easiest way would be: "; // // output: // abcdefghi // // // or a regex: $str = "abc def ghi"; $str = ereg_replace(" ", "", $str); echo $str.""; //if you want to strip any whitespace character: $str = "abc def ghi"; $str = preg_replace("/\s/", "", $str); echo $str.""; // - ?> preg_replace is quite powerful, so if you only want to strip some spaces, you should prefer str_replace. Always think about how many power you need. str_replace -> ereg_replace -> preg_replace. Michael "Chris Boget" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 007f01c1d502$b70b3360$[EMAIL PROTECTED]">news:007f01c1d502$b70b3360$[EMAIL PROTECTED]... > > Say I have a string "xyz abc def" and I want to remove all of the spaces > > withing the string to create a new one. What's the best way? > > > $string = "xyz abc def"; > > $stringWithOutSpaces = implode( "", explode( " ", $string )); > > ?> > > Or you can use eregi_replace(), but I don't know what the regex would be. > I *think* you can do: > > > $string = "xyz abc def"; > > $stringWithOutSpaces = eregi_replace( " ", "", $string ); > > ?> > > > Chris > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FTP upload
Hello ,is it possible to upload file that is bigger than 8MB thrue FTP upload programmed in PHP? I need send attachments up to 50MB by FTP. It's for a graphic studio which works with big files. If yes how? Thank you Zavodsky [EMAIL PROTECTED] --- Odchozí zpráva neobsahuje viry. Zkontrolováno antivirovým systémem AVG (http://www.grisoft.cz). Verze: 6.0.338 / Virová báze: 189 - datum vydání: 14.3.2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reliability of sessions
On the page you start the session, ${session_name()} isn't set. so if you need that on the first page too, you should do the following "Thomas Deliduka" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I use them because 'sid' isn't always populated and, who knows, some browser may not handle cookies right and then lose a session. I do it to make sure, to be absolutely sure that it will work. On 4/4/02 5:19 PM this was written: > If you made your link like this: it tacks > on the name plus the session id. If cookies are enabled you will only see > the session id passed through the url on the first page.. After that you > wont, thus the little script I wrote so the '?' doesn¹t show up. Now if > cookies arent enabled you will see the session name and id passed through > the url every single time. There is absolutely no reason to use those > functions since php takes care of that stuff for you. -- Thomas Deliduka IT Manager - New Eve Media The Solution To Your Internet Angst http://www.neweve.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql_fetch_array()
Hi All, I am new to PHP and am having a bit of trouble. I have a recordset using... $events = mysql_fetch_array($recordset); this drags in 3 columns from my table... event_id, event_title, event_date I want to search the recordset for a given date, if found I want to be able to reference event_id & event_title from the row. I am using PHP 4.01. TIA Phil Ewington. --- P.S. If there are any ColdFusion developers on this list, what is the PHP equivalent of a structure? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Includes
Lately I have noticed many scripts that all consist of one file even though they create the appearance of many pages. For example, you would open setup.php and a form would appear. Then after you complete the form a new page appears with the results of your form, however the URL is still setup.php. So basically you can make complicated forms span only one file instead of having separate file to gather, display and save the data, how is this done? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] getting lines from the highest ID in a database?
Lets say I have a guestbook, and that I only want to show the last entry on my first page I cant figure out a good way to do it.. haven't managed to find a mysql command that can do it either, but maybe there are? :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and DOM XML
"Rarmin" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have one question about operations that can be done with XML. > What I need to do is build a web site which stores some data in XML > files and retrieve that data. It's basically the system that allows > users to register, login and upload and download some files. It needs to > use XML. > > The question is: > If there are simultaneos approaches to register or upload (registration > and upload data are all stored in the single XML file), using DOM will > make me problems. DOM loads the whole document into memory, and writes > it whole to disk. The question is how to avoid this? Since if, for > example, two users register at the same time, they both get their copy > of document, and the later that writes itself to the file will overwrite > the changes made by the first one. How to avoid this and still use DOM? > I am using PHP 4.1.2 and libxml 2.4.19. > > Any advice is wellcome. > Tnx in advance. > > Armin > You could lock the xml file while a user registers: http://www.php.net/manual/en/function.flock.php if ($fp = fopen($file, "r")) { if (flock ($fp, LOCK_EX + LOCK_NB )) { // process registration here flock ($fp,LOCK_UN); fclose($fp); } } however only one user will be able to register at a time. It would be better to store this in a database because then you can have multiple simultaneous registrations. Then when whatever application needs to see the info as xml, have php generate the xml from the data in the database. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session with or not cookies
Hello, I 've found where the problem is. It is with the last update of PHP 4.1.2 of Apple (Apple security Update of 5th April). This library seems light. Also there isn't the GD Library. When I go back to a version 4.1.2 by entropy.ch, All is OK. Session works fine and GD Library is present. Excuse me for the noise. Best regards, >Hello, > >I'm working with sessions. It's work fine with PHP 4.0.6 and when I update to 4.1.2. I've seen a strange thing, I canno't explain: > >Before when a client consult our webserver with no cookies enabled, the PHPSESSID was been add in the URL automatly and when the cookies are enable, >the PHPSESSID was save in the cookie. This work fine > >But now, with no cookie enabled, the PHPSESSID was not add in the end of the URL. So I loose the session and the session variable. > >It is a change in this new version ? Do I make a change in my program ? > >I'm working on MacOs X.1.3 with PHP 4.1.2. Philippe B. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: strip_tags() problem
try the following: $text = ""; $fp = fopen("http://www.yahoo.com";, "r"); while (!feof($fp)) { // read a line and strip all php and html tags // there's a third optional parameter, which // allowes to specify tags not to be replaced $text .= fgetss($fp, 4096); } fclose($fp); echo $text; "Ryan Govostes" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > The following simple code does not function: > > $html = include("http://www.yahoo.com";); > $text = strip_tags($html); > echo $text; > > I've tried several variations of the above, such as using preg_replace() > instead of strip_tags() and readfile() instead of include(), but it does > not work at all, no matter what. Does anyone know why? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Includes
Hi Sebastian! > Lately I have noticed many scripts that all consist of one > file even though > they create the appearance of many pages. For example, you would open > setup.php and a form would appear. Then after you complete > the form a new > page appears with the results of your form, however the URL is still > setup.php. So basically you can make complicated forms span > only one file > instead of having separate file to gather, display and save > the data, how is > this done? You can handle the HTML-output from within any functions. What I am doing normally is the following. I got one page, let's say main.php When calling this page I pass it a variable that tells main.php which function to execute ("printForm", "submitForm", "changeDB" etc.) This is done by a simple switch-cascade. Now I'm organizing my functions properly in different include-files, let's say "displayFuncs.php", "dbFuncs.php" etc.. And IMHO anything is much more clean and relaxed like this ;) On the other hand, if you connect to a db etc. you only have to write the code for the db_connect only one time (I include this, too). Was this what you wanted to know? Cheers, Kiko - It's not a bug, it's a feature. christoph starkmann mailto:[EMAIL PROTECTED] http://www.fh-augsburg.de/~kiko ICQ: 100601600 - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_fetch_array()
$db = mysql_open(); $results = mysql_query( "select * from something", $db ); while( $row = mysql_fetch_array( $results ) ) { processing using $row["column"] as reference } Ben At 11:21 05/04/2002, Phil Ewington wrote: >Hi All, > >I am new to PHP and am having a bit of trouble. I have a recordset using... > >$events = mysql_fetch_array($recordset); > >this drags in 3 columns from my table... > >event_id, event_title, event_date > >I want to search the recordset for a given date, if found I want to be able >to reference event_id & event_title from the row. I am using PHP 4.01. > >TIA > >Phil Ewington. > >--- >P.S. If there are any ColdFusion developers on this list, what is the PHP >equivalent of a structure? > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php * Ben Edwards +44 (0)117 9400 636 * * Critical Site Builderhttp://www.criticaldistribution.com * * online collaborative web authoring content management system * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: New-line characters
You'de be better off using the built in nl2br() function (http://www.php.net/manual/en/function.nl2br.php) it'll have the same effect as a it'll insert a tag everwhere a newline character occurs. Where 2 newline characters occur it will produce which in your HTML will break your text in the same way that a tag would. "James Stewart" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]. .. > Hi, > > I have a form for users of a system I am developing to add their newsletters > to a MySQL database through. I take their input and INSERT it straight into > the database after adding slashes. > > When I retrieve the information from the database I would like to replace > double occurences of new-lines with a tag. Can anyone tell me what > regexp I should be searching for? > > cheers. James. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: strip_tags() problem
or instead of fopen, use: $fp = fsockopen("http://www.yahoo.com";, 80, $errno, $errstr, 30) or die ("Could not connect to yahoo.com"); // wait for answer (replacement for deprecated set_socket_blocking) socket_set_blocking($fp, 1); i forgot to "die" in the example below, if connection could not be established. so $fp = fopen("http://www.yahoo.com";, "r"); should be $fp = fopen("http://www.yahoo.com";, "r") or die ("Could not connect"); or you get an endless while loop on the feof if connection fails. "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > try the following: > > $text = ""; > $fp = fopen("http://www.yahoo.com";, "r"); > while (!feof($fp)) { > // read a line and strip all php and html tags > // there's a third optional parameter, which > // allowes to specify tags not to be replaced > $text .= fgetss($fp, 4096); > } > fclose($fp); > echo $text; > "Ryan Govostes" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > The following simple code does not function: > > > > $html = include("http://www.yahoo.com";); > > $text = strip_tags($html); > > echo $text; > > > > I've tried several variations of the above, such as using preg_replace() > > instead of strip_tags() and readfile() instead of include(), but it does > > not work at all, no matter what. Does anyone know why? > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-GENERAL] animated gif
Sounds like you'll have to use PHP to to first create the images. Then in your output page just include some javascript to rotate the images. If you have to you can use PHP to write the javascript. "Jessica Lee Tishmack" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > can you incorporate java script into php? (I am using php because each > image has to be generated on the fly, based on a data set...realtime data) > > > Thanks, > Jessica > > On Thu, 11 May 2000, Liz Kimber wrote: > > > You could try making the number of images and use a continusuly running java > > script to switch them, which is kinda all an animated gif is hence they stop > > often when you press the stop button! > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: getting lines from the highest ID in a database?
add to your mySQL query: " order by id desc limit 1" This will order your data by your primary id (change 'id' to whatever you auto-increment) in the descending order and will limit the results to 1 record. Cheers, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) www.PHPBeginner.com [EMAIL PROTECTED] Hawk writes: > Lets say I have a guestbook, and that I only want to show the last entry on > my first page > I cant figure out a good way to do it.. > haven't managed to find a mysql command that can do it either, but maybe > there are? :) > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) www.PHPBeginner.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Includes
we still use include(); setup.php has something like: if(file_exists($page) and ...more...controls..) include_once $page; then the $page.php is where you have a part of your site. You can pass $page as the GET variable: setup.php?page=page.php and so on Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) www.PHPBeginner.com [EMAIL PROTECTED] Sebastian A. writes: > Lately I have noticed many scripts that all consist of one file even though > they create the appearance of many pages. For example, you would open > setup.php and a form would appear. Then after you complete the form a new > page appears with the results of your form, however the URL is still > setup.php. So basically you can make complicated forms span only one file > instead of having separate file to gather, display and save the data, how is > this done? > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) www.PHPBeginner.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting lines from the highest ID in a database?
this should do the trick: SELECT MAX(field) from table you have to use MAX to get the highest value in field. Michael "Jason Wong" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED]... > On Friday 05 April 2002 18:27, Hawk wrote: > > Lets say I have a guestbook, and that I only want to show the last entry on > > my first page > > I cant figure out a good way to do it.. > > haven't managed to find a mysql command that can do it either, but maybe > > there are? :) > > The only reliable way to do it is to have a field in your guestbook table > which records the time that the entry was made. Then you can: > > > SELECT * FROM guestbook ORDER BY time_entered LIMIT 1 > > I have set follow-up to [EMAIL PROTECTED] where this belongs. > > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > /* > If there is any realistic deterrent to marriage, it's the fact that you > can't afford divorce. > -- Jack Nicholson > */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Reliability of sessions
Hi Thomas, > What is the opinion, are sessions reliable enough to go through the step > process? We are runnig some online shops for our clients based on PHP. The checkout process is always based on sessions and we never had trouble with the session management. If you are in doubt with the standard implementation of PHP session management (based on files to persist variables) you are able to overwrite the functionality of the session management by your own implementations (e.g. based on a database to persist variables). Bob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: New-line characters
FYI: is not same as . P is paragraph and br is just a line break of the text. So, depending on your text format the lines broken twice might (normally ARE but not too noticeably) look different. try to mess with CSS and you'll see the difference about how browsers see those both ways. In the poster's case, to have a out of he should still use nl2br() and then add this to it: $text = preg_replace("/\w*\w*\w*/i", "\n\n", $text); Cheers, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) www.PHPBeginner.com [EMAIL PROTECTED] Jamie Watt writes: > You'de be better off using the built in nl2br() function > (http://www.php.net/manual/en/function.nl2br.php) it'll have the same effect > as a it'll insert a tag everwhere a newline character occurs. Where 2 > newline characters occur it will produce which in your HTML will > break your text in the same way that a tag would. > > > "James Stewart" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED]. > .. >> Hi, >> >> I have a form for users of a system I am developing to add their > newsletters >> to a MySQL database through. I take their input and INSERT it straight > into >> the database after adding slashes. >> >> When I retrieve the information from the database I would like to replace >> double occurences of new-lines with a tag. Can anyone tell me what >> regexp I should be searching for? >> >> cheers. James. >> > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) www.PHPBeginner.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: script-controlled tablewidthchange, for diff. screen resolutions
Sounds like you might be trying to do things the hard way. Wouldn't it be easier to simply set the table widths as a percentage rather than an exact width in pixels? Eg. width="50%" The above example will set the table width to 50% of the browser window width. Or maybe you could use a bit of DHTML and javascript to do the resizing instead? If you really badly want to do it the way you described below I guess you could use javascript to detect the values for screen width and height and then send them to PHP. "Helmut Ott" <[EMAIL PROTECTED]> wrote in message news:009f01bfbda6$2e8c9850$09bf06d5@pentium... Hallo everybody, huuh - has anybody seen a scriptbased, parametric pagelayout control? Depending on the viewers screen resoltion I would like to change table and cell widths in my page. This would mean I only need ONE version. The screen resolution detection would e.g. find a width of 640 pix. Say my sttandrad res. was 800 than a factor could calulated by setting Factor=res. viewer / res. standard. In the above sample this would be 640 / 800 = 0,8 as factor-value. All page, table, row, cell, images width (and heights) would have to be multilied with this factor. As the screen res. can only be analysed on the clientside it must be e.g. a javascript to do that. Did anybody hear about any way to get this done. Any tip is greatly appreciated. Helmut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cannot compile my extension as a shared .so library
Hi php-4.1.2 linux RH 7.2 I have created a small php extension. The extension works as expected when I compile it using $ ./configure --with-foo && make # foo is the extension It gets compiled into the php binary. All is well, but I would like to compile my extension as a loadable modules (ie to use with the dl() function). Thus $ ./configure --with-foo=shared && make The compilation completes with no errors. The php binary works (my foo ext is not included in the binary), but I end up with *no* 'foo.so' file. Instead I get this $ ls -l modules/ 51776 Apr 5 13:11 foo.a 647 Apr 5 13:11 foo.la I expected to see a 'foo.so' file. Obviously I cannot use dl() on these files. The foo extension is as simple as possible, just to illustrate the problem. It was created using these commands: 1. $ cd ~/php-4.1.2/ext 2. $ ./ext_skel --extname=foo 3. $ cd .. 4. $ vi ext/foo/config.m4 5. $ ./buildconf 6. $ ./configure --with-foo=shared 7. $ make The whole config.m4: PHP_ARG_WITH(foo, for foo support, [ --with-foo Include foo support]) if test "$PHP_FOO" != "no"; then PHP_EXTENSION(foo, $ext_shared) fi Output from make: make[3]: Entering directory `/home/wic/php-4.1.2/ext/foo' /bin/sh /home/wic/php-4.1.2/libtool --silent --mode=compile gcc -I. -I/home/wic/php-4.1.2/ext/foo -I/home/wic/php-4.1.2/main -I/home/wic/php-4.1.2 -I/home/wic/php-4.1.2/Zend -I/home/wic/php-4.1.2/ext/mysql/libmysql -I/home/wic/php-4.1.2/ext/xml/expat -I/home/wic/php-4.1.2/TSRM -g -O2 -prefer-pic -c foo.c && touch foo.slo /bin/sh /home/wic/php-4.1.2/libtool --silent --mode=link gcc -I. -I/home/wic/php-4.1.2/ext/foo -I/home/wic/php-4.1.2/main -I/home/wic/php-4.1.2 -I/home/wic/php-4.1.2/Zend -I/home/wic/php-4.1.2/ext/mysql/libmysql -I/home/wic/php-4.1.2/ext/xml/expat -I/home/wic/php-4.1.2/TSRM -g -O2 -prefer-non-pic -static -o foo.la -avoid-version -module -rpath /home/wic/php-4.1.2/modules foo.lo /bin/sh /home/wic/php-4.1.2/libtool --silent --mode=install cp foo.la /home/wic/php-4.1.2/modules PATH="$PATH:/sbin" ldconfig -n /home/wic/php-4.1.2/modules -- Libraries have been installed in: /home/wic/php-4.1.2/modules [etc...] Note that I can manually create a so-file from the foo.a file using ld as in: $ cd modules; ar x foo.a; ld -Bshareable -o foo.so foo.o and then call dl("foo.so"), but that is not the way to go, right??? I think there is some arcance libtool switch missing in the Makefile, or I need something else in the config.m4 file Btw, my real extension is a lot more complex, but it has the same problems so I figured this foo-thing would be a bit easier to debug :-) I have searched high and low for any leads, but nothing has turned up so far. /Regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mysql_fetch_array()
Jason, This is for an events calendar, I want all the dates form the db but when I am generating the individual days for the calendar I need to know whether there is an event for that day, hence pulling out all the dates from the db. As I am looping through all the days in a month to dynamically create the calendar, I do not want to loop through the entire recordset to look for a date for that day in each iteration. Does your method find any row in the recordset with a given date? I am at present exploring the possibility of creating individual arrays for each row in the recordset using the date as the name of the array, then testing to see if it exists. That way I can check for the existence of a given date at any point in my code and reference the associated values without looping through the recordset each time. My code is as follows... while ($row = mysql_fetch_assoc($events)) { $a = "date_" . $row["event_date"]; $$a = array($row["event_id"], $row["event_title"]); } if ($date_2002-04-15) { do_something(); } Any comments will be greatfully received. Phil. > -Original Message- > From: Jason Wong [mailto:[EMAIL PROTECTED]] > Sent: 05 April 2002 11:31 > To: [EMAIL PROTECTED] > Subject: Re: [PHP] mysql_fetch_array() > > > On Friday 05 April 2002 18:21, you wrote: > > Hi All, > > > > I am new to PHP and am having a bit of trouble. I have a > recordset using... > > > > $events = mysql_fetch_array($recordset); > > > > this drags in 3 columns from my table... > > > > event_id, event_title, event_date > > > > I want to search the recordset for a given date, if found I > want to be able > > to reference event_id & event_title from the row. I am using PHP 4.01. > > Shouldn't you be doing your searching and selecting from within > your mysql > query? > > But if you insist on doing it in PHP then: > > > if ($events['event_date'] == whatever) { > do_something(); > } > > > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > /* > You will engage in a profitable business activity. > */ > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] multiple php.ini files
hi, does anybody have some experience with running PHP with different permissions and modules. The only way that I imagine is to have 2 (or more) independent PHP installations with separate php.ini files. But this is stone age technique... I am sure that PHP has some kind of ini loading functionality (that I could not found in the documentation) Thank you very much for in advance for any creative suggestion. Regards, Z -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Includes
> Well, I think I should give a better explanation. I have been > seeing a lot > of scripts that appear to be on multiple pages. For example: > You open file.php, and you are greeted with a form asking > your name. You > give in your name and then submit the form. After you submit > the form you > would normally get a new page saying your name has been > stored or something > like that. This time, that also happens BUT you do not go to > a new separate > file. The URL in your browser is still on file.php, however > the form that > was there before is GONE and you see a totally new page. I am > asking how > something like this can be done. If it will help I can attach > a file that > does this. Yes, and exactly this is what I told you ;) I've got one page, let's say "main.php". This page is looking for a var, let's say called "$curAction"; $curAction is not present the script knows that you're new to this site and calls a function called "displayWelcome" (wherever this function is defined ;)). So this switch casecade handles what content is to be displayed, which looks as if you where getting different pages... Better now? Cheers, Kiko - It's not a bug, it's a feature. christoph starkmann mailto:[EMAIL PROTECTED] http://www.fh-augsburg.de/~kiko ICQ: 100601600 - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and MS Access
I am running PHP and Apache and have a problem connecting to an Ms Access database I cannot connect to my database. I am using an Apache Server with PHP. Now as far as I can see these work fine apart from some dll files in PHP. I have also set up an ODBC connection to my database, but when I try and run the PHP code I get errors. This is the PHP code I am using. The ODBC is called link1 and the database db1. ".ODBC_Result($res, 'fieldname').""; } ODBC_Free_Result($res); ?> These are the errors that it returns X-Powered-By: PHP/4.0.6 Content-type: text/html Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data., SQL state S1000 in SQLConnect in o:\program files\apache group\apache\htdocs\name1.php on line 2 Warning: Supplied argument is not a valid ODBC-Link resource in o:\program files\apache group\apache\htdocs\name1.php on line 3 Warning: Supplied argument is not a valid ODBC result resource in o:\program files\apache group\apache\htdocs\name1.php on line 4 Warning: Supplied argument is not a valid ODBC result resource in o:\program files\apache group\apache\htdocs\name1.php on line 7 Any help on where to go would be great. Thanks a million Ronan _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP stops execution without error message
Running php ver 3.0.12 and mysql ver 3.22.32 on a linux box. Php installed as apache module The script im running takes a long time to execute (20-40 minutes) and includes hundreds of selects and inserts into the database, and also opening/closing lots of files. And quite often, the script just stops in the middle of runnning without any error message. It isnt a timeout, since i have set_time_limit(3600); I have absolutely no idea what it can be or where to start debugging. Any ideas what it can be (ie lack of resources?) and how would it be possible to debug it. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: preventing "back" button usage?
i don't like javascript. It's pain in the ass to get this working on more than IE and Netscape. Btw, to get it working on IE and Netscape is annoying enough already imo.So what i would do is registering some sort of variable in the session, that shows you if the page has been submitted already. On the page that processes the form, you register this variable to the session, if it isn't registered already. if it is registered already, you simply ignore the request That's the easiest way, but as long as the session remains, the user wouldn't be able to submit this form again. So if you want the user to be able to submit this form again but preventing him from submitting the same data again, you have to do a little more than what i mentioned above. Regards, Michael "Erik Price" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > On Thursday, March 28, 2002, at 06:50 PM, Michael Virnstein wrote: > > > This is not possible. You cannot force the browser > > not to go back in its history, don't even trie to find a solution for > > this... > > the question you should ask yourself is not how to disable the browser > > history > > but how you can prevent your page by getting screwed by multiple posts. > > I see. Then, when I try to do something similar to this on FedEx.com or > Amazon.com, is it JavaScript that redirects me to an error page? If so > then I will have to use both tactics -- preventing a form from being > resubmit, and JavaScript to "disable" the back button (unethical as it > may be). > > > 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] Return-Path
Can you help me? When I call the following script: (1) \r\n", (6) "Return-Path:<[EMAIL PROTECTED]>\r\n"); (7) exit; (8) ?> I get the following error message: Warning: Wrong parameter count for mail() in ... (file_name) ... on line 6. By the way, I tried it with and w/o the \r. Any suggestions? Thanks! Anthony F. Rodriguez ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Return-Path
On Friday 05 April 2002 20:49, Anthony Rodriguez wrote: > Can you help me? > > When I call the following script: > > (1) (2) mail("[EMAIL PROTECTED]", > (3) "Test", > (4) "Test", > (5) "From:SBW Research <[EMAIL PROTECTED]>\r\n", > (6) "Return-Path:<[EMAIL PROTECTED]>\r\n"); > (7) exit; > (8) ?> > > I get the following error message: > > Warning: Wrong parameter count for mail() in ... (file_name) ... on line 6. > > By the way, I tried it with and w/o the \r. > > Any suggestions? mail() is only supposed to take 4 parameters, but you're trying to feed it with 5. The last parameter (the 4th) can take any number of headers separated by by '\r\n'. So try: > (1) (2) mail("[EMAIL PROTECTED]", > (3) "Test", > (4) "Test", > (5) "From:SBW Research <[EMAIL PROTECTED]>\r\n". > (6) "Return-Path:<[EMAIL PROTECTED]>\r\n"); > (7) exit; > (8) ?> -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* CF&C stole it, fair and square. -- Tim Hahn */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can I use php to " Print " a document?
Is there any functions or command that I can print out a page or a document without using the browsers' print? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I use php to " Print " a document?
At 05.04.2002 14:26, you wrote: >Is there any functions or command that I can print out a page or a document >without using the browsers' print? If you have compiled php as standalone (I think it´s called the cgi) you can use the exec("lpd docname"), if you have a printer on your box, or in your network. If you want to do this on the clients(surfers) machine, you have to use the browser and JavaScript, as you are 'only' sending a html-page. HTH Oliver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session Freakiness. Losing Session.
Hi, I have an odd problem. I have intermittent loss of sessions happening, and I've spent lots of time trying to figure it out, but I am at a loss here. I found a post on phpbuilder that seem to be the same or a similar problem from 2001: http://www.phpbuilder.com/forum/archives/2/2001/3/1/125803 Unfortunately no conclusion seems to have been reached in the thread. Anyway, to my problem. I set a cookie with the sessionid on successful login. I also store the sessionid in a mysql database with a timestamp. I check the cookie with the db, and update on each reload. The script resides in one page, that is used repeatedly, and uses the same sessionhandling function for each request. I have the timeouts set to 1 hour (3600) for both the sessioncookie, and the session file on the server. Php version is 4.1.2, residing on Gentoo Linux, with a mysql db. I have observed the directory containing the sessionfiles, while a tester browsed the site, and watched the session disappear from the directory before timeout has elapsed. It is an intermittent problem, and seem to happen randomly... Any ideas what's going on here? Any hints would be greatly appreciated! Regards -Hans -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] WIKI - CMS scripts
This is a general question, and I'm not trying for flames, but I've been looking at various CMS sites: php-nuke, post-nuke, php-website, typo-3, and ez-publish. I've probably visited others, but haven't book marked them. One thing which seems to characterize them all, is that they seem awfully "busy", and it is easy to lose your way when navigating. Is that because the developers are trying to cram as much as possible on to their front pages, or do they tend that way as content and headlines are added? Anyone know of any sites using any of the aforementioned scripts which are less busy, and on which navigation is clearer? Regards - Miles Thompson PS If you don't want to clutter the list, reply to me offlist and I'll summarize and post. /mt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Miguel...
Miguel, Thanks for the reply. . > MySQL has a command-line tool called 'mysqldump' which will output a text > file containing all the table creates and inserts necessary to recreate > the database. O.K. Now I have a .txt file of my sql statement. .. > As others have suggested, you can use phpmyadmin to import this file, or > you can just pipe it into the mysql command-line tool on the server once > you've created your database. Look inside the file created by mysqldump > and all will be much clearer. I take that to mean (the ISP's remote server where my website resides). Right? How can I get the compete mysql statement onto the ISP's server? Please advise. What I would like to know is: I would like to find out the steps one takes in going from the process of having the mysql data reside on my harddrive - localhost - in development - to my ISP's server when it goes live. The site resides on a remote server (the ISP's) when it is published (or goes live). Thank you. Tony Ritter
RE: [PHP] PHP stops execution without error message
If this is a web-page you are generating, I believe browser timeout is 5 minutes. -Original Message- From: Ando [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 6:19 AM To: [EMAIL PROTECTED] Subject: [PHP] PHP stops execution without error message Importance: Low Running php ver 3.0.12 and mysql ver 3.22.32 on a linux box. Php installed as apache module The script im running takes a long time to execute (20-40 minutes) and includes hundreds of selects and inserts into the database, and also opening/closing lots of files. And quite often, the script just stops in the middle of runnning without any error message. It isnt a timeout, since i have set_time_limit(3600); I have absolutely no idea what it can be or where to start debugging. Any ideas what it can be (ie lack of resources?) and how would it be possible to debug it. Thanks -- 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] mysql_fetch_array()
At 05.04.2002 12:31, you wrote: > >Jason, > >This is for an events calendar, I want all the dates form the db but when I >am generating the individual days for the calendar I need to know whether >there is an event for that day, hence pulling out all the dates from the db. >As I am looping through all the days in a month to dynamically create the >calendar, I do not want to loop through the entire recordset to look for a >date for that day in each iteration. Does your method find any row in the >recordset with a given date? As I understand your problem, I would suggest, that you just select the days in the month, where there are events f.e. select count(ref#) from DB where date 'inside your scope' and events 'are there events' this gives you the number of lines. If there are any, you could ask more detailed, using the informations stored. If there are no events, make the calendar as normal. Thats also a good explanation for the column ref# (autoincrement, unique) Even you only have to deal with one select, and can order your result, so that it makes you no pain showing them >I am at present exploring the possibility of creating individual arrays for >each row in the recordset using the date as the name of the array, then >testing to see if it exists. That way I can check for the existence of a >given date at any point in my code and reference the associated values >without looping through the recordset each time. My code is as follows... > >while ($row = mysql_fetch_assoc($events)) { > $a = "date_" . $row["event_date"]; > $$a = array($row["event_id"], $row["event_title"]); >} Here the select could be Assuming you have the DB´s 'event_ref ' where 'event date' and 'event reference number' put in and 'event_content' where other useful informations are stored selct a.event_title, from event_ref a, event_content b where b.ref = a.ref and a.date='2002-04-15' No dealing with arrays and var_vars, just straight sql. HTH Oliver >if ($date_2002-04-15) { do_something(); } > >Any comments will be greatfully received. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP and MS Access
Ronan, Check these: http://support.microsoft.com/default.aspx?scid=kb;EN-US;q306269 http://support.microsoft.com/default.aspx?scid=kb;EN-US;q174943 It's most likely an issue with how you have your DSN setup or how apache is running. Best regards, Andrew Hill Director of Technology Evangelism http://www.openlinksw.com/virtuoso/whatis.htm OpenLink Virtuoso Universal Server > -Original Message- > From: ronan cleary [mailto:[EMAIL PROTECTED]] > Sent: Friday, April 05, 2002 6:42 AM > To: [EMAIL PROTECTED] > Subject: [PHP] PHP and MS Access > > > I am running PHP and Apache and have a problem connecting to an Ms Access > database > > I cannot connect to my database. I am using an Apache Server with > PHP. Now > as far as I can see these work fine apart from some dll files in PHP. > > I have also set up an ODBC connection to my database, but when I > try and run > the PHP code I get errors. > > This is the PHP code I am using. The ODBC is called link1 and the > database > db1. > > $db = ODBC_Connect("link1", "",""); > $res = ODBC_Exec($db, "SELECT Employee.Name FROM Employee;"); > while (ODBC_Fetch_Row($res)) { > echo "".ODBC_Result($res, 'fieldname').""; > } > ODBC_Free_Result($res); > > ?> > > These are the errors that it returns > > X-Powered-By: PHP/4.0.6 Content-type: text/html > Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] The > Microsoft > Jet database engine cannot open the file '(unknown)'. It is > already opened > exclusively by another user, or you need permission to view its > data., SQL > state S1000 in SQLConnect in o:\program files\apache > group\apache\htdocs\name1.php on line 2 > > Warning: Supplied argument is not a valid ODBC-Link resource in > o:\program > files\apache group\apache\htdocs\name1.php on line 3 > > Warning: Supplied argument is not a valid ODBC result resource in > o:\program > files\apache group\apache\htdocs\name1.php on line 4 > > Warning: Supplied argument is not a valid ODBC result resource in > o:\program > files\apache group\apache\htdocs\name1.php on line 7 > > > Any help on where to go would be great. > > Thanks a million > > Ronan > > _ > Join the worlds largest e-mail service with MSN Hotmail. > http://www.hotmail.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Explode and Trim
Unfortunately it doesn't. That is why I am kind of puzzled by the situation. -- Joshua E Minnie CIO [EMAIL PROTECTED] "Don't work for recognition, but always do work worthy of recognition." "Maxim Maletsky" <[EMAIL PROTECTED]> wrote > > I think what yo wrote should be working fine for you. > > My way of your code: > > > > > foreach(file($storelist) as $line_num=>$line_data) { > foreach(explode(':', $line) as $key=>$val) { > $val = trim($val); // remove whitespaces around > > // now you are inside each element of your > multidimentional array > // combine your rest of the code and work it out the way > you need it. > > } > } > > > > Sincerely, > > Maxim Maletsky > Founder, Chief Developer > > PHPBeginner.com (Where PHP Begins) > [EMAIL PROTECTED] > www.phpbeginner.com > > > > -Original Message- > > From: Joshua E Minnie [mailto:[EMAIL PROTECTED]] > > Sent: Friday, April 05, 2002 1:07 AM > > To: [EMAIL PROTECTED] > > Subject: [PHP] Explode and Trim > > > > I am parsing through a text file and using explode to convert the > string to > > an array. The problem seems to be at the end of the string, when I > check to > > see if the last element in the array is empty it tells me that it is > not. > > The problem comes because the last element should be empty because all > that > > was after the separator was white space. > > > > ---Sample text file--- > > AL:123 2nd Ave.:SomeCity:(123) 456-7890:(123) 456-1234::: > > MI:293 3rd St.:Another City:(123) 345-2839:(123) 384-0398::: > > MI:437 4th Ave.:Yet Another City:(123) 283-4839:(123) 458-4843::: > > ---End of text file--- > > > > ---Code snippit--- > > $stores = file($storelist); > > for($i=0; $i > //$stores[$i] = trim($stores[$i],"\r"); > > //$stores[$i] = trim($stores[$i],"\n"); > > //$stores[$i] = trim($stores[$i], ":"); > > //$stores[$i] = rtrim($stores[$i]); > > echo $stores[$i]."\n"; > > $stores[$i] = explode(":", $stores[$i]); > > } > > > > reset($states); > > while(current($states) && current($stores)) { > > for($i=0; $i > while($stores[$i][0] != key($states)) { > > next($states); > > $state = 0; > > } > > if($state==0) { > > echo "".$states[$stores[$i][0]]."\n"; > > $state = 1; > > } > > echo $stores[$i][1].", ".$stores[$i][2]."Phone: > > ".$stores[$i][3]."Fax: ".$stores[$i][4]."\n"; > > if(!empty($stores[$i][5])) echo "Email: ".$stores[$i][5]."\n"; > > if(!empty($stores[$i][6])) echo "Web site: > ".$stores[$i][6]."\n"; > > if(!empty($stores[$i][7]) && $stores[$i][7] != "") echo > "Additional > > notes: ".$stores[$i][7]."\n"; > > echo ""; > > } > > } > > ---End of code snippit--- > > > > Here is the URL of where the code is being used: > > www.wildwebtech.com/acs/nuven/stores.php. The additional notes should > only > > show up if there were additional notes. > > > > -- > > Joshua E Minnie > > CIO > > [EMAIL PROTECTED] > > > > "Don't work for recognition, but always do work worthy of > recognition." > > > > > > > > -- > > 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] Includes
Assume the following file is named "this_script.php": This is all in ONE file. \n"; do some other stuff exit; } ?> -Original Message- From: Sebastian A. [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 4:19 AM To: PHP General List (PHP.NET) Subject: [PHP] Includes Lately I have noticed many scripts that all consist of one file even though they create the appearance of many pages. For example, you would open setup.php and a form would appear. Then after you complete the form a new page appears with the results of your form, however the URL is still setup.php. So basically you can make complicated forms span only one file instead of having separate file to gather, display and save the data, how is this done? -- 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] Read and Escape file
On Friday, April 5, 2002, at 02:50 AM, Miguel Cruz wrote: > Certain characters have special meanings in string literals (that is, > strings you explicitly type into your PHP source code) but if you get > them > in via other means (reading from file, reading from form submissions, > etc.) then they are not treated specially. I have heard of string 'literals' and numeric 'literals' -- and now I learn that they are different from, for instance, strings read from a file or accepted from a form. Is there a resource that discusses these different programming constructs? The PHP manual mentions string literals but assumes that the reader already knows what they are (i.e., doesn't define them opposed to other types of inputs -- http://us4.php.net/manual/ro/html/language.types.string.html). 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] 1024X760 or 800x600
Is there a way with PHP to determine screen resolution size??? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to process URL parameers
Dear All, Sorry to trouble you with this simple question! if I have this php code: echo "http://abc.com/test.php?xyz>try"; how would I process the xyz from test.php? Any thoughts would be greatly appreciated! --Wo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and mySQL...
Since you didnt make it clear, do you even have MySql and php on your server? Are you looking to just move your data or looking to get php & mysql installed on the server as well? (SERVER = production site, not localhost) if you just wanna move data, like everyone else said phpmyadmin rocks, but I do have a recommendation for ya before you jump to the ease of a GUI. Learn how to work in the command line, for the type of situation you are trying to resolve, after you learn that THEN work with a GUI like phpmyadmin. this will both give you a better understanding of mysql commands and also help you to fully appreciate the usefullness of phpmyadmin. -lol if you dont already have mysql php installed on your prodution site, see what it will cost you to have it installed etc, if anyhting, and if its already suppossed to be there, make sure they have set it up for your use, some times ISP's wont create you a database till you ask, or even have the latest version of php intalled for that matter. Even though it's suppossed to be included in your server "option". hope it helps. "Miguel Cruz" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Thu, 4 Apr 2002, Anthony Ritter wrote: > > Sorry if my original question was confusing. > > > > This is what I would like to accomplish: > > > > I am currently developing a database on my website using mysql which is on > > my harddrive. > > I have installed Apache as well and I am using PHP. > > > > My database is functioning fine on localhost. > > > > I would like to find out the steps one takes in going from the process of > > having this reside on my harddrive - localhost - in development - to my > > ISP's server when it goes live. > > MySQL has a command-line tool called 'mysqldump' which will output a text > file containing all the table creates and inserts necessary to recreate > the database. > > As others have suggested, you can use phpmyadmin to import this file, or > you can just pipe it into the mysql command-line tool on the server once > you've created your database. Look inside the file created by mysqldump > and all will be much clearer. > > miguel > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using new AUTOGLOBALS
On Friday, April 5, 2002, at 09:55 AM, cyberskydive wrote: > So I wanna learn how to code properly with register_globals off, I > reead on Good idea, it's not really harder than doing it the old way and it helps you visualize where your data is coming from. I actually prefer it this way. > when I tried to edit an example session script I had from a book to use > $_POST, $_REGISTER, or even $_SESSION i got a blank page on the > reload. I > think sid is returning empty. Yes, I have not yet seen a book that uses the register_globals off style. Hopefully that will change as the shift towards register_globals off becomes more popular. > Can anyone offer me advice on this, proper coding and or proper > configuration in PHP.INI Just turn register_globals off, and make sure you're using PHP 4.1.x or greater. I don't know much about Windows so if there is something wrong with your server then somebody else will be a better help. > I'm trying to learn all this at once-lol, and learn it properly the > first > time around, especially since register globas will be deprecitated-poof. Yep, that's what I did -- almost from the beginning I've been doing it this way. Just make sure that any time you refer to data that comes from one of the superglobals arrays, you use $_*['variablename'] instead of just $variablename. So if you have a cookie with a value of "Fred" and a name of "first_name", do $_COOKIE['first_name'] when you want to use that variable -- its value is "Fred". The only one that works a bit different is $_SESSION['variablename'] -- it is the easiest way to set session variables. Just do something like // user has submitted POST data, and you have // checked it for errors in your script $_SESSION['variablename'] = $_POST['variablename']; // put POST variable in a session How easy is that! Note that doing this assignment with any other superglobal doesn't work and in most cases wouldn't make sense anyway. For instance, you can't set cookies using $_COOKIE['name'] = $name 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] how to process URL parameers
Dear PHPers, Thanks for the extra hands! They all work!! --Wo - Original Message - From: "Erik Price" <[EMAIL PROTECTED]> To: "Wo Chang" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, April 05, 2002 10:00 AM Subject: Re: [PHP] how to process URL parameers > > On Friday, April 5, 2002, at 09:54 AM, Wo Chang wrote: > > > Sorry to trouble you with this simple question! > > > > if I have this php code: > > > > echo "http://abc.com/test.php?xyz>try"; > > > > how would I process the xyz from test.php? > > It needs to be a name/value pair, like this: > > echo "try"; > > Most people do it like this, letting them put a PHP variable in there: > > echo " href=\"http://abc.com/test.php?variablename=$php_variable\";>try"; > > or if you don't like to use escaped doublequotes, try > > echo 'try'; > > > > 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] Directory to array to select box...
Ok here is my problem, for one I am new to php and would like a new pair of eyes for this piece of code, and second what I would like to accomplish is putting the contents of a directory into an array and then pulling the contents of that array into a select box for further processing... If someone could give me some more information on GetDirArray() or a different way to accomplish this problem that would be great... this is where I am thus far. $file"; $form = " $file_count "; // close directory closedir($dir); ?> Then of course I just use an echo to display the select box but so far I have not been able to have it actually work so any help would be great.. Thanks in advance, jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: 1024X760 or 800x600
no, there's no way. But, you could use JavaScript to do this job and appnend the values to URLs as GETs. Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) www.PHPBeginner.com [EMAIL PROTECTED] Ron Allen writes: > Is there a way with PHP to determine screen resolution size??? > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) www.PHPBeginner.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and mySQL...
Cyberskydive wrote in message: > Since you didnt make it clear, do you even have MySql and php on your > server? Are you looking to just move your data or looking to get php & mysql > installed on the server as well? (SERVER = production site, not localhost) ... Yes. I have mySQL and PHP on my end - localhost - for development. I spoke with my ISP and they do not have mySQL installed on their end. They use MS SQL Server. Any idea what the cost is for the ISP to install mySQL on their end so that I can utilize my database that I've set up on localhost? Thank you. Tony Ritter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Directory to array to select box...
how about that: $file\n"; } ?> in your example there are two mistakes: 1. "while ($file = readdir($dir))" is wrong and should be "while (false !== ($file = readdir($dir))". (see php manual readdir) 2. "$file_count .="$file";" is not inside the loop, so you will only get the last $file and not all (3. you probably do not need "." and ".." in your list, "." is a reference to the same directory and ".." to the directory above the current one) "Jas" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Ok here is my problem, for one I am new to php and would like a new pair of > eyes for this piece of code, and second what I would like to accomplish is > putting the contents of a directory into an array and then pulling the > contents of that array into a select box for further processing... If > someone could give me some more information on GetDirArray() or a different > way to accomplish this problem that would be great... this is where I am > thus far. > > $i=0; // counter > $files = array(); // array to store directory content > > // open directory > $dir = opendir("/home/web/b/bignickel.net/htdocs/"); > > // loop through directory and put filenames into an array > while ($file = readdir($dir)) { > $files[$i] = $file; > $i++; > } > // pull $file (directory array into select box) > $file_count .="$file"; > $form = " > $file_count > > "; > // close directory > closedir($dir); > ?> > Then of course I just use an echo to display the select box but so far I > have not been able to have it actually work so any help would be great.. > Thanks in advance, > jas > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Directory to array to select box...
Since I ran this on Win2000 machine, I changed name of directory: You were right on the money with your code; just a minor mod or two was required: $filex\n"; } $form = "\n". "$file_count\n". "\n". ""; // close directory closedir($dir); print $form; ?> outputs the following: . .. activities.txt addwbs.php3 classWBS.php funcs.inc link.php snoopy.inc wbs.sql wbsconv.php wbsform.php3 wbsload.sql wbspkg.php3 wbsproject.csv wbsproject.mpp xx.php -Original Message- From: Jas [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 9:33 AM To: [EMAIL PROTECTED] Subject: [PHP] Directory to array to select box... Ok here is my problem, for one I am new to php and would like a new pair of eyes for this piece of code, and second what I would like to accomplish is putting the contents of a directory into an array and then pulling the contents of that array into a select box for further processing... If someone could give me some more information on GetDirArray() or a different way to accomplish this problem that would be great... this is where I am thus far. $file"; $form = " $file_count "; // close directory closedir($dir); ?> Then of course I just use an echo to display the select box but so far I have not been able to have it actually work so any help would be great.. Thanks in advance, jas -- 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] Explode and Trim
It works great using the foreach statements, but for some reason couldn't make it work the other way. Oh well, no one ever said there was only one way to do things when programming. Thanks for your help. --- Joshua E Minnie CIO [EMAIL PROTECTED] "Don't work for recognition, but always do work worthy of recognition." "Maxim Maletsky" <[EMAIL PROTECTED]> wrote:> > I think what yo wrote should be working fine for you. > > My way of your code: > > > > > foreach(file($storelist) as $line_num=>$line_data) { > foreach(explode(':', $line) as $key=>$val) { > $val = trim($val); // remove whitespaces around > > // now you are inside each element of your > multidimentional array > // combine your rest of the code and work it out the way > you need it. > > } > } > > > > Sincerely, > > Maxim Maletsky > Founder, Chief Developer > > PHPBeginner.com (Where PHP Begins) > [EMAIL PROTECTED] > www.phpbeginner.com > > > > -Original Message- > > From: Joshua E Minnie [mailto:[EMAIL PROTECTED]] > > Sent: Friday, April 05, 2002 1:07 AM > > To: [EMAIL PROTECTED] > > Subject: [PHP] Explode and Trim > > > > I am parsing through a text file and using explode to convert the > string to > > an array. The problem seems to be at the end of the string, when I > check to > > see if the last element in the array is empty it tells me that it is > not. > > The problem comes because the last element should be empty because all > that > > was after the separator was white space. > > > > ---Sample text file--- > > AL:123 2nd Ave.:SomeCity:(123) 456-7890:(123) 456-1234::: > > MI:293 3rd St.:Another City:(123) 345-2839:(123) 384-0398::: > > MI:437 4th Ave.:Yet Another City:(123) 283-4839:(123) 458-4843::: > > ---End of text file--- > > > > ---Code snippit--- > > $stores = file($storelist); > > for($i=0; $i > //$stores[$i] = trim($stores[$i],"\r"); > > //$stores[$i] = trim($stores[$i],"\n"); > > //$stores[$i] = trim($stores[$i], ":"); > > //$stores[$i] = rtrim($stores[$i]); > > echo $stores[$i]."\n"; > > $stores[$i] = explode(":", $stores[$i]); > > } > > > > reset($states); > > while(current($states) && current($stores)) { > > for($i=0; $i > while($stores[$i][0] != key($states)) { > > next($states); > > $state = 0; > > } > > if($state==0) { > > echo "".$states[$stores[$i][0]]."\n"; > > $state = 1; > > } > > echo $stores[$i][1].", ".$stores[$i][2]."Phone: > > ".$stores[$i][3]."Fax: ".$stores[$i][4]."\n"; > > if(!empty($stores[$i][5])) echo "Email: ".$stores[$i][5]."\n"; > > if(!empty($stores[$i][6])) echo "Web site: > ".$stores[$i][6]."\n"; > > if(!empty($stores[$i][7]) && $stores[$i][7] != "") echo > "Additional > > notes: ".$stores[$i][7]."\n"; > > echo ""; > > } > > } > > ---End of code snippit--- > > > > Here is the URL of where the code is being used: > > www.wildwebtech.com/acs/nuven/stores.php. The additional notes should > only > > show up if there were additional notes. > > > > -- > > Joshua E Minnie > > CIO > > [EMAIL PROTECTED] > > > > "Don't work for recognition, but always do work worthy of > recognition." > > > > > > > > -- > > 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] Notice: recent FAQ discussions
For anyone who may have missed the recent debate: We seem to have come down to two groups: the majority seem to be headed for a web-based searchable FAQ, while a small minority - myself and two or three others - want a succint text-based FAQ to post on the newsgroup at regular intervals. As the two are not mutually exclusive, I am going to wish the majority best of luck and proceed in developing a postable FAQ, following the general outline I posted several days ago. I will post preliminary versions for comment as soon as possible. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Directory to array to select box...
Ok I tried a different way to do it and this is the resulting code... I still need to be able to make some hidden fields so the contents of the item selected may be passed to another script which will stick the path of the file into a database table if anyone wants to give me a hand with that part. Here is what I have and it is working as far as just reading the directory and putting the contents into a select box... $file_name"; // read the directory and place them into file names for further processing while ($file_name = readdir($dir)) { // exclude "." and ".." file names if (($file_name != ".") && ($file_name !="..")) { // variable to place results of directory into select box $file_list .= "$file_name"; } } // closing select and form and adding select button $file_list .= ""; // close the directory closedir($dir); ?> If anyone knows how to do this in a better way please let me know, but this works and all it needs is some hidden fields (i am assuming here) so that the item that the user selects from the list can be further processed, like sticking the file path (not the actual file) into a database table. (I need help with that...) Enj0y! Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Directory to array to select box...
Hey Rick, thanks a ton... you have helped me out alot on this list. I got the code working probably about the same time you and another gentleman posted the same fixes I made, however I now have another question about adding a hidden field to take the results of the users selection and passing it along to another form which will stick it into a database, not the file mind you, i simply need to stick the path of the file into a database table. If you have any suggestions on how to do this that would be great. Thanks again, Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to process URL parameers
On Friday, April 5, 2002, at 10:36 AM, Wo Chang wrote: > So, if I want to include multiple parameters, > I'll use something like: ?a=1?b=2 right? No, actually in the querystring the ? only serves to separate the URL from the querystring. So you can only use it once, immediately after the URL. To add additional values, you use the & sign. url.com?a=1&b=2&c=3 etc. > Another question: if I want to hide all these > parameters at the url, how I can do that without > using the form. If you want to do that, it's a little more complex -- you can't use the querystring at all. You need to pass your values via the POST method in HTTP. The easiest way to do this is to make an HTML form and specify the method of the tag as POST (like this: ). There is another way, it's a bit more involved. You open a socket with the server and directly send the data as POST data. This allows you to avoid having to bother with a form. Rasmus Lerdorf wrote a function to do this (takes most of the work out of it) but it helps to understand how sockets work if you're going to take this route. Let me know if you want this function, I have a copy of it. I CC'd this back to the list, because there are probably others who can benefit from this conversation -- in general, try to keep discussion on the list unless there is some reason for privacy. Feel free to ask if you have more questions! 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] getting lines from the highest ID in a database?
On Friday 05 April 2002 18:27, Hawk wrote: > Lets say I have a guestbook, and that I only want to show the last entry on > my first page > I cant figure out a good way to do it.. > haven't managed to find a mysql command that can do it either, but maybe > there are? :) The only reliable way to do it is to have a field in your guestbook table which records the time that the entry was made. Then you can: SELECT * FROM guestbook ORDER BY time_entered LIMIT 1 I have set follow-up to [EMAIL PROTECTED] where this belongs. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* If there is any realistic deterrent to marriage, it's the fact that you can't afford divorce. -- Jack Nicholson */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Directory to array to select box...
I must be missing something. Just add a HIDDEN type in your form. It will be sent with all your form data. -Original Message- From: Jas [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 10:14 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Directory to array to select box... Hey Rick, thanks a ton... you have helped me out alot on this list. I got the code working probably about the same time you and another gentleman posted the same fixes I made, however I now have another question about adding a hidden field to take the results of the users selection and passing it along to another form which will stick it into a database, not the file mind you, i simply need to stick the path of the file into a database table. If you have any suggestions on how to do this that would be great. Thanks again, Jas -- 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] Directory to array to select box...
So adding a hidden field would definately pass the contents of the select box to the other script so I am not doing anything wrong with this portion, but what if I wanted to append the path of the file name? Any tips? Thanks, jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Directory to array to select box...
the contents of the SELECT box and the contents of the HIDDEN field are separate entities. Append the path upon transfer to the next PHP script Show us what you REALLY want to do here instead of keeping us guessing... -Original Message- From: Jas [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 10:22 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Directory to array to select box... So adding a hidden field would definately pass the contents of the select box to the other script so I am not doing anything wrong with this portion, but what if I wanted to append the path of the file name? Any tips? Thanks, jas -- 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] conditionaly including classes/functions
Is it okay practice to condtionally include php files that contain only classes or functions (as opposed to just straight code)? The result is a class or function inserted right in the middle of an if{} block: } elseif ($var=='a') { include('temp.php'); $obj = new foo; echo $obj->hello(); } The above code expanded looks like this (below). Works, but it seems wierd to be able to have a class in the middle of an if{} code block. } elseif ($var=='a') class foo { function hello() { return "Hello"; } } $obj = new foo; echo $obj->hello(); } Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] conditionally including classes/functions
It's okay to do so. That's why include() was created; to provide conditional inclusion. -Original Message- From: Andrew Warner [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 11:29 AM To: [EMAIL PROTECTED] Subject: [PHP] conditionaly including classes/functions Is it okay practice to condtionally include php files that contain only classes or functions (as opposed to just straight code)? The result is a class or function inserted right in the middle of an if{} block: } elseif ($var=='a') { include('temp.php'); $obj = new foo; echo $obj->hello(); } The above code expanded looks like this (below). Works, but it seems wierd to be able to have a class in the middle of an if{} code block. } elseif ($var=='a') class foo { function hello() { return "Hello"; } } $obj = new foo; echo $obj->hello(); } Andrew -- 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] refresh
I want to be able to refresh my browser window after a submission to a database. Is there a reliable function out there that can accomplish this? Kris
Re: [PHP] how to process URL parameers
Thanks Eric, very good info!! For now, I jsut process the string after the "?". Things working fine. Many thanks! --Wo - Original Message - From: "Erik Price" <[EMAIL PROTECTED]> To: "Wo Chang" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, April 05, 2002 11:14 AM Subject: Re: [PHP] how to process URL parameers > > On Friday, April 5, 2002, at 10:36 AM, Wo Chang wrote: > > > So, if I want to include multiple parameters, > > I'll use something like: ?a=1?b=2 right? > > No, actually in the querystring the ? only serves to separate the URL > from the querystring. So you can only use it once, immediately after > the URL. To add additional values, you use the & sign. > > url.com?a=1&b=2&c=3 > etc. > > > Another question: if I want to hide all these > > parameters at the url, how I can do that without > > using the form. > > If you want to do that, it's a little more complex -- you can't use the > querystring at all. You need to pass your values via the POST method in > HTTP. The easiest way to do this is to make an HTML form and specify > the method of the tag as POST (like this: action="targetpage.php">). > > There is another way, it's a bit more involved. You open a socket with > the server and directly send the data as POST data. This allows you to > avoid having to bother with a form. Rasmus Lerdorf wrote a function to > do this (takes most of the work out of it) but it helps to understand > how sockets work if you're going to take this route. Let me know if you > want this function, I have a copy of it. > > I CC'd this back to the list, because there are probably others who can > benefit from this conversation -- in general, try to keep discussion on > the list unless there is some reason for privacy. > > Feel free to ask if you have more questions! > > > 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] Directory to array to select box...
Sorry, here is what I have thus far... everything is working except I am just not sure how to pass the result of the users selection to another script, I have added the hidden input type to try and solve it but I think I am doing something wrong, maybe I need to put the hidden input type on the second script to place the contents into the database, here is the code... $file_name"; while ($file_name = readdir($dir)) { if (($file_name != ".") && ($file_name !="..")) { $file_list .= "$file_name"; } } // added hidden field here... and so far it is not getting any value, so i am assuming that i need it on my ad_done.php3 script??? $file_list .= ""; closedir($dir); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Writing to Files
Hey All, I have recently been trying to create some logs for the install script I have been making (to make it easier for me to diagnose problems) but I am wondering how to create and write to text files. I know about the fopen() and fwrite() functions, which theoretically should enable me to do this however I am not exactly sure how I should go about this. Also, I realize that there is limited formatting I can have with text, however I would like to know if its possible to control the line spacing between the entries, and whether or not its possible to indent lines. Lastly, are text files a good idea for logs? Do any of you use anything else I should be aware of? Thanks for all your help! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] conditionaly including classes/functions
On Thursday, April 4, 2002, at 12:28 PM, Andrew Warner wrote: > Is it okay practice to condtionally include php files that contain only > classes or functions (as opposed to just straight code)? The result > is a class or function inserted right in the middle of an if{} block: It is better to do so, since you don't waste the processor's time with the function/class or include() process if you don't really need it. However, it can be tricky making sure that these libraries are available to your code, since there is now a condition determining whether or not it will be processed. 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] Re: Directory to array to select box...
ok, i'll try to help, but first use "while (false !== ($file = readdir($dir))". ;) why do you need hidden fields on that page? to determine which file the user has selected? hmmm...ok, let's see: The user sees your form, selects the desired file and submits the form. Now the page processing the request will know which one was selected. in your case $files will contain the value of the selected option field within the select-box files. So why do you need additional input fields for that? Please explain a bit more detailed what exactly is your problem. "Jas" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Ok I tried a different way to do it and this is the resulting code... I > still need to be able to make some hidden fields so the contents of the item > selected may be passed to another script which will stick the path of the > file into a database table if anyone wants to give me a hand with that part. > Here is what I have and it is working as far as just reading the directory > and putting the contents into a select box... > // varible to hold path to directory we wish to open > $dir_name = "/path/to/directory/on/server/"; > // opening directory > $dir = opendir($dir_name); > // varible to start form > $file_list .= " > $file_name"; > // read the directory and place them into file names for further processing > while ($file_name = readdir($dir)) { > // exclude "." and ".." file names > if (($file_name != ".") && ($file_name !="..")) { > // variable to place results of directory into select box > $file_list .= "$file_name"; > } > } > // closing select and form and adding select button > $file_list .= " VALUE=\"select\">"; > // close the directory > closedir($dir); > ?> > If anyone knows how to do this in a better way please let me know, but this > works and all it needs is some hidden fields (i am assuming here) so that > the item that the user selects from the list can be further processed, like > sticking the file path (not the actual file) into a database table. (I need > help with that...) Enj0y! > Jas > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Directory to array to select box...
When ad_done.php3 is called, it will receive a variable named $files. Change: $file_name"; to: "; $files will contain the value of the file selected -Original Message- From: Jas [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 10:36 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Directory to array to select box... Sorry, here is what I have thus far... everything is working except I am just not sure how to pass the result of the users selection to another script, I have added the hidden input type to try and solve it but I think I am doing something wrong, maybe I need to put the hidden input type on the second script to place the contents into the database, here is the code... $file_name"; while ($file_name = readdir($dir)) { if (($file_name != ".") && ($file_name !="..")) { $file_list .= "$file_name"; } } // added hidden field here... and so far it is not getting any value, so i am assuming that i need it on my ad_done.php3 script??? $file_list .= ""; closedir($dir); ?> -- 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] regexp for ' replacement
Yet another regexpr question. If I have as part of a text: ...and then 'the quick brown fox jumped over the lazy dog's piano'... How can I substitute the single quote in "dog's" with say \' I want to aply a substitution for only the single quote that is between two single quotes and leave the rest of the text in between the same. Make sense for regexpr usage? TIA, thalis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Javascript and PHP??
sure you can use javascript in your php. php is serverside and produces the page. the webserver sends then this produced page to the client. so javascript is the same as html for php. it's just some lines of text. "Joe Keilholz" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello All! > > I think this is a pretty simple question. I have a file that I am writing > information to and when the process is complete, I am needing to send the > file to the user. In Javascript all I would need to do is window.open() and > the file would be sent to the user (it's a .csv file). How would I > accomplish this in PHP? Can I incorporate Javascript into my PHP code? If > so, how? > > Any help would be appreciated! > Thanks! > Joe Keilholz > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Writing to Files
http://www.php.net/manual/en/function.printf.php try sprintf to format the string and then fwrite I use text files to log debug msgs in my programs as they are not too heavy duty applications. - Original Message - From: "Sebastian A." <[EMAIL PROTECTED]> To: "PHP General List (PHP.NET)" <[EMAIL PROTECTED]> Sent: Friday, April 05, 2002 11:29 AM Subject: [PHP] Writing to Files > Hey All, > I have recently been trying to create some logs for the install script I > have been making (to make it easier for me to diagnose problems) but I am > wondering how to create and write to text files. I know about the fopen() > and fwrite() functions, which theoretically should enable me to do this > however I am not exactly sure how I should go about this. Also, I realize > that there is limited formatting I can have with text, however I would like > to know if its possible to control the line spacing between the entries, and > whether or not its possible to indent lines. Lastly, are text files a good > idea for logs? Do any of you use anything else I should be aware of? > > Thanks for all your help! > > > -- > 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] Re: using new AUTOGLOBALS
the thing is, using the methods I described in my first post, the superglobals or autoglobals arent working. I cant figure out why, and , like the other guy said, most books dont include this feature in a topic for discussion. Can anyone offer advice? "Cyberskydive" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > So I wanna learn how to code properly with register_globals off, I reead on > PHP.net about the new auto globals and inmy new php4.1.2 windows > installation using php.ini-rec edited according to the intall.txt file, and > a few changes from books I have (upload tmp dir etc) I'm off to learn how to > use the new auto globals. I've tried $_REGISTER and $_POST . Here is what I > tried as a simple test. > > > > > > > --somefile.php-- > > > print("$_REGISTER["is_name"]"); > or > print("$_POST["is_name"]"); > > ?> > > I also tried $HTTP_POST_VARS["name"] > > I didnt think about it till now but would it work if i assigned say : > $is_name = getenv($_POST or $_REGISTER); > > this came about while I was learning sessions, which were not working right > with 4.0 installed with APACHE on windows. So I decided to update my php, as > an ISAPI module, instead of running as a cgi version, and I left > register_globals off. > > when I tried to edit an example session script I had from a book to use > $_POST, $_REGISTER, or even $_SESSION i got a blank page on the reload. I > think sid is returning empty. > > Can anyone offer me advice on this, proper coding and or proper > configuration in PHP.INI > > I'm trying to learn all this at once-lol, and learn it properly the first > time around, especially since register globas will be deprecitated-poof. > > I WANT TO BE A GOOD PHP DUDE_LOL_HAHA > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP books
I have 2 PHP books the first is called PHP fast & easy web development -from primatech the second is called CORE PHP PROGRAMMING by Leon Atkinson I like them both, and I was glad I read fast & easy first, i like core php alot, havent read the whole thing yet, been kinda referencing around it, but still reading the whole thing. has anyone else used these books? what are your opinions and what are some other grest books out there? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: using new AUTOGLOBALS
On Friday, April 5, 2002, at 12:09 PM, cyberskydive wrote: > the thing is, using the methods I described in my first post, the > superglobals or autoglobals arent working. I cant figure out why, and , > like > the other guy said, most books dont include this feature in a topic for > discussion. > > Can anyone offer advice? Post your exact code, I'll look at it. 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] Any ideas on combining arrays????
perhaps: $FFR = array("TU4R" => array("data" => array(array("count" => "TU4R is 0"), array("count" => "TU4R is 1"), array("count" => "TU4R is 2"))), "PH01" => array("data" => array(array("count" => "PH01 is 0"; print_r($FFR); "Rick Emery" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > ok...so what problem are you having? what's the error? > your code worked for me, i.e., it compiled and executed > > -Original Message- > From: Scott Fletcher [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, April 03, 2002 11:15 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Any ideas on combining arrays > > > Hi! > > Need some ideas on combining some arrays into one! I have array for > data and other array for counter. How do I make an array that would show > different data for each counter number? > > -- clip -- >$FFR = array ( > "TU4R" => array( "data" => "", "count" => "" ), > "PH01" => array( "data" => "", "count" => "" ), >); > -- clip -- > > The response should look something like this when I pick the correct > data and correct count; > >$FFR["TU4R"]["data"]["0"]["count"] = "TU4R is 0"; >$FFR["TU4R"]["data"]["1"]["count"] = "TU4R is 1"; >$FFR["TU4R"]["data"]["2"]["count"] = "TU4R is 2"; > > I tried to do something like this but it doesn't work. I have been > working for 2 days trying to figure it out. I appreciate any help you can > provide for me. > > Thanks, > Scott > > > > -- > 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 books
On Friday, April 5, 2002, at 12:12 PM, cyberskydive wrote: > what are your opinions and what are some other grest books out there? grest -- is that like "great" and "best" ? ;) I think that Visual QuickPro PHP Advanced, which just came out a month or two ago, is pretty good. I learned a lot of techniques like using templates and PHP's object oriented features, and some non-introductory coverage of things like databases and security. However, the book is more like a rough guide than an in-depth tutorial, so you really need to already know PHP to use it (which is why I liked it -- short and sweet). I'd recommend it to someone who knows PHP basics but might want to know how shopping carts are written, or how to use OO or some security and database advice. There's a chapter on XML too, but the XML stuff in PHP changes at times so I wouldn't rely on it. Rasmus Lerdorf wrote a book on PHP for O'Reilly, it apparently just came out a few days ago although I haven't read it. I believe it covers many advanced topics as well (not just a tutorial). 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] Re: What's wrong with the Array? I"m baffled!
> $number = $sumItUp[$name]; > $number++; > $sumItUp[$name] = $number; this could be done easier: $sumItUp[$name]++; :) "Scott Fletcher" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi! > > I'm a little baffled on why the array is not working the way I expect it > to. It showed there is something about the array I do not know about. > Well, it's never too late to learn something new. So, here's the code and > see if you can help me out. > > -- clip -- > > $name = "TU4R"; > > if ($sumItUp[$name] == "") { > $sumItUp[$name] = 0; > } else { > //debug > echo "**"; > $number = $sumItUp[$name]; > $number++; > $sumItUp[$name] = $number; > } > echo $sumItUp[$name].""; > > -- clip -- > > In this case, the if statement never went into else statement when > there's a number like 0, 1, 2, etc. So, what's the heck is happening here? > When the array, "sumItUp[]" was empty then the number "0" was assigned and > it work like a charm. So, when this code is repeated again, the if > statement check the array, "sumItUp[]" and found a number, "0" and it is not > equal to "" as shown in the if statement. So, therefore the else statement > should be executed. But in this case, it never did. I tested it myself to > make sure I wasn't missing something by putting in the php codes, "echo > '**';" and the data, "**" was never spitted out on the webpage. So, it tell > me that the else statment was never executed. So, the problem had to do > with the data in the array itself. So, can anyone help me out? Thanks a > million!! > > Scott > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] refresh
after database submission, header("location: ...") re-directed to the script you wish to go to -Original Message- From: Kris Vose [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 10:31 AM To: [EMAIL PROTECTED] Subject: [PHP] refresh I want to be able to refresh my browser window after a submission to a database. Is there a reliable function out there that can accomplish this? Kris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] regexp for ' replacement
addslashes($textline) -Original Message- From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 10:54 AM To: [EMAIL PROTECTED] Subject: [PHP] regexp for ' replacement Yet another regexpr question. If I have as part of a text: ...and then 'the quick brown fox jumped over the lazy dog's piano'... How can I substitute the single quote in "dog's" with say \' I want to aply a substitution for only the single quote that is between two single quotes and leave the rest of the text in between the same. Make sense for regexpr usage? TIA, thalis -- 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] Writing to Files
try creating a script with fopen(), fwrite(), etc. When you run into problems, ask here. $filex = fopen("myfile","w"); fwrite( $filex, "write this here"); fclose($filex); -Original Message- From: Sebastian A. [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 10:29 AM To: PHP General List (PHP.NET) Subject: [PHP] Writing to Files Hey All, I have recently been trying to create some logs for the install script I have been making (to make it easier for me to diagnose problems) but I am wondering how to create and write to text files. I know about the fopen() and fwrite() functions, which theoretically should enable me to do this however I am not exactly sure how I should go about this. Also, I realize that there is limited formatting I can have with text, however I would like to know if its possible to control the line spacing between the entries, and whether or not its possible to indent lines. Lastly, are text files a good idea for logs? Do any of you use anything else I should be aware of? Thanks for all your help! -- 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+myslq+IDE
http://dev.zaireweb.com/phpcoder.exe That should be the file - Original Message - From: "Charles Little" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, April 04, 2002 4:59 AM Subject: RE: [PHP] php+myslq+IDE > > Try PHP Coder (not Maguma's Version, becuase PHP Coder kicks it's ass) > > > > I can email you the installed, as there site seems to be down now.. > > > Could you e-mail it to me, also? > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] regexp for ' replacement
Nop. I don't want to affect the first and last ' of every line. On Fri, 5 Apr 2002, Rick Emery wrote: > addslashes($textline) > > -Original Message- > From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]] > Sent: Friday, April 05, 2002 10:54 AM > To: [EMAIL PROTECTED] > Subject: [PHP] regexp for ' replacement > > > Yet another regexpr question. > If I have as part of a text: > ...and then 'the quick brown fox jumped over the lazy dog's piano'... > > How can I substitute the single quote in "dog's" with say \' > I want to aply a substitution for only the single quote that is between two > single quotes and leave the rest of the text in between the same. > > Make sense for regexpr usage? > > TIA, > thalis > > > -- > 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] conditionally including classes/functions
> -Original Message- > From: Andrew Warner [mailto:[EMAIL PROTECTED]] > Sent: Thursday, April 04, 2002 11:29 AM > To: [EMAIL PROTECTED] > Subject: [PHP] conditionaly including classes/functions > > Is it okay practice to condtionally include php files that contain > only classes or functions (as opposed to just straight code)? The > result is a class or function inserted right in the middle of an if{} > block: I would find it much more useful to do something like a transparent include-on-first-use; for a function this shouldn't be too hard, but I have no idea how to make it work for a class short of wrapping every method independantly. function MyLazy($a) { if (!function_exists("contentsMyLazy")) include("contentsmylazy.php");// define the function return contentsMyLazy($a); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Miguel...
On Fri, 5 Apr 2002, Anthony Ritter wrote: > Now I have a .txt file of my sql statement. > >> As others have suggested, you can use phpmyadmin to import this file, or >> you can just pipe it into the mysql command-line tool on the server once >> you've created your database. Look inside the file created by mysqldump >> and all will be much clearer. > > I take that to mean (the ISP's remote server where my website resides). > Right? > > How can I get the compete mysql statement onto the ISP's server? If you have shell access on your ISP's server, the quickest way to get that data into the database there is to copy the file across (using FTP or scp or whatever you use) and then pipe it straight in. Assuming that the mysqldump file is called 'data.txt', your database name is 'my_database' and your database username is 'me', you could use a command like this: mysql -p -u me my_database < data.txt It'll ask for your password and then the data will be in. If you don't have command-line access, you could use a tool like phpmyadmin, which your ISP may provide. It has an option to import data from a mysqldump file. Worst comes to worst, you can write a quick PHP script that reads each line of the .txt file and sends it to mysql_query. Just skip blank lines and comments (lines starting with #). miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Making sure a post request came from your site
For security, you can modify your code so that you check the $_POST elements instead of using the magic globals. That's all well and good. However, someone copy and save your HTML to their local machine, change some values, change the "Action" page of the form to be http://www.yoursite.com/form_page.php instead of "form_page.php". You'll be checking the $_POST elements but you won't have any idea that they were changed and posted from the user's local machine. Is there any way to determine from where the post request came from w/o using http_referer? Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using new AUTOGLOBALS
On Fri, 5 Apr 2002, cyberskydive wrote: > So I wanna learn how to code properly with register_globals off, I reead on > PHP.net about the new auto globals and inmy new php4.1.2 windows > installation using php.ini-rec edited according to the intall.txt file, and > a few changes from books I have (upload tmp dir etc) I'm off to learn how to > use the new auto globals. I've tried $_REGISTER and $_POST . Here is what I > tried as a simple test. > > > > > > > --somefile.php-- > > > print("$_REGISTER["is_name"]"); > or > print("$_POST["is_name"]"); > > ?> Two problems. 1) It's $_REQUEST, not $_REGISTER 2) Take the outermost quotes off the argument to your print, like so: print $_REQUEST["is_name"]; miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Directory to array to select box...
On Fri, 5 Apr 2002, Jas wrote: > So adding a hidden field would definately pass the contents of the select > box to the other script so I am not doing anything wrong with this portion, > but what if I wanted to append the path of the file name? Any tips? This isn't an answer to your question, but I just wanted to warn you: If you place something like a path in a hidden field, or as part of a select option, you have no guarantee that a user won't change it before submitting the form. Most browsers won't let them, but there are plenty of other ways they can (for instance, debugging web proxies that allow editing of raw form submissions, and so on). So it's VERY IMPORTANT that you don't rely on this path without doing further checks to make sure it's really valid. Otherwise people could try to read or write any file on your system. They probably won't get away with writing directly, but if they manage to read your password file or something, they soon will be writing. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Authorize.net interface
I was wondering if someone just point me to a good example of a PHP interface for Authorize.net to work with ADC Relay Response. Thanks, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making sure a post request came from your site
On Fri, 5 Apr 2002, Chris Boget wrote: > For security, you can modify your code so that you check > the $_POST elements instead of using the magic globals. > That's all well and good. > However, someone copy and save your HTML to their local > machine, change some values, change the "Action" page of the > form to be http://www.yoursite.com/form_page.php instead of > "form_page.php". You'll be checking the $_POST elements > but you won't have any idea that they were changed and posted > from the user's local machine. > Is there any way to determine from where the post request came > from w/o using http_referer? No, nor with it. Someone who wants to mess with you can supply any HTTP referer they want to (using something like 'curl -e' or just creating the request by hand in a text editor). You can never assume that submitted data is benign or untampered. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to process URL parameers
> "Erik" == Erik Price <[EMAIL PROTECTED]> writes: [. . .] Erik> There is another way, it's a bit more involved. You open a Erik> socket with the server and directly send the data as POST Erik> data. This allows you to avoid having to bother with a Erik> form. Rasmus Lerdorf wrote a function to do this (takes Erik> most of the work out of it) but it helps to understand how Erik> sockets work if you're going to take this route. Let me Erik> know if you want this function, I have a copy of it. you can use curl also. -- Share your feedback at Affero: http://svcs.affero.net/rm.php?r=leed_25 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and mySQL...
On Fri, 5 Apr 2002, Anthony Ritter wrote: > Any idea what the cost is for the ISP to install mySQL on their end so that > I can utilize my database that I've set up on localhost? MySQL is free for that sort of usage, so it only costs their time. If they've done it before, it takes about 5 minutes from beginning the download to standing up and clapping yourself on the back for a job well done - in a unix environment, anyway. Not sure what's involved on the Windows side but I expect it's slightly more complicated. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] regexp for ' replacement
regexp is not what you need then You will require a character-by-character search/replace or try: which produces: $q= 'here's to you' $a= \'here\'s to you\' $z= 'here\'s to you' -Original Message- From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 11:35 AM To: Rick Emery Cc: [EMAIL PROTECTED] Subject: RE: [PHP] regexp for ' replacement Nop. I don't want to affect the first and last ' of every line. On Fri, 5 Apr 2002, Rick Emery wrote: > addslashes($textline) > > -Original Message- > From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]] > Sent: Friday, April 05, 2002 10:54 AM > To: [EMAIL PROTECTED] > Subject: [PHP] regexp for ' replacement > > > Yet another regexpr question. > If I have as part of a text: > ...and then 'the quick brown fox jumped over the lazy dog's piano'... > > How can I substitute the single quote in "dog's" with say \' > I want to aply a substitution for only the single quote that is between two > single quotes and leave the rest of the text in between the same. > > Make sense for regexpr usage? > > TIA, > thalis > > > -- > 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] refresh
yes, put the name of the PHP file -Original Message- From: Kris Vose [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 12:23 PM To: Rick Emery Subject: RE: [PHP] refresh When I delete a record from a table in php it loops back to the table. However, It does not show that the record has been deleted. I have to click on the refresh button to see the change. I am not sure how this header function works. Do you put the name of the php file as the location? Kris -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 12:09 PM To: Kris Vose; [EMAIL PROTECTED] Subject: RE: [PHP] refresh after database submission, header("location: ...") re-directed to the script you wish to go to -Original Message- From: Kris Vose [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 10:31 AM To: [EMAIL PROTECTED] Subject: [PHP] refresh I want to be able to refresh my browser window after a submission to a database. Is there a reliable function out there that can accomplish this? Kris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regexp for ' replacement
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Thalis A. Kalfigopoulos) wrote: > If I have as part of a text: > ...and then 'the quick brown fox jumped over the lazy dog's piano'... > > How can I substitute the single quote in "dog's" with say \' > I want to aply a substitution for only the single quote that is between two > single quotes and leave the rest of the text in between the same. Does this work for you? $str="...and then 'the quick brown fox jumped over the lazy dog's piano'..."; echo $str=preg_replace("/'(.*)'(.*)'/U","'$1\'$2'",$str); -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making sure a post request came from your site
> > Is there any way to determine from where the post request came > > from w/o using http_referer? > No, nor with it. I know that http_referer is unviable, that's why I asked if you can find out that data w/o using it. > Someone who wants to mess with you can supply any HTTP > referer they want to (using something like 'curl -e' or just creating the > request by hand in a text editor). Understood. > You can never assume that submitted data is benign or untampered. Ok, then how do you go about checking to make sure that submitted data is, in fact, benign and acceptable for your use? Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: conditionaly including classes/functions
In article, [EMAIL PROTECTED] (Andrew Warner) wrote: > Is it okay practice to condtionally include php files that contain > only classes or functions (as opposed to just straight code)? The > result is a class or function inserted right in the middle of an if{} > block: > > > } elseif ($var=='a') > { > include('temp.php'); > > $obj = new foo; > echo $obj->hello(); > > } It's fine, but since redeclaring functions is an error, better to use include_once() or require_once(). -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making sure a post request came from your site
On Friday, April 5, 2002, at 01:15 PM, Miguel Cruz wrote: >> For security, you can modify your code so that you check >> the $_POST elements instead of using the magic globals. >> That's all well and good. >> However, someone copy and save your HTML to their local >> machine, change some values, change the "Action" page of the >> form to be http://www.yoursite.com/form_page.php instead of >> "form_page.php". You'll be checking the $_POST elements >> but you won't have any idea that they were changed and posted >> from the user's local machine. >> Is there any way to determine from where the post request came >> from w/o using http_referer? > > No, nor with it. Someone who wants to mess with you can supply any HTTP > referer they want to (using something like 'curl -e' or just creating > the > request by hand in a text editor). > > You can never assume that submitted data is benign or untampered. Exactly. I was kind of blown away when I realized how it all works for the first time -- for a few weeks I was assuming that using listboxes or radio buttons was safer than using text inputs, since it limits what kind of data the user can send you. But this was completely false security on my part, because in reality, the user can send you whatever they want -- the browser is only one way to provide this ability to users. Anyone can use telnet to try to send you any POST data they wish, and even the stupidest of crackers can figure out how to send GET data in the browser's "Address" bar (as you point out in your original post) or modify the value in their cookies. How to make sure that input or other elements of your HTML pages are safe? Religious error checking. Write some decent error checking functions, and then run them on any user-input data you get before you allow that data to have any effect on your code. DevShed recently had an article on the subject of writing a class for form validation: http://www.devshed.com/Server_Side/PHP/FormValidatorClass/page1.html And remember, unless your server is unplugged in a locked room, it's never really safe from intrusion. 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