[PHP] Putting an image or logo on another image.
<< THIS ASSUMES THAT THE IMAGE WAS UPLOADED OK >> // ADD A FILE NAME TO THE UPLOADED FILE. $pageDestinationFile="$pageGalleryPath/image_".$pagePicNum."_temp.jpg"; // LETS MOVE THE IMAGE OUT OF THE TEMP DIR. move_uploaded_file ($uploadedfile, $pageDestinationFile); // USER OUTPUT. echo "Image #$i:"; echo "Temp File Uploaded: ../image_".$pagePicNum."_temp.jpg"; echo "Status: $statusresult"; // MAAKE THEM 800x600 $sourcepath="$pageDestinationFile"; // Source Image Path -- Destination from FileUpload() $srcimagehw = GetImageSize($sourcepath); //GetImage Info -- Source Image $src_width="$srcimagehw[0]"; // Source Image Width $src_height="$srcimagehw[1]"; // Source Image Height //Set some Variabled about the Output Image $samplepath1="$pageGalleryPath/image_".$i.".jpg"; //path of output sample image ;-) $dest_width="800"; // Destination Width $dest_height="600"; // Destination Height (Fixed Aspect Ratio) $dest_height= ($src_height * $dest_width) / $src_width; //Destination Height (Variable Aspect Ratio) $quality="90"; // JPEG Image Quality $src_img = imagecreatefromjpeg("$sourcepath"); $dst_img = imagecreatetruecolor($dest_width,$dest_height); imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height); imageinterlace($dst_img, 1); imagejpeg($dst_img, "$samplepath1", $quality); $white = ImageColorAllocate($dst_img, 255, 255, 255); $photoImage = ImageCreateFromJPEG("$pageDestinationFile"); ImageAlphaBlending($photoImage, true); $logoImage = ImageCreateFromPNG("$sitePath/$siteUploads/image.png"); $logoW = ImageSX($logoImage); $logoH = ImageSY($logoImage); $dest_width="800"; // Destination Width $dest_height="600"; // Destination Height (Fixed Aspect Ratio) $dest_height= ($src_height * $dest_width) / $src_width; //Destination Height (Variable Aspect Ratio) ImageCopy($photoImage, $logoImage, 0, 0, 0, 0, $logoW, $logoH); imagejpeg($dst_img, "$pageGalleryPath/image_".$i."final.jpg", $quality); ImageDestroy($photoImage); ImageDestroy($logoImage); Any Ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need assistance using sendmail or mail()
Nathan Nobbe wrote: > On Jan 30, 2008 2:47 AM, Per Jessen <[EMAIL PROTECTED]> wrote: > >> Philip, please state what sort of problems you are having. mail() and >> sendmail are both easy to use from php. >> And please don't post another 2000 lines of code. No-one is going to >> read them. >> > > amen to that brother! :) > > -nathan Hi guys, I'm new to both this newsgroups and PHP. I need to get the form submission working by Friday (Feb. 1). Any help with sendmailor mail() will be appreciated. Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to create a slide show using PHP5
Hi everyone, I want to create a slide show of photos for my web site. How is this done using php5? I am using Opensuse 10.3, Apache, PHP5. TIA for any assistance, Philip -- Philip Ramsey learning PHP and MySQL for building a better world philipramsey.is-a-geek.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to create a slide show using PHP5
Bastien Koert wrote: On Wed, Jul 2, 2008 at 4:37 PM, philip <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote: Hi everyone, I want to create a slide show of photos for my web site. How is this done using php5? I am using Opensuse 10.3, Apache, PHP5. TIA for any assistance, Philip -- Philip Ramsey learning PHP and MySQL for building a better world philipramsey.is-a-geek.net <http://philipramsey.is-a-geek.net> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php 2 parts to this 1. pull a series on [random] images from the system to show the user 2. client side javascript code to load the images in a slide show fashion You may want to get an existing one and pull it apart to see how they've done it -- Bastien Cat, the other other white meat Hi Bastien, Thank you for your quick response. Where may I find sample? I tried searching the web but only found samples and tutorials that required flash for the actual slide show. Since I run Linux and Adobe/Macromedia do not make a flash editor for Linux, flash is not an option. TIA, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP_AUTH_USER failing, please help me...
Just a quick guess that register_globals is probably turned off (check with a phpinfo() to be sure) and therefore $PHP_AUTH_USER and $PHP_AUTH_PW are not being set. Or, try $_SERVER[PHP_AUTH_USER], etc... On Mon, 25 Nov 2002, Larry Brown wrote: > I just built a new server and loaded with RH8. I copied my php files over > to the new apache server and modified the links. I couldn't find any > mention of php in the httpd.conf so I figured it must me compiled into httpd > so I tested it. The PHP files load, however, the php_auth_user and > php_auth_pw don't work. They prompt the user yet with : > > > if (isset( $PHP_AUTH_USER ) && isset($PHP_AUTH_PW)) { > > echo $PHP_AUTH_USER; > echo $PHP_AUTH_PW; > } if ( ! $auth ) > { > header( 'WWW-Authenticate: Basic realm="Private"' ); > header( 'HTTP/1.0 401 Unauthorized' ); > echo 'Authorization Required.'; > echo $PHP_AUTH_USER; > echo $PHP_AUTH_PW; > echo "OK?"; > exit; > > } > else > { > echo $PHP_AUTH_USER; > echo $PHP_AUTH_PW; > } > > The prompt comes up and asks for a password three times. After the three it > prints... Authorization Required.OK? > So it appears as though it is not returning the variables. The php version > is 4.2.2 and apache is 2.0.4 (redhat). > > > > > > Larry S. Brown > Dimension Networks, Inc. > > > > > > -- > 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: Comment Threading
Your best bet would be to look at how some of the other apps do it :) (taking licensing issues into account that is :) This might help as well.. not sure how efficient it is on a really long list, but it works for my little stuff... http://stuff.adhesivemedia.com/php/heirarchial-sorting.php On Tue, 3 Dec 2002, Beth Gore wrote: > Hello, > > I'm trying to work out how to do some simple comment threading using > PHP. I've overridden the blockquote tag in CSS so that it only indents > from the left. > > At the moment comments are simply displayed in reverse chronological > order as all the replies to a particular post. > > I just can't get my head around how to do the threading. > > I could add an extra column in the comments table, i.e, "repliedto" > which would contain the comment ID of the comment the user replied to, > but that would seem to require some sort of recursion to check whether > or not a comment has a reply, which I'd rather avoid if I can (mainly > because I don't think I'm good enough to pull it off) > > The other idea would be to have a threadID.. hmm... > > table thread: threadID, rootCommmentID, replyCommentID > > Then perhaps every time a user replies to a comment, it adds a row to > the database? > > How can I somehow take the data in the comments and/or thread table and > sort an array of comment data which I can then use to layout the page, > i.e, adding a different level of indent for each "thread"? > > ie: > > originalpost > -comment1/thread1(reply to post) > > --comment2/thread2(reply to comment1) > > ---comment3/thread3(reply to comment 2) > > comment3/thread4(reply to comment 3) > > --comment5/thread1(reply to comment1) > > ---comment3/thread5(reply to comment 2) > > --comment6/thread2(reply to comment1) > > -coment7/thread1(reply to post) > > Thanks for any help/examples. I really just can't get my head around it. > > Beth Gore > -- > http://bethanoia.dyndns.org > > > -- > 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] magic quotes
magic_quotes_gpc is simple, it essentially runs addslashes on all GET, POST and COOKIE data. That's it. http://www.php.net/ref.info#ini.magic-quotes-gpc http://www.php.net/addslashes http://www.php.net/variables.external Not sure about your problem, maybe someone else can help. Regards, Philip On Wed, 4 Dec 2002, John Taylor-Johnston wrote: > What are magic quotes? Will this help me? > > http://news.php.net/article.php?group=php.general&article=126934 > > How is this different from stripslashes. > > I have RTF doc :) > > http://www.php.net/manual/en/function.get-magic-quotes-gpc.php > > Be gentil ::p > > -- > John Taylor-Johnston > - > "If it's not open-source, it's Murphy's Law." > >- Université de Sherbrooke: > http://compcanlit.ca/ > > > -- > 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] ini function like ini_set and ini_alter
Reread the docs here (the table): http://www.php.net/ini_set You cannot set this directive at runtime. Using .htaccess is as close as you'll get to that. I see no reason why using auto_prepend_file here would be better than include() as this is exactly what include() is for. Regards, Philip On 4 Dec 2002, Franco Pozzer wrote: > Thanks for all. > > My end it is Apache 1.3.27 and PHP 4.3.2 in Win32 system NT 4.0. > > I have the php.ini auto_prepend_file like this: > auto_prepend_file="C:\OPENFEDRA\Apache\htdocs\fedra\sv\cfg\" > > All work fine with this configuration of the php.ini. > > For same reason I must to do not configure php.ini and the directives > auto_prepend_file must be null like auto_prepend_file =. > > I have discovered ini_alter function but I do not be able to work in my > application. > > My script it is like: > $path="C:\\OPENFEDRA\\Apache\\htdocs\\fedra\\sv\\cfg\\"; > > echo"$path"; > > if(ini_alter('auto_prepend_file', $path.'systemVariables.php')) > echo "ini_alter success"; > else > echo "ini_alter failed"; > > but do not work. > > If I change the ini_alter with include() it work all fine but I do not > want to use include or require function. > > have sameone an idea about this code do not work?? > > Thanks for all and if it is possible reply to me also to e-mail follow. > > [EMAIL PROTECTED] > www.infocamere.it > > > > > -- > 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 2.4.3 and Apache 2.0.x
Read the docs: http://www.php.net/install.apache2.php Apache 2 is EXPERIMENTAL in PHP right now, it may or may not work. But, the following combination is known to work: PHP 4.2.3 along with Apache 2.0.39 But Apache 1.3.x is recommended and considered stable and will work with any PHP version. Regards, Philip On Wed, 4 Dec 2002, Adam Williams wrote: > If you mean PHP 4.2.3, it'll work with apache 2.0, but not that great. > I'm also using PHP 4.3.0-rc2 with Apache 2.0 and its not any better. > > Adam > > On Wed, 4 Dec 2002, Vicente Valero wrote: > > > Hello, > > > > PHP 2.4.3 can work with Apache 2.0.x or I need Apache 1.3.x? > > > -- > 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] trouble with update from php 3 to php 4.2.3
If you want to do relative includes, you must have a . in your include_path. Maybe this is what you are meaning to do. Please reread this: http://www.php.net/configuration.directives.php#ini.include-path And if you still have problems after adjusting it and restarting the web server, tell us your include_path definition and make sure it's the same as reported in phpinfo(). Regards, Philip On Wed, 4 Dec 2002, Omar wrote: > I updated php from version 3 to 4.2.3 on a win NT 4 server (with iss 4). > Everything went ok, but the include() function. > I have problems when including files. > I tried to specify a directory in the php.ini file but it still didn't work. > This is how i have the include line: > include ('file.inc'); > > I copied the file to the folder where my php file is, to the directory where > originally was (x:\path\includes) and it doesn't work. > I really need some help. > Thanx. > > > > > -- > 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] fopen over a network
Please reread the documentation found here: http://www.php.net/header It has a pdf file as an example, modify according to your needs. Regards, Philip On Wed, 4 Dec 2002, Elkan wrote: > Couldn't you set the Mime-Type on the server for the correct extenstion? > > Leif K-Brooks wrote: > > > Link them to a page like this to download the file: > > > > > header("Content-type: application/octet-stream"); > > //Code to display file > > ?> > > > > Dara Dowd wrote: > > > > >Hello, > > >I'd like a user to be able download a file from a file server on my LAN. > > > > > >Using works ok, but this simply >displays the file in the browser and I want to force the download dialog box to >appear. > > > > > > > > >So now i have , and i want to do something >like > > >fopen("file://server/directory/filename",rb") but i just get an invalid argument >warning. > > >Am i on the right track?Is there a way around this? > > > > > >Cheers, > > >Dara > > > > > > > > > > > > > > > > > > > -- > > The above message is encrypted with double rot13 encoding. Any unauthorized >attempt to decrypt it will be prosecuted to the full extent of the law. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables from script to script
On Tue, 10 Dec 2002, Stefan Hoelzner wrote: > Hi folks, > > surely this question has already been answered many times before in > this ng, but nevertheless: I want to pass variables from one .php to > another .php script. But I do not want to use either the > http://localhost/target.php?var1=test&var2=test2 nor the POST method. > I would like to pass over general variables like usernames and > passwords for several MySQL-connects; obviously it is not a good way > to pass these vars via the mentioned ways. > > What else does PHP offer? Are there any other methods? Can I define > these vars as some kind of "global variables" in any ini-file? Use includes. http://www.php.net/include dbinfo.inc showstuff.php Ideally this include will be outside the document root. If not, make sure it's not viewable or use a php extension such as .php See also the include_path php directive. Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GD installation - Simple Question
To use the bundled gd just do: --enable-gd Note that 4.3.0 is the first distro that includes a bundled GD. Also note that as of 4.3.0 just doing --with-gd will also use the bundled GD. Before this, --with-gd (no directory specified) would look for a local copy. That seems odd yes but theory is it means more people will use the preferred bundled GD now. To use a non-bundled, you must specify the path so: --with-gd=/path/to/gd/dir Note: It's strongly recommended to use the bundled GD. Regards, Philip p.s. 4.3.0-RC3 came out today! :) On Wed, 11 Dec 2002, Sean Burlington wrote: > [EMAIL PROTECTED] wrote: > > Hello list, > > > > simple question: > > > > I´ve heard that it is possible to compile php with dg-support on two ways > > 1) first way: Distribution dependant with the gd-files and libraries, eg. gd.c, >gd.lo, gd.o > > coming with the distribution of the compiled php-4.x-tarball > > compiled the follwing way: > > > > ./configure .. --with-gd > > > > > > 2) second way: You can compile the newest Distribution from GD, eg. gd-2.0.8 > > > > compiling gd-2.0.8 this way > > ./configure --prefix=/usr/local/gd ... > > eg. under /usr/local/gd > > > > and the compile php-4.x this way > > ./configure --with-gd=/usr/local > > > > > > Did I got that right ? > > almost > > I think that the value you use for 'prefix=' on gd should be the same as > the value for 'with-gd=' > > and its probably best to install gd in /usr/local so that the libraries > are in an already known location. > > like this > > ./configure --prefix=/usr/local > eg. under /usr/local > > and the compile php-4.x this way > ./configure --with-gd=/usr/local > > if you do this - be aware that you will have two versions of gd > installed - this shouldn't cause any problems but don't forget you have > two versions - and if you install more software make sure it finds the > right version. > > - you can always remove the ditro version - but eg rpm may complain > about dependency problems as it won't know about your /usr/local version. > > -- > > Sean > > > -- > 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: understanding headers
Where/How do you set $data? Everything else looks fine, but without knowing that we can't help much. On Wed, 11 Dec 2002, Colin Bossen wrote: > Hello: > > I am trying to use the header function to enable users to download > files. I am able to get files to download. Unfortunately, the wrong file > keeps downloading. Instead of downloading the file I want the php source > file is getting downloaded. Here is the posting code: > > $output = " href=\"download.php?name=".$filename."&size=".$size."\">Click here to > download ".$filename.""; > > echo $output; > > Here is the download code: > > if ($name) { > > header("Content-type: application/x-macbinary"); > header("Content-length: $size"); > header("Content-Disposition: attachment; filename=$name"); > header("Content-Description: PHP Generated Data"); > echo $data; > } > ?> > > Any help anyone might have would be much appreciated. > > Colin > > > -- > 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: Re: understanding headers
Then you're getting exactly what you should be getting. fopen will read the text file as it appears on *disk* not what the output on your browser is. ?? -philip On Wed, 11 Dec 2002, Colin Bossen wrote: > I add mention that the contents of the download.php file are the > contents of the file I am trying to download... > > > On Wednesday, December 11, 2002, at 06:31 PM, Colin Bossen wrote: > > > Opps... $data is set on the download page. It is set like this: > > > > $path .= "export/".$name; > > $fp = fopen($path, "rb"); > > $data = fread($fp, $size); > > fclose($fp); > > > > Colin > > > > On Wednesday, December 11, 2002, at 06:21 PM, Philip Hallstrom wrote: > > > >> Where/How do you set $data? Everything else looks fine, but without > >> knowing that we can't help much. > >> > >> On Wed, 11 Dec 2002, Colin Bossen wrote: > >> > >>> Hello: > >>> > >>> I am trying to use the header function to enable users to download > >>> files. I am able to get files to download. Unfortunately, the wrong > >>> file > >>> keeps downloading. Instead of downloading the file I want the php > >>> source > >>> file is getting downloaded. Here is the posting code: > >>> > >>> $output = " >>> href=\"download.php?name=".$filename."&size=".$size."\">Click here to > >>> download ".$filename.""; > >>> > >>> echo $output; > >>> > >>> Here is the download code: > >>> > >>> >>> if ($name) { > >>> > >>> header("Content-type: application/x-macbinary"); > >>> header("Content-length: $size"); > >>> header("Content-Disposition: attachment; filename=$name"); > >>> header("Content-Description: PHP Generated Data"); > >>> echo $data; > >>> } > >>> ?> > >>> > >>> Any help anyone might have would be much appreciated. > >>> > >>> Colin > >>> > >>> > >>> -- > >>> 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 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute a cgi inside of php?
The error you get does not have to do with that note, but rather that code of yours has many other issues such as: a) The syntax is incorrect print "a b " c " d"; // bad print "a b \" c \" d"; // good print "a b ' c ' d"; // good print 'a b " c " d'; // good ... http://www.php.net/types.string b) You are attempting to mix SSI into PHP You can't do that, just like how one can't write PERL or ASP code in PHP. Some options: a) Using virtual() virtual("../cgi-bin/include/horoscopes.cgi"); b) Go through HTTP $url = 'http://www.example.com/foo/horoscopes.cgi'; echo implode('', file($url)); c) Rewrite horoscopes.cgi as PHP This is the ideal option, consider doing this in the future. That manual note you referred to has to do with code such as (http == remote file): include 'http://www.example.com/foo.php'; Which would include the output of that url into the webpage. This is unrelated and remember that parse errors are always due to syntax problems. Regards, Philip Olson On Wed, 11 Dec 2002, Richard Creech wrote: > > Hello List, > Is there a way to execute a cgi inside of php? This is what a customer wants to do: > > > include(""); > > but get an error message: > > Parse error: parse error, unexpected '.' in >D:\Inetpub\townforum\wwwroot\orgs\header.php on line 3 > > > The manual says it won't work: > http://www.php.net/manual/en/function.include.php > "Warning > Windows versions of PHP prior to PHP 4.3 do not support accessing remote files via >this function, even if allow_url_fopen is enabled." > > The mail archives didn't shed any light on this question. > > > What alternatives might work? > > > Regards, > > Richard Creech > [EMAIL PROTECTED] > 250.744.3350 Pacific Time > Free and retail php resources for developers > http://www.dreamriver.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] Using fopen() to open a php file with variables.
Why don't you just use include? $month = 12; $year = 2002; // This include has access to the above variables include 'make_calendar.php3'; Include it wherever you intended to print $caledar_html. It doesn't exist in your code because the url is seen as part of the filename. Regards, Philip Olson On Wed, 11 Dec 2002, Jay (PHP List) wrote: > Okay, I need to retrieve the output of a php file with variables being > passed to it. Example: > > $calendar_file = "make_calendar.php3?month=$month&year=$year"; > $fp = $fp = fopen("$calendar_file", "r"); > while (!feof ($fp)) { > $buffer = fgets($fp, 4096); > $calendar_html .= $buffer; > } > fclose($fp); > > It gives me an error that the file doesn't exist, but it does. Any > suggestions? > > Jay Douglas > Systems Consultant > Fort Collins, CO > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Delete array element
Remove the {braces}, those are only used when inside "a {$strin['g']}". Also, be sure to 'quote' your array indices. unset($arr['foo'][$bar]); Regards, Philip Olson On Wed, 11 Dec 2002, Richard Baskett wrote: > Ok I feel a little sheepish after that answer :) Still not working though > due to my variable.. help! > > unset({$_SESSION[map][mapText][$_POST[Email]]}); > > Im getting errors on this because I havent figured out how to get it to > understand that variable :( > > Rick > > "If I accept you as you are, I will make you worse; however, if I treat you > as though you are what you are capable of becoming, I help you become that." > - Johann Wolfgang von Goethe > > > From: "John W. Holmes" <[EMAIL PROTECTED]> > > Organization: U.S. Army > > Reply-To: <[EMAIL PROTECTED]> > > Date: Wed, 11 Dec 2002 21:37:18 -0500 > > To: "'Richard Baskett'" <[EMAIL PROTECTED]>, "'PHP General'" > > <[EMAIL PROTECTED]> > > Subject: RE: [PHP] Delete array element > > > >> How can I delete a key and it's value from an array? > >> > >> for example: > >> > >> $test = array(0=>'yes', 2=>'no', 5=>'maybe', 7=>'so'); > >> > >> And I wanted to delete the second key "2" so I could end up with an > > array > >> like so: > >> > >> $test = array(0=>'yes', 5=>'maybe', 7=>'so'); > > > > unset($test[2]); > > > > ---John W. Holmes... > > > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > > today. http://www.phparch.com/ > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GD installation - Simple Question
No, GD is only bundled as of PHP 4.3.0. Regards, Philip On Thu, 12 Dec 2002 [EMAIL PROTECTED] wrote: > Hello Phillip, hello Sean, > > thank you very much, for answering the question of --with-gd - compiling. > > I am not using 4.3 . I did it with php-4.2.3 > > Did I got it right - to use the bundled-gd I have to use the > compiling-flag: > --enable-gd > ?? > > But when I run ./configure --help there isn´t shown any flag --enable-gd > just --enable-gd-native-ttf to use GD: Enable TrueType string function. > > Any hints??? > > Oliver Etzel > > > > > To use the bundled gd just do: --enable-gd > > Note that 4.3.0 is the first distro that includes a > bundled GD. Also note that as of 4.3.0 just doing > --with-gd will also use the bundled GD. Before this, > --with-gd (no directory specified) would look for a > local copy. That seems odd yes but theory is it > means more people will use the preferred bundled GD > now. To use a non-bundled, you must specify the path > so: --with-gd=/path/to/gd/dir > > Note: It's strongly recommended to use the bundled GD. > > Regards, > Philip > > p.s. 4.3.0-RC3 came out today! :) > > > On Wed, 11 Dec 2002, Sean Burlington wrote: > > > [EMAIL PROTECTED] wrote: > > > Hello list, > > > > > > simple question: > > > > > > I´ve heard that it is possible to compile php with dg-support on two > ways > > > 1) first way: Distribution dependant with the gd-files and libraries, > eg. gd.c, gd.lo, gd.o > > > coming with the distribution of the compiled php-4.x-tarball > > > compiled the follwing way: > > > > > > ./configure .. --with-gd > > > > > > > > > 2) second way: You can compile the newest Distribution from GD, eg. > gd-2.0.8 > > > > > > compiling gd-2.0.8 this way > > > ./configure --prefix=/usr/local/gd ... > > > eg. under /usr/local/gd > > > > > > and the compile php-4.x this way > > > ./configure --with-gd=/usr/local > > > > > > > > > Did I got that right ? > > > > almost > > > > I think that the value you use for 'prefix=' on gd should be the same as > > the value for 'with-gd=' > > > > and its probably best to install gd in /usr/local so that the libraries > > are in an already known location. > > > > like this > > > > ./configure --prefix=/usr/local > > eg. under /usr/local > > > > and the compile php-4.x this way > > ./configure --with-gd=/usr/local > > > > if you do this - be aware that you will have two versions of gd > > installed - this shouldn't cause any problems but don't forget you have > > two versions - and if you install more software make sure it finds the > > right version. > > > > - you can always remove the ditro version - but eg rpm may complain > > about dependency problems as it won't know about your /usr/local version. > > > > -- > > > > Sean > > > > > > -- > > 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 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 error
You need to do some error handling, as in: > $mysql_result = mysql_query($query, $mysql_link); > > // get each row > > --> line 36 while($row = mysql_fetch_row($mysql_result)) > Make sure $mysql_result is a valid resource as PHP is telling you it's not. Here's one way: if (!$mysql_result) { echo "DB Error ($query) : " . mysql_error(); exit; } while ($row = mysql_fetch_row($mysql_result)) { } See? We made sure $mysql_result isn't false as the function mysql_query returns false on failure. If it is false, we print some useful info out to debug it. In production, you most likely won't want to print it out but anyway... For a more complete example, see: http://www.php.net/mysql_fetch_assoc Btw, being that there is a function named mysql_result I wouldn't create a variable by that name, kinda confusing. Regards, Philip Olson p.s. mysql_error is your friend. > { > > //get columns > > $id = $row[0]; > $ynimi = $row[1]; > $ylahi = $row[2]; > $ypostios = $row[3]; > $ypostitmp = $row[11]; > > print("\n"); > print("\n"); > > print("$ynimi, $ylahi, $ypostios > $ypostitmp\n"); > print(" HREF=\"tarkenna.php3?id=$id\">MUOKKAA> - HREF=\"poista.php3?id=$id\">POISTA>"); > > print("\n"); > print("\n"); > > } > > // disconnect > mysql_close($mysql_link); > ?> > > when run, i'll following error messages: > > Warning: mysql_fetch_row(): supplied argument is not a valid MySQL > result resource in /www/domains/lammidb.phnet.fi/public_html/kaikki.php3 > on line 36 > > > > -- > 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] Don't get variable to be passed to the page on submit
Read this: http://www.php.net/variables.external Pay special attention to the parts about the PHP directive register_globals. If on, both $_GET['nafn'] and $nafn will exist. If off, $nafn will not exist. As of PHP 4.2.0, the default for this in php.ini went from on to off. This applies to all variables, even web server variables such as PHP_SELF so you'd use: $_SERVER['PHP_SELF'], etc. Regards, Philip Olson P.s. So you want your query to look more like this: $sql = INSERT INTO $db_imgCat (catName, subCat) VALUES ('{$_GET['nafn']}', 0)"; P.s.s. Consider validating nafn first, users are evil. P.s.s.s. Use $_SESSION instead of session_register On Fri, 13 Dec 2002, [iso-8859-1] Davíð Örn Jóhannsson wrote: > I have this code whitch I have been staring at for hours and I just > cant figure out what is going on... > > it is about as simple as it gets I just need to pass a variable from > this page to it self, and that would be tha variable $nafn > > I have this included code included into another page that is why I use > the aAction and sAction variables in the from action > so the script knows where to go after submiting. I have done similar > things on this site Im working on an that works but this > i just cant get to work. > > It is prob. just somthing silly and wery eazy but I could use some > assistance to finde out what. > > Regards, David > > > if(!isset($submit)){ > session_register("nafn"); > ?> > " > method="post" enctype="text/plain" name="form"> > > > > Nafn yfirflokks: > > > > > > > > > } > else{ > print($test); > print($nafn); > $newQuery = "INSERT INTO $db_imgCat (catName, subCat) VALUES > ('$nafn', 0)"; > if(mysql_query($newQuery, $db) or die(mysql_error())){ > print("Flokkur vistaður"); > } > else{ > print("fail"); > } > > } > ?> > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: A little regex help
Why not... $url = ereg_replace("See ([^ ]*) for", "See \1 for", $original_string) or something close to that. On Fri, 13 Dec 2002, Gareth Hastings wrote: > Hi, > > I'm trying to work out the regex needed to split either one of the > following lines > > Windows 2000 Hotfix (Pre-SP4) See Q322842 for more information > Windows XP Hotfix (SP2) See Q327696 for more information > > Into one of these > > Windows 2000 Hotfix (Pre-SP4) See href='http://support.microsoft.com/default.aspx?scid=kb;en-us;Q322842'>Q > 322842 for more information > Windows XP Hotfix (SP2) See href='http://support.microsoft.com/default.aspx?scid=kb;en-us;Q327696>Q3 > 27696 for more information > > I can work out half of the expression but not the other half lol, I've > used a combination of ereg and split but I'm sure this can be done with > 1 ereg statement. Here is my code > > $ms = "http://support.microsoft.com/default.aspx?scid=kb;en-us;";; > > > if (ereg("(\[See )([Q|q][0-9]+)( for more information\])", $name)) > { > $sp = split("\[See ", $name); > ereg("([Q|q][0-9]+)( for more information\])", $sp[1], $qb); > > $url = $sp[0] . "See target='_blank'>" . $qb[1] . " for more information"; > > } > > Any ideas? > > Gareth > > > > -- > 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] Array
I'm not sure what is meant in this thread but arrays are pretty simple. PHP allows both numerical and associative arrays (although in all reality they all are associative) but anyway: $arr1 = array('a','b','c', 42 => 'yep'); print $arr1[0]; // a print $arr1[1]; // b print $arr1[2]; // c print $arr1[42]; // yep $arr1[] = 'd'; print $arr1[43]; // d $arr2 = array('a' => 'apple', 'blah'); print $arr2['a']; // apple print $arr2[0]; // blah Anyway the best way to see what values an array actually has is with print_r() or var_dump() print_r($arr2); That code quoted from "PHP Bible" has many issues, it isn't generic at all. Please ignore it or at least keep in mind the context of it. A more generic form of it: function print_keys_and_values($arr) { foreach ($arr as $key => $value) { print "Key: $key - Value: $value\n"; } } Please read the following manual entries on arrays: http://www.php.net/types.array http://www.php.net/foreach Play around with them for awhile and they'll eventually make sense. Regarding the original question of this thread, see print_r() as I blame a typo or something... or maybe it's a variable scope issue. Your example looks fine. Regards, Philip Olson P.s: Essentially numerical == numbered keys associative == worded keys On Mon, 16 Dec 2002, Andy Turegano wrote: > I see. Well, in that case I don't really know what to do. Sorry. > > > On Tue, 17 Dec 2002, Quentin Bennett wrote: > > > Hi, > > > > No I don't think that is right. > > > > $monthschedule["Jun"] is not what is being looked for, but >$monthschedule[something]="Jun"; > > > > Try doing a loop to see what is in the array. > > > > Example, from PHP Bible, > > > > function print_keys_and_values_each($arr) > > { > >reset($arr); > >while ($cell = each($arr)) > >{ > > $c = $cell['value']; > > $k = $cell['key']; > > print ("Key: $k; Value: $c"); > >} > > } > > > > > > Quentin > > > > -Original Message- > > From: Andy Turegano [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, 17 December 2002 10:25 a.m. > > To: Mako Shark > > Cc: [EMAIL PROTECTED] > > Subject: Re: [PHP] Array > > > > > > What you have to do, at least I think, is you have to type: > > $r = $monthschedule["Jun"]; > > > > That is what I think you have to do. The other way you did it was when you > > have a value-only array. > > > > > > On Mon, 16 Dec 2002, Mako Shark wrote: > > > > > I have an array I set up like this: > > > > > > $monthschedule = array(1 => "Jan", 2 => "Feb", 3 => > > > "Mar", 6 => "Jun"); > > > > > > When I try to access them, doing this: > > > $r = $monthschedule[6]; > > > > > > nothing comes up ($r is blank). Any thoughts? There > > > are missing elements (4,5,7-12) in $monthschedule. > > > > > > __ > > > Do you Yahoo!? > > > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > > > http://mailplus.yahoo.com > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > The information contained in this email is privileged and confidential and > > intended for the addressee only. If you are not the intended recipient, you > > are asked to respect that confidentiality and not disclose, copy or make use > > of its contents. If received in error you are asked to destroy this email > > and contact the sender immediately. Your assistance is appreciated. > > > > -- > > 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_num_rows
> Would someone be kind enough to explain why I'm not getting the correct > result from the following query. If I select a valid member no. and name, > the following query should return 1 row. This is not the case, however. It > returns zero rows. > > $sql = "SELECT * FROM users WHERE member_no = '$member_no' and > name = ' $name' "; Because ' $name' != '$name' so zero rows are returned. So remove the leading space from your query and you'll get one row.. > $result = mysql_query($sql) or die ("Cannot verify the member"); > $rows = mysql_num_rows($result); > echo "rows = $rows"; > > Furthermore when trying the following query where the table "users" contains > 13 rows, the query returns only 12 rows. > > $sql = "SELECT * FROM users"; > $result = mysql_query($sql) or die ("Cannot verify the member"); > $rows = mysql_num_rows($result); > echo "rows = $rows"; Because there are 12 rows, not 13 ;) Check again or simply test it: $sql = "SELECT * FROM users"; if (!$result = mysql_query($sql)) { echo "Could not run query ($sql) " . mysql_error(); exit; } $count = mysql_num_rows($result); while ($row = mysql_fetch_assoc($result)) { $rows[] = $row; } print ""; print "Returned: " . count($rows) . " and num_rows: $count\n"; print_r($rows); > Conclusion: mysql_num_rows seems to be returning one less row > than exists. Is this correct? Nope. Regards, Philip Olson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] list and (array) get_val
Have another look here: http://www.php.net/list Note that the list construct only works on numerical arrays and assumes 0-n. You may want to use import_request_variables() or extract() though. Regards, Philip Olson On Wed, 18 Dec 2002, Ns_Andy wrote: > a.php > > list($a) = $_GET; > print $a; > ?> > > and I typed a.php?b=c > > I expected c would be printed, What the problems have I made? > -- > Regards, > Ns_Andy, [EMAIL PROTECTED] > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] easy spliting
You may want to provide more information like why is this string being split at these seemingly random points? Maybe there is a common separator or could be? But anyway it sounds like you want substr(). http://www.php.net/substr Regards, Philip Olson On Wed, 18 Dec 2002, Alex Ciurea wrote: > Hi, > > I know it is easy but I can't figure how I should do > > I want to split a string from position 1 to 9, from 10 to 36, from 37 to 54 and so >on... > > how can I do this? > > > is there a function who does this? > > > Regards, > > Alx > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mysql_num_rows
First, there is no reason to do mycounter like this when mysql_num_rows() will work perfectly. It's not based on any certain column numbers or primary keys. Although if you're suggesting this method to simply print 0-n in the loop (as users may want to know the row number of output not any id number) then that's good altough it's not really a counter in this case. Second, we assume this person wants a count for informational purposes, to go along with the data in which case mysql_num_rows() is your best bet. It means having a count before the data is printed/used. And checking the number or rows returned before fetching is a form of error handling as well as if it equals 0 than there is no data to fetch. But if one ONLY wants a number of rows count, doing SELECT count(*)... works great as suggested below. Regards, Philip Olson On Wed, 18 Dec 2002, liljim wrote: > Hi John, > > "John Taylor-Johnston" wrote in message: > > I use $mycounter, not saying it is pretty. But if you have a whole bunch > of stuff deleted, your last id might be worth a lot more than the actual > number of rows. > > > > $myconnection = mysql_connect($server,$user,$pass); > > mysql_select_db($db,$myconnection); > > > > $news = mysql_query('select * from '.$table.' where '.$where.' order by id > asc'); > > $mycounter = 0; > > while ($mydata = mysql_fetch_object($news)) > > { > > $mycounter++; > > } > > Have you ever considered just doing a count()? > > $count = @mysql_query("select count(*) from [table(s)] where [criteria > [group by something]]"); > $total = mysql_result($count, 0); > > That will return the number of rows in your table(s). It's also much quicker > and less resource intensive, particularly with large datasets. :) > > James > > > > -- > 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] Re: mysql_num_rows
And now mysql4 allows doing this another way, I *assume* this new way is slightly faster then the additional count() although I haven't tested it and wonder if it affects mysql_num_rows()... See: SQL_CALC_FOUND_ROWS() http://www.mysql.com/doc/en/Miscellaneous_functions.html Regards, Philip Olson On Wed, 18 Dec 2002, liljim wrote: > I would also tend to do a count(*) as well as the main query if I intend to > use pagination (with the help of LIMIT in the main query). > > Suppose, for example, you're limiting to 30 news posts per page, and from > calculations there are only 2 pages that fall into the criteria, then trying > to bring the result set back on page 3 when it doesn't "exist" will result > in a warning. Also, you'll want to know how many pages of the news post > there are... > > Brief Example (assuming $page has already been validated as an integer): > > $num = 30; // per page > $total = 49; // result from count(*) > $total_pages = ceil($total/$num); > if($page > $total_pages) > { > $page = $total_pages; > } > > // Main query. > // "select [whatever] from [table(s)] where [criteria] [whateverelse] limit > " . (($page*$num)-$num) . ",$num; > > James > > "Philip Olson" <[EMAIL PROTECTED]> wrote in message > Pine.BSF.4.10.10212181637090.4483-10@localhost">news:Pine.BSF.4.10.10212181637090.4483-10@localhost... > > > > First, there is no reason to do mycounter like this > > when mysql_num_rows() will work perfectly. It's not > > based on any certain column numbers or primary keys. > > Although if you're suggesting this method to simply > > print 0-n in the loop (as users may want to know the > > row number of output not any id number) then that's > > good altough it's not really a counter in this case. > > > > Second, we assume this person wants a count for > > informational purposes, to go along with the > > data in which case mysql_num_rows() is your best > > bet. It means having a count before the data is > > printed/used. And checking the number or rows > > returned before fetching is a form of error handling > > as well as if it equals 0 than there is no data to > > fetch. But if one ONLY wants a number of rows count, > > doing SELECT count(*)... works great as suggested > > below. > > > > > > Regards, > > Philip Olson > > > > > > On Wed, 18 Dec 2002, liljim wrote: > > > > > Hi John, > > > > > > "John Taylor-Johnston" wrote in message: > > > > I use $mycounter, not saying it is pretty. But if you have a whole > bunch > > > of stuff deleted, your last id might be worth a lot more than the actual > > > number of rows. > > > > > > > > $myconnection = mysql_connect($server,$user,$pass); > > > > mysql_select_db($db,$myconnection); > > > > > > > > $news = mysql_query('select * from '.$table.' where '.$where.' order > by id > > > asc'); > > > > $mycounter = 0; > > > > while ($mydata = mysql_fetch_object($news)) > > > > { > > > > $mycounter++; > > > > } > > > > > > Have you ever considered just doing a count()? > > > > > > $count = @mysql_query("select count(*) from [table(s)] where [criteria > > > [group by something]]"); > > > $total = mysql_result($count, 0); > > > > > > That will return the number of rows in your table(s). It's also much > quicker > > > and less resource intensive, particularly with large datasets. :) > > > > > > James > > > > > > > > > > > > -- > > > 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is there php equiv left() and right() functions?
You want explode(), something like: list($a, $b) = explode('|', $string); Regards, Philip Olson On Wed, 18 Dec 2002, Jeff Bluemel wrote: > I have a string that will look like the following; > > data1|data2 > > now - I need to put data1 in a variable, and data2 in another variable. > I've found the functions strlen, and strpos, but I can't figure how to grab > this data. > > thanks, > > Jeff > > > > -- > 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] Question about the exit() command
How about: if (!$conn = mysql_connect($host, $user, $pass)) { include 'static_html.inc'; exit; } print "Welcome, yes the database is connected"; exit ends the script, nothing after its use is executed. Regards, Philip Olson On Thu, 19 Dec 2002, Beauford.2002 wrote: > Hi, > > Could someone clarify this for me. I want to be able to exit out of a PHP > webpage and return to the calling page if certain conditions are not met. It > appears using exit() will do this, but I am unclear exactly how to use it. > > any info is appreciated. > > TIA > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with sessions.
For the record, variables are case sensitive so it's $_SESSION not $_session. And if you're going to use $_SESSION (which you should), do not use session_register(). Regards, Philip On Thu, 19 Dec 2002, Mike Hillyer wrote: > I have recieved a private response, it appears my system had > register_globals off and the other server would have had it turned on. The > proper usage was actually $_session["name"] and I shall be using that. > > This was my first use of the PHP mailing list and I am very impressed and > pleased with all the quick and helpful responses. Thank you all. > > Mike Hillyer > > -Original Message- > From: Quentin Bennett [mailto:[EMAIL PROTECTED]] > Sent: Thursday, December 19, 2002 5:24 PM > To: PHP GENERAL LIST > Subject: RE: [PHP] Problem with sessions. > > > Hi, > > Is your 'other server' identical (Web Server, PHP Version, register_globals > setting)? > > Quentin > > -Original Message- > From: Mike Hillyer [mailto:[EMAIL PROTECTED]] > Sent: Friday, 20 December 2002 12:43 p.m. > To: PHP GENERAL LIST > Subject: [PHP] Problem with sessions. > > > Hello All; > > Please forgive me if I am repeating an often asked question, but I am having > a problem with sessions. I simply cannot get them to work. > > The sample code I provide works on another server perfectly, this is the > first page: > > > session_start(); > session_register("name","pass"); > $name = "hilde"; > $pass = "mypassword"; > echo "Session variables set!"; > echo "go to next page"; > > ?> > > When called, the following file arrives in /tmp: > > sess_f9c5e87b35ae66eac64a9a346321b269 > > name|s:5:"hilde";pass|s:10:"mypassword"; > > > > So obviously the session file is being created. > However, when I go to page2.php?PHPSESSID=f9c5e87b35ae66eac64a9a346321b269 > Which has this code: > > session_start(); > echo "The password of $name is $pass "; > > ?> > > I get "The Password of is " > > As a response. Both pages work perfectly on another server, so I am having > trouble finding the problem, especially since the session file is actually > created in /tmp > > My PHP.ini file is standard to a RedHat RPM install, but I will include it > as an attachment. > > Any help would be greatly appreciated! > > Mike Hillyer > > The information contained in this email is privileged and confidential and > intended for the addressee only. If you are not the intended recipient, you > are asked to respect that confidentiality and not disclose, copy or make use > of its contents. If received in error you are asked to destroy this email > and contact the sender immediately. Your assistance is appreciated. > > -- > 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] syntax to reference $_POST within function
First, read this: http://www.php.net/variables.external Second, assuming you have a PHP version equal to or greater than 4.1.0 and the method of the form is POST, you'd do something like this: $banlist = array('[EMAIL PROTECTED]'); echo check_banlist($banlist, $_POST['email']); Your question sounds like you're wondering if the function definition should change, it doesn't. You leave it as $email and use $email within the function. This is just how functions work, you pass in values. So: function foo ($email) { print $email; } foo($_POST['email']); // Or as you used to do with register_globals foo($email); Or you could always just do: function bar () { print $_POST['email']; } bar(); This is why they are SUPERglobals, because this is what you would have done in the past (old school): function baz () { global $email, $HTTP_POST_VARS; print $email; print $HTTP_POST_VARS['email']; } Also it's worth mentioning that $HTTP_POST_VARS has existed since PHP 3, so just in case that might be important to you too. It is not super. Now if you don't care if 'email' comes from GET, POST, or COOKIE ... you could use $_REQUEST['email']. Or, import_request_variables() is another option. For example: import_request_variables('p', 'p_'); print $p_email; See the manual for details, and have fun! It really isn't that complicated and you'll be yelling out Eureka! pretty soon now. Regards, Philip Olson P.s. Superglobals work with register_globals on or off. On Thu, 19 Dec 2002, Jamie wrote: > I am attempting to modify an old script to support the superglobal > $_POST with register_globals=Off. These register globals are definately > challenging when you are new to php and every example shown anywhere > uses the old method but I guess what doesn't kill you only makes you > stronger. > > I am trying to convert this line, $email is coming from an html form so > I would typically call it with $_POST['email'] but this doesn't work in > this case and I thus far haven't been able to find anything that > explains what I should be doing. > > function check_banlist($banlist, $email) { > > Any assistance is appreciated! Thanks, > > Jamie > > > -- > 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] Alternating Links
This faqt answers your question: http://www.faqts.com/knowledge_base/view.phtml/aid/8583 Regards, Philip Olson On Fri, 20 Dec 2002, conbud wrote: > Hi. > Lets says I have 8 links stored in a database, extracting those links is > no problem. Now lets says I have 2 columns, how do I get link 1 into > column 1 then get link 2 into column 2 then link 3 into column 1 and > link 4 into column 2 and so on... > > > > This is column 1 > This is column 2 > > > > -- > Conbud > Graphic & Web Design Using Open Source Technology > -- > > > -- > 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] syntax to reference $_POST within function
This is a very important point to understand, I tried (and failed) to explain it. I think Leif made it pretty clear though, here's another :) // $a can be anything when you call the function function bar ($a) { print $a; } bar ('Hello World'); bar ($_POST['something']); Regards, Philip Olson On Fri, 20 Dec 2002, Leif K-Brooks wrote: > You don't need to import the request variables for that to work. The > variable names in the function definition have no relationship to > variables outside of it. Most likely, you're calling with something like: > check_banlist($banlist,$p_email); > but you could also call it with: > check_banlist($variable_with_a_totally_different_name,$another_oddly_named_variable); > or call it with > check_banlist('some string','another string'); > or even call it with > check_banlist($banlist,$_POST['email']); > so importing the request variables is pointless. What you call the > variables inside the function doesn't have anything to do with whether > there is a global variable with the same name! > > Jamie wrote: > > > Thanks for the vote of confidence. I ended up getting it working with > > this: > > > > import_request_variables('p', 'p_'); > > function check_banlist($banlist, $p_email) { > > > > This is what I had been trying to accomplish but was writing it this way: > > > > function check_banlist($banlist, $_POST['email']) { > > > > Maybe you could also point me to the lesson that needs to be learned > > here. Is it that it is an array? or syntax? > > > > Thanks for the assistance! > > > > Jamie Sullivan > > > > Philip Olson wrote: > > > >> First, read this: > >> > >> http://www.php.net/variables.external > >> > >> Second, assuming you have a PHP version equal to > >> or greater than 4.1.0 and the method of the form > >> is POST, you'd do something like this: > >> > >> $banlist = array('[EMAIL PROTECTED]'); > >> echo check_banlist($banlist, $_POST['email']); > >> > >> Your question sounds like you're wondering if the > >> function definition should change, it doesn't. You > >> leave it as $email and use $email within the function. > >> This is just how functions work, you pass in values. > >> So: > >> > >> function foo ($email) { > >> print $email; > >> } > >> > >> foo($_POST['email']); > >> > >> // Or as you used to do with register_globals > >> foo($email); > >> > >> Or you could always just do: > >> > >> function bar () { > >> print $_POST['email']; > >> } > >> > >> bar(); > >> > >> This is why they are SUPERglobals, because this is > >> what you would have done in the past (old school): > >> > >> function baz () { > >> global $email, $HTTP_POST_VARS; > >> > >> print $email; > >> > >> print $HTTP_POST_VARS['email']; > >> } > >> > >> Also it's worth mentioning that $HTTP_POST_VARS has existed since PHP > >> 3, so just in case that might be important to you too. It is not super. > >> > >> Now if you don't care if 'email' comes from GET, POST, > >> or COOKIE ... you could use $_REQUEST['email']. Or, > >> import_request_variables() is another option. For > >> example: > >> > >> import_request_variables('p', 'p_'); > >> > >> print $p_email; > >> > >> See the manual for details, and have fun! It really > >> isn't that complicated and you'll be yelling out > >> Eureka! pretty soon now. > >> > >> Regards, > >> Philip Olson > >> > >> P.s. Superglobals work with register_globals on or off. > >> > >> > >> On Thu, 19 Dec 2002, Jamie wrote: > >> > >> > >>> I am attempting to modify an old script to support the superglobal > >>> $_POST with register_globals=Off. These register globals are > >>> definately challenging when you are new to php and every example > >>> shown anywhere uses the old method but I guess what doesn't kill you > >>> only makes you stronger. > >>> > >>> I am trying to convert this line, $email is coming from an html form > >>> so I would typically call it with $_POST['email'] but this doesn't > >>> work in this case and I thus far haven't been able to find anything > >>> that explains what I should be doing. > >>> > >>> function check_banlist($banlist, $email) { > >>> > >>> Any assistance is appreciated! Thanks, > >>> > >>> Jamie > >>> > >>> > >>> -- > >>> PHP General Mailing List (http://www.php.net/) > >>> To unsubscribe, visit: http://www.php.net/unsub.php > >>> > >> > >> > > > > > > > > -- > The above message is encrypted with double rot13 encoding. Any unauthorized attempt >to decrypt it will be prosecuted to the full extent of the law. > > > > > -- > 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] the numeric key of an array???
No, but you can do this: $arr2 = array_values($array); print $arr2[0]; // VALUE1 Regards, Philip Olson On Fri, 20 Dec 2002, Alexander Guevara wrote: > How can i do for printing the value of an array given the numeric key for > example i have this code: > > $array = array ( > 'VAL1' => "VALUE1", > 'VAL2' => "VALUE2", > 'VAL3' => "VALUE3" > ) > > So the only way i have found to print the value is like this : > echo $array['VAL1']; > > and it prints = VALUE1 but i want to know if its possible to do it something > like this: > echo $array[0]; > i mean give the numeric key for printing VALUE1 so instead the string key > (VAL1) use the numerc (0) > > Thanks in advance! > > > > -- > 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] Is there any method to filter the single quote from astring?
He is referring to a question that is answered here: http://www.php.net/manual/en/faq.html.php#faq.html.encoding Spoiler: htmlspecialchars() -> http://www.php.net/htmlspecialchars Regards, Philip Olson On Sat, 21 Dec 2002, Justin French wrote: > on 21/12/02 2:00 PM, Alexander Guevara ([EMAIL PROTECTED]) wrote: > > > It works.. but when you retrieve the data from the database to a text box it > > doesnt appear if it has the single quote ('), o tought it was cause i have > > the stripslashes but i delete stripslashes and it still doesnt appear in the > > text box! > > Huh? I can't really understand what you're saying. > > If you're adding stuff to a database, and getting an error, use > addslashes(), then on the way out of the database, you need to > stripslashes(). Easy. > > If you don't get any errors, then magic quotes is probably enabled in your > php.ini file. > > > Justin > > > > > > "Justin French" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > don't filter the quotes... escape them with add_slashes() > > > > justin > > > > on 20/12/02 10:50 PM, ªüYam ([EMAIL PROTECTED]) wrote: > > > >> as title that I'm getting a trouble on filtering the single quote ' , > > since > >> there would be error when storing those string into MySQL, thus, i have to > >> find the appropriate method to solve it, anybody can help please? > >> thx a lot > >> > >> > > > > > > > -- > 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] Forms and PHP variables
Use is_numeric() http://www.php.net/is_numeric See also the ctype functions which can be read about here: http://www.php.net/ctype And yes, regular expressions are another option but aren't needed here. Regards, Philip Olson On Sat, 21 Dec 2002, Beauford.2002 wrote: > Hi, > > First off, thanks to all those that helped out with my other questions. Not > all my problems were solved, but I'm certainly closer. Still working on the > same project I need to do the following. > > I have a form where users input numbers only, is there a way I can have php > check to make sure a letter or other character didn't get put in by > accident. I was looking at ereg, but not to familiar with this or if it > would work in this case. > > TIA > > > > -- > 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] Loading modules not compiled in php
Aspell is deprecated in favor of Pspell in PHP so using it is a bad idea. But you can do this to get Pspell going: a) On either the JTL box or on some other one with the same operating system, get the php source and get ready to compile. http://www.php.net/downloads b) Be sure the appropriate libraries are available as per the instructions found here: http://www.php.net/pspell c) Configure PHP like so: ./configure --with-apxs --with-pspell=shared d) Then build it: make e) This will then create the module which will exist in: yourphpsourcedir/modules/pspell.so f) Copy this file somewhere on your web server and in the php script load it with dl() like so: dl('pspell.so'); Easier said then done I know but the above is a possibility ;) You may want to ask them if they could create this .so so that clients can load it dynamically, that would be ideal. Regards, Philip Olson On Sun, 22 Dec 2002, Tony Earnshaw wrote: > >I have a site hosted at JTL Networks, and I'm looking into setting up > > a spell checker for my message boards. The problem is, JTL doesn't have > > pspell compiled in with their php build, and it may be some time before > > they do (if they ever do). Does anyone know of a way to include > > something like pspell support in php dynamically? Like by using a > > .htaccess file to call it or something? > > At the last count (Apache 1.3.27/PHP4.2.3), aspell doesn't get compiled into > PHP. It just sits in /usr/bin on RH Linux, at least.. > > The bad news is, that your code will have to be written for it. The good news > is, that you can cheese the code off Horde's Imp. > > Best, > > Tony > > -- > > When all's said and done, there's nothing left to say or do ... > http://www.billy.demon.nl > > - > This mail sent through IMP: http://horde.org/imp/ > > -- > 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] Forms and PHP variables
is_numeric() will work with variables just fine. So: if (is_numeric($var)) { print "Yep, it's numeric"; } else { print "Nope, it sure isn't a number"; } Make sure $var is defined. If it's coming from a form then use $_POST['var'] or similar instead for reasons described here: http://www.php.net/variables.external Regards, Philip Olson On Sat, 21 Dec 2002, Beauford.2002 wrote: > Thanks for the info, but . is_numeric does not appear to accept > variables i.e. is_numeric($num) and ctype gives me the following. > > Fatal error: Call to undefined function: ctype_digit() in > /usr/local/apache/htdocs/.. on line 6 > > > > > - Original Message - > From: "Philip Olson" <[EMAIL PROTECTED]> > To: "Beauford.2002" <[EMAIL PROTECTED]> > Cc: "PHP General" <[EMAIL PROTECTED]> > Sent: Saturday, December 21, 2002 9:50 PM > Subject: Re: [PHP] Forms and PHP variables > > > > > > Use is_numeric() > > > > http://www.php.net/is_numeric > > > > See also the ctype functions which can > > be read about here: > > > > http://www.php.net/ctype > > > > And yes, regular expressions are another > > option but aren't needed here. > > > > Regards, > > Philip Olson > > > > > > On Sat, 21 Dec 2002, Beauford.2002 wrote: > > > > > Hi, > > > > > > First off, thanks to all those that helped out with my other questions. > Not > > > all my problems were solved, but I'm certainly closer. Still working on > the > > > same project I need to do the following. > > > > > > I have a form where users input numbers only, is there a way I can have > php > > > check to make sure a letter or other character didn't get put in by > > > accident. I was looking at ereg, but not to familiar with this or if it > > > would work in this case. > > > > > > TIA > > > > > > > > > > > > -- > > > 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 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] Tutorials on OOP
This tutorial lists many oop tutorials: Know of any basic tutorials on PHP Classes and OOP? --- http://www.faqts.com/knowledge_base/view.phtml/aid/7569 Regards, Philip Olson On Mon, 23 Dec 2002, Wee Keat wrote: > > > Hi Justin, > > > > Thanks for your quick reply.. Well in this case i needs to build em > > myself, because i am doing a course called Masterclass PHP and i have to > > learn OOP.. So i am looking for some good OOP tutorials/examples on the > > web I am very interested in creating a user login class using > > sessionsDo u know any good sites where i can find tutorials/examples > > about this.? > > > > If that's the case... u can try looking at these tutorials on Zend.com... > > http://www.zend.com/zend/tut/tutorial-johnson.php > http://www.zend.com/zend/tut/tutorial-johnson2.php > > As well as these ones on DevArticles.com > > http://www.devarticles.com/art/1/241 > http://www.devarticles.com/art/1/245 > http://www.devarticles.com/art/1/262 > http://www.devarticles.com/art/1/285 > > HTH! > > Yours, > Wee Keat > > > "Good timber does not grow with ease; the stronger the wind, the stronger > the trees." > > > > -- > 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] forum?
Another good one: fudforum: http://fud.prohost.org/ Regards, Philip On Tue, 24 Dec 2002, [windows-1254] Fatih Üstündað wrote: > do you know freeware forum in php I can easly use? > > thanks. > fatih ustundag > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Include
I've heard that RH8 decided to disable short tags in their default php.ini If this is true, the people at RedHat deserve a good spanking. Talk about being irresponsible! Regards, Philip On Tue, 24 Dec 2002, Tom Woody wrote: > I have found this to be very true with RedHat 8 (includes Apache2.0.40, > and php 4.2.2). While RedHat 8.0 isn't really ready for a production > server, apache2 and php definitly are not. You have to bend over > backwards to get some things working correctly if at all. Plus there > are still some stability issues with RH 8. > > As far as my production servers go apache 1.3 and RH 7.3 for now. > > On Tue, 24 Dec 2002 00:02:49 -0700 > Rick Widmer <[EMAIL PROTECTED]> wrote: > > > At 08:04 AM 12/24/02 +0300, sport4ever wrote: > > > > >maybe there is something wrong with php.ini > > >notice that I faced with this problem just after I upgraded to (PHP > > >4.2.1),(Apache2), everything was great before! > > > > The last I heard PHP + Apache2 is pretty much experimental, and not > > recommended for production servers. Unless you plan on working to > > debug the combination of programs, you should be using Apache 1.3 if > > you want to use PHP. > > > > There are a few combinations of versions that work together, but > > unless you are willing to put a lot of extra effort and study into > > using Apache 2, stick with 1.3 until the PHP developers announce > > Apache 2 support. > > > > > -- > Tom Woody > Systems Administrator > > Don't throw your computer out the window, > throw the Windows out of your computer! > > > -- > 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: query join 2 databases? or match up arrays?
Any chance you can do a somewhat frequent export from informix into mysql or the other way around so all your stuff is in one database? -philip On Fri, 3 Jan 2003, Jeff Bluemel wrote: > ok - here's my problem. I have some data in mysql, and other data in > informix. > > here is my application. this is for distributors of prepaid phone cards. > prepaid phone cards have 3 numbers they can be identified by pin number > (which is unique), or by batch & serial number. the batch number is > basically the type of card, and the serial number & batch number for another > unique identifier when used together. > > now - a batch can be given to several different distributors. therefore, > when then are pulling various types of information on the batch they should > only be able to see it for their cards, and not all of the cards in the > batch. > > piece of cake right? well - the permissions information is kept in mysql, > and the batch information its self is kept in an informix database. there > is no way around this for me. > > the only way I can think of to work around this problem is to query 1 card > at a time, and sum the info etc. together. however, there could be 400,000+ > records, and this would be a slow tedious process. plus for each card I'd > have to query the mysql database for permissions, and then in turn query the > informix database in turn. this could take a long time to display the > webpage. > > clear as mud??? recommendations? > > > > -- > 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: query join 2 databases? or match up arrays?
Hmm... what about querying the informix database for the set of rows you want all at once, putting that into a temporary mysql table with a timestamp and then doing the rest of your work from there. Then the next time it happens check the timestamp on that mysql table and if it's out of date, delete it and go and fetch updated rows from informix, otherwise just use what's in that mysql table. This would act as a sort of replicated table, but only taking into account the records that are actually being hit... maybe? On Fri, 3 Jan 2003, Jeff Bluemel wrote: > well - the informix database will be running on another server (a telecom > billing system). this is a web based front end, and I really want to leave > the other system alone 100%. if I were to modify anything I would make the > mysql permissions table inside of informix, but there are liability reason > which would keep me from doing so. > > still - you bring up an interesting point. a php script file that ran on > crontab may not be a bad answer. however, again I would run into a problem > of volume. there are an average of 3-4 million card in the informix server > so I couldn't do this in a export & import. too may records, and info has > to be accurate within 15 minutes. shear volume I believe is going to kill > that idea. I would be back to 1 record at a time running every 15 minutes. > I would think too much load, and more practical to do it 1 record at a time > upon request which won't be too frequent. > > hoping there's another solution I'm not aware of, or over looked. > > Jeff > > "Philip Hallstrom" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Any chance you can do a somewhat frequent export from informix into mysql > > or the other way around so all your stuff is in one database? > > > > -philip > > > > On Fri, 3 Jan 2003, Jeff Bluemel wrote: > > > > > ok - here's my problem. I have some data in mysql, and other data in > > > informix. > > > > > > here is my application. this is for distributors of prepaid phone > cards. > > > prepaid phone cards have 3 numbers they can be identified by pin number > > > (which is unique), or by batch & serial number. the batch number is > > > basically the type of card, and the serial number & batch number for > another > > > unique identifier when used together. > > > > > > now - a batch can be given to several different distributors. > therefore, > > > when then are pulling various types of information on the batch they > should > > > only be able to see it for their cards, and not all of the cards in the > > > batch. > > > > > > piece of cake right? well - the permissions information is kept in > mysql, > > > and the batch information its self is kept in an informix database. > there > > > is no way around this for me. > > > > > > the only way I can think of to work around this problem is to query 1 > card > > > at a time, and sum the info etc. together. however, there could be > 400,000+ > > > records, and this would be a slow tedious process. plus for each card > I'd > > > have to query the mysql database for permissions, and then in turn query > the > > > informix database in turn. this could take a long time to display the > > > webpage. > > > > > > clear as mud??? recommendations? > > > > > > > > > > > > -- > > > 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: query join 2 databases? or match up arrays?
> actually - I believe that may be a workable solution. you were mentioning > checking the timestamp on a mysql table. how would I check the timestamp on > a mysql table? see the timestamp data type. > even with this I'm betting it would be more time consuming to create the > table then it would to pull the info from informix, and process validation 1 > record at a time from mysql. that would be a simple query instead of an Yeah, but only the first time... if you get a lot of repeat traffic on the same set of rows only the first "hit" will be slow since after that it will all be in mysql... > insert. this would also all take place on the server it's self instead of > pulling it from another server. I could load it up with ram & let it run. > > at any rate that gives me a lot of option to think about, and I'll probably > has to work with some samples of the stuff from here to see what way is > going to be the fastest. it would probably depend if the user was pulling > this info in a session. if it was once, or several times. all something to > think about. > > the other option I'm thinking about is just not giving the distributors > access to this information, but restricting it to users with permissions to > the entire batch only. > > thanks, > > Jeff > > "Philip Hallstrom" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hmm... what about querying the informix database for the set of rows you > > want all at once, putting that into a temporary mysql table with a > > timestamp and then doing the rest of your work from there. > > > > Then the next time it happens check the timestamp on that mysql table and > > if it's out of date, delete it and go and fetch updated rows from > > informix, otherwise just use what's in that mysql table. > > > > This would act as a sort of replicated table, but only taking into account > > the records that are actually being hit... > > > > maybe? > > > > On Fri, 3 Jan 2003, Jeff Bluemel wrote: > > > > > well - the informix database will be running on another server (a > telecom > > > billing system). this is a web based front end, and I really want to > leave > > > the other system alone 100%. if I were to modify anything I would make > the > > > mysql permissions table inside of informix, but there are liability > reason > > > which would keep me from doing so. > > > > > > still - you bring up an interesting point. a php script file that ran > on > > > crontab may not be a bad answer. however, again I would run into a > problem > > > of volume. there are an average of 3-4 million card in the informix > server > > > so I couldn't do this in a export & import. too may records, and info > has > > > to be accurate within 15 minutes. shear volume I believe is going to > kill > > > that idea. I would be back to 1 record at a time running every 15 > minutes. > > > I would think too much load, and more practical to do it 1 record at a > time > > > upon request which won't be too frequent. > > > > > > hoping there's another solution I'm not aware of, or over looked. > > > > > > Jeff > > > > > > "Philip Hallstrom" <[EMAIL PROTECTED]> wrote in message > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > Any chance you can do a somewhat frequent export from informix into > mysql > > > > or the other way around so all your stuff is in one database? > > > > > > > > -philip > > > > > > > > On Fri, 3 Jan 2003, Jeff Bluemel wrote: > > > > > > > > > ok - here's my problem. I have some data in mysql, and other data > in > > > > > informix. > > > > > > > > > > here is my application. this is for distributors of prepaid phone > > > cards. > > > > > prepaid phone cards have 3 numbers they can be identified by pin > number > > > > > (which is unique), or by batch & serial number. the batch number is > > > > > basically the type of card, and the serial number & batch number for > > > another > > > > > unique identifier when used together. > > > > > > > > > > now - a batch can be given to several different distributors. > > > therefore, > > > > > when then are pulling various types of information on the batch they > > > should > &
Re: [PHP] php4.3.0 & GD library
On Sun, 5 Jan 2003, thkiat wrote: > Do you kow how can I upgrade the PHP 4.1.1 in PHPTriad to PHP 4.3.0? > I need PHP 4.3.0. as it includes a version of gd (GD Library) as "standard > equipment." GD is not "standard equipment", a "special" version is just bundled in PHP source now. It sounds like you are using windows, this bundling has no affect on the windows distribution as it included all the pre-compiled binaries already, including GD's. In fact, I bet you already have a GD binary and just need to uncomment out in your php.ini but anyway 4.1.1 is old so you should upgrade. Like with any version of PHP you download it and follow the install instructions. http://www.php.net/downloads Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HEEELP...please
Is register_globals on or off? If it's off on the new machine that explains why $DOCUMENT_ROOT is evaluating to "" which would produce the error message you are getting... On Thu, 9 Jan 2003 [EMAIL PROTECTED] wrote: > I absolutely cannot understand the include_path directive. > Can somebody, please, explain this? > I have a situation that I find absolutely incomprehensible: I moved my > experimental web-site from FreeBSD 4.5 running php4 v. 4.0 (or something), > apache 1.13 where thesite worked just fine to another box with FreeBSD 4.7 > running php4 v. 4.2.3, apache 1.13.27_1. > All of a sudden, I get the message: > Warning: Failed opening '/../lib/somefile.conf' for inclusion > (include_path='.:/usr/local/lib/php') in /usr/local/www/html/index.php on > line 6 > > I can find nothing in the httpd.conf files that could account for this; > there is no configuration in them for include_path. > > Obviously, the php file is being parsed correctly, but there is a problem > with the line : > include "$DOCUMENT_ROOT/../lib/somefile.conf". > > It works on one machine, but not on the latest version of php4 an apache. > > I see there are others on the net who have had this problem, but I have not > yet found an explanation or a cure. > > HELP please, > > PJ > > > > > > > -- > 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: Persistent global data ?
http://www.php.net/manual/en/ref.shmop.php On Tue, 14 Jan 2003, Mathias Rockel wrote: > Hi all ! > > It seems I did not state exactly enough what I need ... if I use the > $_SESSION functions or write the stuff myself makes no difference, actually > then I can just leave it in the database and read it every time ... but that > is just slow ... I want to create it persistant in the system memory so > every script can access the contents without having to recreate the whole > tree each time ... > > mathias rockel > > - Original Message - > From: "Rick Emery" <[EMAIL PROTECTED]> > To: "Mathias Rockel" <[EMAIL PROTECTED]>; > <[EMAIL PROTECTED]> > Sent: Tuesday, January 14, 2003 3:30 PM > Subject: Re: Persistent global data ? > > > > Write persistent data to a file on server side > > > > - Original Message - > > From: "Mathias Rockel" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Tuesday, January 14, 2003 8:12 AM > > Subject: Re: Persistent global data ? > > > > > > Hi! > > > > I'm not sure if that would be a good idea in respect to performance, also > > AFAIR cookies cannot save objects (can they?), and there are size > > limitations on cookies, so I probably cannot use them because they could > not > > contain all the data ... and also, if I have the complete file structure > > saved on the client side its very easy to modify the data, possibly > getting > > access to stuff that is not meant to be seen ... no cookies =). > > > > thanks anyway ! > > > > mathias rockel > > > > - Original Message - > > From: "Rick Emery" <[EMAIL PROTECTED]> > > To: "Mathias Rockel" <[EMAIL PROTECTED]>; > > <[EMAIL PROTECTED]> > > Sent: Tuesday, January 14, 2003 3:06 PM > > Subject: Re: Persistent global data ? > > > > > > > cookies? > > > > > > - Original Message - > > > From: "Mathias Rockel" <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Tuesday, January 14, 2003 7:33 AM > > > Subject: Persistent global data ? > > > > > > > > > Hi all ! > > > > > > I am currently writing some kind of Document/File-Library in a LAMP > > > environment. > > > > > > As the library should be able to handle various file types, and most > file > > > types have to be handled differently internally, I would like to use > > > Objects/Classes to make the code for the Library iself independent from > > the > > > stuff that is individual to the different file types. > > > > > > Now I noticed early that when I use Objects in PHP and have to create > many > > > for them each time a script runs it slows the system down considerably. > It > > > seems you can now save objects in sessions which AFAIR was not possible > > last > > > time I tried. But then I would have to read the whole file index (which > is > > > actually a tree) into a session variable for each user, and I don't know > > if > > > thats a good idea performancewise. It would be a rather large > > > multi-dimensional array. > > > > > > So I would like to know if there is any possibility in PHP to create my > > own > > > persistent superglobal, a variable which can be read by any script > > running. > > > I think something similiar is available as the "Application" Object in > ASP > > > under IIS. I know I have to take care of locking and stuff (although the > > > end-user scripts would only need read access to it), but if I could > write > > > some functions which just would check if the tree is already in memory > or > > > not (after a server shutdown or whatever), and if not just read it in > from > > > the database to make it available in every other script. > > > > > > The only thing I've found so far which I think may be a possibility is > the > > > shared memory stuff that PHP supports, but I don't know anything about > > that > > > on the system level, and its not explained in much detail in the PHP > > manual. > > > Is that something I should follow, or can't I use it ? Can I somehow use > > the > > > underlying Apache ? Are there better options ? > > > > > > any help/suggestions/hints are greatly appreciated ! > > > > > > mathias rockel > > > > > > > > > -- > > > 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 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP receiving e-mail
You could use fetchmail to get the mail and pipe it into your php script which would see it as standard input... Or look on zend.com for a POP class... On Tue, 14 Jan 2003, David Russell wrote: > Hi all, > > I want to develop a script that can read an e-mail from a pop account, > and then perform actions on that e-mail based on characteristics of the > e-mail (e.g. header information, attachments, etc) > > Does anyone know of a way to receive e-mails via php, and then to parse > them easily. My assumption would be that there should be a class out > there somewhere that handles it well. > > Thanks > > David Russell > IT Support Manager > Barloworld Optimus (Pty) Ltd > Tel: +2711 444-7250 > Fax: +2711 444-7256 > e-mail: [EMAIL PROTECTED] > web: www.BarloworldOptimus.com > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] REQUEST_URI, which part of $_ is it from??
> Which part of $_ is the REQUEST_URI be found from? It's a web server predefined variable so only lives in $_SERVER. http://www.php.net/variables.predefined Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Acessing $DOCUMENT_ROOT
$_SERVER[DOCUMENT_ROOT] On Fri, 17 Jan 2003, Don wrote: > Hi, > > How do I access $DOCUMENT_ROOT when register_gobals is set off? I think > there's an array, something like $HTTP_ENV_VARS['DOCUMENT_ROOT'] but I can't > find it in the documentation. > > Thanks, > Don > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 > > > -- > 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] $HTTP_GET_VARS
Everyone from this thread needs to reread this: http://www.php.net/variables.external Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Acessing $DOCUMENT_ROOT
> How do I access $DOCUMENT_ROOT when register_gobals is set off? I think > there's an array, something like $HTTP_ENV_VARS['DOCUMENT_ROOT'] but I can't > find it in the documentation. http://www.php.net/variables.predefined Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Cannot show reuploaded image file on page unless manual refresh
I wonder if appending time() would be better... granular to a second and you save the filesystem lookup effort?? On Mon, 20 Jan 2003, Jim Lucas wrote: > I would add the modification time of the file in question with > > filetime($filename); > > that way you will be sure to get a unique argurment. > > Jim > > - Original Message - > From: <[EMAIL PROTECTED]> > To: "Chris Shiflett" <[EMAIL PROTECTED]> > Cc: "Phil Powell" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; > <[EMAIL PROTECTED]> > Sent: Monday, January 20, 2003 10:48 AM > Subject: Re: Cannot show reuploaded image file on page unless manual > refresh > > > > > > Aha! Something I can chime in on. I happened across the same scenario a > > few months back. The list helped me then so I'll give back. > > > > Call the image using a random identifier. > > > > $rand = rand(1000, ); > > > > echo "http://someurl.com/image.jpg?$rand";; > > > > Since the browser will more than likely not have the image file identified > > by the random number it must request it again from the server. Works > > great where I need it! > > > > Ed > > > > On Mon, 20 Jan 2003, Chris Shiflett wrote: > > > > > --- Phil Powell <[EMAIL PROTECTED]> wrote: > > > > I am using the following header() functions to force > > > > view.php to not cache: > > > > > > > > header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); > > > > header("Last-Modified: " . gmdate("D, d M Y H:i:s") . > > > > " GMT"); > > > > header("Cache-Control: no-store, no-cache, > > > > must-revalidate"); > > > > header("Cache-Control: post-check=0, pre-check=0", > > > > false); > > > > header("Pragma: no-cache"); > > > > > > :-) > > > > > > I think you killed it. > > > > > > > However, when a user reuploads a file in manage.php, it > > > > does a form post onto manage.php and reuploads the file > > > > (which I verified works). However, when redirected via > > > > header() to view.php, they still see their OLD image > > > > file, NOT the new one! Unless I manually refresh the > > > > page, they never see it, until they manually refresh the > > > > page, then the new image file appears! > > > > > > Right. > > > > > > I think you are forgetting that the image is not really > > > part of the PHP resource. Meaning, this is the series of > > > events for a PHP script that refernces a single image > > > called bar.jpg using the tag: > > > > > > 1. HTTP request sent for foo.php (Web client -> Web server) > > > 2. HTTP response sent that includes the output of foo.php > > >(Web server -> Web client) > > > 3. Web client (browser) notices tag referenced in > > >the HTML. > > > 4. HTTP request sent for bar.jpg (Web client -> Web server) > > > 5. HTTP response sent that includes bar.jpg > > > > > > So, the headers that you are setting only matter for the > > > resource returned in step 2. Meaning, the HTML output of > > > foo.php is not cached. The image, since it is returned by > > > the Web server and not your PHP script, is cached. > > > > > > Chris > > > > > > -- > > > 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 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: fscanf
Why not: $array = split("[ ,]", $line); ? On Wed, 22 Jan 2003, Kris wrote: > Hi > > I'm having dramers with fscanf > I have a line: > text, text, text > > I can't work out how to scan removing the comma and whitespace. > the text can be absolutle anything. > > at the moment I have > $array = fscanf ($fp, %s%[^,] %s%[^,] %s%[^,]); > > Thanks > > Kris > > > -- > 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] image source from PHP
> > Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need Coding Help With getdate()
Replace your last line with this... $date = $month . $mday . $year Or take a look at the date() command... something like: $date = date("mdy", time()); would do the same thing (check the man page for sure). On Fri, 24 Jan 2003, Guru Geek wrote: > Hello, > > I'm trying to use getdate() and then create a numeric value based on > putting the month (numeric), the date, and the year all together, side > by side in one variable. > > Here's my code: > $today = getdate(); > $month = $today['mon']; > $mday = $today['mday']; > $year = $today['year']; > > $date = $today['mon'.'mday'.'year']; > ?> > > But all I get is a blank when I look at $date in the browser. Any idea > why that is? > > Thanks in advance, > Roger > > > > -- > 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: linux cpu usage
does it hog the CPU and stop other things from running or is it just using 100% of the CPU? If the latter, that's fine. If the former, read the man page for nice or renice (it's renice on freebsd) -philip On Fri, 24 Jan 2003, Gareth Thomas wrote: > Hi all, > > I have a command line PHP script that is in a continous loop to monitor a > particular database event. I am running RedHat 8 and the only problem I am > finding is that it hogs the CPU. I developed the script originally on > Windows and it worked better there. Is there a way to limit CPU resource for > a PHP command line script in Linux? > > Gareth > > > > -- > 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] Predefined Variables In Classes
Read: http://www.php.net/variables.scope Also note that $_SERVER is an autoglobal. Regards, Philip On Sun, 26 Jan 2003, @ Nilaab wrote: > Hello Everyone, > > I am a little confused. Why do predefined variables like $PHP_SELF or > $DOCUMENT_ROOT not process within a class, in the methods secifically. For > example: > > class someClass { > >function someFunction () { > $root = $DOCUMENT_ROOT; > return $root; >} > >function someFunction2 () { > $path = $this->someFunction() . $PHP_SELF; > return $path; >} > } > ?> > > I just threw this together to give you an example of how I might be using > these two predefined variables in a class. The problem is that > $DOCUMENT_ROOT or $PHP_SELF won't parse or something. It just returns blank. > > It is included in another page when needed, say somePage.php. Shouldn't > $PHP_SELF recognize the somePage.php as the current running script file, as > opposed to the class file where these two functions are called? If it > doesn't work that way then how do I do this without sending predefined > variable parameters to these functions? > > Please note that register globals is on. I could not find any documentation > on this on php.net. Maybe someone can give me a hint of point it out for me > on the documentation. 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] Java call on object causes segfault.
Whenever you get a segfault, try the latest stable release and during compile be sure to use --enable-debug : http://snaps.php.net/ If the segfault exists here, write a bug report and include the backtrace: http://bugs.php.net/how-to-report.php http://bugs.php.net/ This will be of great help to the php-dev team. Also I believe many changes to the Java extension went into 4.3.0 so maybe it'll work for you. Regards, Philip On Sun, 26 Jan 2003, John Wells wrote: > Working on getting Java integration going. I was able to get it to work > with the online example and can create an object of java.lang.System and > print various properties returned from there. > > However, if I create my own class, I can instantiate it, but if I call a > method on that class it causes a SIGSEV. > > Could anyone provide some insight? > > Here's the code and backtrace: > > This is with Sun jdk 1.4.1_1, php-4.2.3 on Red Hat 8.0. > > > $obj = new Java('com.x.reports.Serv'); > > print $obj->getMsg(); > ?> > > --- java code stored off of class path in com/x/reports --- > package com.x.reports; > > class Serv > { > public String msg = "THIS IS A TEST MESSAGE"; > > Serv() > { > > } > > public String getMsg() > { > return this.msg; > } > > } > > -- BACKTRACE --- > Program received signal SIGSEGV, Segmentation fault. > [Switching to Thread 8192 (LWP 9303)] > 0x402da2cb in java_call_function_handler (ht=0, return_value=0x8114d14, > this_ptr=0x810d604, return_value_used=1, property_reference=0xbfffdf54) > at java.c:464 > 464 obj = zend_list_find(Z_LVAL_PP(handle), &type); > (gdb) bt > #0 0x402da2cb in java_call_function_handler (ht=0, > return_value=0x8114d14, this_ptr=0x810d604, return_value_used=1, > property_reference=0xbfffdf54) at java.c:464 > #1 0x40191553 in call_overloaded_function (T=0xbfffdf48, arg_count=0, > return_value=0x8114d14) at zend_execute.c:953 > #2 0x40194636 in execute (op_array=0x8114b6c) at zend_execute.c:1660 > #3 0x401a40a3 in zend_execute_scripts (type=8, retval=0x0, > file_count=3) at zend.c:812 > #4 0x401b5aaf in php_execute_script (primary_file=0xb450) at > main.c:1383 > #5 0x401b0aba in apache_php_module_main (r=0x8107004, > display_source_mode=0) at sapi_apache.c:90 > #6 0x401b18ea in send_php (r=0x8107004, display_source_mode=0, > filename=0x8107b34 "/opt/apache_1.3.27/htdocs/t.php") at mod_php4.c:575 > #7 0x401b1963 in send_parsed_php (r=0x8107004) at mod_php4.c:590 > #8 0x08074880 in ap_invoke_handler () > #9 0x08088c76 in process_request_internal () > #10 0x08088cd6 in ap_process_request () > #11 0x0807ff9a in child_main () > #12 0x0808013a in make_child () > #13 0x080802a1 in startup_children () > #14 0x080808ce in standalone_main () > #15 0x080810ec in main () > #16 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6 > > > > > -- > 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] I'm new in PHP
On Sun, 26 Jan 2003, Beogradjanin wrote: > Zdravo php-general, > > Hi I have setup PHP Apache MySql. > I;m new in this stuff where can I learn hot to make web pages in > PHP...??? Go here: Learn HTML http://www.w3schools.com/html/ Learn SQL http://www.w3schools.com/sql/ http://www.sqlcourse.com/ Learn PHP http://www.faqts.com/knowledge_base/view.phtml/aid/2836/fid/51 http://www.php.net/manual/ http://www.php.net/links.php Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about SSL/php globals
On Mon, 27 Jan 2003, Wei Weng wrote: > Is there any environment/Global variable in PHP that indicates whether the > server port you connect to is SSL port? $_SERVER['HTTPS'] Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strip_Tags @ php 4.3
On Mon, 27 Jan 2003, George E. Papadakis wrote: > Hello, > > Has anyone noticed strange behaviour in strap_tags @ php 4.3? > We did upgrade to the latest snap yet the problem remains. For some reason > strip_tags acts weird.. Please be specific with a short self-contained example that demonstrates your definition of "weird" Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: multiple entry forms !!
Use several smaller forms and store the results of each into a session variable. Also store a "got-results-for-form-1" (through 7) that gets set for each of the 7 forms. Once all 7 are set you can do the final processing. Set the action of each form to say "save.php" and pass in a "saving_what" field". save.php can then do a switch on the saving_what field to determine what needs checking/storing/etc. Works good for me. On Mon, 27 Jan 2003, scott wrote: > hi > > looking for some advice > > I have a site in progress. user to it have to enter a LOT of information (it > will contain a club directory) > > in order to try and make it a less unpleasant experience for the user, I > want to give them 7 smaller input forms, each one following the other > > what would be the correct way to do this, one very large, complex coded php > conditional form that does everything, or several smaller ones ? > > if I use one form, it will conatin rather a lot of code, but execution would > all be handled by the form itself > > but if I use multiple smaller forms, each form would need to process the > previous forms input, and then display it's inputs for entry > > I am also using sessions, which adds a little to complexity > > any general good coding practice tips/links would be helpful > > 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
[PHP] Re: output of fread() is blank
I could be wrong, but I'd guess that filesize fails for remote files. If all you're doing is spitting out the text, why not use readfile()? -philip On Mon, 27 Jan 2003, Guru Geek wrote: > Hello, > > I'm a recent convert from CGI/Perl and so am still getting my feet wet > in PHP. > > Here's my code: > $filename = "http://www.myserver.com/include/sometext.txt";; > $handle = fopen ($filename, "rb"); > $contents = fread ($handle, filesize ($filename)); > fclose ($handle); > echo $contents; > exit; > > The problem is nothing shows up, it's a blank browser window. I'm sure > this is a stupid questions and very easily fixed. > > Also, if the text file I'm trying to read is multi lined, shouldnt I be > placing the contents into an array? or is that old cgi habits coming > through? > > Thanks, > Roger > > > > -- > 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] output of fread() is blank
On Mon, 27 Jan 2003, Guru Geek wrote: > Hello, > > I'm a recent convert from CGI/Perl and so am still getting my feet wet > in PHP. > > Here's my code: > $filename = "http://www.myserver.com/include/sometext.txt";; > $handle = fopen ($filename, "rb"); > $contents = fread ($handle, filesize ($filename)); [snip] See: http://www.php.net/filesize You cannot use it with urls. Also if you can help it, don't go through http like this. But anyway, see also: file(), fgets(), and include() Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mail () format
Something like... $body = "blah blah blah\n"; $body .= "Name = $name\n"; $body .= "Address = $address\n"; $body .= "Comments = $comments\n"; mail("[EMAIL PROTECTED]", "subject", $body); would do it. On Tue, 28 Jan 2003, Bruce Levick wrote: > I have a number of field entries that I am trying to send through to the > body of an email. > > How can I format the mail() command to send these multiple fields. > > EG $name, $address, $comments. All to go into the body of an email. > > Cheers > > > -- > 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] output of fread() is blank - FIXED - updated
On Mon, 27 Jan 2003, Guru Geek wrote: > Sorry, here is the code now ( I need a nap ) > > $filename > ="/usr/local/plesk/apache/vhosts/myserver.com/httpdocs/include/text.txt"; > $handle = fopen ($filename, "r"); > $contents = fread ($handle, filesize ($filename)); > fclose ($handle); > echo $contents; > exit; For something like this, just use readfile() and not fread as it'd be much more efficient if you don't actually manipulate the string $contents. So: readfile($filename); // note: do not use echo Also, what is your include_path setting? It's important you know it and what it means as that'll answer the question in your last post: print ini_get('include_path'); http://www.php.net/manual/configuration.directives.php#ini.include-path Also, no need for "exit" here as that happens automatically. Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP vs Perl for system scripts (non-web)
Unless you've got a compelling reason to switch to Perl, I wouldn't. I like Perl, but like you have used PHP a lot more often in the last couple of years. Where I find it really nice is when my cron scripts need to use the same libraries as my web scripts... -philip On Mon, 27 Jan 2003, Paul Chvostek wrote: > > I have to write a swath of code to manage system-related stuff based on > database content. Scripts will be run as root by cron, and determine > what they have to do via user interaction and SQL lookups. Functions > will include manipulation of system configuration files, legacy text > file configs, and some signalling with posix_kill. On some of the > machines in question, there won't even be an httpd installed, so I'd be > building a php as a standalone binary, and running it with shell magic > and a -q option. I've done this kind of stuff in the past in smaller > environments, and it seems to work nicely. > > I'm more comfortable writing stuff in PHP. I use PHP alot more, and I > find the resultant code more readable and easier to maintain. Aside > from Perl's ubiquity and the dubious advantage of future flexibility by > using Perl's DBI interface to talk to different SQL servers (I'm using > MySQL at the moment), are there any compelling reasons I should write > system stuff in Perl rather than PHP? > > Thanks. > > -- > Paul Chvostek <[EMAIL PROTECTED]> > Operations / Abuse / Whatever > it.canada, hosting and development http://www.it.ca/ > > > -- > 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] Allowing . in $_POST variable
Regarding keeping . as . and not _ in variables: This isn't going to happen as it seriously breaks BC. This also would affect functions such as import_request_variables() and extract(). There is no worthy benefit here, this will never happen. Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Variables not getting passed || Apache, MySql, Win2k Setup
One too many $'s in your code, use: $_REQUEST['my_passed_variable'] This is how all arrays work, autoglobals are the same. See also: http://www.php.net/variables.external http://www.php.net/variables.predefined Regards, Philip On Wed, 29 Jan 2003, CF High wrote: > Hey all. > > This driving me nuts: > > I've got Apache, MySql, and Windows 2000 running on my local machine. > In order to get passed php variables evaluated, whether via a url query > string, or through a form post, I have to use this syntax: > > $_REQUEST[$my_passed_variable] > > I have no such problem with our hosting company servers; i.e. I can access > query_string and form posted variables as $my_passed_variable. > > What is going on here? Is there something in php.ini that needs to be > adjusted? > > Any help whatsoever here is much appreciated, > > --Noah > > -- > > > > > -- > 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] Form Variables not getting passed || Apache, MySql, Win2k Setup
> You never answered if this was in a function or class > method. Is it? Did you say whether it was Apache 1 or 2? Also, to check what the register_globals setting really is, make a call to phpinfo() as it will tell you the true setting. Sometimes the wrong php.ini is edited or the web server wasn't restarted or .htaccess/httpd.conf gets in the way or ... ... Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using custom "button" form element instead of standard"submit"?
[snip] > I assume i could use solution "A" above, and parse the _x out of the "name" > value .. but this seems pretty hoaky and it's my understanding soultion B is [snip] This is how it's done. If this is set, the button was clicked. For example: if (isset($_REQUEST['thebuttonname_x'])) { print "The button was clicked"; } Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: __PHP_Incomplete_Class Object
I don't see where you include() your class definition in that second file... add include("nycmgMail.php") right before the session_start() line and see if that makes a difference. -philip On Thu, 30 Jan 2003, Weston Houghton wrote: > > Ok, now I'm frustrated. > > I'm trying to register an object in the session, and access that object > from 2 different pages. > > I start off in the first file, and do: > include("nycmgMail.php"); > session_start(); > $myMailer = new nycmgMail(); > $myMailer->buildRecipients(); > $_SESSION['myMailer'] = $myMailer; > ?> > > If I print_r the $_SESSION on that page, everything looks fine. So I > then move to my second page, and use: > > session_start(); > > $myMailer = &$_SESSION['myMailer']; > if ($myMailer) { > $addressArray = $myMailer->getRecipients(); > } else { > $addressArray = null; > } > > ?> > > Now when I do this, if I look at the $_SESSION object I see that that > class is now listed as: > [myMailer] => __PHP_Incomplete_Class Object > ( > [__PHP_Incomplete_Class_Name] => nycmgmail > ... > > and in the error log I see: > [29-Jan-2003 23:58:09] PHP Fatal error: Unknown(): The script tried to > execute a method or access a property of an incomplete object. Please > ensure that the class definition nycmgmail of the object you are > trying to operate on was loaded _before_ the session was started in > /.../.../.../.../admin/addresses.php on line 6 > > I swear I have done all of this before, but it is just not working now, > and for the life of me I can't see anything right in front of me. > > Help! Please? > > thanks, > Wes > > > > > --- > The selection and placement of letters on this page was > determined automatically by a computer program. Any > resemblance to actual words, sentences, or paragraphs is > pure coincidence, and no liability will be assumed for > such coincidences. > > --- > > > -- > 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] Using custom "button" form element instead of standard"submit"?
On Thu, 30 Jan 2003, Chris Hayes wrote: > At 12:18 30-1-2003, you wrote: > >sure this would work but it'd be VERY inefficient in my application. It's a > >file browser application so i have hundreds of folder icons on a page .. the > >'submit' element will pass back the name of the button clicked and it would > >be available immediately/directly, which is what i want. BUT an 'image' > >element would require me to loop through ALL buttons doing an 'isset' test > >on each one. > * if there is not other data in the form you coudl turn it into an image > link and get the value in the $_GET > * else walk through the $_GET vars (each key/value) untill you see a > varname that could be what you looked for. Or why not: $lookingfor = 'somebutton'; if (isset($_REQUEST[{$lookingfor . '_x'}])) { print "Found it, a button named $lookingfor was clicked"; } Or something, I think this is what you mean? Whatever the problem, there will be a solution ... don't stress :) But regarding the problem here, I don't get what you mean. How familiar are you with arrays? Anyway, as Chris stated, the name/value will be available in the appropriate autoglobal which will be $_POST or $_GET, and/or $_REQUEST. > >I can't believe html provides no means for using an icon as a submit button. > well it does doesn't it? > > >by the way .. unrelated question ... why would one want to use > >$_REQUEST['foo'] instead of just $foo? doesn't php give you access to form > >variables using the latter construct which is much cleaner? > not automatically anymore since PHP 4.10. > and the exact reason was that the old way was NOT clean, see the release > notes for PHP 4.10 for the details. It's as of PHP 4.2.0 that the default value of the register_globals directive went from on to off. It is this directive that pollutes your script with these variables and it's recommended to not use them and leave this deprecated directive off. Now what happened in PHP 4.1.0 was the introduction of autoglobals but this is all described in various places in the manual and here's such a place that links to others: http://www.php.net/variables.external May as well read this too: http://www.php.net/release_4_2_0.php Where have you been, hibernating? :) Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php question - query string
You've got it right... look at the man page for parse_str() for more info on the QUERY_STRING stuff as well as the register_globals configuration option. Looking at the script below, there is nothing special about setting $addjoke to 1. It's just important that it is set to *something* (because of the isset($addjoke) call. You could set it to whatever you want, but setting it to 1 is commonly done to indicate "trueness" or "it's on". You could set it to "yes" if you wanted and the script would work the same. Hope this helps. -philip On Thu, 30 Jan 2003, Anthony Ritter wrote: > The following script is from Kevin Yank's book on page 59-60. (Sitepoint) > > I'd like to get some clarification about the line: (almost next to last line > in the script) > > ... > echo("Add a Joke!"); > > > > He has a link called "Add a Joke!". > > When the user clicks on the link, the same page loads - with the form this > time - and the query string passes the value -1 - to the variable $addjoke. > > Am I on the right track? > > If so, why does 1 - as opposed to 2 or something else - have to be the > name/value pair if the user is adding another joke? > > Thank you. > TR > .. > > > > The Internet Joke Database > > >if (isset($addjoke)): // If the user wants to add a joke > ?> > > > Type your joke here: > > > > >else: // Default page display > > // Connect to the database server > $dbcnx = @mysql_connect("localhost", "root", "mypasswd"); > if (!$dbcnx) { > echo( "Unable to connect to the " . > "database server at this time." ); > exit(); > } > > // Select the jokes database > if (! @mysql_select_db("jokes") ) { > echo( "Unable to locate the joke " . > "database at this time." ); > exit(); > } > > // If a joke has been submitted, > // add it to the database. > if ($submitjoke == "SUBMIT") { > $sql = "INSERT INTO Jokes SET > JokeText='$joketext', > JokeDate=CURDATE()"; > if (@mysql_query($sql)) { > echo("Your joke has been added."); > } else { > echo("Error adding submitted joke: " . > mysql_error() . ""); > } > } > > echo(" Here are all the jokes in our database: "); > > // Request the text of all the jokes > $result = @mysql_query("SELECT JokeText FROM Jokes"); > if (!$result) { > echo("Error performing query: " . mysql_error() . ""); > exit(); > } > > // Display the text of each joke in a paragraph > while ( $row = mysql_fetch_array($result) ) { > echo("" . $row["JokeText"] . ""); > } > > // When clicked, this link will load this page > // with the joke submission form displayed. > echo("Add a Joke!"); > > endif; > > ?> > > > > -- > > > > > > -- > 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] mysq_connect()
On Thu, 30 Jan 2003, Cesar Rodriguez wrote: > Hi there, my name is Cesar Rodriguez and I am trying to upgrade from Caldera > Linux Server 2.3 into RedHat Server 8.0. The problem I encounter is that > after testing different scripts, php is working, except when I make an MySQL > call like mysql_connect() or mysql_pconnect(). > The call is as follows: > > $link = mysql_connect('localhost', 'user1', 'passwd') > or exit(); > > mysql_select_db ('mydb') > or exit (); > > $result = mysql_query ('SELECT COUNT(*) FROM clients') > or exit (); > > if ($row = mysql_fetch_array ($result)) > . etc .. > > The message I get is: > > "Fatal error: Call to undefined function: mysql_pconnect() in > var/www/html/lesson/firsta.php" > > Seems that PHP4 does not find the MySQL library. I checked php.ini and > httpd.conf files and everything is in its place apparently. I re-installed > everything from scratch with no positive result. I would appreciate advice > on this issue. Install the php-mysql rpm, restart apache, and they will now exist. (assuming you already installed the mysql rpm) In short, there are three rpms: php, mysql, and php-mysql. http://www.rpmfind.net/ Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Processing - Multiple inputs of the same name
On Fri, 31 Jan 2003, Tracy Finifter Rotton wrote: > Change the name of your checkboxes in your HTML to something like: > > name="DeleteIDs[]" > > This will make it an array, and you can access all the elements like > > $_POST['DeleteIDs'][0] > > etc. > > (This should really be in a FAQ somewhere...) Using arrays with forms is in a faq: http://www.php.net/manual/en/faq.html.php#faq.html.arrays How do you feel this should be expanded? Mentioning that unchecked checkboxes do not pass values, and that the default value is 'on' (if checked) ... would be good too. I remember posting some information on this topic in the past: http://marc.theaimsgroup.com/?l=php-general&m=101142826821051 http://marc.theaimsgroup.com/?l=php-general&m=98576486229922 Anyway, I agree, just not sure if there should be one specific faq for each form type, such as checkboxes or select boxes or... Ideally one faq would explain it for all types, checkboxes or otherwise. Making it short/concise and understandable for all user levels (such as newbies) is the tricky part. Well, actually, the tricky part is convincing people to read faqs :) Regards, Philip > On 1/31/03 11:17 AM, "Mike Potter" <[EMAIL PROTECTED]> wrote: > > > Is it possible to pass an group of input boxes of the same name, then get > > the values of all the checked boxes or filled out textboxes? > > How do I get ALL the IDs passed. Right now it only passes the last ID. Do > > I really have to give them all unique names? > > > > For example... > > > > > > > > > > > > > > Jon Smith > > David Callow > > Peter Parker > > . > > . > > . > > > > > > > > > > > > This list of DeleteIDs will be build dynamically. I want the user to be > > able to check the boxes they want to delete and pull the IDs on the posted > > page. > > > > How do I get ALL the IDs passed. Right now it only passes the last ID. > > > > Thanks, > > > > Mike > > > > > > -- > Tracy F. Rotton > [EMAIL PROTECTED] > http://www.taupecat.com/ > > "... I like the 49ers because they're pure of heart, > Seattle because they've got something to prove, > and the Raiders because they always cheat." > -- Lisa Simpson, "Lisa the Greek" > > > -- > 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] 4.3 Install on Solaris
On Fri, 31 Jan 2003, Weston Houghton wrote: > > All, > > I seem to be getting a silly error on Solaris when trying to do a PHP > 4.3 make. I get an error that looks to me like the liner arguments are > just too long. to be honest, I'm a bit stupified as to why this is > happening or how to fix it. FWIW, I have compiled 4.23 just fine on > that box. [snip] Are you using the GNU utilities? PHP requires them, for example, sed must be of GNU origin. Same for bison, flex, etc. This is a common problem on Solaris these days as it comes with a broken sed. GNU good. Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing Variables
On Sat, 1 Feb 2003, Beauford.2002 wrote: > Hi, > > Is there a way to pass a variable to a PHP script without using a form? I > want to put several links on my main page that when clicked on goes to a PHP > script - depending on what link was selected, will determine what part of > the PHP script gets executed. Yes, use GET: eat an apple See also if() and switch() http://www.php.net/else http://www.php.net/switch http://www.php.net/variables.external print $_GET['fruit']; Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] any change to see php source?
> I am studying on php. And the book say, when the server see php extension it > is running php file and giving results to the visiting browser. > > But as I see related directories are normal directory, doesn' t like cgi-bin > directories. > > Is there any change to see php file source such as file open function or > something else? I am not going to somebody else file. Just I want to be sure > how secure the php? It's all in CVS, read the source: http://cvs.php.net/ http://www.php.net/anoncvs.php You may also search the source in lxr: http://lxr.php.net/ Also, the following may be helpful to you: http://www.zend.com/phpfunc/ Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need to set default parameter || How to do in PHP?
On Sat, 1 Feb 2003, CF High wrote: > Hey all. > > In cold fusion I was able to define a default value with the "test" default = "myValue"> tag > > When I passed the variable "test" via a form or query string, it would over > ride the parameter value. > > How can I do this in PHP? I looked in PHP manual for param, default, etc., > but could find no equivalent. > > Any ideas? if (!isset($_REQUEST['rvar']) || inappropriate($_REQUEST['rvar'])) { $rvar = 'default'; } else { $rvar = $_REQUEST['rvar']; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using tags with php (IMPORTANT READ)
On Sat, 1 Feb 2003, Sunfire wrote: > if i do this: > /*all the mysql login stuff here*/ > > $query=mysql_query("select * from members"); > while($new=mysql_fetch_array($query)){ > echo "$new['company']"; > /*so on through the field list*/ > } > on output all i get is the title with a submit button.. > otherwise blank.. There is a bug in PHP 4.3.0 regarding the use of arrays in strings. The following gave a parse error before PHP 4.3.0: print "Do not do this: $arr['key']"; Now it gives an E_NOTICE error due to changes to the string scanner. In PHP 4.3.1 it will no longer give a bogus E_NOTICE and instead it will work (no parse error either). Surrounding the array with {braces} in the string works regardless, so: print "You can do this: {$arr['key']}"; Regarding this question, don't write it like that but instead do the following (no quotes needed): echo $new['company']; For those wondering about this bug, see: http://bugs.php.net/bug.php?id=21820 The string documentation has been updated to demonstrate the array in string phenomena (except the bug hasn't been mentioned as I'm waiting for it to be committed first). http://www.php.net/types.string Sunfire, you aren't seeing this E_NOTICE error because your error level is turned down (by default). Put this on top of your script to see them all: error_reporting(E_ALL); Regards, Philip > same thing with fetch_object()...and i have 1 row in the members table..im > sort of confused now that it doesnt work for a wierd reason > > any better ideas on how to get the stuff out of the table and into vars? > maybe im doing it wrong > > > - Original Message - > From: <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Saturday, February 01, 2003 5:33 PM > Subject: Re: [PHP] using tags with php > > > > In a message dated 2/1/2003 2:02:06 PM Pacific Standard Time, > > [EMAIL PROTECTED] writes: > > > > >i tried getting the values into vars using fetch_array/fetch_object and > > >fetch_row and tried to put them in variables but for some odd reason it > > >really doesnt work because when i try to use the vars in the value > section > > >instead of printing in the edit box the content of the variable i usually > > >end up with "?>", ">", "" instead... any reason this shows > > >up? and when i do: > > >echo ""; > > >then on the web page i end up with some thing like this instead of the > edit > > >box: > > >">";;"> > > >}?> > > >any reason for that? > > > > It sounds like $name and/or $new_var may be empty. Did you echo the > variables > > before using them in your form to check whether the values from the > database > > are actually in the variables? > > > > Janet > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 > > > -- > 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] using tags with php
On Sat, 1 Feb 2003, Sunfire wrote: > hi.. i took your idea... > i put the error reporting code at the top of the script and ran it as the > problem was still there to see what would happen.. instead i get 0 messages > from the reporting system and all i get is the last 7 chars of the print > line and the }?> at the end of the script... so for instance if i do: > print(" or any variance of that statement changing around the \" and apostrophes > around to try different things all i get is the rest of the script starting > from the \n all the way to the rest of the script where it says }?> at the > end dont know if this is a bug or not but its getting hard to figure out > what the problem with my echo or print statements are... > here is the whole script: > its supposed to get all fields and then display in input text boxes the > current values in that certain record i know i missed some stuff in it with > the query but at this point was supposed to be a test to see if i could even > put it in the box in the first place... but here is the code: Please step back, slow down, and write your question in a short concise format. I have no clue what the above means. > > > edit member > > > > > pick some of these: > error_reporting(E_ALL); > mysql_connect("192.4.5.6", "root", ""); > mysql_select_db("wata"); > $result=mysql_query("select * from members where company like 'test'"); > while($row=mysql_fetch_array($result)){ > print("\n\n"); // Try this instead, see also: htmlspecialchars()* print ""; Regards, Philip * http://www.php.net/manual/en/faq.html.php#faq.html.encoding > } > ?> > > > > > /*end*/ > any changes to make it work would be appreciated...tnx > > > - Original Message - > From: "Philip Olson" <[EMAIL PROTECTED]> > To: "Sunfire" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Saturday, February 01, 2003 6:48 PM > Subject: Re: [PHP] using tags with php (IMPORTANT READ) > > > > > > On Sat, 1 Feb 2003, Sunfire wrote: > > > > > if i do this: > > > /*all the mysql login stuff here*/ > > > > > > $query=mysql_query("select * from members"); > > > while($new=mysql_fetch_array($query)){ > > > echo "$new['company']"; > > > /*so on through the field list*/ > > > } > > > on output all i get is the title with a submit button.. > > > otherwise blank.. > > > > There is a bug in PHP 4.3.0 regarding the use of arrays > > in strings. The following gave a parse error before > > PHP 4.3.0: > > > > print "Do not do this: $arr['key']"; > > > > Now it gives an E_NOTICE error due to changes to the string > > scanner. In PHP 4.3.1 it will no longer give a bogus E_NOTICE > > and instead it will work (no parse error either). Surrounding > > the array with {braces} in the string works regardless, so: > > > > print "You can do this: {$arr['key']}"; > > > > Regarding this question, don't write it like that but instead > > do the following (no quotes needed): > > > > echo $new['company']; > > > > For those wondering about this bug, see: > > > > http://bugs.php.net/bug.php?id=21820 > > > > The string documentation has been updated to demonstrate > > the array in string phenomena (except the bug hasn't been > > mentioned as I'm waiting for it to be committed first). > > > > http://www.php.net/types.string > > > > Sunfire, you aren't seeing this E_NOTICE error because your > > error level is turned down (by default). Put this on top > > of your script to see them all: > > > > error_reporting(E_ALL); > > > > Regards, > > Philip > > > > > > > same thing with fetch_object()...and i have 1 row in the members > table..im > > > sort of confused now that it doesnt work for a wierd reason > > > > > > any better ideas on how to get the stuff out of the table and into vars? > > > maybe im doing it wrong > > > > > > > > > - Original Message - > > > From: <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Saturday, February 01, 2003 5:33 PM > > > Subject: Re: [PHP] using tags with php > > > > > > > > > > In a message dated 2/1/2003 2:02:06 PM
Re: [PHP] Re: Register globals on and off
On Sun, 2 Feb 2003, Pat Johnston wrote: > I've read that an include file in each of your pages with the lines below > should do the trick for you with register_globals OFF.. > > Not sure if this is a valid way to go though... > > extract($_SERVER); > extract($_ENV); > extract($_GET); > extract($_POST); > extract($_REQUEST); > ?> Whoever told you this should be shot as this is an enormous security hole! The above is a security hole much larger than register_globals could ever hope to be. That and it's silly to attempt to mimic register_globals at runtime. The above is insecure in that it will overwrite web server variables ($_SERVER) with request variables such as those from $_GET. This is TERRIBLE!!! Just imagine this as just an example: http://www.example.com/a.php?PHP_SELF=http://www.foo.com In the above scenerio, this would create $PHP_SELF first from $_SERVER then it'd be overwritten by the $_GET and than by the $_REQUEST that had the GET in it. So this makes it inefficient and insecure :) A better example exists but anyway this should show a nice point (like maybe PHP_AUTH_PW or REMOTE_USER). Anyway, sorry for the rant but it's just that whoever told you that should not tell anyone anything related to this topic. The best options are: a) rewrite the code or b) set register_globals with .htaccess or php.ini or in virtualhost in httpd.conf http://www.php.net/manual/en/configuration.changes.php Now if you must set it at runtime (please do not do this) then you could try this: // THIS IS NOT RECOMMENDED if (!ini_get('register_globals')) { $types_to_register = array('GET','POST','COOKIE', 'SESSION','SERVER'); foreach ($types_to_register as $type) { if (@count(${'HTTP_' . $type . '_VARS'}) > 0) { extract(${'HTTP_' . $type . '_VARS'}, EXTR_OVERWRITE); } } } // THIS IS NOT RECOMMENDED Although it doesn't depend on the variables_order directive like register_globals does, it is flexible. Keep in mind that variables are written from first to last so you certainly don't want GET coming after SERVER. Regards, Philip > "Davy Obdam" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hello people, > > > > On my development machine (win XP/Apache 2.0.44/PHP 4.3.0/MySQL 3.23.55) > > i have several websites that i made some time ago that require register > > globals to be On in the php.ini. Ofcourse i know thats not a good idea > > at all for security, but rewriting all this code is not an option. > > However in my php.ini i have set register globals to Off because that > > better. Is it possible to configure my webserver/php so that only those > > sites that require register globals to be On have that setting, for > > instance in a .htacces file?? Any help is appreciated:-) > > > > Best regards, > > > > Davy Obdam > > mailto:[EMAIL PROTECTED] > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script!!!
On Sat, 1 Feb 2003, Karl James wrote: > Hello guys and gals!!! > > can you tell me why i can't get this script to print my > table > > thanks Karl > > please check out the code below > obviously i left my username and passwords blank :-) > > > - > > $sqlhost = "localhost"; > $sqllogin = "login"; > $sqlpw = "password"; > $sqldb = "database table name"; > (@!mysql_pconnect($sql[localhost], $sql[wedbd13], $sql[webdb13])) { > die(mysql_error()); } > (@!mysql_select_db($sql[wedbd13])) { die(mysql_error()); } > $result = mysql_query("SELECT * FROM `assignment_one`"); > while($array = mysql_fetch_array($result)) { > echo("| %s | %s | %s | %s | %s |", $array[id], $array[username], > $array[password], $array[status], $array[notes]); > } > ?> Maybe this will help: \n"; } ?> Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Line Number function?
On Sun, 2 Feb 2003, Michael Sims wrote: > On Sat, 1 Feb 2003 19:59:00 -0800, you wrote: > > >PHP keeps track of what line# is being executed, so that when there's an > >error (say in pg_exec() ) it reports what line the error occured on. > [...] > >Is there a function where I can access this information? Something like > >"get_line();" or something? > > Do you mean like the predefined "constant" __LINE__? > > http://www.php.net/manual/en/language.constants.predefined.php Yep, that will do it and has been available in PHP for a very long time (along with __FILE__). PHP 4.3.0 introduces the following: __FUNCTION__ Function name __CLASS__ Class name debug_backtrace() Debugging information including the line number See: http://www.php.net/debug_backtrace Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script!!!
On Sat, 1 Feb 2003, Hugh Danaher wrote: > echo("| %s | %s | %s | %s | %s |", $array[id], $array[username], > $array[password], $array[status], $array[notes]); > > try > echo "| %s | %s | %s | %s | %s |".$array[id]." ".$array[username]." > ".$array[password]." ".$array[status]." ".$array[notes]; > > dots not comas between variables. echo takes on commas as we can echo multiple variables which isn't something we can do with print. This is also the main difference between echo and print. So, the commas are okay here but as someone else already stated, echo doesn't behave like printf so no special %formatting% with echo. Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP version of ColdFusion CFParam
On Sun, 2 Feb 2003, Lon Lentz wrote: > > Is there a PHP version of the ColdFusion tag ? Go here: http://marc.theaimsgroup.com/?l=php-general&s=cfparam Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Looping through the mysql_field_name function
On Sun, 2 Feb 2003, Davy Obdam wrote: > Hi ppl, > > I have a problem that probably very simple, but i cannot figure it out > right now > I need to get the field names of my database. I have a query like select > * from books and now i wanna have both the result and the field name. I > have been trying with mysql_field_name, but not succesfully... > > $i = 0; > for($a=0; $a < sizeof(mysql_field_name($db->sqlResult, $i)); $a++) { > echo mysql_field_name($db->sqlResult, $i).""; > $i++; > } > > Can anyone help me please.. Your help is greatly appreciated;-) Please read the example in the manual as well as the user contributed notes. They show how to do this: http://www.php.net/mysql_field_name See also: mysql_num_fields() Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] listbox problems
On Sun, 2 Feb 2003, Sunfire wrote: > i have a listbox: > > //connect to db and get query > mysql_connect("."); > mysql_select_db("..."); > $query=mysql_query("select username from users); > /*finish the listbox*/ > while($account=mysql_fetch_array($query)){ > echo "$account[username]"; > } > ?> > > > > got it to fill listbox with usernames.. > now my question is how do you use the $users variable in the php script that > deals with the listbox? > iat this point all i wanted to do was print the user name that was selected > in the listbox but after i get how that works then it will load a form with > all user data in it so it can be changed.. Read this: http://www.php.net/variables.external Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can I display lastmodified for all my php-files?
On Sun, 2 Feb 2003, Øystein Håland wrote: > > "Jason Sheets" <[EMAIL PROTECTED]> skrev i meddelandet > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Take a look at the getlastmod() function, an example of the usage would > be: > > $last_mod = date ("F d Y H:i:s.", getlastmod()); > > Then you can print or operate on last_mod any way you want, if you don't > want to operate on the date you can just print the return of date. > > I use the getlastmod()function already, to print in the same document, but I > recon this isn't exactly the same thing, since I want to display in ONE page > the last modified date of all my php-files, or am I wrong? > Some kind of array is necessary? I believe I need some kind of (recursive) > function that collect this information from all my files, and I believe > someone have written one already. I have not the skills (yet) to write it > myself See: http://www.php.net/readdir http://www.php.net/filemtime The examples within will help you write this. Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] authentication
Read this: http://www.php.net/features.http-auth Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Can anyone help me? i'm getting crazy... : |
On Mon, 3 Feb 2003, Tomator wrote: > User "Mr. Bungl3" <[EMAIL PROTECTED]> wrote: > > I'm trying to delete a some records from a table with checkboxes and then > i > > have this code: > > > $sql="DELETE FROM divx where id=".$del[$i].""; > > Great idea, but when checkbox is checked, variable of it's name just becomes > true (doesn't get value of it's index anyway). So, I'd write it this way: > > if ($del[$i]) { > $sql="DELETE FROM divx WHERE id='".$i."'"; > mysql_query...; > } By default a checked checkbox has the value of 'on' but this can be changed to anything. So for example: One can use IN to delete them all, for example: $ids = implode(',', $_POST['id']); $sql = "DELETE FROM divx WHERE id IN ($ids)"; Anyway, you mention $del so you should make sure that this variable even exists as for it to exist automatically you need the register_globals directive to be on. Odds are it's off and you should code with it off. I assume we are using method="POST" in the form. See: http://www.php.net/variables.external Debugging101 would have you do: print $sql; And lastly, posting a TON of code won't get you very far. I just ignored it and based my response on the one above. Regards, Philip Olson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: exec() in safe mode
Add the directory that contains the script you want to run to safe_mode_exec_dir (check the docs to confirm this) -philip On Tue, 4 Feb 2003, [ISO-8859-2] Bc. Radek Krejèa wrote: > Hello, > > I need use function exec or backtick operator, but i have PHP in > safe mode. I need use it only for one virtual host in Apache. > > How can I do it without disabling safe mode. > > Thanks > Radek > > -- > Regards, > Bc. Radek Krejèa > Starnet, s. r. o. > [EMAIL PROTECTED] > http://www.ceskedomeny.cz > http://www.skdomeny.com > http://www.starnet.cz > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Html forms
On Mon, 3 Feb 2003, Sunfire wrote: > do this: > run your php query to get the value of the text box and then do this: > //connect to db here > $query=//put your query here > while($foo=mysql_fetch_array($query)){ > //if you use mysql that is... > echo ""; > } > ?> No offense Sunfire but I don't think you're ready to be answering questions. Please spend some more time learning first and then start answering ;) Although your point of using quotes was good, just say so without code as the above would always result in the value "Array". In a more general sense, it's most likely $Foo has a space in it or a quote or some undesireable character: // good html // bad html (value becomes 'a' not 'a var') Regarding other possible goodies in $var such as characters like < or > or " or whatever ... read this faq: http://www.php.net/manual/en/faq.html.php#faq.html.encoding If the error is something else it's because you did not describe the question very well. Knowing the error would be a huge help. Regards, Philip > > - Original Message - > From: "Todd Barr" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, February 03, 2003 9:59 AM > Subject: [PHP] Html forms > > > I am having difficulty putting results into an form > > Once the query runs, I have this for my output > > print ""; > > This results in an HTML error > > being apache finds an error AFTER the tag > > Any ideas? > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 > > -- > 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: Bi-weekly pay period
> I'm writing a quick little thing to act as a time clock since people are > writing out by hand and it's not so accurate. It's basically click a button > to clock in and click a button to clock out. > > What I also want to do is create a report (well I've already created the > report) but I want to limit it to the current pay period. Our pay periods > are biweekly. I was trying to think of a smart way to have php figure out > what the current pay period is and I'm having a hard time figuring out if > this is even possible or should I just tell it a years worth of pay period > ranges for now. > > I figure something like, if the week # is even, use this past Sunday as the > start date. If the week # is odd use the Sunday of the week before. Then > figure out what date is 2 saturdays after whatever Sunday was selected. That seems very doable... look at the date() function, in particular the options to return week number, day of week (0-6), etc. Then it's just some conditionals, and substractions to get back to the right sunday, and then add 14 (or is it 13?) days to get the right saturday. Just remember to do it all the math as the number of seconds since 1970 (look at time() and strtotime()) and you'll be fine. -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Etiquette
On Mon, 3 Feb 2003, Chris Shiflett wrote: > --- Philip Olson <[EMAIL PROTECTED]> wrote: > > No offense Sunfire but I don't think you're ready to > > be answering questions. > > Please try to be a little more kind. While his answer does > have problems, his helpful attitude is a good thing. > > Whenever someone's answer can potentially do more harm than > good (by misleading the original poster, as was a risk in > this case), it might be better just to help correct the > problems or offer a more proper solution. Degrading the > person who erred does not really add any additional > benefit. [snip] I've seen his questions and felt he's not ready to provide answers. Facts are facts, we all start somewhere. Through time Sunfire will learn PHP and provide useful replies. I don't feel my reply was degrading. You have cut-n-pasted my reply to be somewhat out of context. At any rate, thanks, but I disagree. I may have been a little harsh but chalk it up as frustration towards some of the replies I see on this list. A lot of PHP newbies try too hard to help so Sunfire, I am sorry if I offended you but *my opinions* still stand. Good luck with learning PHP. Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there a way to retrieve an entire source code from aphp file?
On 4 Feb 2003, Adam Voigt wrote: > I believe he meant the HTML source of an HTML page. An example in the manual does exactly this: http://www.php.net/file Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help Needed
[snip] > How should I display the page ... the page has a lot of html code and > trying to write echo " blah blah blah . "; > will not be a an option. Please suggest a way out . Use includes: http://www.php.net/include And write HTML as HTML: Greetings Hello , we hope you enjoy this webpage. Or a little heredoc: http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php