php-general Digest 16 Mar 2001 14:05:25 -0000 Issue 570
Topics (messages 44195 through 44261):
Re: $REDIRECT_ERROR_NOTES
44195 by: Paul R. Jackson
44197 by: Yasuo Ohgaki
Re: how fast is php
44196 by: David Robley
44210 by: Chris Adams
Re: Has anyone got MSSQL2000 to connect and work properlly?
44198 by: Andrew Hill
Re: Passing JavaScript variables
44199 by: Yasuo Ohgaki
Where is my parent?
44200 by: Chien-pin Wang
Problem refreshing page after exec
44201 by: Eric Watson
Re: Reminders
44202 by: Yasuo Ohgaki
I WORKED IT OUT Re: [PHP] $REDIRECT_ERROR_NOTES
44203 by: Paul R. Jackson
Website, Design, hosting and maintenance for only $999.00 per year
44204 by: Netmark Desing
44239 by: Mal McKay
44244 by: Harshdeep S Jawanda
44250 by: Matt Williams
sorting multi-dim arrays based on keys (like SQL's ORDER BY)
44205 by: Francisco Hernandez
Re: Chat with PHP and MySQL - come and chat about Linux problems...
44206 by: John Hinsley
Why my php page will reply "session expire" when the use press back button?
44207 by: Carfield Yim
44215 by: Yasuo Ohgaki
Re: Finding the depth
44208 by: Harshdeep S Jawanda
44243 by: Christian Reiniger
44245 by: Christian Reiniger
Thoughts on Class libraries
44209 by: Dennis Gearon
44219 by: Yasuo Ohgaki
Hmmm... What's problems?
44211 by: Al
44213 by: Rick St Jean
44220 by: Yasuo Ohgaki
Putting php at end of html?
44212 by: webmaster.xke.com
44222 by: Yasuo Ohgaki
44235 by: Richard Lynch
Re: Good Free PHP Editor?
44214 by: Andrew Halliday
44259 by: V e r b a l
the mail() again!!!!
44216 by: Nilesh Parmar
With all this talk about editors ...
44217 by: Richard McLean
44221 by: Yasuo Ohgaki
44237 by: Richard McLean
Re: FAQ - Newbie perspective
44218 by: Harshdeep S Jawanda
44236 by: Jason Lotito
44252 by: Christian Reiniger
Re: Fields, Comboboxes, repost
44223 by: Richard Lynch
Re: Send Mail Problem
44224 by: Richard Lynch
Re: mysql help!! urgent!
44225 by: Richard Lynch
Re: Using selected fields
44226 by: Richard Lynch
Re: Changing Directory rights with chgrp or exec("chown")
44227 by: Richard Lynch
Re: Dynamic pages
44228 by: Richard Lynch
44238 by: Aaron Tuller
Re: PHPDoc and file with function only
44229 by: Richard Lynch
Re: HTML character escape codes from beyond
44230 by: Richard Lynch
Re: cannot use post
44231 by: Richard Lynch
Re: select * from nmensagem m, nusuario...
44232 by: Richard Lynch
Re: Help! Cookies...
44233 by: Richard Lynch
Re: Help. creating excel file form mysql
44234 by: Richard Lynch
Re: mail() implementation problem
44240 by: Mathieu Arnold
Image from db
44241 by: Kassai Istvan
Re: Windows 2000, PHP, mySQL: multiple users and security
44242 by: Dezider Góra
Shopping Carts and Sessions
44246 by: DynamicHTML.aol.com
Re: FAQ
44247 by: Christian Reiniger
output to html file
44248 by: yawstick
Strange PHP Reference behaviour with globals
44249 by: John
44255 by: Yasuo Ohgaki
44256 by: John
44260 by: Yasuo Ohgaki
odbc+apache+w2kserver sp1 = emalloc()
44251 by: Carsten Senf
ODBC to mysql?
44253 by: Costas
Re: [PHP-DB] Sessions in Functions
44254 by: Jordan Elver
Benchmarks
44257 by: Phil Driscoll
Re: How do you keep your scripts secure?
44258 by: Jim Jagielski
Re: Strange Behaviour in non-reference globals?
44261 by: John
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
The htaccess option would not really be a great solution for me given we
have many diferent htacces files do lots of different things.
But I did try it just in case it lead me to some answers. I created a new
directory placed a .htaccess file in there with the correct stuff directing
404's to a test error page. The test error page has your exact code except I
dont mail I just displayed and it all worked, BUT the $URL variable as per
you last email just contains the URL of the error document.
I'm thinking maybe some settings in my php.ini file need to be different.
I'm looking into that now.
Paul
"David Robley" <[EMAIL PROTECTED]> wrote in message
01031612205409.01881@www">news:01031612205409.01881@www...
> On Fri, 16 Mar 2001 12:13, Paul R. Jackson wrote:
> > >>Check out REQUEST_URI - from that you can build a full URL if you
> > >> need it.
> >
> > The REQUEST_URI only has the URI of the error page itself (in my case
> > /error/404.html) I want the URI of the page that wasn't found.
> >
> > A php info doesnt show the URI anywhere.
> >
> > Thanks for the speedy response
> >
> > Paul
>
> Try moving the errordocument 404 /error/404.html from your httpd.conf
> into .htaccess files.
>
> Here's what I use and it mails me an error message as well!
>
> <?php
>
> $admin_email = "[EMAIL PROTECTED]";
> $from = "From: [EMAIL PROTECTED]";
> $website_url = $SERVER_NAME;
> $subject = "404 Error at $REQUEST_URI";
> $URL = "http://" . getenv("HTTP_HOST");
> $URL .= ereg_replace( "[^!#-9:;=?-Z_a-z~]", "",
> substr(getenv("REQUEST_URI"), 0, 200) );
>
> $body = "WEBSITE--\n$website_url\n
> BAD LINK--\n$URL\n\n
> PAGE WITH BAD LINK--\n$HTTP_REFERER\n
> TYPE--\n404 File Not Found\n\n
> WHO WAS ACCESSING--\n$REMOTE_ADDR: $REMOTE_HOST\n
> USER AGENT\n$HTTP_USER_AGENT";
>
> mail($admin_email,$subject,$body,$from);
> ?>
>
> <title>Centre for Injury Studies - File Not Found</title>
> </head>
> <table border="0" cellspacing="0" cellpadding="10" align="center"
> BGCOLOR="#70DBDB">
> <tr><td>
> <!-- <h1 align="center">File Not Found </h1> -->
> <P ALIGN="CENTER"><IMG SRC="/images/404.gif" WIDTH=321 HEIGHT=120></P>
> <p>The requested URL <?php print($URL) ?> was not found on this
> server.</p>
> <ul>
> <li>If you followed this link form another page on our site, it is
> possible
> that it is inaccurate or outdated. This error has been logged, and we
> will look into it right away. </li>
> <li>If you entered the requested URL by hand, check and make sure you
> entered it correctly. Remember, URL's are case-sensitive. Index.html
> is not equal to index.html.</li>
> <li>If you followed a link from another web site, try contacting that
> site's webmaster and inform them that their link may be broken.</li>
> <LI>As a result of the upgrade of our web site, some URLs have been
> changed. Try
> using the Quick Search option above or our <A
> HREF="/search/search.php">Search Page</A>
> to locate the document you are seeking.</LI>
> <?php
> if(strpos($URL, '3icipc')) {
> echo '<LI STYLE="COLOR:red">';
> }
> else {
> echo '<LI>';
> }
> ?>
> Program and proceedings of the 3rd International Conference on Injury
> Control and
> Prevention (3ICICP) are no longer available here.</LI>
> </ul>
> <h3 align="center"><a href="<?php echo $HTTP_SERVER?>">Back to our main
> page.</a></h3>
> </TD></tr>
> </table>
>
> </html>
>
>
> --
> David Robley | WEBMASTER & Mail List Admin
> RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
> AusEinet | http://auseinet.flinders.edu.au/
> Flinders University, ADELAIDE, SOUTH AUSTRALIA
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
----- Original Message -----
From: "Paul R. Jackson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 16, 2001 10:34 AM
Subject: [PHP] $REDIRECT_ERROR_NOTES
> Hello,
>
> This is my first post to the group so go easy on me.
>
> I am using apache httpd.conf file to redirect 404 errors to a page which
> basically displays and error message, amongst other things. It all works
> fine but...
>
> I want to be able to find out what the document that they attempted to
> access was named, so I can display and log the value to a special log that I
> am using for othger purposes.
>
> Should the 'not found' url be in $REDIRECT_ERROR_NOTES ???
>
> This value doesn't seem to be set. And its not in any of the HTTP_ENV_VARS
> or HTTP_SERVER_VARS.
Try $HTTP_SERVER_VARS['REQUEST_URI'] (and others if needed)
Works on my Apache/PHP4.0.4pl1 both virtual and non-virtual server.
--httpd.conf--
ErrorDocument 403 /error/not_permitted.php
ErrorDocument 404 /error/file_not_found.php
-------------
Or are you using CGI version of PHP? (Even if you have access to httpd.conf??)
I don't use CGI version, but you can still put phpinfo() in your error
docuements and see if there is anything useful values are set or not. If you can
use DSO, I recommend to do it.
Regards,
--
Yasuo Ohgaki
> I know the answer will be something simple but I cant seem to find much help
> anywhere. Any help or push in the direction of a useful web page would be
> nice.
>
> Paul
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
On Fri, 16 Mar 2001 12:34, Randy Johnson wrote:
> I have a question. can a 1 php script access a mysql database more
> than 10 times a second.... it's a simple updated statement? if it
> can how many times do you think it can access the database in a second?
>
> thanks randy
On which machine? Under how much load? Using what operating system?
Write a script that does what you want and put a timer on it.
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA
On 15 Mar 2001 17:56:18 -0800, Randy Johnson <[EMAIL PROTECTED]> wrote:
>I have a question. can a 1 php script access a mysql database more than 10
>times a second.... it's a simple updated statement? if it can how many
>times do you think it can access the database in a second?
Sure, depending on the hardware, database and server configuration. On my
desktop with a small database which fits entirely in RAM, MySQL doesn't even
blink at a few thousand updates in a second. If you were working with a large
database which is being read and updated by many processes at the same time,
performance won't be as good.
Tips:
- Make sure you have enough RAM. An easy way to get high performance is
to make sure the operating system can cache everything and MySQL has
all the space it wants for buffers.
- Try to avoid situations with lots of SELECT and UPDATE / INSERT
statements being executed at the same time. MyISAM tables allow
simultaneous SELECT and INSERT statements, which can help a lot.
- If the data doesn't need to be kept permanently (e.g. session
variables), use the HEAP table type. HEAP tables are kept entirely in
memory and are insanely fast. This could also help with busy tables
getting updated frequently - have a HEAP table which is periodically
refreshed using the INSERT INTO ... SELECT syntax so that you get a
large SELECT or INSERT statement hitting a table ever 30 seconds
instead of every time someone requests a page.
Brandon,
It works just fine via ODBC. Driver are available at www.openlinksw.com and
a HOWTO on compiling iODBC into PHP (needed if you want to use ODBC drivers)
is available at www.iodbc.org.
Please let me know if I may assist in any way.
Best regards,
Andrew
---------------------------------------
Andrew Hill - OpenLink Software
Director Technology Evangelism
eBusiness Infrastructure Technology
http://www.openlinksw.com
On 3/15/01 5:32 PM, "Brandon Orther" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I am trying to get PHP4 to connect to Microsoft SQL2000. All I want to know
> is if it is possible on a Win Box and a Linux box for server.
>
> Thank you,
>
> --------------------------------------------
> Brandon Orther
> WebIntellects Design/Development Manager
> [EMAIL PROTECTED]
> 800-994-6364
> www.webintellects.com
> --------------------------------------------
>
>
"Gary" <[EMAIL PROTECTED]> wrote in message
98rohv$b0k$[EMAIL PROTECTED]">news:98rohv$b0k$[EMAIL PROTECTED]...
> Is there a way to pass a JavaScript variable to a PHP function?
>
> Thanks, Gary
You can use GET/POST/COOKIE to do that.
i.e. You must send new request to server and send variables, that you wan to
pass PHP, as $HTTP_GET_VARS, $HTTP_POST_VARS or $HTTP_COOKIE_VARS. And of
course, you cannot call PHP functions from JavaScript.
Regards,
--
Yasuo Ohgaki
Dear All,
Is there a way to re-write a method in parent class and still access
the parent class by parent::method()?
I have a class (classChild) extended from another class
(classParent). In classChild I have re-implemented method foo() as a
wrapper function of method foo() in classParent. Method foo() in
classChild calls method foo() in classParent by parent::foo().
The scheme works out fine when I test it by writing a shell script
that runs a CGI version of php. But when I run it through apache module, I
got a fatal error saying 'No parent class available in this context'. I
have made sure the parent class file is included, and the classChild
'EXTENDS' the classParent. Now, where is my parent?
Thanks in advance for any comment and suggestion.
Chien-pin
P.S.: PHP CGI version is 4.0.2, apache module version is 4.0.4pl1
Hello,
I am trying to start/stop a java program using PHP 4.04 on RH6.2. I can
successfully start the program using:
exec("/usr/bin/nohup /home/itrades/bin/startserver >/dev/null 2>&1 &")
But when I revisit the page or refresh the page the web server hangs
until I kill the java program.
Can someone tell me why or provide a solution for controlling
applications via PHP.
Thanks
----- Original Message -----
From: "Dale Frohman" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 16, 2001 5:33 AM
Subject: [PHP] Reminders
> I have a web interface that will submit entries into a mysql db. These
> entries are things to do at certain times, an organizer. Is there a way
> for php to intelligently keep track of time and when the certain time of
> the event hits, to trigger an event - such as an email. Any help will be
> appreciated.
>
> Thanks
I would wirte a C or Perl program query database tables. If there are
event must be handled, send e-mail or whatever. Use cron, to execute
the program for certain interval. If you have many events, users or need
realtime response, you may need to use different approch so that you
don't have to query db a lot. i.e. create deamon that stores and handles
events.
If you really would like to do it with PHP, use CGI version of PHP for it.
Regards,
--
Yasuo Ohgaki
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
I figured out what was going on. I knew it would be something simple
(embarrassingly simple too).
We run apache split across 2 servers so I have the error document path in
the httpd.conf as a full URL, i.e. http://www.etc...
This is what was causing it to lose all the Redirect info. When I use a
relative address for the error document it works like you would expect. I
would have expected that the HTTP_REFERER would be set when using the full
http url but its not...thems the breaks!!
Thanks for your help David and Yasuo. Maybe this will all help someone else
in the future too.
Paul
""Paul R. Jackson"" <[EMAIL PROTECTED]> wrote in message
98rq93$ldg$[EMAIL PROTECTED]">news:98rq93$ldg$[EMAIL PROTECTED]...
> Hello,
>
> This is my first post to the group so go easy on me.
>
> I am using apache httpd.conf file to redirect 404 errors to a page which
> basically displays and error message, amongst other things. It all works
> fine but...
>
> I want to be able to find out what the document that they attempted to
> access was named, so I can display and log the value to a special log that
I
> am using for othger purposes.
>
> Should the 'not found' url be in $REDIRECT_ERROR_NOTES ???
>
> This value doesn't seem to be set. And its not in any of the HTTP_ENV_VARS
> or HTTP_SERVER_VARS.
>
> I know the answer will be something simple but I cant seem to find much
help
> anywhere. Any help or push in the direction of a useful web page would be
> nice.
>
> Paul
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
<<< multipart/mixed;boundary= "Z_MULTI_PART_MAIL_BOUNDAEY_S": Unrecognized >>>
strange that they don't use their own domain name...............
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: 16 March 2001 04:14
To: [EMAIL PROTECTED]
Subject: [PHP] Website, Design, hosting and maintenance for only $999.00
per year
Website, Design, hosting and maintenance for only $999.00 per year,
by NetmarkDesign.
Looking for a cost effective, professionally designed website? Our program
enables you to budget your internet base expenses upfront. We offer
in-house
design, hosting and marketing. Put all your internet operations under one
roof.
If you have an existing site and would like a quotation to convert, upgrade
or redesign we offer 48 hour no obligation proposals tailored to your needs.
See us at Top Ten Traffic Sites at www.greatfreesite.net/bestten where
we've been ranked number 5 as the most cost effective website provider and
take the next step to your success.
NetmarkDesign
Hey! What the hell is happening? That's my company's domain name!!
Please don't anybody bother to reply to this posting by "Netmark.Desing" - its
an obvious fake. A visit to www.pspl.co.in will prove to you that we're not into
anything even remotely connected with this posting.
[EMAIL PROTECTED] wrote:
> Website, Design, hosting and maintenance for only $999.00 per year,
> by NetmarkDesign.
>
> Looking for a cost effective, professionally designed website? Our program
> enables you to budget your internet base expenses upfront. We offer
> in-house
> design, hosting and marketing. Put all your internet operations under one
> roof.
>
> If you have an existing site and would like a quotation to convert, upgrade
> or redesign we offer 48 hour no obligation proposals tailored to your needs.
>
> See us at Top Ten Traffic Sites at www.greatfreesite.net/bestten where
> we've been ranked number 5 as the most cost effective website provider and
> take the next step to your success.
>
> NetmarkDesign
--
Regards,
Harshdeep Singh Jawanda.
> [EMAIL PROTECTED] wrote:
too bad they can't even spell their own email address
M@
hi,
How could i sort data in a multi-dim array?
for example:
$data = array(
array("Job 3","House Party","Done"),
array("Job 1","Days End","Done"),
array("Job 5","Light Wave House","Done"),
array("Job 2","The Amazon","Not Done"),
array("Job 4","Fear","Not Done")
);
I want to sort that array via the first,second or third key (Job ID,Job
Title,Job Status)
basically what i need to end up doing is having a table where i can click on
the header colums and sort ascending/descending based on the heading i
clicked
very much like SQL's ORDER BY, which ive been using so far, but now ive come
into a situation where the data cant be fetched from a DB.
Thanks in advance
Marian Vasile <[EMAIL PROTECTED]> wrote:
//snipped! This list is long enough!
>The main problem I have with my chat is that after some use of it, the
>server is going very very slowly.
>Someone with (256Mb, 800Mhz and just my chat running (Linux also)) told me
>that the chat is still doing this stuff.
>The problem he told me about it, it's that the httpd (apache) connections
>don't close.
//end snip
It could be that (although I'd expect them to close unless your code or
your Apache settings explicitly keep them open) or it could be the
forking (careful how you pronounce that!) of Apache. What kernel are you
using? Going to 2.4 should show an improvement in Apache performance if
the forking is the problem.
I'll try a look at the code, but there are far better code readers out
there than me!
--
******************************************************************************
Marx: "Why do Anarchists only drink herbal tea?"
Proudhon: "Because all proper tea is theft."
******************************************************************************
Why my php page will reply "session expire" when the use press back
button? And then all the information in the form that user fill is lost,
how can I fix this? thx
----- Original Message -----
From: "Carfield Yim" <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Friday, March 16, 2001 1:44 PM
Subject: [PHP] Why my php page will reply "session expire" when the use press
back button?
> Why my php page will reply "session expire" when the use press back
> button? And then all the information in the form that user fill is lost,
> how can I fix this? thx
>
Set your session.cache_limitter to private and set some reasonable expration
time for session.cache_expire.
Regards,
--
Yasuo Ohgaki
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
Hi,
Chris Lee wrote:
> ok, this is what you asked for <snip/>
Thanks! I haven't tried it, but I am sure it will work.
> but why cant you just do this.
>
> echo "
> <img src='/image/back.gif'>
> ";
I don't want to do that because that sort of link will work only when this page is
served up by a web server.
It won't work if I mirror my site onto a hard disk :-).
--
Regards,
Harshdeep Singh Jawanda.
On Thursday 15 March 2001 16:51, you wrote:
> ok, this is what you asked for
>
> <?php
>
> function depth()
> {
> global $PHP_SELF;
>
> $count = count_chars($PHP_SELF);
>
> for($c = 0; $c < $count[ord('/')]; $c++)
> $return[] = "..";
>
> if (isset($return))
> return implode('/', $return);
> }
Won't work for the (perfectly valid) URL
http://somewhere.de/lvl1////lvl2//lvl3/foo.bar
it's quite unlikely though that someone enters such a thing
--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)
Google results 1-10 of about 142,000,000 for e. Search took 0.18 seconds.
- http://www.google.com/search?q=e
On Friday 16 March 2001 06:04, you wrote:
> Hi,
>
> Chris Lee wrote:
> > ok, this is what you asked for <snip/>
>
> Thanks! I haven't tried it, but I am sure it will work.
>
> > but why cant you just do this.
> >
> > echo "
> > <img src='/image/back.gif'>
> > ";
>
> I don't want to do that because that sort of link will work only when
> this page is served up by a web server. It won't work if I mirror my
> site onto a hard disk :-).
Well, if you use PHP you'll need some web server anyway. And all good
mirroring tools can do automatic link conversion (absolute->relative).
So I'd just go with absolute paths.
--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)
Google results 1-10 of about 142,000,000 for e. Search took 0.18 seconds.
- http://www.google.com/search?q=e
In talking about PEAR and PHPLIB, the subject of large class
libraries came up.
So in response to this problem, I had this idea. I'd like to get
some feedback on it.
Every script includes a simple parsing function from the
'prepend.php' file at the very top of the script. This function causes
the script being loaded to **parse itself**. It finds all the 'new'
statements, to make an array of needed class names.
Only the executing file would would parse itself, all the classname
files and classname extending files would could only include any parent
object file, and NOT the parsing function file.
<implementation-1>
The parsing function includes the correct file by just adding '.php' to
the end of the class name. This would require:
A/ One class per file
B/ the class name same as the class
<implementation-2>
Classes are in libraries that are named after the prefix of a SET of
classnames. The library file is included which has the bare name of the
'prefix.php'.
<implementation-3>
Classes have little 'ghost files.php' which are just just an
'include once' statement for the relative library. The first time the
library gets included, it appends all the class names it holds to an
array in the parent script. The function checks that array for relevant
classnames before reopening the 'ghost.file' and reopening the
'libraryX.php' file.
<implementation-4>
The classname<>library list is in a master library file, parsed into
an array first off in the function. The parsing function first queues up
classnames needed, then checks the names in the master list, erroring
out if desired, then queues up the appropriate libraries to include,
then includes them.
<implementation-5>
An extension of number 4 above. You give the parsing function the
class/class library path, and for any classes it doesn't find in the
master list (table), it goes through the libraries looking for 'class'
statements and updates the list. If you happen to be the unlucky user
who loads a page when that happens, it sends a timed redirect page back
to the original page with a message with the (typical user) mind blowing
message, "You have triggered an automatic self improvement process on
our server! The server is adjusting it's performance to your
requirements. Thank you, and HANG ON! You will be rewarded with a reload
of the page you requested and a faster site! Thank you for helping us!
Reload will occur in '10', '9', etc....." It's be good if you could make
this an 'in memory table or file'.
<?php-----------?>
FINAL RESULT FOR ANY IMPLEMENTATION:
A/ You would never have to worry about what file to include the
class from.
B/ You could limit the amount php included.
C/ Depending on the implementation, you could limit the number of
php, file opening, and use also class libraries.
With good grouping, this would let a minimal amount of included php/file
operations happen.
--
________________________________________________________________
Sites by friends of mine: http://www.myhiddentreasures.com/
________________________________________________________________
WARNING personal propaganda signature
TAKE WHAT YOU LIKE AND LEAVE THE REST
SINCE OUR GOVERNMENT WON'T PRESERVE OUR CLIMATE, IT'S UP TO US!
Imagine ** yourself ** and your kids now an endangered species
<1>Inflate automobile tires to near maximum in summer, -2psi in winter
<2>add insulation to house and hot water heater, and refrigerator,
<3>combine trips in cars, make less of them <4>buy cars, sports
vehicles and recreational vehicles with good if not best mileage
<4>put awnings over windows is summer, remove in winter. <5> add
solar hot water heating. <6>Push for energy recycling clothes
dryers <7> walk more, play outside with your kids! <8> let your
grass grow to 3-4 inches, chokes weeds, saves water and energy,
keeps house cooler <9> Put WHITE or REFLECTIVE materials on
roofs to send energy back into space. <10> Vote for burial of
logging slash onsite in logging areas for better watersheds
and less burned vegetation. <11> compost your leaves and grass,
bury in flower beds, lawns, gardens, or give away. <12> VOTE
for energy and CO2 ratings on ALL products and foods. KNOW how
much damage your purchases do to the climate. <13> Give your kids
less stuff and more of you. <14> recycle everything you can <15>
limit your children to an average 1 per adult between all your
marriages. (Only REPLACE yourself, not expand the population)
----- Original Message -----
From: "Dennis Gearon" <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Friday, March 16, 2001 2:42 PM
Subject: [PHP] Thoughts on Class libraries
> In talking about PEAR and PHPLIB, the subject of large class
> libraries came up.
>
> So in response to this problem, I had this idea. I'd like to get
> some feedback on it.
>
>
> Every script includes a simple parsing function from the
> 'prepend.php' file at the very top of the script. This function causes
> the script being loaded to **parse itself**. It finds all the 'new'
> statements, to make an array of needed class names.
Pros and Cons
Pros
Persing required files result in minimum number of included files, it may result
in better performance.
Cons
Parsing and finding required files from scripts would requries CPU intensive
work, it may NOT result in better performance.
It would be nice to have a ability to include all class/function definitions
required by a certain scripts. However, I think programmer must control
include()/require(). If there are many files to be included and hit server
performance, I would consider to use script cache modules like, Zend Cache, APC
or bcache(?).
Besides, I think programmers should know which files are needed for a program
and PHP complains if there is no class/function definitions.
Although, this kind of approch works great for build system like autoconf,
libtool, etc. It is generally not a good idea especially for script language
like PHP.
(In some cases, this kind of approch works great with PHP also. For example, you
can implement abstruct database class as follows. Create abstruct database class
for 20 different databases, and you want to use the same class name for all
databases. You can make a class that defined only user interfaces and create
database spcific object as the class property. Each database has its own class
definitions and abstruct database class needs only one of them. In this case,
you can improve performance with your approch)
Sorry for the negative response.
Regards,
--
Yasuo Ohgaki
> Only the executing file would would parse itself, all the classname
> files and classname extending files would could only include any parent
> object file, and NOT the parsing function file.
>
> <implementation-1>
> The parsing function includes the correct file by just adding '.php' to
> the end of the class name. This would require:
> A/ One class per file
> B/ the class name same as the class
>
> <implementation-2>
> Classes are in libraries that are named after the prefix of a SET of
> classnames. The library file is included which has the bare name of the
> 'prefix.php'.
>
> <implementation-3>
> Classes have little 'ghost files.php' which are just just an
> 'include once' statement for the relative library. The first time the
> library gets included, it appends all the class names it holds to an
> array in the parent script. The function checks that array for relevant
> classnames before reopening the 'ghost.file' and reopening the
> 'libraryX.php' file.
>
> <implementation-4>
> The classname<>library list is in a master library file, parsed into
> an array first off in the function. The parsing function first queues up
> classnames needed, then checks the names in the master list, erroring
> out if desired, then queues up the appropriate libraries to include,
> then includes them.
>
> <implementation-5>
> An extension of number 4 above. You give the parsing function the
> class/class library path, and for any classes it doesn't find in the
> master list (table), it goes through the libraries looking for 'class'
> statements and updates the list. If you happen to be the unlucky user
> who loads a page when that happens, it sends a timed redirect page back
> to the original page with a message with the (typical user) mind blowing
> message, "You have triggered an automatic self improvement process on
> our server! The server is adjusting it's performance to your
> requirements. Thank you, and HANG ON! You will be rewarded with a reload
> of the page you requested and a faster site! Thank you for helping us!
> Reload will occur in '10', '9', etc....." It's be good if you could make
> this an 'in memory table or file'.
>
> <?php-----------?>
>
> FINAL RESULT FOR ANY IMPLEMENTATION:
>
> A/ You would never have to worry about what file to include the
> class from.
> B/ You could limit the amount php included.
> C/ Depending on the implementation, you could limit the number of
> php, file opening, and use also class libraries.
>
> With good grouping, this would let a minimal amount of included php/file
> operations happen.
> --
> ________________________________________________________________
> Sites by friends of mine: http://www.myhiddentreasures.com/
> ________________________________________________________________
> WARNING personal propaganda signature
> TAKE WHAT YOU LIKE AND LEAVE THE REST
>
> SINCE OUR GOVERNMENT WON'T PRESERVE OUR CLIMATE, IT'S UP TO US!
> Imagine ** yourself ** and your kids now an endangered species
> <1>Inflate automobile tires to near maximum in summer, -2psi in winter
> <2>add insulation to house and hot water heater, and refrigerator,
> <3>combine trips in cars, make less of them <4>buy cars, sports
> vehicles and recreational vehicles with good if not best mileage
> <4>put awnings over windows is summer, remove in winter. <5> add
> solar hot water heating. <6>Push for energy recycling clothes
> dryers <7> walk more, play outside with your kids! <8> let your
> grass grow to 3-4 inches, chokes weeds, saves water and energy,
> keeps house cooler <9> Put WHITE or REFLECTIVE materials on
> roofs to send energy back into space. <10> Vote for burial of
> logging slash onsite in logging areas for better watersheds
> and less burned vegetation. <11> compost your leaves and grass,
> bury in flower beds, lawns, gardens, or give away. <12> VOTE
> for energy and CO2 ratings on ALL products and foods. KNOW how
> much damage your purchases do to the climate. <13> Give your kids
> less stuff and more of you. <14> recycle everything you can <15>
> limit your children to an average 1 per adult between all your
> marriages. (Only REPLACE yourself, not expand the population)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
I'm using manual online on php.net and use example of File uploader.
If i changed TEXT file All right!
If i changed Binary file php script answer Error!
in sources code PHP using Binary method...
And temporary subject $source_file is empty!
if i insert in PHP { echo "source: $source_file"; } and PHP say "Source:
none" And "Ftp upload has failed!"
Whats problem?
I don't understand.......
Make sure that enctype="multipart/form-data" is in your form.
At 05:29 PM 3/15/01 +0300, you wrote:
>I'm using manual online on php.net and use example of File uploader.
>If i changed TEXT file All right!
>If i changed Binary file php script answer Error!
>in sources code PHP using Binary method...
>And temporary subject $source_file is empty!
>if i insert in PHP { echo "source: $source_file"; } and PHP say "Source:
>none" And "Ftp upload has failed!"
>Whats problem?
>I don't understand.......
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
##########################################################
# Rick St Jean,
# [EMAIL PROTECTED]
# President of Design Shark,
# http://www.designshark.com/
# Quick Contact: http://www.designshark.com/messaging.ihtml
# Tel: 905-684-2952
##########################################################
----- Original Message -----
From: ""Al"" <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Friday, March 16, 2001 3:09 PM
Subject: [PHP] Hmmm... What's problems?
> I'm using manual online on php.net and use example of File uploader.
> If i changed TEXT file All right!
> If i changed Binary file php script answer Error!
> in sources code PHP using Binary method...
> And temporary subject $source_file is empty!
> if i insert in PHP { echo "source: $source_file"; } and PHP say "Source:
> none" And "Ftp upload has failed!"
> Whats problem?
> I don't understand.......
I'm not sure if you are talking about HTTP upload or FTP upload, but anyway
if you are using HTTP upload, check $HTTP_POST_FILES for uploaded file info.
(It must be set if you are using recent PHP4)
If you are talking about FTP upload, post some of your code.
Regards,
--
Yasuo Ohgaki
I am creating a site right now and I think many of the pages will
use php in the future...But not right now.
Should I put the .php extentsion at the end of these pages now
even though they currently do not have php on them.
So there anything that can go wrong if I do this?
Steve
Before you do that, you are better to read PHP manual AT LEAST Getting Started
Section.
http://www.php.net/manual/en/getting-started.php
Note: Your scripts may be disclosed to the net w/o proper setup.
Regards,
--
Yasuo Ohgaki
----- Original Message -----
From: <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Friday, March 16, 2001 3:11 PM
Subject: [PHP] Putting php at end of html?
> I am creating a site right now and I think many of the pages will
> use php in the future...But not right now.
>
> Should I put the .php extentsion at the end of these pages now
> even though they currently do not have php on them.
>
> So there anything that can go wrong if I do this?
>
> Steve
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
YES!
The only "problem" will be that these .php pages will be maybe 5% slower
since PHP is "parsing" them.
--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Friday, March 16, 2001 12:11 AM
Subject: [PHP] Putting php at end of html?
> I am creating a site right now and I think many of the pages will
> use php in the future...But not right now.
>
> Should I put the .php extentsion at the end of these pages now
> even though they currently do not have php on them.
>
> So there anything that can go wrong if I do this?
>
> Steve
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
Hey guys and gals - i think i finally found my all and end all PHP editor -
PHPEd - good stuff!
AndrewH
----- Original Message -----
From: "John LYC" <[EMAIL PROTECTED]>
To: "Andrew Halliday" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, March 12, 2001 5:54 PM
Subject: Re: [PHP] Good Free PHP Editor?
> http://www.ultraedit.com
>
> not free.. but worth the nominal fee
>
>
> Andrew Halliday wrote:
>
> > Does anyone know of a good PHP enabled editor that fits the following
> > criteria:?
> >
> > (in order of importance)
> > - Is free
> > - Runs under Windows
> > - Has colors (syntax highlighting)
> > - Can edit multiple files (ie multi threaded)
> > - Reports line numbers
> > - Has good search & replace functionality
> >
> > ???
> >
> > Ive been using editpad up till now but my code is starting to get so
large
> > that ill need syntax highlighting soon...
> >
> > AndrewH
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
On 12 Mar 2001 03:51:13 -0800, [EMAIL PROTECTED] (Nick Davies) wrote:
>How about linux ones?
>
>I just tend to use vim or emacs but i'm sure there are some out there.
I've used Xemacs. Do you know if there is a PHP mode for it?
Otherwise you could check out Screem (www.screem.org) or Quanta
(quanta.sourceforge.com).
V
Hi
I have installed php4 with apache onto my windows 98 machine .I am trying
to send an email using the mail() function . When i run the following piece
of code i get a warning .Can anyone please help me figure what has gone
wrong and suggest me with what to do.
****************************
This is the code!!
<?php
$mailto = "[EMAIL PROTECTED];
$mailsub = "this is a php mail() function";
$body = " i hope this works";
if (mail($mailto ,$mailsub, $body))
echo("successfully sent an email to $mailto");
else
echo("failed to send the email \"$mailsub\" to $mailto");
?>
*************************************
the following is the warining i get.
Warning: Server Error in c:\program files\apache
group\apache\htdocs\nilesh\mail.php on line 6
failed to send the email "this is a php mail() function" to
[EMAIL PROTECTED]
********************************************
Hoping someone can help me in this regard
bye and thanx in advance
Nilesh Parmar
Does anyone know of one that can do custom function
management?
e.g.
You have a functions file - site_functions.php, and a page
- the_page.php, with the functions file included/required.
What I need is to be able to open the_page.php, and have
a functions list that shows what functions are available from
the included file, and be able to select a function to include,
complete with the number of parameters if possible.
Does anyone know of an editor that will do that?
(Win / Mac / Linux)
cheers,
Richard
http://www.php.net/manual/en/ref.funchand.php
This page must be your friends.
Regards,
--
Yasuo Ohgaki
----- Original Message -----
From: "Richard McLean" <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Friday, March 16, 2001 4:02 PM
Subject: [PHP] With all this talk about editors ...
> Does anyone know of one that can do custom function
> management?
>
> e.g.
> You have a functions file - site_functions.php, and a page
> - the_page.php, with the functions file included/required.
>
> What I need is to be able to open the_page.php, and have
> a functions list that shows what functions are available from
> the included file, and be able to select a function to include,
> complete with the number of parameters if possible.
>
>
> Does anyone know of an editor that will do that?
> (Win / Mac / Linux)
>
>
> cheers,
> Richard
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
Many thanks Yasuo.
Unless I've missed something (which is quite possible), that
would seem to help if I was trying to do it at runtime, but this
is a feature I need during development (ie a feature of the
editor).
cheers,
Richard
>http://www.php.net/manual/en/ref.funchand.php
>
>This page must be your friends.
>
>Regards,
>--
>Yasuo Ohgaki
>
>----- Original Message -----
>From: "Richard McLean" <[EMAIL PROTECTED]>
>Newsgroups: php.general
>Sent: Friday, March 16, 2001 4:02 PM
>Subject: [PHP] With all this talk about editors ...
>
>
>> Does anyone know of one that can do custom function
>> management?
>>
>> e.g.
>> You have a functions file - site_functions.php, and a page
>> - the_page.php, with the functions file included/required.
>>
>> What I need is to be able to open the_page.php, and have
>> a functions list that shows what functions are available from
>> the included file, and be able to select a function to include,
>> complete with the number of parameters if possible.
>>
>>
>> Does anyone know of an editor that will do that?
>> (Win / Mac / Linux)
>>
>>
>> cheers,
>> Richard
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>>
Hi,
I don't want to argue about anything, just point out something that occurred
to me.
First of all, I am a newbie as far as PHP is concerned, though I am more
than comfortable with programming.
I recently asked a pretty simple question on this list ("Finding the
depth"). I could have found out the answer to it in about 10-15 minutes on
my own, thanks to my experience with programming. Still, I posted the
question to this list. Why?
What did I gain:
* I saved time.
* I got to see _PHP_code_ for solving my problem. Any solution from me
would have been more C++ than PHP. I got to become more familiar with
thinking the PHP way.
What did I lose:
* Nothing, because reading the code snippet and investigating the
functions used therein taught me all I needed to know (for this
instance). Following the "See also" links taught me some more.
Did I _waste_ somebody else's time? I don't really think so. Plus, a posting
can always be ignored...
An answer saying "RTFM" and pointing me the relevant functions (even if they
were just function names) would have been good enough too. But then I
wouldn't have gotten to see an experienced person's PHP code.
The question is: how many of you think that that posting was "ok" and how
many had to curb the temptation to flame me :-)?
Btw, I too don't like all those "PHP editor" and "How to loop" type of
questions ;-). But then, I simply delete them and that's it!
Rick St Jean wrote:
> It is there a list of most frequently asked questions?
> It seems that people ask the same questions, again and again,
> they do not READ THE MANUAL. Yes I have asked 2 stupid
> questions, but I really did search and I am reading my manuals,
> the PHP and the book that I bought.
>
> Also I would like to know if there would be a demand for an
> experienced mailing list? I am just frustrated by the same 3
> questions that pop up about once a day. The rest of the posts
> are great.
--
Regards,
Harshdeep Singh Jawanda.
> Hi,
>
> I don't want to argue about anything, just point out something
> that occurred
> to me.
>
> First of all, I am a newbie as far as PHP is concerned, though I am more
> than comfortable with programming.
>
> I recently asked a pretty simple question on this list ("Finding the
> depth"). I could have found out the answer to it in about 10-15 minutes on
> my own, thanks to my experience with programming. Still, I posted the
> question to this list. Why?
>
> What did I gain:
>
> * I saved time.
> * I got to see _PHP_code_ for solving my problem. Any solution from me
> would have been more C++ than PHP. I got to become more familiar with
> thinking the PHP way.
Very reasonable.
>
> What did I lose:
>
> * Nothing, because reading the code snippet and investigating the
> functions used therein taught me all I needed to know (for this
> instance). Following the "See also" links taught me some more.
>
> Did I _waste_ somebody else's time? I don't really think so.
> Plus, a posting
> can always be ignored...
Yes, but not dozens of 'wastefull' postings...=(
>
> An answer saying "RTFM" and pointing me the relevant functions
> (even if they
> were just function names) would have been good enough too. But then I
> wouldn't have gotten to see an experienced person's PHP code.
>
> The question is: how many of you think that that posting was "ok" and how
> many had to curb the temptation to flame me :-)?
The question itself was fine. I think the FAQ postings haven't been about
Newbie's to PHP, but newbie's to programming in general asking Programming
questions in the guise of being PHP questions. There are many resources out
there on the basics of programming, and their is simply no excuse for not
understanding what a variable is, what a loop is, and how a function works.
However, I don't expect the average person to know the Rules of
Normalization for database design, nor do I expect the average PHP person to
understand classes. These concepts, while common for the experiences
programmer, is something that some people just do not deal with. These are
the times the questions are okay. But when you simply don't understand the
concept behind what you want (at least in your post, you understood what you
wanted to accomplish, understood how it could be accomplished, but wanted to
instead find a better/faster way), you are merely hiding the truth.
The mailing list is here not so PHP programmers can program things for
people, but to help people learn (and help out with the occasional problem).
It just bothers me that I spend time learning to program, learning other
languages, learning PHP. If I can't figure something out, I don't jump
right to the mailing list or the news group. I take my time, look through
all my manuals, my own code, look back through the PHPManual and logically
deduce what the problem is. So far that method has worked very well.
Agreed, sometimes a function may not be working like I thought it would, and
I need someone to post some sample code for it in use, but that is not me
not understanding the concepts of programming. Thats merely syntax.
Programming is 90% creativity. The rest is just syntax.
Jason Lotito
www.NewbieNetwork.net
Where those who can, teach;
and those who can, learn.
>
> Btw, I too don't like all those "PHP editor" and "How to loop" type of
> questions ;-). But then, I simply delete them and that's it!
>
> --
> Regards,
> Harshdeep Singh Jawanda.
>
>
On Friday 16 March 2001 08:09, you wrote:
> I recently asked a pretty simple question on this list ("Finding the
> depth"). I could have found out the answer to it in about 10-15 minutes
> on my own, thanks to my experience with programming. Still, I posted
> the question to this list. Why?
>
> What did I gain:
>
> * I saved time.
> * I got to see _PHP_code_ for solving my problem. Any solution from
> me would have been more C++ than PHP. I got to become more familiar
> with thinking the PHP way.
> The question is: how many of you think that that posting was "ok" and
> how many had to curb the temptation to flame me :-)?
I thought it was "ok" and didn't want to flame you - until now when I saw
that you "could have found out the answer to it in about 10-15 minutes"
on your own (well, not realy). In such a situation the correct thing is
IMO to actually spend these 10-15 minutes and then post your code and ask
the list how this could be done better.
--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)
Google results 1-10 of about 142,000,000 for e. Search took 0.18 seconds.
- http://www.google.com/search?q=e
>1. I am hoping to read the entire range of values from a field in my MySQL
table into a combo >box on my form, but I am not sure how. On top of that,
I want the user to select one value >from this list, press next, and the
combo box reappears with the full list minus the chosen >value. The user
then chooses another, presses next, and the combo box then appears again,
>minus the two chosen values. This loop continues until flagged.
>
>Does anyone have any ideas how I can do this?
<?php
if (isset($selected)){
$selected_list = implode(', ', $selected);
$where = " where not id in ($selected_list) ";
}
else{
$where = '';
}
$query = "select id, whatever from blah $where ";
$choices = mysql_query($query) or die(mysql_error());
echo "<SELECT NAME=selected>\n";
while (list($id, $whatever) = mysql_fetch_row($choices)){
echo "<OPTION $id>$whatever</OPTION>\n";
}
echo "</SELECT>\n";
?>
>2. I have created a session variable $session. This is an array. I have a
dynamic variable, >${"myvalue$counter"}, which has particular values
assigned. The number of instances varies >depending on the data in the
database, so it is difficult to go through and assign each value >to the
session variable manually, eg $session["myvalue1"], $session["myvalue2"],
etc. Is >there any way I can incorporate dynamic variable names into the
array structure like above. >I have searched around, but I am not really
sure what this would come under.
It would probably be easier to just make a 2-D array instead of dealing with
variable variables...
>3. This is similar to above, but it refers to functions. Is it possible to
have dynamic >function names that actually change from where you call it?
>
>eg. $value=1;
>(call function from within another file)
>function name$value (...)
>$value=2;
>(call same function from within the same file as before)
>function name$value (...)
You can *call* a variable-named function, but I don't think you can define
them like that...
--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
It sounds like maybe you are trying to send too many emails -- The PHP
mail() function just isn't cut out for mass email.
Look at using Manuel Lemos' mail class or some other code that talks direct
to port 80.
--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: "seojuyung" <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Saturday, March 10, 2001 9:39 AM
Subject: [PHP] Send Mail Problem
Hello
I'm PHPer in Korea.
Now I have a problem with mail function.
I used it many times and it worked very well.
But it has a problem today !
When I use mail() function in a PHP web page, it took too many times to show
that web page like sleep.
Mail function returns some values so I guess it worked well.
But mail transfer was not done !
So I tried to restart Sendmail, Apache but it didn't make any differences .
Oops!
What I have to do to solve this problem ?
It's a strange problem.
> Warning: Unable to jump to row 0 on MySQL result index 2 in
> /home/sites/site3/web/showthumb on line 71
>
> --here is my code
Change it to look like this:
> $connetion = mysql_connect("localhost","cel34243","s2343223") or
die($php_errormsg);
> $query = "select images from celeb where name=\"$dir.\" ";
> $result = mysql_db_query("celebzone", $query) or die(mysql_error());
> $imagesnum= mysql_result($result, "images");
You are missing an argument there...
You need a row number in front of "images".
Also, you probably don't have any rows that matched your criteria, so asking
for the first row (row 0) is bad.
--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
> How can I tell the page to use the userlevel colunm too?
Use it how?...
Do you want to use it to decide where to send them?:
$userlevel = mysql_result($result, 0, 'userlevel');
switch ($userlevel){
case 1:
header("Location: guru.php");
break;
case 2:
header("Location: newbie.php");
break;
}
Or, do you want to only get users matching some pre-defined userlevel?
$sql = "select * from $table_name where member = '$member' and pw = '$pw'
and userlevel = '$userlevel'";
--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
> Is it possible to change the group rights on a directory like this?
>
> chgrp("/home/www/host/sitedir.com", "site1.com");
"site1.com" is a pretty unusual group name... I don't think that's valid...
> It doesn't work for me and i have tried this:
> exec(chown apache:site1.com /home/www/host/sitedir.com")
>
> Where sitedir.com is the directory i wish to be affected and site1.com is
> the group that i want assigned to it. Is their a way to make this work??
--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
You can use PHP to write out the HTML to a file, instead of using
echo/print.
You'll have to fwrite() *ALL* your HTML, however.
I did this for a site that got burned into a CD once.
There are also some tools "out there" to "walk" a site and "steal" it, that
you could use on your "work" site to snag all the HTML output.
--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: Jason Mockler <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Tuesday, March 13, 2001 7:45 AM
Subject: [PHP] Dynamic pages
> I have some dynamic pages which pull
> content from a DB using a PHP function.
>
> I have just found out that the production server
> for the project won't allow MySQL/PHP.
>
> The editors will need to use the input tool
> on a test server and then FTP to the
> production server.
>
> What I need to know is how do I save each
> page as static HTML when the page update has
> taken place (html is in DB)
>
> Code in each page(body text) is:
>
> <?
> require("lib/dbconnect.html");
> dbConnect();
>
> require("lib/echocontent.html");;
> echoContent(1);
> ?>
>
> Thanks in advance,
>
> JM
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
you don't have to use fwrite() if you use output buffering.
just ob_start(), ob_get_contents(), and ob_end_clean()
and leave your code how it is.
-aaron
At 1:02 AM -0600 3/16/01, Richard Lynch wrote:
>You can use PHP to write out the HTML to a file, instead of using
>echo/print.
>
>You'll have to fwrite() *ALL* your HTML, however.
>
>I did this for a site that got burned into a CD once.
>
>There are also some tools "out there" to "walk" a site and "steal" it, that
>you could use on your "work" site to snag all the HTML output.
>
>--
>Visit the Zend Store at http://www.zend.com/store/
>Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
>Volunteer a little time: http://chatmusic.com/volunteer.htm
>----- Original Message -----
>From: Jason Mockler <[EMAIL PROTECTED]>
>Newsgroups: php.general
>Sent: Tuesday, March 13, 2001 7:45 AM
>Subject: [PHP] Dynamic pages
>
>
>> I have some dynamic pages which pull
>> content from a DB using a PHP function.
>>
>> I have just found out that the production server
>> for the project won't allow MySQL/PHP.
>>
>> The editors will need to use the input tool
>> on a test server and then FTP to the
>> production server.
>>
>> What I need to know is how do I save each
>> page as static HTML when the page update has
>> taken place (html is in DB)
>>
>> Code in each page(body text) is:
>>
>> <?
>> require("lib/dbconnect.html");
>> dbConnect();
>>
>> require("lib/echocontent.html");;
>> echoContent(1);
>> ?>
>>
>> Thanks in advance,
>>
>> JM
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
I think PHPDoc is only for documenting classes...
--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: Remi Ricard <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Tuesday, March 13, 2001 11:20 AM
Subject: [PHP] PHPDoc and file with function only
> Hi,
>
> I'm trying to document a file which include only function and it
> does not work
> can you help me on that.
>
> The file look like:
> /**
> * Small comments
> *
> * Bigger comments lkjadfhlkjgaljfdgag ;kajhdflhgdsbf
> * @module mod1
> * @modulegroup mod_group1
> */
>
> /**
> * Small comment for the function
> *
> * Bigger comment for the function kjhdlakhdlakjfhlakdhf
> * @param string first param
> * @return boolean A value to be returned
> */
> function tata($str) { return 1; }
>
>
> I'm able to document file which contains class.
>
>
> Remi Ricard
> [EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
Perhaps the user pasted in characters that caused those HTML codes to be
part of their input...
--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: "Rob Salmond" <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Tuesday, March 13, 2001 10:56 PM
Subject: [PHP] HTML character escape codes from beyond
> A curiousity appeared in some code I put together almost six months
ago
> now. The site owner emailed me the output of our script which pulls
> together a collection of $HTTP_POST_VARS, and emails them off as a plain
> text document with some other information. Strewn about in one of these
> emails was &#somenumber; style html escaped character. The number 61623
> over and over at seemingly random locations.
>
> Aside from mail(), trim() and some sundry case manipulation functions
> I've used nothing I can think of that would cause characters to be altered
> this way. Has anyone got a suggestion that might lead me in the right
> direction?
>
> Much thanks,
> Rob Salmond.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
Be sure your DocumentRoot and <Directory > directives match up...
Also check for any Limit directives.
--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: Fabian Fabela <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Wednesday, March 14, 2001 10:59 AM
Subject: [PHP] cannot use post
> Hello,
>
> I think that this is off topic but may be you can help me.
>
> I have just installed linux, apache, and php.
>
> I have some programs (in php) running in a server when I try to run them
in
> this new server I get the following error.
>
> Method Not Allowed
> The requested method POST is not allowed for the URL /inicia.php
>
>
> I think that this is because apache and not because php.
> Please help me what can I do?
>
> Thank you
> Fabian Fabela
> [EMAIL PROTECTED]
> www.vacagorda.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> select * from nmensagem m, nusuario u, nprefuser p where
> m.cdpreferencia=p.cdpreferencia and p.flag=1;
>
> With "m.cdpreferencia=p.cdpreferencia" I should get just the values there
> exists on m.preferencia and p.cdpreferencia?
No, because you have a record for every single nusario, since you don't
restrict any relation between u and m, nor u and p
--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
Cookies do not inherently support arrays.
You'll have to serialize/unserialize your arrays to store them in cookies.
--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: Jack Sasportas <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Wednesday, March 14, 2001 5:57 PM
Subject: [PHP] Help! Cookies...
> I am frustrated with cookies, and the whole array aspect of them.
> I have looked at sample code on php.net, but it keeps bombing.
>
> Here are my questions:
>
> #1 When passing an array to the cookie, is the array one dimensional
> or 2 ?
> In other words when the value is stored in the cookie does it look like
> this:
>
> cookie_name, value1_of_array, value2_of_array, rest of cookie info
> or
> cookie_name,name_of_val1= value1_of_array, name_of_val1=
> value2_of_array, rest of cookie info
>
> if the first, then do I basically have to query the cookie name for
> array position in order to check the value stored there, like
>
> echo $cookie_name[1]
>
> of could I just
> echo $name resulting in value1_of_array ?
>
> Finally if I didn't confuse you...does anyone have a GOOD example of the
> proper way to put & get the cookies in an array format ?
>
> THANKS!
>
>
> ___________________________________________________________
> Jack Sasportas
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
Excel can import tab-delimited (or CSV) files pretty darn easy...
And you can spew those out very easily...
--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: Javier Onate <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Thursday, March 15, 2001 7:37 PM
Subject: [PHP] Help. creating excel file form mysql
> Hello,
>
> I need to create excel files from data stored in mysql.
> I'm using php in a linux box, so as far as I know I cant
> use COM functions.
>
> Is there a way to do what I intend
>
> Tank you
>
> --
> Javier Onate Mendia
> [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
Manuel Lemos wrote:
>
> Hello,
>
> Mathieu Arnold wrote:
> >
> > Hi
> >
> > The actual implementation of the mail fonction use sendmail -t and
> > relies on sendmail to parse the headers to get the recipients.
> > It would be great if it was possible to switch from this way of using
> > sendmail to a more classic
> > sendmail -f sender rcpt
> > it should be quite easy, but I lack time to do it.
>
> You may want to try this PHP MIME message composing and sending class
> that has subclasses for sending messages using directly sendmail, qmail
> or even a SMTP server.
>
> http://phpclasses.UpperDesign.com/browse.html/package/9
looks nice, but I'm not going to ask all my clients to change their php
scripts ;)
I just need to change the way php calls sendmail :)
I believe I'm going to do it myself next week or so.
--
Mathieu Arnold
Hello everyone!
Could anyone help me? My problem is the following:
I have to insert an image from a PostgreSQL database(Large Object), into
a web- page.
How can I make it?
Thanks, bye!
Istvan Kassai
Hello Alain,
from my point of view, the easiest way would be to use Apache on Win2k ( I got
1.3.17 installed and running very fine) and use Apache to control access to user
home directories which would be restricted realms. As for PHP, sapi module seems
to be stable for me. Download the full php 4.0.4Pl1 archive from
http://www.php4win.de, unpack to desired directory, move the php4ts.dll to
winnt\system32 directory, and copy/move php4apache.dll to apache's modules
directory.
Then add:
LoadModule php4_module modules/php4apache.dll
directive to httpd.conf under modules directive, uncomment lines:
AddType application/x-httpd-php .php .php3 .phtml .inc .php4 (I add couple
more extensions to be sure that all scripts are parsed with php, and inc is
important if you use include files)
AddType application/x-httpd-php-source .phps
And configure apache as desired. Add index.php, default.php to autoindex files,
etc.
If you don't want to create restricted directories for each group, you could
create 16 http.conf files, where the only difference would be webroot and
docroot directory. For example using c:\wwwroot as uppermost directory for
storing documents, create 16 directories like group01, group02 ... group16 which
will be root directories for each group.
Then in httpd.conf01 the DocumentRoot will look like this
DocumentRoot "c:/webroot/group01"
and also Directory directive
<Directory "c:/webroot/group01">
For group02 change group01 to group02, etc.
Then the only thing you'd need would be copy corresponding httpd.confxy to
\apache\conf\httpd.conf and restart apache. Php.ini and my.ini shouldn't need
any change.
When configuring php, I found one small gotcha, if you want to use curl library,
you have to copy SSLeay32.dll and libeay32.dll from \php\dlls to winnt\system32
directory. If you want to use gd functions with gif creations, enable gd_gif.dll
in extensions directives.
For mysql I'd create one database per group and allow access only to that group.
Or allow access to everyone, and assign full rights to the owning group.
just my .02 cents.
hth
Dezider.
Alain Fontaine wrote:
> Hello,
>
> My former school has invited me to teach a small course (32 hours) about web
> development, and I will of course teach PHP and mySQL. The question I now
> have is the following: How shall I best go about installing PHP and mySQL on
> a Windows 2000 computer (no Linux, sorry) so that each of the 16 groups of
> students have access to their files, databases, etc, without having problems
> with security ? I know how to configure mySQL access rights, so that will be
> fine. I can also install a small FTP server so that everyone has access to a
> subdirectory of the wwwroot directory. But how about PHP?
>
> If anyone has already done this, I'd be more than happy to hear from you.
> Basically, I am in the situation of setting up a "micro hosting provider"
> with PHP, mySQL support, running Win2k ;)
>
> Thanks !
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
Hi,
I have been playing around trying to build a 'perfect' shopping cart. A brief
as possible feature list: database driven, fully indexable by search engines,
and can operate without cookies.
I decided to use Apache's mod_rewrite to change a standard looking URL into
something php can use easily.
ex: http://www.mydomain.com/produce/carrots/spec1/94d0bb50cd.html
would become
http://www.mydomain.com/index.php?dept=produce&product=carrots&
specials=spec1&PHPSESSID=94d0bb50cd
Now for the problem, when a search engine spiders this it will be including
the session id. Unless I do some kind of checking, I could end up with
multiple users having the same session id -- if they click into the site from
a search engine or a bookmark.
The best solution I have come up with is to add a timestamp variable inside
the URL. If the timestamp is more than 1 hour old -- reassign a new timestamp
and session id then build the page as specified by the other variables passed
to the script.
I was wondering if anyone knows of a more elegant solution for this problem.
thanks,
don
On Thursday 15 March 2001 17:22, you wrote:
> people wouldnt use an FAQ, when you see three people ask the exact same
> question on one single day, you know they dont read the other post, or
> care. if they wont read the posts on the same day they wont read an
> FAQ, they keep posting.
Yep. But if there's a FAQ the answers can be greatly simplified :)
--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)
Google results 1-10 of about 142,000,000 for e. Search took 0.18 seconds.
- http://www.google.com/search?q=e
I have some scripts to build pages that will be sent to a production server.
Is is possible to redirect the page to a file with an html extention that
could be sent via the ftp functions to the production server.
Thanks
Hello,
Try the following code:
<?php
$gGlobal = 1;
function ChangeGlobalValue()
{
global $gGlobal;
$local = 55;
$gGlobal = $local;
print "Value:Global=$gGlobal<BR>";
}
function ChangeGlobalRef()
{
global $gGlobal;
$local = 99;
$gGlobal = &$local;
print "Ref:Global=$gGlobal<BR>";
}
print "Global=$gGlobal<BR>";
ChangeGlobalValue();
print "Global=$gGlobal<BR>";
ChangeGlobalRef();
print "Global=$gGlobal<BR>";
?>
I get the following results:
Global=1
Value:Global=55
Global=55
Ref:Global=99
Global=55 <=========== shouldn't this be 99 ???
Why does setting a global variable to a reference fail in a function?
Tested on PHP 4.0.4 on IIS5 (CGI version).
This is expected behavior of PHP's reference. Reference works like a pointer,
but it dose NOT works like a pointer. This is case that reference does not
works as many programmer expected.
I think this is in manual.
Hint: when programmer use 'global $var'. It is the same as do '$var = &
$GLOBALS['var']'.
Regards,
Yasuo Ohgaki
=========================
My favorite links
[RFC] http://www.faqs.org/rfcs/ [W3C] http://www.w3.org/
[PHP Manual] http://www.php.net/manual/en/
> Hello,
>
> Try the following code:
>
> <?php
>
> $gGlobal = 1;
> function ChangeGlobalValue()
> {
> global $gGlobal;
>
> $local = 55;
> $gGlobal = $local;
> print "Value:Global=$gGlobal<BR>";
> }
>
> function ChangeGlobalRef()
> {
> global $gGlobal;
>
> $local = 99;
> $gGlobal = &$local;
> print "Ref:Global=$gGlobal<BR>";
> }
>
> print "Global=$gGlobal<BR>";
> ChangeGlobalValue();
> print "Global=$gGlobal<BR>";
> ChangeGlobalRef();
> print "Global=$gGlobal<BR>";
> ?>
>
> I get the following results:
>
> Global=1
> Value:Global=55
> Global=55
> Ref:Global=99
> Global=55 <=========== shouldn't this be 99 ???
>
> Why does setting a global variable to a reference fail in a function?
>
> Tested on PHP 4.0.4 on IIS5 (CGI version).
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
Thanks Yasuo,
That might explain why $gGlobal is not permanently set to 99,
but that doesn't explain why $gGlobal is set to 55 in ChangeGlobalValue()
permanently. So are you or am I missing something?
Bye, John
""Yasuo Ohgaki"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> This is expected behavior of PHP's reference. Reference works like a
pointer,
> but it dose NOT works like a pointer. This is case that reference does
not
> works as many programmer expected.
>
> I think this is in manual.
>
> Hint: when programmer use 'global $var'. It is the same as do '$var = &
> $GLOBALS['var']'.
>
> Regards,
>
> Yasuo Ohgaki
> =========================
> My favorite links
> [RFC] http://www.faqs.org/rfcs/ [W3C] http://www.w3.org/
> [PHP Manual] http://www.php.net/manual/en/
>
> > Hello,
> >
> > Try the following code:
> >
> > <?php
> >
> > $gGlobal = 1;
> > function ChangeGlobalValue()
> > {
> > global $gGlobal;
> >
> > $local = 55;
> > $gGlobal = $local;
> > print "Value:Global=$gGlobal<BR>";
> > }
> >
> > function ChangeGlobalRef()
> > {
> > global $gGlobal;
> >
> > $local = 99;
> > $gGlobal = &$local;
> > print "Ref:Global=$gGlobal<BR>";
> > }
> >
> > print "Global=$gGlobal<BR>";
> > ChangeGlobalValue();
> > print "Global=$gGlobal<BR>";
> > ChangeGlobalRef();
> > print "Global=$gGlobal<BR>";
> > ?>
> >
> > I get the following results:
> >
> > Global=1
> > Value:Global=55
> > Global=55
> > Ref:Global=99
> > Global=55 <=========== shouldn't this be 99 ???
> >
> > Why does setting a global variable to a reference fail in a function?
> >
> > Tested on PHP 4.0.4 on IIS5 (CGI version).
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
----- Original Message -----
From: "John" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 16, 2001 9:12 PM
Subject: Re: [PHP] Strange PHP Reference behaviour with globals
> Thanks Yasuo,
>
> That might explain why $gGlobal is not permanently set to 99,
> but that doesn't explain why $gGlobal is set to 55 in ChangeGlobalValue()
> permanently. So are you or am I missing something?
Reference in PHP is not actually a pointer. It's a common pithole for C/C++
programmers.
In C/C++, you will get 99, instead of 55. But we get 55 in PHP. Here is why.
Reference is just a place holder for a value.
Your code creates referece with "global" statement asI wrote in previous mail.
global $var;
creates reference to $GLOBAL['var'] for local $var IN function scope.
$var is actually a reference, NOT a variable itself nor a pointer.
> > > function ChangeGlobalRef()
> > > {
> > > global $gGlobal;
Creating reference here, for $GLOBAL['gGlobal'].
> > >
> > > $local = 99;
> > > $gGlobal = &$local;
You assign reference of "$local" to "$gGlobal" which is also a reference.
$gGlobal = &$local;
This replaces $gGlobal(reference) with $local(reference).
Your code does not change $GLOBAL['gGlobal'], which is the value you want to
change.
> > > print "Ref:Global=$gGlobal<BR>";
> > > }
Since your code replace reference with reference inside function scope.
You get $gGlobal = 99 inside the function, but not outside the function.
(Note: Your $gGlobal is refered to $local that has 99 in the function)
Because $gGlobal itself is local to the function.
Therefore, you cannot get 99 outside the function, but 55.
I hope I explained well, so that all readers understand what I'm talking about.
Regards,
--
Yasuo Ohgaki
> Bye, John
>
> ""Yasuo Ohgaki"" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > This is expected behavior of PHP's reference. Reference works like a
> pointer,
> > but it dose NOT works like a pointer. This is case that reference does
> not
> > works as many programmer expected.
> >
> > I think this is in manual.
> >
> > Hint: when programmer use 'global $var'. It is the same as do '$var = &
> > $GLOBALS['var']'.
> >
> > Regards,
> >
> > Yasuo Ohgaki
> > =========================
> > My favorite links
> > [RFC] http://www.faqs.org/rfcs/ [W3C] http://www.w3.org/
> > [PHP Manual] http://www.php.net/manual/en/
> >
> > > Hello,
> > >
> > > Try the following code:
> > >
> > > <?php
> > >
> > > $gGlobal = 1;
> > > function ChangeGlobalValue()
> > > {
> > > global $gGlobal;
> > >
> > > $local = 55;
> > > $gGlobal = $local;
> > > print "Value:Global=$gGlobal<BR>";
> > > }
> > >
> > > function ChangeGlobalRef()
> > > {
> > > global $gGlobal;
> > >
> > > $local = 99;
> > > $gGlobal = &$local;
> > > print "Ref:Global=$gGlobal<BR>";
> > > }
> > >
> > > print "Global=$gGlobal<BR>";
> > > ChangeGlobalValue();
> > > print "Global=$gGlobal<BR>";
> > > ChangeGlobalRef();
> > > print "Global=$gGlobal<BR>";
> > > ?>
> > >
> > > I get the following results:
> > >
> > > Global=1
> > > Value:Global=55
> > > Global=55
> > > Ref:Global=99
> > > Global=55 <=========== shouldn't this be 99 ???
> > >
> > > Why does setting a global variable to a reference fail in a function?
> > >
> > > Tested on PHP 4.0.4 on IIS5 (CGI version).
> > >
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
Hi,
My configuration: w2kserver (1GB RAM etc.), last stable Apache, last
stable PHP4.
I installed Servicepack 1 to my clean w2k Server. After that PHP4.0.4pl1
generates a "FATAL: emalloc(): Unable to allocate 2147483599 bytes"
errormessage when I tried to call the function odbc_execute(). Before
this it works! I think, any other should know about this problem.
Carsten
Is it possible to use odbc to connect to a mysql database.
If not which database functions should i use
Hi,
Yep I do. I just figured out that it was because I had session_start() inside
another function ;-)
Thanks anyway,
Jord
On Friday 16 March 2001 10:43, you wrote:
> > Did you declare $LOGGED_IN as a global variable in your function?
>
> e.g.
>
> global $LOGGED_IN;
>
>
> _____
>
> ~ Richard Allsebrook ~
> Applications Developer and Webmaster
> Easysoft Limited, Thorp Arch Grange, Thorp Arch, Wetherby, LS23 7BA, UK
> http://www.easysoft.com <http://www.easysoft.com> -
> http://www.cinema.com <http://www.cinema.com>
> "A computer lets you make more mistakes faster than any invention in
> human history - with the possible exceptions of handguns and tequila."
>
> _____
>
>
>
>
>
> -----Original Message-----
> From: jjelver [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 16, 2001 10:41 AM
> To: php-db
> Cc: jjelver
> Subject: FW: [PHP-DB] Sessions in Functions
>
>
> Hi,
> I have some code which I decided to make into a function. Some of the
> code
> updates a session var which holds the current time. It now does not
> work.
>
> // update session variable with new time
> session_register("LOGGED_IN['time']");
> $LOGGED_IN['time'] = mktime();
>
> Are there issues that I should be aware of when I use sessions like
> this?
>
> Thanks,
>
> Jord
----------------------------------------
Content-Type: application/rtf; charset="ISO-8859-1"; name="Attachment: 1"
Content-Transfer-Encoding: base64
Content-Description:
----------------------------------------
----------------------------------------
Content-Type: application/ms-tnef; charset="ISO-8859-1"; name="Attachment: 2"
Content-Transfer-Encoding: base64
Content-Description:
----------------------------------------
Posted in a discussion on Slashdot today was a this link:
http://www.perlmonth.com/features/benchmarks/benchmarks.html?issue=4&id=9351
4159
A performance comparison of various web scripting languages. PHP does rather
well!
Cheers
--
Phil Driscoll
Dial Solutions
+44 (0)113 294 5112
http://www.dialsolutions.com
http://www.dtonline.org
Keith Vance wrote:
>
> The Zend encoder seems cool, but for $2400? What happened to the Zend
> Compiler, is that what the Zend Encoder is? The Zend Encoder would
> definetly be worth it if you were selling your code, but I haven't tried
> it out.
>
Yes, the Zend Encoder is the Zend Compiler, it just went through
a name change, to more accurately reflect what it does. After all,
it's the Zend Engine itself which compiles.
--
===========================================================================
Jim Jagielski [|] [EMAIL PROTECTED] [|] http://www.jaguNET.com/
"Hell is hot, that's never been disputed by anybody."
Hi Yasuo,
Thanks for taking the trouble to explain everything in such detail.
Actually I understood your first message. What it doesn't explain is why:
$gGlobal == 1 is changed permanently to $gGlobal == 55.
in the following code:
<?php
function ChangeGlobalValue()
{
global $gGlobal;
$local = 55;
$gGlobal = $local;
print "Value:Global=$gGlobal<BR>";
}
$gGlobal = 1;
ChangeGlobalValue();
print $gGlobal; <=============== THIS IS 55 NOW
?>
==========================
""Yasuo Ohgaki"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> ----- Original Message -----
> From: "John" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, March 16, 2001 9:12 PM
> Subject: Re: [PHP] Strange PHP Reference behaviour with globals
>
>
> > Thanks Yasuo,
> >
> > That might explain why $gGlobal is not permanently set to 99,
> > but that doesn't explain why $gGlobal is set to 55 in
ChangeGlobalValue()
> > permanently. So are you or am I missing something?
>
> Reference in PHP is not actually a pointer. It's a common pithole for
C/C++
> programmers.
> In C/C++, you will get 99, instead of 55. But we get 55 in PHP. Here is
why.
>
> Reference is just a place holder for a value.
>
> Your code creates referece with "global" statement asI wrote in previous
mail.
>
> global $var;
>
> creates reference to $GLOBAL['var'] for local $var IN function scope.
>
> $var is actually a reference, NOT a variable itself nor a pointer.
>
> > > > function ChangeGlobalRef()
> > > > {
> > > > global $gGlobal;
>
> Creating reference here, for $GLOBAL['gGlobal'].
>
> > > >
> > > > $local = 99;
> > > > $gGlobal = &$local;
>
> You assign reference of "$local" to "$gGlobal" which is also a reference.
>
> $gGlobal = &$local;
>
> This replaces $gGlobal(reference) with $local(reference).
> Your code does not change $GLOBAL['gGlobal'], which is the value you want
to
> change.
>
> > > > print "Ref:Global=$gGlobal<BR>";
> > > > }
>
> Since your code replace reference with reference inside function scope.
> You get $gGlobal = 99 inside the function, but not outside the function.
> (Note: Your $gGlobal is refered to $local that has 99 in the function)
> Because $gGlobal itself is local to the function.
>
> Therefore, you cannot get 99 outside the function, but 55.
>
> I hope I explained well, so that all readers understand what I'm talking
about.
>
> Regards,
> --
> Yasuo Ohgaki
>
> > Bye, John
> >
> > ""Yasuo Ohgaki"" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > This is expected behavior of PHP's reference. Reference works like a
> > pointer,
> > > but it dose NOT works like a pointer. This is case that reference
does
> > not
> > > works as many programmer expected.
> > >
> > > I think this is in manual.
> > >
> > > Hint: when programmer use 'global $var'. It is the same as do '$var =
&
> > > $GLOBALS['var']'.
> > >
> > > Regards,
> > >
> > > Yasuo Ohgaki
> > > =========================
> > > My favorite links
> > > [RFC] http://www.faqs.org/rfcs/ [W3C] http://www.w3.org/
> > > [PHP Manual] http://www.php.net/manual/en/
> > >
> > > > Hello,
> > > >
> > > > Try the following code:
> > > >
> > > > <?php
> > > >
> > > > $gGlobal = 1;
> > > > function ChangeGlobalValue()
> > > > {
> > > > global $gGlobal;
> > > >
> > > > $local = 55;
> > > > $gGlobal = $local;
> > > > print "Value:Global=$gGlobal<BR>";
> > > > }
> > > >
> > > > function ChangeGlobalRef()
> > > > {
> > > > global $gGlobal;
> > > >
> > > > $local = 99;
> > > > $gGlobal = &$local;
> > > > print "Ref:Global=$gGlobal<BR>";
> > > > }
> > > >
> > > > print "Global=$gGlobal<BR>";
> > > > ChangeGlobalValue();
> > > > print "Global=$gGlobal<BR>";
> > > > ChangeGlobalRef();
> > > > print "Global=$gGlobal<BR>";
> > > > ?>
> > > >
> > > > I get the following results:
> > > >
> > > > Global=1
> > > > Value:Global=55
> > > > Global=55
> > > > Ref:Global=99
> > > > Global=55 <=========== shouldn't this be 99 ???
> > > >
> > > > Why does setting a global variable to a reference fail in a
function?
> > > >
> > > > Tested on PHP 4.0.4 on IIS5 (CGI version).
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > To contact the list administrators, e-mail:
[EMAIL PROTECTED]
> > > >
> > > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail:
[EMAIL PROTECTED]
> > >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>