Re: [PHP] web server and permissions
At 23:37 20.11.2002, Dennis Gearon said: [snip] Would this prevent other PHP users from including files in my include directory? [snip] No - even if _they_ cannot read your include files, they add the include() directive, and PHP will be able to read the file. -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A very powful tool
-- Virus Warning Message (on lakdiva) Policy.scr is removed from here because it contains a virus. -
Re: [PHP] Pause for user input?
In CLI you can use readline See the readline section in the PHP manual at http://www.php.net/manual/en Jason On Wed, 2002-11-20 at 06:42, Larry Brown wrote: Does anyone know of a method to pause during the processing of a script to prompt a user for information and then incorporate the user's response for the remainder of the script? Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -- 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] Reading part of a file
I'm making a module system. I need to make the actual module then a form to go along with it. The only way I can think of doing this is makign a file and then sectioning the file so that the first part is read and put somewhere on a page them the other part is put on the same page later on or on a different page. How can this be done without reading a certain amount of characters? The actual module part won't all be the same length so...how can this be done? Thanks, Stephen Craton http://www.melchior.us Life is a gift from God. Wasting it is like destroying a gift you got from the person you love most. -- http://www.melchior.us
Re: [PHP] Help with functions()
Try: $meat = testfunction ($var1, $var2, $var3, $var4); echo $meat; Or, alternatively, print (testfunction ($var1, $var2, $var3, $var4)); hope this helps. --t On 11/20/02 8:40 PM, Beauford 2002 [EMAIL PROTECTED] wrote: Hi, I have form that a user would input information and that info is sent to a function, but I need to be able to return a result of this function and is where I am having a problem. For example: testfunction($var1, $var2, $var3, $var4); //the form fills these values. echo $meat; function testfunction($a, $b, $c, $d) { The $meat of the function goes here; Now I need to return the result of $meat; return $meat; } This does not work. I'm new to funtions and obviously missing something, but I haven't been able to find a good tutorial on this. The PHP manual isn't much help. Any help is appreciated. -- 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] force SQL user/host/password in sql.safe_mode
Hello, working by an ISP, I'd like to force my users to use given databases - force the hostname, user, password and database too. I thought I can do that with defining sql.safe_mode On but as it seems now, it is not possible to do this. Any idea about how to do it? -- Matus fantomas Uhlar, [EMAIL PROTECTED] ; http://www.fantomas.sk/ Warning: I don't wish to receive spam to this address. Varovanie: Nezelam si na tuto adresu dostavat akukolvek reklamnu postu. You have the right to remain silent. Anything you say will be misquoted, then used against you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with functions()
You don't need the () around print. print testfunction($var1, $var2, $var3, $var4); Jason On Wed, 2002-11-20 at 17:48, Tracy Finifter Rotton wrote: Try: $meat = testfunction ($var1, $var2, $var3, $var4); echo $meat; Or, alternatively, print (testfunction ($var1, $var2, $var3, $var4)); hope this helps. --t On 11/20/02 8:40 PM, Beauford 2002 [EMAIL PROTECTED] wrote: Hi, I have form that a user would input information and that info is sent to a function, but I need to be able to return a result of this function and is where I am having a problem. For example: testfunction($var1, $var2, $var3, $var4); //the form fills these values. echo $meat; function testfunction($a, $b, $c, $d) { The $meat of the function goes here; Now I need to return the result of $meat; return $meat; } This does not work. I'm new to funtions and obviously missing something, but I haven't been able to find a good tutorial on this. The PHP manual isn't much help. Any help is appreciated. -- 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
[PHP] how does sql.safe_mode work?
Hello, reading manual did not help me answering this question. Where does PHP get the correst host/user/password when sql.safe_mode is on? -- Matus fantomas Uhlar, [EMAIL PROTECTED] ; http://www.fantomas.sk/ Warning: I don't wish to receive spam to this address. Varovanie: Nezelam si na tuto adresu dostavat akukolvek reklamnu postu. I wonder how much deeper the ocean would be without sponges. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] scrolling data from db
Justin, Creative thinking to a smart solution. I will keep that in mind for future sites. Peter At 10:35 AM 11/21/2002 +1100, Justin French wrote: If you know that your client base will ever only use IE, then go for it. Otherwise, you'll have to avoid the iframe. That sounds a little harsh! You can put a message in place of the iframe, for those who don't support it. iframe src= blah blah Sorry, your browser does not support iframes, to view the content of this frame, a href=click here/a. /iframe Or better still, you can actually PUT SOME CONTENT IN THERE. I have an iframe which lists multiple tour dates for a band, sorted in date order... if the iframe can be used, the user gets ALL upcomming gigs ina scroller, otherwise they just get the next 3 (using approximately the same amount of space), with a link to view all gigs. iframes CAN work in many cases, if you think about it. - - - - - - - - - - - - - - - - - - - - - Fourth Realm Solutions [EMAIL PROTECTED] http://www.fourthrealm.com Tel: 519-739-1652 - - - - - - - - - - - - - - - - - - - - - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reading part of a file
What I'm doing is having a PHP part, let's say that it's a calculator that adds module, that does the adding. The second part of the file is the form that the user uses to put in the numbers. That's what I want to do... - Original Message - From: Matt [EMAIL PROTECTED] To: Stephen [EMAIL PROTECTED] Sent: Wednesday, November 20, 2002 8:11 PM Subject: Re: [PHP] Reading part of a file I think what your trying to do is to read one file containing html, and insert some other html in the middle of the first file. If that's correct, you should look into a template class, which can handle that quite nicely. Other than that, you can break up the first file into 2 parts, a header and a footer. Then you would have a page that does a: ?php require('header.php'); require('middle.php'); require('footer.php'); ? You put your form or whatever into the middle.php file. Lots of pages are built that way, but templates are more flexible. For templates packages, you can look into phplib (http://phplib.sourceforge.net/), and smarty (http://smarty.php.net/). If I'm off base, perhaps you could explain a little more about what you're trying to do. - Original Message - From: Stephen [EMAIL PROTECTED] To: PHP List [EMAIL PROTECTED] Sent: Wednesday, November 20, 2002 7:33 PM Subject: [PHP] Reading part of a file I'm making a module system. I need to make the actual module then a form to go along with it. The only way I can think of doing this is makign a file and then sectioning the file so that the first part is read and put somewhere on a page them the other part is put on the same page later on or on a different page. How can this be done without reading a certain amount of characters? The actual module part won't all be the same length so...how can this be done? Thanks, Stephen Craton http://www.melchior.us Life is a gift from God. Wasting it is like destroying a gift you got from the person you love most. -- http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reading part of a file
From: Stephen [EMAIL PROTECTED] Cc: PHP List [EMAIL PROTECTED] Sent: Wednesday, November 20, 2002 8:52 PM Subject: Re: [PHP] Reading part of a file What I'm doing is having a PHP part, let's say that it's a calculator that adds module, that does the adding. The second part of the file is the form that the user uses to put in the numbers. That's what I want to do... If you have a piece of php code sitting in a file, you can use it anytime by including or requiring it. Say you have a file named add.php and in it you have: --- Top of file --- ?php function add($addend1, $addend2) { return ($addend1 + $addend2); } ? --- End of file --- in another file named page calc.php you can do a: --- Top of file --- ?php require 'add.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $sum = add($_POST['addend1'],$_POST['addend2']); echo brThe sum of {$_POST['addend1']} and {$_POST['addend2']} is $sumbr\n; } ? form method=post action=calc.php input type=text name=addend1 size=10br input type=text name=addend2 size=10br input type=submit name=submit value=Add them /form --- End of file --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Animated GIF Help!
Hello~. I made a PHP script which resize GIF Image. But, Animated GIF don't Animate ;-( Manual says 'use imagecolortransparent() to format GIF89'. But, I don't know how to use imagecolortransparent() ... Somebody Help me~ My code likes follows # cut here # if( eregi(\.gif$, $image_url ) ) $image_type = gif ; else if( eregi( \.jpg$, $image_url ) ) $image_type = jpeg ; Header(Content-type: image/.$image_type) ; if( $image_type == jpeg ) $src_img = ImageCreatefromjpeg( $image_url ) ; else $src_img = ImageCreatefromgif( $image_url ) ; if( $src_img == 0 ) die() ; $SMALL_SIZE = 100 ; $src_w = ImageSx( $src_img ) ; $src_h = ImageSy( $src_img ) ; if( $src_w = $src_h ) { $new_w = $SMALL_SIZE ; $new_h = $src_h * ( $SMALL_SIZE / $src_w ) ; } else { $new_h = $SMALL_SIZE ; $new_w = $src_w * ( $SMALL_SIZE / $src_h ) ; } $new_img = ImageCreate( $new_w, $new_h ) ; if( $new_img == 0 ) die() ; ImageCopyResized( $new_img, $src_img, 0, 0, 0, 0, $new_w, $new_h, ImageSX($src_img), ImageSY( $src_img ) ) ; if( $image_type == jpeg ) imagejpeg( $new_img ) ; else if( $image_type == gif ) imagegif( $new_img ) ; cut here ### ## Heo, Jungsu Mr. SimpleX Internet. http://www.simplexi.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reading part of a file
That's what my alternative was if there wasn't a way to do it in PHP with some special leet attack. :-) Thanks! - Original Message - From: Matt [EMAIL PROTECTED] To: Stephen [EMAIL PROTECTED] Cc: PHP List [EMAIL PROTECTED] Sent: Wednesday, November 20, 2002 9:27 PM Subject: Re: [PHP] Reading part of a file From: Stephen [EMAIL PROTECTED] Cc: PHP List [EMAIL PROTECTED] Sent: Wednesday, November 20, 2002 8:52 PM Subject: Re: [PHP] Reading part of a file What I'm doing is having a PHP part, let's say that it's a calculator that adds module, that does the adding. The second part of the file is the form that the user uses to put in the numbers. That's what I want to do... If you have a piece of php code sitting in a file, you can use it anytime by including or requiring it. Say you have a file named add.php and in it you have: --- Top of file --- ?php function add($addend1, $addend2) { return ($addend1 + $addend2); } ? --- End of file --- in another file named page calc.php you can do a: --- Top of file --- ?php require 'add.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $sum = add($_POST['addend1'],$_POST['addend2']); echo brThe sum of {$_POST['addend1']} and {$_POST['addend2']} is $sumbr\n; } ? form method=post action=calc.php input type=text name=addend1 size=10br input type=text name=addend2 size=10br input type=submit name=submit value=Add them /form --- End of file --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session not Registering
I have a PHP script that logs someone in then takes them to another page indicating their online status. However, when I try echoing out the contents of the session variable, it says this: Notice: Undefined variable: _SESSION in c:\program files\apache group\apache\htdocs\checker\members\index.php on line 38 Here's the code that registers the variable, or is atleast supposed to: if ($dbconn) { $querystr = "SELECT user FROM users WHERE (user = '" . prepareData($_POST['user']) . "' and pass=PASSWORD('" . prepareData($_POST['pass']) . "'))"; $result = mysql_query($querystr,$dbconn); if ($result) { if ($frow = mysql_fetch_row($result)) { session_start();session_register('user'); $_SESSION['user'] = $frow[0]; header("Location: index.php?" . SID); exit(); } else { $error = "Invalid username and password combo."; } } Here's where I echo it out: div align="left" class="log"font size="2"Logged in as ?php echo $_SESSION['user']; ?/font/div Any ideas why it's not working? Thanks,Stephen Cratonhttp://www.melchior.us "Life is a gift from God. Wasting it is like destroying a gift you got from the person you love most." -- http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Variable passing through a form
Hi, I currently have a page divided into three areas, two of which are iframes. The user selects a component out of part 1, which decides what is shown in part 2. When something is clicked in part 2 the information updates in the second iframe, or part 3. This is all working fine through $PHP_SELF and target. I am now working in part 3 of my page which has already had variables passed to it from part 2, however when I try to make selections on this page which should update in the same area ($PHP_SELF) I am losing all the variables which were earlier passed. I have tried $REQUEST_URI also which didn't help. example: after coming from part 2 $REQUEST_URI might be test.php?var1=avar5=fvar16=d . If I then select and option on this new form and then send it to itself I lose everything that was originally there (output might then be test.php?newvar=new) The line which executes my form is (currently) form name=tick action=?php echo $REQUEST_URI; ? method=get enctype=multipart/form-data , and as I said $REQUEST_IRI does contain the variables on initial loading. I need to keep these initial variables and add the new (ie test.php?var1=avar5=fvar16=dnewvar=new) Please help! Thanks, Michael. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie: nested include and object in session
Hi everyone, I'm a newbie on PHP and MySQL. I've two questions that want to get some help. 1. How to solve the problem of nested include? That's mean A include B and B include C. 2. Can I save the object in session? Thanks for your great help!! Regards, Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie: nested include and object in session
1. see php.net/include_once 2. Yes $_SESSION['foo'] = new foo(); $myFoo = $_SESSION['foo']; $myFoo-var = 123; /* page2.php */ $myFoo = $_SESSION['foo']; echo $myFoo-var; -js Michael Wai wrote: Hi everyone, I'm a newbie on PHP and MySQL. I've two questions that want to get some help. 1. How to solve the problem of nested include? That's mean A include B and B include C. 2. Can I save the object in session? Thanks for your great help!! Regards, Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Add On: Variable passing through a form
Sorry, but I forgot to say the variables froming from part 2 to part 3 can be anything between 1 and 30 or any combination thereof. input type=hidden will be no good here as it is too hard to pre-distringuish which variable names will be transferred Thanks Michael Benbow wrote: Hi, I currently have a page divided into three areas, two of which are iframes. The user selects a component out of part 1, which decides what is shown in part 2. When something is clicked in part 2 the information updates in the second iframe, or part 3. This is all working fine through $PHP_SELF and target. I am now working in part 3 of my page which has already had variables passed to it from part 2, however when I try to make selections on this page which should update in the same area ($PHP_SELF) I am losing all the variables which were earlier passed. I have tried $REQUEST_URI also which didn't help. example: after coming from part 2 $REQUEST_URI might be test.php?var1=avar5=fvar16=d . If I then select and option on this new form and then send it to itself I lose everything that was originally there (output might then be test.php?newvar=new) The line which executes my form is (currently) form name=tick action=?php echo $REQUEST_URI; ? method=get enctype=multipart/form-data , and as I said $REQUEST_IRI does contain the variables on initial loading. I need to keep these initial variables and add the new (ie test.php?var1=avar5=fvar16=dnewvar=new) Please help! Thanks, Michael. -- _ Michael Benbow Centre for Learning and Teaching Support Gippsland Campus IT Support Co-ordinator Phone: +61 3 9902 6254 Fax: +61 3 9902 6578 Web: http://www.celts.monash.edu.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] copying tables
Using PHP and MySQL. I have looked and can't find the answer to this problem. What I am trying to do is to copy a mysql table to a new table name in a PHP script. The reason for this is to keep the original table the way it is and editing the copy. Now, I know that I can go through a loop reading the old table and putting it into the new table, but is there an easier way that would just duplicate or copy the mysql table to a new table name? The reason for all of this is my script will create the original table (a temporary table), populate it, delete what needs to be deleted out of it, then I need a copy of that table for a subroutine that will be running multiple times and need the same information to start off with. Thanks for any help Steve -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copying tables
Hi, I don't have the answer, but when that happens, the first thing I do is dig around in phpMyAdmin(.org)... it's a web based GUI for MySQL, and most of the time, when you do something (like copy a table), it shows you the query used to do it... then you just need to copy it, and integrate it into your php script. Failing that, this Q really needs to be asked on the mysql list. Justin on 21/11/02 5:54 AM, Steve Buehler ([EMAIL PROTECTED]) wrote: Using PHP and MySQL. I have looked and can't find the answer to this problem. What I am trying to do is to copy a mysql table to a new table name in a PHP script. The reason for this is to keep the original table the way it is and editing the copy. Now, I know that I can go through a loop reading the old table and putting it into the new table, but is there an easier way that would just duplicate or copy the mysql table to a new table name? The reason for all of this is my script will create the original table (a temporary table), populate it, delete what needs to be deleted out of it, then I need a copy of that table for a subroutine that will be running multiple times and need the same information to start off with. Justin French http://Indent.com.au Web Developent Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MY CLIENT
GOLDEN BUSINESS OPPORTUNITY I am an Attorney and close confidant of MRS. MARYAM ABACHA, the former first lady and wife of the late GEN. SANI ABACHA, the former head of state and commander in chief of the armed forces of the Federal Republic of Nigeria. She (MRS. M. ABACHA), has as a result of the trust and confidence she has in me mandated that I search for a reliable and trustworthy foreign partner, who will help receive some funds which she had in cash totaling US$45m (Forty Five Million United States Dollars Only) into a personal, company or any reliable foreign bank account for safe keeping for a short period of time, since her family bank accounts within and outside the country have all been frozen by the authorities. (I would refer you to the website of .http://www.transnationale.org/anglais/sources/tiersmonde/dirigeants__aba http://allafrica.com/stories/200203180074.html http://www.time.com/time/europe/magazine/2000/27/swiss.html , for further information about these monies and the ABACHAS) This money in question has however, been carefully keptin defaced form and deposited with a security company that has branches in Europe and America. You may therefore be required to travel to any of the branches to collect the money on behalf of my client for safe keeping. It may also interest you to know that she (MRS. ABACHA) and her family have, since the inception of the present democratic government, been placed under partial house arrest, with their international traveler's passports withdrawn pending the resolution of current fund recovery face - off between them and the present RTD GEN. OBASANJO led Federal Government, which from all indications will not exceed this year. She has decided to offer anybody who will be willing to render this tremendous assistance 20% of the total sum, while 5% shall be set aside for incidental expenses. Note that this transaction involves no risks whatsoever, as you will have no dealing with my Country, Nigeria. Rather, you will deal directly with the security company, which is based where the money is right now. Let me have your confidential Tel/Fax Numbers in your response to this proposal. I shall let you into a complete picture of this mutually beneficial transaction when I have received your anticipated positive reply. This matter should be treated as urgent and confidential. This is very important. Best Regards, Barrister George Emeka. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MY CLIENT
Sorry, I'm holding out for the 126 million. :) -Original Message- From: GEORGE EMEKA [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 20, 2002 10:18 PM To: [EMAIL PROTECTED] Subject: [PHP] MY CLIENT Importance: High GOLDEN BUSINESS OPPORTUNITY I am an Attorney and close confidant of MRS. MARYAM ABACHA, the former first lady and wife of the late GEN. SANI ABACHA, the former head of state and commander in chief of the armed forces of the Federal Republic of Nigeria. She (MRS. M. ABACHA), has as a result of the trust and confidence she has in me mandated that I search for a reliable and trustworthy foreign partner, who will help receive some funds which she had in cash totaling US$45m (Forty Five Million United States Dollars Only) into a personal, company or any reliable foreign bank account for safe keeping for a short period of time, since her family bank accounts within and outside the country have all been frozen by the authorities. (I would refer you to the website of .http://www.transnationale.org/anglais/sources/tiersmonde/dirigeants__aba http://allafrica.com/stories/200203180074.html http://www.time.com/time/europe/magazine/2000/27/swiss.html , for further information about these monies and the ABACHAS) This money in question has however, been carefully keptin defaced form and deposited with a security company that has branches in Europe and America. You may therefore be required to travel to any of the branches to collect the money on behalf of my client for safe keeping. It may also interest you to know that she (MRS. ABACHA) and her family have, since the inception of the present democratic government, been placed under partial house arrest, with their international traveler's passports withdrawn pending the resolution of current fund recovery face - off between them and the present RTD GEN. OBASANJO led Federal Government, which from all indications will not exceed this year. She has decided to offer anybody who will be willing to render this tremendous assistance 20% of the total sum, while 5% shall be set aside for incidental expenses. Note that this transaction involves no risks whatsoever, as you will have no dealing with my Country, Nigeria. Rather, you will deal directly with the security company, which is based where the money is right now. Let me have your confidential Tel/Fax Numbers in your response to this proposal. I shall let you into a complete picture of this mutually beneficial transaction when I have received your anticipated positive reply. This matter should be treated as urgent and confidential. This is very important. Best Regards, Barrister George Emeka. -- 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] Opening a file to manipulate it
Thanks Ed! Yes, another member here told me to use fread(), which is what your link led to if you're not using the CVS version of PHP. (whatever that is) I got it working with this: ? $file = ../header.html; $fp = fopen($file, r); $header = fread($fp, filesize($file)); fclose ($fp); echo $header; I'm a Perl guy so I was looking for an easier way. In Perl, all you have to do is open it, dump it to a variable and close it. I thought it would be that easy in PHP too. I guess Perl wins there, but PHP is much better overall so far. ;) Thanks again! Troy -Original Message- From: @ Edwin [mailto:[EMAIL PROTECTED]] Sent: Saturday, November 16, 2002 9:29 PM To: Troy May Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Opening a file to manipulate it Hello, Troy May [EMAIL PROTECTED] wrote: Hello, Extreme newbie here (halfway through my first book :) ). I need to open a file, read the whole file into a variable, manipulate it, and then echo it to the screen. I'm doing it right from my book and it's not working. Here's what I have now: ? $header = fopen(header.html,r); echo $header; ? It writes Resource id #1 at the top of the page. What is that?! :) Check the manual: http://www.php.net/manual/en/function.fopen.php You're echoing the result of fopen() which is an int--you have to make sure that you're using the function properly ;) I have also tried using file(). That displays Array on the screen. What am I doing wrong? I think it's because you're echoing the result of file() which is an array. You cannot just echo $the_array; Try print_r($the_array) and you'll see a different result--though I doubt it's the one you want to see :) Check the manual again: http://www.php.net/manual/en/function.file.php Anyway, I think you're looking for something like this: http://www.php.net/manual/en/function.file-get-contents.php Esp. the User Contributed Notes. HTH, - E -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Opening a file to manipulate it
Try this: $content = implode('', file('../header.html')); Or if you're running php 4.3.0 or greater: $content = file_get_contents('../header.html'); Can't get much easier than that :) -Mark PS: That was in the user contributed notes Ed mentioned :) - Original message - From: Troy May [EMAIL PROTECTED] To: @ Edwin [EMAIL PROTECTED] Date: Sat, 16 Nov 2002 21:45:50 -0800 Subject: RE: [PHP] Opening a file to manipulate it Thanks Ed! Yes, another member here told me to use fread(), which is what your link led to if you're not using the CVS version of PHP. (whatever that is) I got it working with this: ? $file = ../header.html; $fp = fopen($file, r); $header = fread($fp, filesize($file)); fclose ($fp); echo $header; I'm a Perl guy so I was looking for an easier way. In Perl, all you have to do is open it, dump it to a variable and close it. I thought it would be that easy in PHP too. I guess Perl wins there, but PHP is much better overall so far. ;) Thanks again! Troy -Original Message- From: @ Edwin [mailto:[EMAIL PROTECTED]] Sent: Saturday, November 16, 2002 9:29 PM To: Troy May Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Opening a file to manipulate it Hello, Troy May [EMAIL PROTECTED] wrote: Hello, Extreme newbie here (halfway through my first book :) ). I need to open a file, read the whole file into a variable, manipulate it, and then echo it to the screen. I'm doing it right from my book and it's not working. Here's what I have now: ? $header = fopen(header.html,r); echo $header; ? It writes Resource id #1 at the top of the page. What is that?! :) Check the manual: http://www.php.net/manual/en/function.fopen.php You're echoing the result of fopen() which is an int--you have to make sure that you're using the function properly ;) I have also tried using file(). That displays Array on the screen. What am I doing wrong? I think it's because you're echoing the result of file() which is an array. You cannot just echo $the_array; Try print_r($the_array) and you'll see a different result--though I doubt it's the one you want to see :) Check the manual again: http://www.php.net/manual/en/function.file.php Anyway, I think you're looking for something like this: http://www.php.net/manual/en/function.file-get-contents.php Esp. the User Contributed Notes. HTH, - E -- 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] MY CLIENT
Geez, how old is that one. Been receiving it for at least a year. And here is is, all spammed up and everything! How did that creep in? Troy May wrote: Sorry, I'm holding out for the 126 million. :) -Original Message- From: GEORGE EMEKA [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 20, 2002 10:18 PM To: [EMAIL PROTECTED] Subject: [PHP] MY CLIENT Importance: High GOLDEN BUSINESS OPPORTUNITY I am an Attorney and close confidant of MRS. MARYAM ABACHA, the former first lady and wife of the late GEN. SANI ABACHA, the former head of state and commander in chief of the armed forces of the Federal Republic of Nigeria. She (MRS. M. ABACHA), has as a result of the trust and confidence she has in me mandated that I search for a reliable and trustworthy foreign partner, who will help receive some funds which she had in cash totaling US$45m (Forty Five Million United States Dollars Only) into a personal, company or any reliable foreign bank account for safe keeping for a short period of time, since her family bank accounts within and outside the country have all been frozen by the authorities. (I would refer you to the website of .http://www.transnationale.org/anglais/sources/tiersmonde/dirigeants__aba http://allafrica.com/stories/200203180074.html http://www.time.com/time/europe/magazine/2000/27/swiss.html , for further information about these monies and the ABACHAS) This money in question has however, been carefully keptin defaced form and deposited with a security company that has branches in Europe and America. You may therefore be required to travel to any of the branches to collect the money on behalf of my client for safe keeping. It may also interest you to know that she (MRS. ABACHA) and her family have, since the inception of the present democratic government, been placed under partial house arrest, with their international traveler's passports withdrawn pending the resolution of current fund recovery face - off between them and the present RTD GEN. OBASANJO led Federal Government, which from all indications will not exceed this year. She has decided to offer anybody who will be willing to render this tremendous assistance 20% of the total sum, while 5% shall be set aside for incidental expenses. Note that this transaction involves no risks whatsoever, as you will have no dealing with my Country, Nigeria. Rather, you will deal directly with the security company, which is based where the money is right now. Let me have your confidential Tel/Fax Numbers in your response to this proposal. I shall let you into a complete picture of this mutually beneficial transaction when I have received your anticipated positive reply. This matter should be treated as urgent and confidential. This is very important. Best Regards, Barrister George Emeka. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- John Taylor-Johnston - If it's not open-source, it's Murphy's Law. ' ' ' Collège de Sherbrooke: ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/ - Université de Sherbrooke: http://compcanlit.ca/ 819-569-2064 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php