|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 4 May 2003 18:11:24 -0000 Issue 2037
php-general-digest-help
lists.php.net
Date: Sun May 04 2003 - 13:11:24 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 4 May 2003 18:11:24 -0000 Issue 2037
Topics (messages 146326 through 146372):
Re: Week Number
146326 by: Ben C.
pls help me :-)
146327 by: kristi
146331 by: Jason Wong
146359 by: John W. Holmes
number check
146328 by: Matt Palermo
146329 by: John W. Holmes
Re: This list can be better
146330 by: Jason Wong
146372 by: Chris Hewitt
php and js variables
146332 by: Paul Marinas
146340 by: Ernest E Vogelsinger
compression tool
146333 by: Matt Palermo
146335 by: Evan Nemerson
what are good php books
146334 by: Karl James
146343 by: Manuel Lemos
Re: Include problems
146336 by: Ernest E Vogelsinger
146350 by: Shawn McKenzie
Re: fsockopen
146337 by: Ernest E Vogelsinger
Re: Archive Link
146338 by: David Robley
Re: win xp exec() question
146339 by: David Robley
Re: Moving text data into variables
146341 by: Jason Wong
Re: FTP and absolute path
146342 by: Jason Wong
include_once() then what?
146344 by: Ryan A
146345 by: Ernest E Vogelsinger
146358 by: John W. Holmes
Dumb question or what? (Thank you)
146346 by: Ryan A
child pid xxxxx exit signal Segmentation fault (11) - when I call "mysql_connect (host,user,password)"
146347 by: Martin
Gettin' PHP 4.2.3 going w. RH8 ... htf do I do that???
146348 by: -{ Rene Brehmer }-
146349 by: Mark Charette
error messages
146351 by: Matt Palermo
146354 by: Cal Evans
Re: How do I do this?
146352 by: Cal Evans
146353 by: Cal Evans
php mysql apostrophe issue
146355 by: Matt Palermo
146357 by: John W. Holmes
146363 by: Matt Palermo
146366 by: John W. Holmes
146368 by: Matt Palermo
146370 by: John W. Holmes
Get original file path
146356 by: John M.
146360 by: Johannes Schlueter
146361 by: John W. Holmes
146365 by: Jason Sheets
Posting to a database
146362 by: Brent Lee
146364 by: John W. Holmes
146369 by: Jason Sheets
puzzleing problem, please help
146367 by: Ryan A
preg_replace and emails
146371 by: Michael
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
No some years have 53 weeks.
-----Original Message-----
From: ruusvuu
whitney.dns2go.com [mailto:ruusvuu
whitney.dns2go.com]
Sent: Monday, December 31, 2001 4:39 PM
To: Ben C.
Cc: Matt Palermo; php-general
lists.php.net
Subject: RE: [PHP] Week Number
Wouldn't the 53rd week be the first week of the following year! :-)
> If you are using MySQL you can use the MySQL function SELECT
> WEEK('2001-12-30'); it would return 53 for the 53rd week.
>
> Hope this helps...Ben
>
> -----Original Message-----
> From: Matt Palermo [mailto:mpalermo
vt.edu]
> Sent: Friday, May 02, 2003 10:01 PM
> To: php-general
lists.php.net
> Subject: [PHP] Week Number
>
>
> Does anyone know if there is a function where I can feed it the day,
> month, and year parameters, and it will give me the week number of the
> year (like week 1-52)? Please let me know. Thanks.
>
> Matt
>
>
> --
> 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
attached mail follows:
Hi,
Okay, this function is used to set or print the current value of the expire.
Its set on your php.ini by default to 180 minutes and yes, new values are in
minutes too. If you need any more help you are free to mail me.
that the session_cache_expire()
but i should need something to set my sessions to never to die
so instead of using cookies just let the session alive , also when closing
browser
is that possible ?
i work like this
a bit noob but it works :-)
<?PHP
ob_start();
session_start();
if($_SESSION["toegang"]=="jawhol")
{
}
and maybe if you find the time is this safe ?
<?PHP
ob_start();
session_start();
include('pages/inc.php');
$login=$_POST["naam"];
$pas=$_POST["passw"];
$query = "SELECT * FROM noobregist WHERE login = '$login' and paswoord =
'$pas'";
$res = mysql_query($query);
$count = mysql_num_rows($res);
if ($count != 0)
{
$_SESSION["toegang"]="jawhol";
session_register("login");
header("Location:index.php?page=pages/ingelogt");
}
else
{
header("Location:index.php?page=pages/inlog");
}
?>
if you can help me out here i will be very very thankfull :-)
i hope you understand my english :-)
attached mail follows:
On Sunday 04 May 2003 13:55, kristi wrote:
Please use a descriptive subject!
> but i should need something to set my sessions to never to die
> so instead of using cookies just let the session alive , also when closing
> browser
>
> is that possible ?
No.
If you want something permanent use a cookie. You can store an identity token
in a cookie, and on the server store the data related to that identity in a
database or something.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
We read to say that we have read.
*/
attached mail follows:
> > but i should need something to set my sessions to never to die
> > so instead of using cookies just let the session alive , also when
> closing
> > browser
> >
> > is that possible ?
>
> No.
>
> If you want something permanent use a cookie. You can store an
identity
> token
> in a cookie, and on the server store the data related to that identity
in
> a
> database or something.
If I understand the portion of this question correctly, then yes it's
possible. You can adjust the lifetime of the session cookie to persist
after the browser is closed. So when they return to your site, the
session cookie will still be there and their session will be restored.
Make sure you really need this as you're making it easier for people to
hijack sessions by making the ID persist. Adjust the session cookie
lifetime in php.ini.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
attached mail follows:
Is there a function to check if a variable is a number or not?
attached mail follows:
> Is there a function to check if a variable is a number or not?
Yes.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
PS: Check the manual for: is_numeric() or in_integer()...
attached mail follows:
On Sunday 04 May 2003 02:52, Mario Soto wrote:
> An answer that I give to one of this peple that replied, is: "I tried, but
> there is a lot, a LOT of messages, so I tried the easiest way: ask to the
> list.
Great. So you're implying that because the same questions are repeatedly asked
and answered so often that the archives become huge it puts people off. So
instead of searching the archives it is easier to ask the same questions
again on the list? Creating even MORE messages for the archives?
> And is true. But I could save a lot of traffic into the list if I were know
> in wich address I can found the FAQ for this list (if exists).
There is an official FAQ on www.php.net which is also included in the manual.
So if you've missed it you've either never been on www.php.net or you've
never looked at the manual. There are also many unofficial FAQs which can be
found without too much trouble.
> I'm not saying that the
> people that maintains this archives does a bad job, they are doing an
> excelent labor, and is an excelent reference.
So please USE it.
> I readed on May 2nd the messages for this week. In some messages, people
> asks for the same, chek the archive, but no much people know were is that,
> or how to search it (as me).
Jeez! Anybody intelligent enough to write to this list should be smart enough
to know how to find information on the internet. Is it that hard to type 'php
list archive' in google?
> it might include too a link for this FAQ page (if exists).
> If exists, does somebody know were is it?
Can I ask, what research did you do to try and find the (or a) PHP FAQ? It
seems to me that the only 'research' you did was to ask the list?
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
"I'll bet you $5 USD (and these days, that's about a gadzillion Euros) that
this explains it."
- Linus
*/
attached mail follows:
Mario Soto wrote:
>Recently I sended a message asking for help about a good php IDE. I guess that EditPlus is winning by hand of Zend Studio (?). In some messages that some people replied only into my mail account tell me to search the archive before asking questions. I did. For those that don't know were it is, all the arhive is in here: http://marc.theaimsgroup.com/?l=php-general.
>
I put "php ide" into the search box for the archives and got a lot of
useful information.
>
>
>An answer that I give to one of this peple that replied, is: "I tried, but there is a lot, a LOT of messages, so I tried the easiest way: ask to the list.
>
Yes, that is the problem. It is easier to ask the list than look for the
answer. Others may disagree but I think people should search the
archives, look through the FAQ and ask Google, then and only then post
to the list, indicating what steps have been taken to find the answer.
Again others may disagree, but I feel the list should mainly be about
new questions, not the same ones repeated.
Your particular question was not about php but about an editor on
windows for it. Many of us do not use windows so might regard the
question as off-topic.
>
>I readed on May 2nd the messages for this week. In some messages, people asks for the same, chek the archive, but no much people know were is that, or how to search it (as me).
>
For answers to questions that I feel should not have been asked, I try
to guide the poster (gently) to where I would go to find the answer. I
have done a few posts like that in the last few days, so I feel I am one
of the people Mario is talking about. If people on the list feel that I
am doing wrong then I will accept the criticism and change.
>Greetings to all, and thanks for the people that helped me to solve my problem.
>
>(I hope that by naming `some peopleŽ won't take into bad. This some people helped too. The English is not my own language, so I hope that I expressed into the rigth way.)
>
I think you have given your opinion in a clear way, and I am pleased to
have your opinion. I agree with you that it would be a good idea to have
the FAQ as well as the link to the archive on the end of messages from
this list.
Regards
Chris
attached mail follows:
Is there a way to get the value of a javascript
variable and put it into a php variable?
Thanks
Paul.
attached mail follows:
At 08:27 04.05.2003, Paul Marinas said:
--------------------[snip]--------------------
>Is there a way to get the value of a javascript
>variable and put it into a php variable?
--------------------[snip]--------------------
JS is client-side, and PHP is server-side. This implies you must transmit
the JS value to the server somehow, usually as a form element, or via URL.
an example (untested, most certainly you need to fiddle around a bit):
<script>
var client_side_var = 4711;
function submit_this(form)
{
hidden = form.elements['client_side'];
if (hidden) hidden.value = client_side_var;
}
</script>
<!-- some more header/body/etc, then the form: -->
<form action="myscript.php" onSubmit="submit_this(this);">
<input type="hidden" name="client_side" />
<input type="submit" />
</form>
Upon submit, the provided JS function gets be executed. It fills the hidden
form element with the contents of the JS variable, so you have it available
in myscript.php as $_REQUEST['client_side'].
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
attached mail follows:
Does anyone know of a compression tool for Window that will allow me to
compress files into a tar.gz format? Thanks.
Matt
attached mail follows:
Power archiver if you're into the GUI thing, or just download win32 ports of
gzip and tar from gnu.org/directory
On Sunday 04 May 2003 12:12 am, Matt Palermo wrote:
> Does anyone know of a compression tool for Window that will allow me to
> compress files into a tar.gz format? Thanks.
>
> Matt
--
In heaven all the interesting people are missing.
-Nietzsche
attached mail follows:
What is a good php book to buy?
Please email directly to advise what books are good to buy
If you can please provide the ISBN numbers
Thanks
Karl
Karl.james
verizon.net
attached mail follows:
Hello,
On 05/04/2003 04:36 AM, Karl James wrote:
> What is a good php book to buy?
> Please email directly to advise what books are good to buy
> If you can please provide the ISBN numbers
Here you may find plenty of books already reviewed:
http://www.phpclasses.org/products.html
These are the week best-sellers:
http://www.phpclasses.org/browse.html/top/top.html#weekbestsellers
--
Regards,
Manuel Lemos
attached mail follows:
At 21:09 03.05.2003, Shawn McKenzie said:
--------------------[snip]--------------------
>I understand what's being said that . is the current dir, but shouldn't PHP
>look in the dir returned by dirname(__FILE__) before it looks in the include
>path???
--------------------[snip]--------------------
As long as a script doesn't chdir() to another directory you're located in
the directory where the initial script os located (usually the webserver's
DOCROOT, plus any additional tree branch from the URL.
Assuming DOCROOT is /var/www:
http://dom/script.php /var/www/script.php
http://dom/sub/script.php /var/www/sub/script.php
This doesn't change for included scripts, regardless where they are
located. You always need to include a script either absolute from the hosts
root directory (e.g. '/var/www/tools/scripts/helper.inc'), or relative from
your starting point.
For a more complex layout it might be a good idea to have a config file
defining the locations and being included at the very top of any
application. Thus you can use symbolic path names for inclusion, and don't
have too much hassle when redesigning your directory layout.
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
attached mail follows:
Thanks Ernest,
[snip]
You always need to include a script either absolute from the hosts
> root directory (e.g. '/var/www/tools/scripts/helper.inc')
Thus you can use symbolic path names for inclusion, and don't
> have too much hassle when redesigning your directory layout.
[/snip]
I thought that was what I was doing. __FILE__ is supposed to return the
current file and dirname() is supposed to return the path to that file. It
seems that the now 2 people running into issues with this are both running
SunOS 5.7. Many others run this script with no problem on Windows, Linux,
BSD, OSX, etc.
Thanks!
Shawn
"Ernest E Vogelsinger" <ernest
vogelsinger.at> wrote in message
news:5.1.1.6.2.20030504112000.04487ad0
mail.vogelsinger.at...
> At 21:09 03.05.2003, Shawn McKenzie said:
> --------------------[snip]--------------------
> >I understand what's being said that . is the current dir, but shouldn't
PHP
> >look in the dir returned by dirname(__FILE__) before it looks in the
include
> >path???
> --------------------[snip]--------------------
>
> As long as a script doesn't chdir() to another directory you're located in
> the directory where the initial script os located (usually the webserver's
> DOCROOT, plus any additional tree branch from the URL.
>
> Assuming DOCROOT is /var/www:
> http://dom/script.php /var/www/script.php
> http://dom/sub/script.php /var/www/sub/script.php
>
> This doesn't change for included scripts, regardless where they are
> located. You always need to include a script either absolute from the
hosts
> root directory (e.g. '/var/www/tools/scripts/helper.inc'), or relative
from
> your starting point.
>
> For a more complex layout it might be a good idea to have a config file
> defining the locations and being included at the very top of any
> application. Thus you can use symbolic path names for inclusion, and don't
> have too much hassle when redesigning your directory layout.
>
>
> --
> >O Ernest E. Vogelsinger
> (\) ICQ #13394035
> ^ http://www.vogelsinger.at/
>
>
attached mail follows:
At 05:36 04.05.2003, dan rossi said:
--------------------[snip]--------------------
>hi guys is there anyway to prevent php from giving error if an invalid host
>is given to fsocketopen?
--------------------[snip]--------------------
Try
$hstream =
fsockopen($host, $port, $errno, $errstr, $timeout);
Note the '
' that should suppress error messages. If you don't get a valid
$hstream you can check $errno and $errstr for the cause.
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
attached mail follows:
In article <BAD7D838.1CC9D%php
baskettcase.com>, php
baskettcase.com
says...
> Seriously, I think it would be a good idea to include the archive address in
> the footer of this list. Every single message has a footer appended onto
> the end of it, it is really simple to do with most list servers. Some of us
> have been on this list forever and a day and of course we know where the
> archives are, but some people are new or just plain lazy and don't want to
> go search.. let's make it easy for them and us, so all we have to do is
> click on a link that would be included on each and every single message sent
> through this list.
>
> Ideas? thoughts?
>
> Rick
It's a nice thought but (last time I looked) unfortunately the footer is
only added where the original mail is plain text - so anyone who sends
html mail or any other non-plain message won't have the footer attached. I
can't offhand find the reference but there are good reasons why ezmlm
behaves thus.
--
Quod subigo farinam
attached mail follows:
In article <BB41A616-7CD1-11D7-9BB1-00306540D594
awn.com>, mike
awn.com
says...
> This works perfectly from a command window but doesn't work from a php
> page, why?
> (Note: There is a path variable set for mogrify)
>
> $cmd = "mogrify -resize 200x134 \"C:\\Apache\\myDocs\\myImage.jpg\"";
> exec($cmd , $results);
Does php necessarily inherit the same environment under xp as a 'regular'
user? What do you get if you try and show the path settings from within
php?
--
Quod subigo farinam
$email =~ s/oz$/au/o;
attached mail follows:
On Sunday 04 May 2003 04:34, Richard Kurth wrote:
> Could somebody tell me way this stops at Corp Type: and how I can make
> it process the whole file. I can not change the format of the text
> string in any way but I need to move the data into variables.
>
>
> $f = "Name: WILL PROVIDE, INC. Type: CorporationFile
> Number:C17481-2221State: NEVADA Incorporated On: July 02, 2001Status:
> Current list of officers on fileCorp Type: Non-profitResident Agent:
> AMERICAN LEGAL SERVICES (Accepted)Address: 239 S. SIERRA STREET RENO
> NV89501- President:ROBERT DOBYNS Address: 16843 FM 1314 CONROE TX77302-
> Secretary:RICK PENNY Address: 23026 RED LEO SPRING TX77389-
> Treasurer:DEBORAH PENNY Address: 23026 RED LEO SPRING TX77389-";
Try:
// ugly, but your input data is gross too!
$f = "Name: WILL PROVIDE, INC. Type: CorporationFile Number:C17481-2221State:
NEVADA Incorporated On: July 02, 2001Status: Current list of officers on
fileCorp Type: Non-profitResident Agent: AMERICAN LEGAL SERVICES
(Accepted)Address: 239 S. SIERRA STREET RENO NV89501- President:ROBERT DOBYNS
Address: 16843 FM 1314 CONROE TX77302- Secretary:RICK PENNY Address: 23026
RED LEO SPRING TX77389- Treasurer:DEBORAH PENNY Address: 23026 RED LEO SPRING
TX77389-";
preg_match("/(Name:)(.*)(Type:)(.*)(File Number:)(.*)(State:)(.*)(Incorporated
On:)(.*)(Status:)(.*)(Corp Type:)(.*)(Resident
Agent:)(.*)(Address:)(.*)(President:)(.*)(Address:)(.*)(Secretary:)(.*)(Address:)(.*)(Treasurer:)(.*)(Address:)(.*)/",
$f, $matches);
print_r($matches);
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
How you look depends on where you go.
*/
attached mail follows:
On Sunday 04 May 2003 00:12, Jason Paschal wrote:
> Q: is there a function that i'm overlooking that will get me the absolute
> path of the FTP base directory?
>
>
> Trying to build a simple web-base FTP client for my own personal use. (I
> know there are tons already out there, but I still want to make my own.
>
> Using the ftp_pwd function, i get "/", and that's expected.
>
> $pwd = ftp_pwd($cn); //$pwd is equal to "/" upon connection
>
> I'd like to get the directory listing, but if I use opendir($pwd), php is
opendir() works on the local filesystem. Not sure whether it works for remote
files, assume that it does then you would still need to specify WHERE the
remote directory is possibly like so:
opendir('ftp://ftp.server.com/some/directory').
BUT ...
[snip]
> is there a function that i'm overlooking that will get me the absolute path
> of the FTP base directory?
... (yes) you should be using the ftp_*() functions such as ftp_chmod().
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
The road to ruin is always in good repair, and the travellers pay the
expense of it.
-- Josh Billings
*/
attached mail follows:
Hi,
I am a bit confused about include_once(), although it is pretty obvious that
it will include anything only once..
I have been going through the manual and I see the defination/use of
include_once but one thing the manual does not mention is what happens if
you accidentally include_once in the same file twice by accident?
on my damn hosting webserver errors are off or I would have tested it myself
but do any of you guys know?
Does it throw a warning? error? what?
I think I really should get myself a local server etc installed on my
machine, I tried phpTriad and was not all that pleased and for some reason
FoxServ didnt work on my machine so i uninstalled it...anything else thats
really good out there?
After visiting hotscripts I was thinking of getting Phperl
(http://www.hotscripts.com/Detailed/18015.html) any comments?
Cheers,
-Ryan
attached mail follows:
At 14:12 04.05.2003, Ryan A said:
--------------------[snip]--------------------
>I am a bit confused about include_once(), although it is pretty obvious that
>it will include anything only once..
>
>I have been going through the manual and I see the defination/use of
>include_once but one thing the manual does not mention is what happens if
>you accidentally include_once in the same file twice by accident?
>
>on my damn hosting webserver errors are off or I would have tested it myself
>but do any of you guys know?
>Does it throw a warning? error? what?
No. It simply does nothing.
include_once, and require_once, are made just for that - you can safely
include a, say, library file in multiple sources where you need them. If
they're already included, the directive will be simply ignored to avoid
duplicate definitions.
>I think I really should get myself a local server etc installed on my
>machine, I tried phpTriad and was not all that pleased and for some reason
>FoxServ didnt work on my machine so i uninstalled it...anything else thats
>really good out there?
The best idea is to install Apache and PHP. You can do this even on a
notebook running Win98 (shudder). (Just MHO)
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
attached mail follows:
> on my damn hosting webserver errors are off or I would have tested it
> myself
FYI, use error_reporting() to turn on or adjust the error reporting
level in your scripts.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
attached mail follows:
Hey Guys,
Whooh, now THAT was a nice response to a dumb doubt.
Thank you, (ALL of you) who responded and cleared up that doubt once and for
all, it was nice to hear about examples of other apps using many includes
and your own experiences + techniques/tricks of how you are handling
includes.
Not only did I get all that but also got advise and ideas, things to avoid
and lots more.
Thanks guys, hopefully someday I can answer your problem/query on the list.
Cheers,
-Ryan
----- Original Message -----
From: "Justin French" <justin
indent.com.au>
To: "Ryan A" <ryan
jumac.com>
Sent: Sunday, May 04, 2003 2:57 AM
Subject: Re: [PHP] Dumb question or what?
> on 04/05/03 11:19 AM, Ryan A (ryan
jumac.com) wrote:
>
> > I am kind of new to php coming from a java servlets background and
> > welll....I have fallen for PHP like a sailer for a hooker after a few
months
> > at sea :-)
> >
> > I am going a little crazy with the include() calls and have a template
with
> > around 7 includes in the pages like
> > header.php
> > footer.php
> > left.php
> > right.php
> > menu.php
> > news.php
> > misc.php
>
> includes() are pretty quick and pain free... especially if each include is
> just more HTML, not PHP with huge database queries.
>
> Most of my sites are built off my own CMS, which currently has about 4
basic
> includes for 99% of the pages (plus embedded includes, which there are
about
> 5-6), plus any additional includes that each specific page/script might
> require, most of which are being parsed by PHP, and half of which would
have
> database queries and other "slowish" code.
>
> I have never noticed any performance problems (even on my old P1 133 test
> server on my LAN).
>
>
> Of course, these pages CANNOT be running as fast as single, static HTML
> pages, but the benefits outweigh the cause.
>
>
> Think about some of the fusebox-style architecture (and some of the
> templating languages out there) which have MANY MANY MANY includes... no
> problems at all. phpMyAdmin would be another good example of a popular
> application running with MANY includes.
>
>
> One thing I would suggest (a personal preference only) is to name your
> included files differently to your main scripts. This way:
>
> a) you can easily tell which are "pages" and which are "portions of pages"
> b) you can use apache to block http access to the "portions"
> c) you can designate static HTML pages differently to PHP scripts and
other
> includes
>
> Example
>
>
> All my PAGES are named *.php
> All my includes that use PHP are named *.inc, and are stored in an /inc/
> directory
> All my static HTML includes are named *.html
> All my static TEXT includes are named .txt
>
>
> Then, in my Apache .htaccess file, I block .html, .inc, and .txt files
from
> being served directly over http.
>
> This helps make sure that
>
> a) little snippets of PHP code don't get executed out of context
> b) people don't / can't readily access sensitive data (like passwords)
that
> are in include files, or access chunks of text and HTML which are only
> intended to be included by users in some circumstances (like members-only
> stuff)
>
>
> Just a personal preference, but it helps me :)
>
>
> Justin
>
>
>
>
>
>
>
>
>
> > all those files are just static blocks of html code nothing dynamic...my
> > question is (since you guys are much more experienced than me and are
using
> > PHP longer) will this be too big a load on the server and/or slow down
my
> > page loading a lot in the long run?
> > I have a high speed broadband connection so to me it really does not
matter
> > but to the average joe...
> > I have around 13 pages on the whole site...
> >
> > your views are appreciated.
> >
> > Cheers,
> > -Ryan
> >
>
attached mail follows:
Hi,
I tried to upgrade my default instalation Slacware 8.1 (contains apache
1.3.26 ; mod_ssl 2.8.9-1.3.26; php 4.2.1; mysql 3.23.51; kernel 2.4.18;
gcc 2.95.3) with new version of php 4.3.1 (as loadeable module); apache
1.3.27; mod_ssl 2.8.14-1.3.27 (all from source). For simlification not
yet with new mysql, openssl.
After instalation I tried to run phpMyAdmin. It fails with few rows in
log like this:
[notice] child pid 10537 exit signal Segmentation fault (11)
(it fails when tries to call mysql_connect function)
When I upgrade installation of PHP only (I keep default slacware apache
and mod_ssl), it's functioning.
When I upgrade apache + php (as static module), it's functioning.
When I try some combination of apache + php (as loadeable moodule), it
fails.
I mean some combination of apache 1.3.27, 1.3.26, 1.3.24, 1.3.14 (with
and/or without mod_ssl); php 4.3.1, 4.3.0, 4.2.3
these are my configuration options:
APACHE (without mod_ssl):
./configure \
--enable-shared=max \
--manualdir=/var/www/htdocs/manual \
--enable-module=all
PHP:
./configure \
--with-config-file-path=/usr/local/apache/conf \
--with-apxs=/usr/local/apache/bin/apxs \
--with-mysql=/usr \
--enable-debug
I try to create BACKTRACE (apache 1.3.27 without mos_ssl + php 4.3.1 +
kernel 2.4.18):
#0 0x00000000 in ?? ()
#1 0x4067ecec in db_open () from /lib/libnss_db.so.2
#2 0x4067edac in internal_setent () from /lib/libnss_db.so.2
#3 0x4067e3ed in _nss_db_endservent () from /lib/libnss_db.so.2
#4 0x4067e6f9 in _nss_db_getservbyname_r () from /lib/libnss_db.so.2
#5 0x40205354 in __getservbyname_r (name=0x4065b46e "mysql",
proto=0x4065b46a "tcp", resbuf=0x40240f7c, buffer=0x8235500
"(######
(######
",
buflen=1024, result=0xbfff5e48) at ../nss/getXXbyYY_r.c:200
#6 0x402051f5 in getservbyname (name=0x4065b46e "mysql",
proto=0x4065b46a "tcp") at ../nss/getXXbyYY.c:145
#7 0x4064af0c in simple_command () from /usr/lib/libmysqlclient.so.10
#8 0x4064d2a7 in mysql_init () from /usr/lib/libmysqlclient.so.10
#9 0x40391d96 in php_mysql_do_connect (ht=5, return_value=0x817be64,
this_ptr=0x0, return_value_used=1, persistent=0)
at /usr/src/php/php-4.3.1/ext/mysql/php_mysql.c:736
#10 0x403920b5 in zif_mysql_connect (ht=5, return_value=0x817be64,
this_ptr=0x0, return_value_used=1)
at /usr/src/php/php-4.3.1/ext/mysql/php_mysql.c:792
#11 0x404a02f2 in execute (op_array=0x81356dc)
at /usr/src/php/php-4.3.1/Zend/zend_execute.c:1596
#12 0x404a2686 in execute (op_array=0x81306f4)
at /usr/src/php/php-4.3.1/Zend/zend_execute.c:2162
#13 0x4048d2d4 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
at /usr/src/php/php-4.3.1/Zend/zend.c:864
#14 0x404522f3 in php_execute_script (primary_file=0xbffff488)
at /usr/src/php/php-4.3.1/main/main.c:1573
#15 0x404a57f0 in apache_php_module_main (r=0x812743c,
display_source_mode=0)
at /usr/src/php/php-4.3.1/sapi/apache/sapi_apache.c:55
#16 0x404a6790 in send_php (r=0x812743c, display_source_mode=0,
filename=0x812846c "/usr/local/apache/htdocs/sql/index.php")
at /usr/src/php/php-4.3.1/sapi/apache/mod_php4.c:556
#17 0x404a680f in send_parsed_php (r=0x812743c)
at /usr/src/php/php-4.3.1/sapi/apache/mod_php4.c:571
#18 0x08054aa9 in ap_invoke_handler ()
#19 0x0806a64f in process_request_internal ()
#20 0x0806a6b6 in ap_process_request ()
#21 0x08060f46 in child_main ()
#22 0x08061101 in make_child ()
#23 0x0806127c in startup_children ()
#24 0x0806190d in standalone_main ()
#25 0x0806217c in main ()
#26 0x4013917d in __libc_start_main (main=0x8061dd8 <main>, argc=4,
ubp_av=0xbffff8b4, init=0x804ea8c <_init>, fini=0x8098000 <_fini>,
rtld_fini=0x4000a534 <_dl_fini>, stack_end=0xbffff8ac)
at ../sysdeps/generic/libc-start.c:129
Thanks for every help.
Regards
Martin Swiech
attached mail follows:
Hi gang
Sorry for being out on a limb here, but I've run into an annoyancy:
Been running w. PHP 4.2.3 on Apache 2.0.40 on WinXP Pro, but I want to shift
it over to the machine I'm setting up as Linux server, but've gotten into
some problems ...
It's a RedHat 8, running with whatever Apache and MySQL it came with. RH8
comes with PHP 4.2.2 and I have some problems with my code not coming out
properly when run on this, so I wanted to shift it to 4.2.3 (also since the
final platform it's going to run on is PHP 4.2.3), but I'm having a small
problem: I cannot find the APXS files for the purpose of getting PHP built
as DSO ...
I've tried searching for apxs, and only found it in the source for Apache
1.3.27 that I downloaded. I'm having problems figuring out where the RH
Apache RPM puts the files ... they seem to be scattered around /usr and /etc
... so I've been unable to locate the actual bin dir for the Apache ...
Anyone know where to find what I'm looking for on a standard RH8 server
install?
Or how else to build PHP 4.2.3 as DSO without APXS???
The alternative I'm looking at is dumping the RPM version of Apache
2.0.4whatever, and then building the 1.3.27 from scratch ... but I'd rather
try and getting it running with the one already in the system...
Anyone able to help ???
Feel free to answer off-list if you feel it's more appropriate ...
Rene
Rene Brehmer
aka Metalbunny
http://metalbunny.net/
References, tools, and other useful stuff...
attached mail follows:
> -----Original Message-----
> From: -{ Rene Brehmer }- [mailto:metalbunny
metalbunny.net]
>
> The alternative I'm looking at is dumping the RPM version of Apache
> 2.0.4whatever, and then building the 1.3.27 from scratch ... but
> I'd rather
> try and getting it running with the one already in the system...
You have two choices, as has been said here many, many times:
1) Use Apache 2.x and remember that PHP is not supported running as a module
(it's experimental) and you'll be having trouble for a long, long time.
2) Use Apache 1.3.x and have a much simpler time running everything.
Mark C.
attached mail follows:
Can anyone help me out on this? Does anyone know what this means?
Warning: Cannot use a scalar value as an array in C:\Program
Files\Apache Group\Apache2\htdocs\calendar\my_events.php on line 473
Warning: Cannot use a scalar value as an array in C:\Program
Files\Apache Group\Apache2\htdocs\calendar\my_events.php on line 475
Warning: Cannot use a scalar value as an array in C:\Program
Files\Apache Group\Apache2\htdocs\calendar\my_events.php on line 473
Warning: Cannot use a scalar value as an array in C:\Program
Files\Apache Group\Apache2\htdocs\calendar\my_events.php on line 475
Warning: Cannot use a scalar value as an array in C:\Program
Files\Apache Group\Apache2\htdocs\calendar\my_events.php on line 473
Warning: Cannot use a scalar value as an array in C:\Program
Files\Apache Group\Apache2\htdocs\calendar\my_events.php on line 475
Warning: Cannot use a scalar value as an array in C:\Program
Files\Apache Group\Apache2\htdocs\calendar\my_events.php on line 473
Warning: Cannot use a scalar value as an array in C:\Program
Files\Apache Group\Apache2\htdocs\calendar\my_events.php on line 475
Thanks.
Matt
attached mail follows:
Matt,
Looks likve you've defined a variable as a scalar value and are now trying
to dimension it as an array.
i.e.
$int = 123;
$int[] = 'b';
This won't work. If you need to use a variable as an array, good programming
practices (and most good languages) require you to initalize the array
first.
$int = array();
$int[] = 'b';
This will work.
'course I could be wrong, I'm flying blind where without knowing what lines
473 and 475 are.
=C=
* Cal Evans
* http://www.christianperformer.com
* Stay plugged into your audience
* The measure of a programmer is not the number of lines of code he writes
but the number of lines he does not have to write.
----- Original Message -----
From: "Matt Palermo" <mpalermo
vt.edu>
To: <php-general
lists.php.net>
Sent: Sunday, May 04, 2003 9:51 AM
Subject: [PHP] error messages
> Can anyone help me out on this? Does anyone know what this means?
>
> Warning: Cannot use a scalar value as an array in C:\Program
> Files\Apache Group\Apache2\htdocs\calendar\my_events.php on line 473
>
> Warning: Cannot use a scalar value as an array in C:\Program
> Files\Apache Group\Apache2\htdocs\calendar\my_events.php on line 475
>
> Warning: Cannot use a scalar value as an array in C:\Program
> Files\Apache Group\Apache2\htdocs\calendar\my_events.php on line 473
>
> Warning: Cannot use a scalar value as an array in C:\Program
> Files\Apache Group\Apache2\htdocs\calendar\my_events.php on line 475
>
> Warning: Cannot use a scalar value as an array in C:\Program
> Files\Apache Group\Apache2\htdocs\calendar\my_events.php on line 473
>
> Warning: Cannot use a scalar value as an array in C:\Program
> Files\Apache Group\Apache2\htdocs\calendar\my_events.php on line 475
>
> Warning: Cannot use a scalar value as an array in C:\Program
> Files\Apache Group\Apache2\htdocs\calendar\my_events.php on line 473
>
> Warning: Cannot use a scalar value as an array in C:\Program
> Files\Apache Group\Apache2\htdocs\calendar\my_events.php on line 475
>
> Thanks.
>
> Matt
>
attached mail follows:
Denis,
This is called 'Breadcrumb Navigation' and there is no easy way to do it.
Keeping a list of hidden fields is one way to do it but it's not necessarily
easy. You'll have to treat them as a stack and make sure you pop them
correctly if the user starts jumping around your site.
I've done this using a data driven menu system and 'Nested Trees' to store
the menu's. This worked well because for any given page, I could trace the
path back to the home page programmatically. But this was not easy. If you
are interested in nested trees, check out 'SQL for Smarties' by Joe Celko.
Chapter 28. Great primer and you should be able to figure it out from
there.
HTH,
=C=
* Cal Evans
* http://www.christianperformer.com
* Stay plugged into your audience
* The measure of a programmer is not the number of lines of code he writes
but the number of lines he does not have to write.
----- Original Message -----
From: "Denis L. Menezes" <menezesd
singnet.com.sg>
To: "PHP general list" <php-general
lists.php.net>
Sent: Saturday, May 03, 2003 9:16 PM
Subject: [PHP] How do I do this?
Hello Friends.
In one shopping website I saw this :
Home > Departments > Photography > Cameras & Photographic Equipment >
Camera Film > Item Detail
I know one way to do this is to remember every link that the visitor
has clicked until he has arrived to this page by using hidden fields.
Is there an easier way than that?
Thanks
Denis
attached mail follows:
Oh yea and Joe posted most of Chapter 28 here:
http://searchdatabase.techtarget.com/tip/1,289483,sid13_gci801943,00.html
* Cal Evans
* http://www.christianperformer.com
* Stay plugged into your audience
* The measure of a programmer is not the number of lines of code he writes
but the number of lines he does not have to write.
----- Original Message -----
From: "Denis L. Menezes" <menezesd
singnet.com.sg>
To: "PHP general list" <php-general
lists.php.net>
Sent: Saturday, May 03, 2003 9:16 PM
Subject: [PHP] How do I do this?
Hello Friends.
In one shopping website I saw this :
Home > Departments > Photography > Cameras & Photographic Equipment >
Camera Film > Item Detail
I know one way to do this is to remember every link that the visitor
has clicked until he has arrived to this page by using hidden fields.
Is there an easier way than that?
Thanks
Denis
attached mail follows:
I know that in order to insert an apostrophe into a mysql database,
instead of putting one apostrophe, you need to put double apostrophes.
So to do this, I am using the command:
$NewTitleBox=eregi_replace("'", "''", $TitleBox);
but instead of replacing the apostrophe with a double apostrophe, it
replaces it with this \''
anyone got any ideas? Thanks.
Matt
attached mail follows:
> I know that in order to insert an apostrophe into a mysql database,
> instead of putting one apostrophe, you need to put double apostrophes.
> So to do this, I am using the command:
>
> $NewTitleBox=eregi_replace("'", "''", $TitleBox);
>
> but instead of replacing the apostrophe with a double apostrophe, it
> replaces it with this \''
You probably have magic_quotes_gpc enabled, which is adding the
backslash before the original single quote. Then your str_replace() is
duplicating the single quote.
For mysql, the single quote can be escaped with a backslash or another
single quote. So, since magic_quotes appears to be on, you do not need
to do anymore escaping of the text.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
attached mail follows:
Okay, I don't need to replace it, but now when I am getting the info
from the mysql database that has an apostrophe in it, it just cut's off
everything from the apostrophe on. For example, I am reading in a field
that contains "I like my dad's haircut." But then I go to output it, and
it reads, "I like my dad" Any ideas?
Matt
-----Original Message-----
From: John W. Holmes [mailto:holmes072000
charter.net]
Sent: Sunday, May 04, 2003 11:35 AM
To: 'Matt Palermo'; php-general
lists.php.net
Subject: RE: [PHP] php mysql apostrophe issue
> I know that in order to insert an apostrophe into a mysql database,
> instead of putting one apostrophe, you need to put double apostrophes.
> So to do this, I am using the command:
>
> $NewTitleBox=eregi_replace("'", "''", $TitleBox);
>
> but instead of replacing the apostrophe with a double apostrophe, it
> replaces it with this \''
You probably have magic_quotes_gpc enabled, which is adding the
backslash before the original single quote. Then your str_replace() is
duplicating the single quote.
For mysql, the single quote can be escaped with a backslash or another
single quote. So, since magic_quotes appears to be on, you do not need
to do anymore escaping of the text.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
> Okay, I don't need to replace it, but now when I am getting the info
> from the mysql database that has an apostrophe in it, it just cut's
off
> everything from the apostrophe on. For example, I am reading in a
field
> that contains "I like my dad's haircut." But then I go to output it,
and
> it reads, "I like my dad" Any ideas?
No, not right off hand. How are you displaying the data? A simple echo
or within a text box? If it's a text box, look at your page source for
the reason why.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
attached mail follows:
It is within a textbox. What do you mean "look at your page source for
the reason why?"
-----Original Message-----
From: John W. Holmes [mailto:holmes072000
charter.net]
Sent: Sunday, May 04, 2003 12:11 PM
To: 'Matt Palermo'; php-general
lists.php.net
Subject: RE: [PHP] php mysql apostrophe issue
> Okay, I don't need to replace it, but now when I am getting the info
> from the mysql database that has an apostrophe in it, it just cut's
off
> everything from the apostrophe on. For example, I am reading in a
field
> that contains "I like my dad's haircut." But then I go to output it,
and
> it reads, "I like my dad" Any ideas?
No, not right off hand. How are you displaying the data? A simple echo
or within a text box? If it's a text box, look at your page source for
the reason why.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
attached mail follows:
> > > Okay, I don't need to replace it, but now when I am getting the
info
> > > from the mysql database that has an apostrophe in it, it just
cut's
> > off
> > > everything from the apostrophe on. For example, I am reading in a
> > field
> > > that contains "I like my dad's haircut." But then I go to output
it,
> > and
> > > it reads, "I like my dad" Any ideas?
> >
> > No, not right off hand. How are you displaying the data? A simple
echo
> > or within a text box? If it's a text box, look at your page source
for
> > the reason why.
>
> It is within a textbox. What do you mean "look at your page source
for
> the reason why?"
Did you do it? Look at the text box where you are trying to display this
value and see if you can spot the problem. FYI: HTML does not recognize
two single quotes or a backslash as escape characters. It only
understand HTML entities. Spoiler below if you can't figure it out...
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
SPOILER:
You have something like this:
<input type='text' name='foo' value='it's my value'>
Do you see the problem in the value? Whether you have the single quote,
two of them, or use a backslash as an escape, you'll end up with the
same. HTML will cut off the value at the first single quote.
To stop this, you must use htmlentities() or htmlspecialchars() on the
data before you place it into the value tag.
attached mail follows:
Hello,
I upload a file with php. It works fine. I know the tmpname, filetype,...
But how can I get the original file path? I mean the value of the file input
field after choosing a file.
Thanks!
attached mail follows:
John M. wrote:
> I upload a file with php. It works fine. I know the tmpname, filetype,...
> But how can I get the original file path? I mean the value of the file
> input field after choosing a file.
You can't. This info isn't submitted to the server so PHP can't get it.
johannes
attached mail follows:
> I upload a file with php. It works fine. I know the tmpname,
filetype,...
> But how can I get the original file path? I mean the value of the file
> input
> field after choosing a file.
You can't; privacy issues.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
attached mail follows:
$_FILES['userfile']['name'] will give you the original file name minux
the directory path.
Jason
John M. wrote:
>Hello,
>
>I upload a file with php. It works fine. I know the tmpname, filetype,...
>But how can I get the original file path? I mean the value of the file input
>field after choosing a file.
>
>Thanks!
>
>
>
>
>
attached mail follows:
Hi all, I'm new to all this. could someone tell me why this script doesn't
post to my Database?
<HTML>
<?php
if($submit)
{
$db = mysql_connect("localhost", "XXXXXX","xxxxxxxx");
mysql_select_db("xxxxxxxx",$db);
$sql = "INSERT INTO current (Company, Start, Description, DWSRep)
VALUES ('$company','$start','$description', '$rep',)";
$result = mysql_query($sql);
echo "PIP Information Updated.";
}
else
{
?>
<form method="post" action="data_input.php">
Customer name:<input type="Text" name="company"><br>
Start Date: <input type="Text" name="start"><br>
Project Description: <input type="Text" name="description"><br>
DWS Representative: <input type="Text" name="rep"><br>
<input type="Submit" name="submit" value="Update PIP"></form>
<?
}
?>
</HTML>
I get the "PIP Information updated" message back but when i view the
Database there is no new information in it.
I'm reading as fast as I can but having someone to ask questions is very
helpfull.
--
Thanks all.
attached mail follows:
> Hi all, I'm new to all this. could someone tell me why this script
doesn't
> post to my Database?
Check mysql_error() after your query to see if an error occurred.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
attached mail follows:
It looks like you have an extra comma in SQL query, take a look at
VALUES ('$company','$start','$description', '$rep',) you have a comment after '$rep' indicating you intend to provide another value, try taking that out.
In general when your SQL does not work as expected try echo $sql and look at the SQL to see if it is what you expect and also use mysql_error to determine what the error on the db is.
Jason
Brent Lee wrote:
>Hi all, I'm new to all this. could someone tell me why this script doesn't
>post to my Database?
><HTML>
><?php
>if($submit)
>{
>$db = mysql_connect("localhost", "XXXXXX","xxxxxxxx");
>mysql_select_db("xxxxxxxx",$db);
>$sql = "INSERT INTO current (Company, Start, Description, DWSRep)
>VALUES ('$company','$start','$description', '$rep',)";
>$result = mysql_query($sql);
>echo "PIP Information Updated.";
>}
>else
>{
>?>
><form method="post" action="data_input.php">
>Customer name:<input type="Text" name="company"><br>
>Start Date: <input type="Text" name="start"><br>
>Project Description: <input type="Text" name="description"><br>
>DWS Representative: <input type="Text" name="rep"><br>
><input type="Submit" name="submit" value="Update PIP"></form>
><?
>}
>?>
></HTML>
>
>I get the "PIP Information updated" message back but when i view the
>Database there is no new information in it.
>
>I'm reading as fast as I can but having someone to ask questions is very
>helpfull.
>
>--
>Thanks all.
>
>
>
>
>
attached mail follows:
Hi guys,
This is driving me nuts.
my directory structure
/sales
/sales/inc
/sales/inc2
in ../sales i have confirmed.php with this:
if($product_id == 3)
{ include ("/home/public_html/sales/inc/stan.php"); }
else{ include ("/home/public_html/sales/inc2/stan.php"); }
in both "inc" and "inc2" i have the same identical file "stan.php", but for
each "stan.php" I have a differient config.php file.
confirmed.php is working perfectly and is calling
"/home/public_html/sales/inc/stan.php" if product_id=3 but because stan.php
there has a "require('config.php');" it is giving me an error and dieing.
What to do?
Kindly reply if you think of anything, I have just about given up.
Cheers,
-Ryan
attached mail follows:
I found this regex that does this:
"mike
yahoo.com" converts to "<a
href="mailto:mike
yahoo.com">mike
yahoo.com</a>"
$text =
preg_replace("/([\w-?&;#~=\.\/]+\
(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9
]{1,3})(\]?))/i","<A HREF=\"mailto:$1\">$1</A>", $text);
... but I'm having problems with this:
"<a href="mailto:mike
yahoo.com">mike
yahoo.com</a>"
converts to
"<a href="mailto:<a href="mailto:mike
yahoo.com">mike
yahoo.com</a>"><a
href="mailto:mike
yahoo.com">mike
yahoo.com</a></a>"
What do I need to include in the regex to not do it if "mailto:" is infront
of the email address?
---
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.474 / Virus Database: 272 - Release Date: 18/04/03
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]