Re: [PHP] Australian *nix Hosts?

2002-04-19 Thread Justin French

Hi,

I stopped searching in Australia and looked over to the US, and am pretty
happy with experthost.com (2GB/50meg/20POP starting at US$15/m)... since
signing up, I changed over to a reseller account to run multiple domains for
clients, and am now paying around US$6.25/m per domain.

I know that additional bandwidth is available too.


The problem is that AU bandwidth is wy expensive.  A comparable plan to
the above on a reliable, customer service drive ISP in AU is more like
AU$50-150/month, and as you know, getting up near 5gb puts the price through
the roof.

Bandwidth is the US is s much cheaper.  Unless you have a specificly
focused group of Australian users, and are server a lot of large files, or
stuff that requires really short ping times (like gaming?), I'd recommend
looking overseas...  just ensure they have 24/7 support, otherwise you'll
have email/support delays and 3am phone calls :)


Justin French

Creative Director
http://Indent.com.au




on 15/04/02 11:31 PM, The_RadiX ([EMAIL PROTECTED]) wrote:

> Hi yes I have already read the posts about the hosting questions
> 
> 
> But as I am in Australia I'd like to know if anyone here has had any dealings
> with a good Australian host and any recommendations..
> 
> 
> 
> 
> Thanks a heap..
> 
> 
> P.S. I see what spec's US and EU guys have on the sites and from the months I
> have hunted around AUS I found that it's pretty exp. just to get like 5gb a
> month downloads is around AUD$300p/m which is kinda pricey for me..
> 
> 
> 
> 
> Thanks again..
> 
> 
> 
> 
> :::
> Julien Bonastre [The-Spectrum.org CEO]
> A.K.A. The_RadiX
> [EMAIL PROTECTED]
> ABN: 64 235 749 494
> Mobile: 0407 122 268
> QUT Student #: 04475739
> :::
> 
> 
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] $PHP_SELF question

2002-04-19 Thread Justin French

Spend a bit of time reading up on predefined variables (like $PHP_SELF) in
the manual:

http://www.php.net/manual/fi/reserved.variables.php

I believe you're after SCRIPT_NAME, but it's worth familiarising yourself
with them all for future reference.


Justin French

Creative Director
http://Indent.com.au





on 18/04/02 11:48 PM, Brinkman, Theodore
([EMAIL PROTECTED]) wrote:

> I've got an include file that provides the basic framework for every page on
> my site, and at the bottom of each page, I want to spit out when the page
> was last updated.  I used $PHP_SELF inside the include file, and got the
> include file's path.  Is there a variable equivalent to $PHP_SELF that
> returns the path for the file that is being executed?
> 
> Basically, if I'm running index.php, and I include template.php is there any
> way, from inside template.php, to get index.php short of passing it as a
> parameter?
> 
> - Theo


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] header redirection

2002-04-19 Thread Jason Wong

On Saturday 20 April 2002 05:07, Norman Zhang wrote:
> Hi,
>
> I use header(location: ...) for redirection to another page. But I also
> want to include ,  and  tags in the other page. Is there
> a way to this? Because php complains that the header already been sent.

Show us your code.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Spiritual leadership should remain spiritual leadership and the temporal
power should not become too important in any church.
- Eleanor Roosevelt
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] some problems about gd in php

2002-04-19 Thread Jason Wong

On Saturday 20 April 2002 09:36, zhaoxd wrote:
> Yeah,I have already restarted web server and there was no error in
> compiling during configure/make/install .Using gd,I get the information
> that concern about GD Support ,GD version,WBMP Support ,etc.as follow:
 
> GD Support ---enabled
> GD Version1.6.2 or higher
> WBMP Support---enabled

If it was a recompile, try to do a clean installation. Remove the directory 
containing your existing php src, untar your tarball, then 
configure/make/install.

> > > ./configure --with-mysql=/usr/local/mysql
> > > --with-apache=../apache_1.3.24
 --enable-track-vars
> > > --with-gd=../gd-1.8.4 --with-png-dir=../libpng --with-zlib-dir=../zlib

Also, what is inside these directories?

../gd-1.8.4
../libpng
../zlib

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Physician:  One upon whom we set our hopes when ill and our dogs when well.
-- Ambrose Bierce
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] redirect browser

2002-04-19 Thread Jason Wong

On Saturday 20 April 2002 09:26, Joe wrote:


> =
>
>  
> Warning: Cannot add header information - headers already sent
> by (output started at c:\html\html\check.php:4) in
> c:\html\html\check.php on line 42
> 
>
> I had no idea about this.
> Can anyone tell me what's wrong of my code?

You cannot have anything between the beginning of the file and your  Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
A real person has two reasons for doing anything ... a good reason and
the real reason.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Empty $_SESSION and $_POST ??

2002-04-19 Thread Jason Wong

On Saturday 20 April 2002 09:41, Andre Dubuc wrote:

> Is there a way I can verify that (a) globals are off and (b) $_SESSION or
> $_POST are on? This probably what's happening -- I can't access the arrays
> at all -- so, I think that might be where the problem lies. The $vars still
> work though throughout all scripts.

Use:

  print_r($GLOBALS);

to see what variables you have.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Dr. Jekyll had something to Hyde.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Getting All Variables?

2002-04-19 Thread Jason Wong

On Saturday 20 April 2002 07:23, Devin Atencio wrote:
> Is there an easy way in PHP to have it display to screen all the variables
> that
> it has in memory? So i can see what variables there is and what they are
> set to?

print_r($GLOBALS);

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
There has been an alarming increase in the number of things you know
nothing about.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] About socket function

2002-04-19 Thread KeithAY

Hi all,

I got a problem when I using socket function in PHP.
After I use fsockopen() to open socket, I send a msg
using fwrite() and receive a msg using fread(), this work fine. However, I
use fwrite() again to send a msg and use
fread() to receive a response msg, it failed.
The sequence of function call is :
fsockopen -> fwrite -> fread -> fwrite -> fread then fail
Why this happen? any method to solve it?
Thx all your kindly help!!!

Regards,
Keith AY




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Attachments

2002-04-19 Thread Jason Wong

On Saturday 20 April 2002 12:29, Jason Soza wrote:

> Using both Perl and PHP to send mail with attachments from forms, the
> attachments get truncated. Since both Perl scripts and PHP scripts do this,
> I'm ruling out coding error, and since my mailserver has been receiving
> e-mails from other sources and has transmitted the whole attachments from
> them, I'm ruling it out too. Does anyone know if Apache has some sort of
> limitation on attachments? Is there a setting for this in httpd.conf? I
> don't have any .htaccess files laying around, just httpd.conf and virtual
> hosts. Is there like a max_file_size thing I need to mess with?

If you're using GET in your form(s) change it to POST.

Also, please do not reply to an existing thread and change the subject. This 
messes up the threading for those of us who use an intelligent mail client. 
Start your own thread.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
QOTD:
If it's too loud, you're too old.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Attachments

2002-04-19 Thread Jason Soza

I apologize in advance, this question most likely doesn't belong here, but
if anyone can help that'd be great:

Using both Perl and PHP to send mail with attachments from forms, the
attachments get truncated. Since both Perl scripts and PHP scripts do this,
I'm ruling out coding error, and since my mailserver has been receiving
e-mails from other sources and has transmitted the whole attachments from
them, I'm ruling it out too. Does anyone know if Apache has some sort of
limitation on attachments? Is there a setting for this in httpd.conf? I
don't have any .htaccess files laying around, just httpd.conf and virtual
hosts. Is there like a max_file_size thing I need to mess with?

Again, I apologize for the off-topic nature of this, just looking for some
help.

Thanks,
Jason


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] .phps

2002-04-19 Thread Mantas Kriauciunas

Hey [EMAIL PROTECTED],

 as i understand files .phps should view code nice and in colors...
 but when i set up everything good in http.conf and (as i think)
 everything is perfect it wants me to download that .phps
 file...what can be wrong? im using PHPTriad on win2k

 thank you

:--:
Have A Nice Day! 
 Mantas Kriauciunas A.k.A mNTKz

Contacts:
[EMAIL PROTECTED]
Http://mntkz-hata.visiems.lt


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: [PHP-INST] can't view PHP

2002-04-19 Thread Andre Dubuc

Hi Joey,

Don't know whetehr I can help, but I ran into the same problem with my Linux 
box. In Mozilla et al, I had to change in "Preferences > Advanced > Proxies > 
Manual Proxy Config >> No proxy for: Localhost".

I haven't followed your thead, and I'm no familair with networking, butthta 
might steer you in a new direction. It worked for me while I'm protyping my 
site.

Hth,
Andre


On Friday 19 April 2002 11:31 pm, you wrote:
> yes i've tried that too *sigh* :( i've read the manual over and over again
> and installed it a few times and added all those lines ppl suggested but
> still no luck. I'm about to just give up. I know how to work PHP but I just
> can't find where this problem comes from. Maybe it's a windows thingy who
> knows, maybe i need IIS on my system which of course doesn't come with Win
> XP Home Edition. I read something about webpage in management tools in
> Windows but i don't have that so i can't change things there.  I really do
> appreciate all your reactions and replies.
>
>
> "Christoph görgen" <[EMAIL PROTECTED]> wrote in message
> news:003101c1e77e$c3ca5fc0$0e0a@AGENTUR...
>
> > > Everytime i try to view a php file on my server it prompts me to
>
> download
>
> > > the file then opens it up in word pad. I can view any other file just
>
> not
>
> > > php.
> > >
> > > Can anyone help me with this problem please?
> >
> > Already tried to insert these lines into your httpd.conf ... ?
> > #if you use php3#
> > AddType application/x-httpd-php3 .php3
> > #if u use php4:#
> > AddType application/x-httpd-php3 .php4 .php
> >
> > that should solve your problem after having restarted the webserver
> > good luck
> > chris

-- 
Please pray the Holy Rosary to end the holocaust of abortion.
Remember in your prayers the Holy Souls in Purgatory.

May God bless you abundantly in His love!
For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Empty $_SESSION and $_POST ??

2002-04-19 Thread Andre Dubuc

I'm running PHP 4.1.2 + Apache 1.3.23 + PostgreSQL 7.2.

I've tried reverting back to globals=on, and same problem. Yet, earlier in 
another script I used $sfname = $_GET['sfname']; to get the value of sfname 
-- now, it won't work. I'm truly stumped -- I don't know whether it's my 
code? [I beginning to think it isn't because of the flakiness of the php.ini 
failing to report changes accurately] 

I've dumped PHP and re-installed it, but the same problem persists.

Now for the big question -- what's wrong with globals=on anyway? Eventually 
the site will be public, and probably the host won't allow globals on, but 
what's the security risk?

You say $_SESSION[] and $_POST[] are always on -- even if globals are on?
Can I verify what all the variables in the array are? Where would I look? By 
the look of things, I've got a major problem -- but I don't know where to 
look.

Help? Please?

Tia,
Andre


On Friday 19 April 2002 10:17 pm, you wrote:
> I accidentally deleted your last message. But with current versions of
> PHP, $_POST, etc., are always on and there's no way to turn them off.
> Which version are you running? (check phpinfo()).
>
> miguel
>
> On Fri, 19 Apr 2002, Miguel Cruz wrote:
> > On Fri, 19 Apr 2002, Andre Dubuc wrote:
> > > Whenever I try:
> > >
> > > print("$_SESSION['sfname']);  or  print("$_POST['scity']
> > >
> > > I get a parse error "expecting 'T_STRING' . . ." -- obviously there's
> > > nothing in the array or I haven't set it.
> >
> > You just have a simple syntax error.
> >
> > You can use any of the following:
> >
> >print $_SESSION['sfname'];
> >print "{$_SESSION['sfname']}";
> >print "${_SESSION['sfname']}";
> >
> > But you can't put a bare array dereference inside a quoted string like
> > you tried above. You need to surround it with {curly braces} or take it
> > outside the quoted string.
> >
> > miguel

-- 
Please pray the Holy Rosary to end the holocaust of abortion.
Remember in your prayers the Holy Souls in Purgatory.

May God bless you abundantly in His love!
For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Variable Inside Variable

2002-04-19 Thread Miguel Cruz

On Fri, 19 Apr 2002, Jeff Oien wrote:
>> Far better would be to put a placeholder in $body like @@@ and then just 
>> do $body = ereg_replace('@@@', $url, $body);
> 
> That's giving me a blank also. The form for changing the email is in a 
> password protected area where only two people are allowed. But I'll
> implement the more secure version when I can get it to work. Thanks
> for the help.

If that's giving you a blank then something else is wrong in your code.  
This definitely does work:
 
   $body = "Hello, and thank you. Please visit the site @@@.";
   $url = "http://boogers.on.toast/";;
   $body = ereg_replace('@@@', $url, $body);

Start from the simplest case, verify that it works, and then work out to
include all the other funky stuff you've got going on.

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Does anyone have auto-signup stopping code? URGENT!

2002-04-19 Thread Miguel Cruz

On Fri, 19 Apr 2002, Leif K-Brooks wrote:
> I have a website where people can signup.  Some jerk just made a program
> that cheats by signing up automaticly and transfering what he gets when
> he starts (you can get virtual money in my game).  Does anyone have code
> to stop automatic signups?  I would write it, but he's about to
> distribute his program, which would create quite q mess and unbalance
> the game.  Thanks if you can help!

To defeat a program you need to come up with something that only a person 
can do. 

One idea would be to generate a 3-digit number and use GD to display it as
a GIF. Randomly vary the offset and colors so he can't just hash out all
the possibilities. Display the GIF image, and require that the user look
at it and enter that number in order to have their registration processed.

This works because people's brains are very good at pattern recognition 
but computers are awful at it.

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Variable Inside Variable

2002-04-19 Thread Jeff Oien

> On Fri, 19 Apr 2002, Jeff Oien wrote:
> >> Use eval().
> > 
> > I have $url (literally) embedded in some text in the database that is to be 
> > sent as an email message. I'm using this and $url disappears with a blank
> > spot in the text:
> > eval("\$body = \"$body\";");
> > I've tried variations and can't get it to work. Any help? Thanks.
> 
> While you could do something like:
> 
>   $body = eval("return \"{$body}\";");
> 
> ...the huge, monstrous, gigantic problem is that if you allow anyone to 
> edit any part of $body or any string that goes into it, you are basically 
> handing them control of your server, because they can get eval() to 
> execute any code they want.
> 
> Far better would be to put a placeholder in $body like @@@ and then just 
> do $body = ereg_replace('@@@', $url, $body);
> 
> miguel

That's giving me a blank also. The form for changing the email is in a 
password protected area where only two people are allowed. But I'll
implement the more secure version when I can get it to work. Thanks
for the help.
Jeff Oien 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Does anyone have auto-signup stopping code? URGENT!

2002-04-19 Thread Leif K-Brooks

I have a website where people can signup.  Some jerk just made a program
that cheats by signing up automaticly and transfering what he gets when he
starts (you can get virtual money in my game).  Does anyone have code to
stop automatic signups?  I would write it, but he's about to distribute his
program, which would create quite q mess and unbalance the game.  Thanks if
you can help! 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Empty $_SESSION and $_POST ??

2002-04-19 Thread Andre Dubuc

On Friday 19 April 2002 08:13 pm, you wrote:
> On Fri, 19 Apr 2002, Andre Dubuc wrote:
> > Whenever I try:
> >
> > print("$_SESSION['sfname']);  or  print("$_POST['scity']
> >
> > I get a parse error "expecting 'T_STRING' . . ." -- obviously there's
> > nothing in the array or I haven't set it.
>
> You just have a simple syntax error.
>
> You can use any of the following:
>
>print $_SESSION['sfname'];
>print "{$_SESSION['sfname']}";
>print "${_SESSION['sfname']}";
>
> But you can't put a bare array dereference inside a quoted string like you
> tried above. You need to surround it with {curly braces} or take it
> outside the quoted string.
>
> miguel


Hi Miguel,

I tried all three -- none work.  I question whether register_globals is truly 
"off" since, earlier when I changed php.ini it dumped my Postgresql and left 
the phpinfo() unchanged. This time it reported the change, and Postgresql is 
working.

Is there a way I can verify that (a) globals are off and (b) $_SESSION or 
$_POST are on? This probably what's happening -- I can't access the arrays at 
all -- so, I think that might be where the problem lies. The $vars still work 
though throughout all scripts.

Any ideas?

Tia,
Andre

-- 
Please pray the Holy Rosary to end the holocaust of abortion.
Remember in your prayers the Holy Souls in Purgatory.

May God bless you abundantly in His love!
For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Variable Inside Variable

2002-04-19 Thread Miguel Cruz

On Fri, 19 Apr 2002, Jeff Oien wrote:
>> Use eval().
> 
> I have $url (literally) embedded in some text in the database that is to be 
> sent as an email message. I'm using this and $url disappears with a blank
> spot in the text:
> eval("\$body = \"$body\";");
> I've tried variations and can't get it to work. Any help? Thanks.

While you could do something like:

  $body = eval("return \"{$body}\";");

...the huge, monstrous, gigantic problem is that if you allow anyone to 
edit any part of $body or any string that goes into it, you are basically 
handing them control of your server, because they can get eval() to 
execute any code they want.

Far better would be to put a placeholder in $body like @@@ and then just 
do $body = ereg_replace('@@@', $url, $body);

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] some problems about gd in php

2002-04-19 Thread zhaoxd


Yeah,I have already restarted web server and there was no error in compiling during 
configure/make/install .Using gd,I get the information that concern about GD Support 
,GD version,WBMP Support ,etc.as follow:

GD Support ---enabled
GD Version1.6.2 or higher
WBMP Support---enabled

the environment variable of  LS_COLORS is 
"no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:"


By the way,my OS is linux 7.2;kernel is 2.4.17.Before I compiled gd-1.8.4 , I 
configure/make/make install libpng-1.2.0&zlib-1.1.4&jpeg-6b without any arguments such 
as --prefix and others.Is this right?During the process,there was no error reported.Is 
my test code right?
  
Thank you
zhaoxd
> On Friday 19 April 2002 18:57, zhaoxd wrote:
> > The version of php is php-4.1.2,the latest version,apache-1.3.24,also
> > latest.
>  
> > I have installed gd-1.8.4 in apache server without any problems.To check if
> > the gd can work,I write some codes in php like this:
>   
> [snip]
> 
> > Is this a compiling problem?The compiling command of php is:
> 
> > 
> 
> > ./configure --with-mysql=/usr/local/mysql --with-apache=../apache_1.3.24
> > --enable-track-vars --with-gd=../gd-1.8.4 --with-png-dir=../libpng
> > --with-zlib-dir=../zlib
>  
> 
> 1) If this was a recompile:
>  a) Presumably there were no errors during configure/make/install?
>  b) Did you restart the webserver? 
> 
> 2) What do you get using phpinfo()?




RE: [PHP] Variable Inside Variable

2002-04-19 Thread Jeff Oien

> On Friday 19 April 2002 09:31, Jeff Oien wrote:
> > I have a script which retrieves the body of an email message from
> > a MySQL database to be sent to someone who applies using a form.
> > The script contains this:
> >
> > $url = " > href=\"http://$HTTP_HOST$SCRIPT_NAME\";>http://$HTTP_HOST$SCRIPT_NAME";
> > $url = addslashes("$url");
> >
> > $msg1 .= "$body"; //to be sent via mail()
> >
> > Then within the body of the message I want $url to show up.
> > The body of the message in the database looks like this:
> > ---
> > You are receiving this exclusive message to confirm your
> > application through $url.
> > ---
> > I've tried everything I can think of with $url, curly brackets, backslashes
> > etc. What am I missing? Thanks.
> 
> Use eval().

I have $url (literally) embedded in some text in the database that is to be 
sent as an email message. I'm using this and $url disappears with a blank
spot in the text:
eval("\$body = \"$body\";");
I've tried variations and can't get it to work. Any help? Thanks.
Jeff Oien

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] redirect browser

2002-04-19 Thread Joe

I had developed the web-based survey for student.
And I need to check that each only fill in the form once time.
So I write following code to check if the student number
exist in the database or not.
if yes, don't let them to fill in again.
if no, redirect the browser to the page for them to fill in.

=

=1)
 {
  echo "Student Number $studno already existed in the database."
  ."You don't need to input again!";
 }
 else
 {
  header("Location: http://www.XXX.edu/index.php";);
  exit;
 }
?>

=

the code can check the student no. are exist in database or not
but the browser don't redirect to the page if student not exist
in database and display the following error code:


Warning: Cannot add header information - headers already sent
by (output started at c:\html\html\check.php:4) in
c:\html\html\check.php on line 42


I had no idea about this.
Can anyone tell me what's wrong of my code?

Thx!

Joe




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: 3dim Array problem

2002-04-19 Thread Hugh Bothwell

>  while( $res=$UDV -> getDbAns()) {// fetch mains

Just checking:

On success, $UDV->getDbAns() returns array of string;
On fail, it returns false.

>  if(strlen($res[0]) > 2) { // if result is OK
> $menarr[$h]=$res[0]; // put them in array

Here is your problem - you set $menarr[$h] to
a string, then later try to set stringval[$s][$h] to
a string.  Unsurprisingly, PHP has no idea how to
treat a string as a 2d array.


> // get submenues
> $selchi="select chi from link where pa = '$res[0]'";

Try echoing this string to make sure it is what you think;
might have to be
... where pa = '{$res[0]}' ";

> $UDB ->  talk2DB($selchi);
> while($chia=$UDB -> getDbAns()) {
>if(strlen($chia[0]) >3) { // if result is OK
>   //echo "".$chia[0]."";
>   // Youll get a <0x20> separated string
>   $subp=explode(" ",$chia[0]); // explode it, to get single values

>   if(is_array($subp)) { // if there are more than one in it

... the result of explode() is _always_ an array; this
test and the alternate code are unnecessary.

>  $maxs=count($subp); // check out how many
>  for($n=0; $n < $maxs ; $n++) {// each child in main/sub/n

why not use foreach() ?  not much difference, maybe,
just a bit easier to follow...

> // put the value in main/sub/n
> error here  ->   $menarr[$h][$s][$n]=$subp[$n];

as above, $menarr[$h] is a string.


>  }
>   }

>del else // if there´s only one value
>del {
>del $menarr[$h][$s][0]=$chia[0];
>del }

> }// end if sub
> $s++; // submenues plus one

You never set $s to 0; your submenus are going to be
numbered funny, ie

$menarr[0][0]
$menarr[0][1]
$menarr[0][2]
$menarr[1][3]
$menarr[1][4]
etc

>  }// end while subs
>   }// end if main
>
>   $h++; // mainmenues plus one
> }// end while mainmenues



Here is my reorganized code:

$h = 0;
while ( $res = $UDV->getDbAns() ) {
if ( strlen($res[0]) <= 2 )
continue;// skip invalid results ('--' ?)

$menarr[$h]['menu'] = $res[0];// store menu name

$child_query = "SELECT chi FROM link WHERE pa='{$res[0]}' ";
$UDB->talk2DB($child_query);

$s = 0;
while ( $child = $UDB->getDbAns() ) {
if ( strlen($child[0]) <= 3 ) {
continue;

$subp = explode(" ", $child[0]);
foreach($subp as $key => $val)
$menarr[$h][$s][$key] = $val;

$s++;
}

$h++;
}

Hope this helps.

P.S.  ... it seems to me the query-in-query could be
replaced by a single sorted query; the result would
probably be a little faster, but (shrug) save that for later.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Leading zeros in array index

2002-04-19 Thread Kent Briggs


"Joshua B. Jore" wrote:
> 
> Oh it's probably because your numbers are being interpreted as octal.
> Either use the array as '00' .. '09' or just 0 .. 9. 00 .. 09 is valid for
> 00 to 07 but there is no such thing as 08 and 09 in octal.

Ok, thanks.

-- 
Kent Briggs, [EMAIL PROTECTED]
Briggs Softworks, http://www.briggsoft.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] multidimensional array

2002-04-19 Thread Miguel Cruz

On Fri, 19 Apr 2002, Rodrigo Peres wrote:
> In order to avoid many left joins I took an aproach that I didn't know
> if it's good, but I couldn't figure out another way. If my cliente has
> 10 phone numbers I buld an array, serialize it and store in database, so
> I didn't have to create another table.

What do you have against left joins?

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Empty $_SESSION and $_POST ??

2002-04-19 Thread Miguel Cruz

On Fri, 19 Apr 2002, Andre Dubuc wrote:
> Whenever I try:
> 
> print("$_SESSION['sfname']);  or  print("$_POST['scity']
> 
> I get a parse error "expecting 'T_STRING' . . ." -- obviously there's nothing 
> in the array or I haven't set it.

You just have a simple syntax error.

You can use any of the following:

   print $_SESSION['sfname'];
   print "{$_SESSION['sfname']}";
   print "${_SESSION['sfname']}";

But you can't put a bare array dereference inside a quoted string like you
tried above. You need to surround it with {curly braces} or take it 
outside the quoted string.

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Out of memory error message

2002-04-19 Thread Mullin, Reginald

Hi Guys,

Does anyone know what the following error message is and how I can go about
solving it?

***ERROR MSG***
Out of memory during "large" request for 2147487744 bytes, total sbrk() is
1459608 bytes.

This error message gets written to Apache's error logs every other time I
execute my MSSQL query.  The web browser then displays "The page cannot be
displayed" error (404).

***SAMPLE MSSQL QUERY***
if ($ViewItemNumber){
$ViewItemNumber = urldecode($ViewItemNumber);
$sql = "SELECT
Item.ItemNumber,Item.Description,Item.Type,Item.Comments,Inventory.Site,Inve
ntory.Location,Inventory.ItemNumber,Inventory.SerialNumber,Inventory.Lot,Inv
entory.OnHandQuantity FROM Item,Inventory WHERE
(Item.ItemNumber='$ViewItemNumber' AND
Item.ItemNumber=Inventory.ItemNumber)";
$query = mssql_query($sql) or die ("THE SECOND (2) TABLE SELECTION
FAILED.");
$results = mssql_fetch_array($query);
echo $results['ItemNumber'];
}


Note: I'm running LAMP locally (NY) and connecting remotely to a Windows
2000 box running MS SQL Server 2000 (UK) with the FreeTDS package. 


O  From Now 'Till Then,
\->Reginald Alex Mullin
/\  212-894-1690



**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the postmaster at [EMAIL PROTECTED]


www.sothebys.com
**


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] multidimensional array

2002-04-19 Thread Rodrigo Peres

Hi list,

In order to avoid many left joins I took an aproach that I didn't know
if it's good, but I couldn't figure out another way. If my cliente has
10 phone numbers I buld an array, serialize it and store in database, so
I didn't have to create another table. The problem is now I need to
migrate the data to this format, how can I select the multiple data and
put in multidimensional array at runtime to store again. for example I
need to put all fileds with graduation and all fields with discipline
with equal id in array named school serialize it and after insert in
another table.

Thank's

Rodrigo



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Empty $_SESSION and $_POST ??

2002-04-19 Thread Andre Dubuc

I've switched  "register_globals=off" and "register_argc_argv=off" in php.ini 
to use $_SESSION and/or $_POST. All my code had been written using $var

Unfortunately, I cannot seem to access the arrays in either $_SESSION and 
$_POST. I've set each page to start with  since I'm also processing the variables from an input html form. Below 
that, on my first page the " if  (!isset($_SESSION['count'] . . . "

Everything seems to work OK until I try to access, on my last page, 
'confirm-guest.php' which attempts to capture either the session variables or 
the posted variables from the previous two pages. 

Whenever I try:

print("$_SESSION['sfname']);  or  print("$_POST['scity']

I get a parse error "expecting 'T_STRING' . . ." -- obviously there's nothing 
in the array or I haven't set it. Problem is how do you set the "variables", 
as in $_POST['sfname'] -- I thought that it would pick them up automatically 
from the text input.

Btw, I retained these satements (which could be the problem):

$sfname = $_POST['sfname'];

Since when I tried to use $_POST['sfname'] in the scipt I got the same parse 
error as above.

I'm REALLY confused about the whole session thing -- I don't know where else 
to read up on it -- I've scoured PHP.net, Zend, PHPBuilder -- and I've 
followed what they said, but . . .

Can anyone enlighten me on what I'm doing wrong, or where my thinking is 
amiss? I'd greatly appreciate any help.

Tia,
Andre


-- 
Please pray the Holy Rosary to end the holocaust of abortion.
Remember in your prayers the Holy Souls in Purgatory.

May God bless you abundantly in His love!
For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] PHP @ 24-hour programming competition

2002-04-19 Thread Visontay Peter

Hi!

I have quite an unusual problem for you :) There will be a 24-hour
programming competition at our university, where teams of 3 have one
day to solve a complex problem (which will be revealed on the day
of the competition). Teams cannot get help from "outside", so no outward
network / phone communication is available, but you can use anything you
take there with you (any development tools, books, pre-written software
etc.)

The language in which you write the software is up to you, the most
popular choices being C++ and Java - but this year our team are going
to use PHP (and PHP-GTK).

The big question is: will PHP be enough for the whole project, or will
we need something else (like external C/Java modules)?
Last year the task was to write an artificially intelligent soccer game
based on a client-server architecture: there was a server acting like
some kind of game controller (referee) and 2D display screen, while
the automated clients (players) were playing individually according
to the game's rules and some simulated information on what they 'see'
at the time.

It's said that it will be something quite different this year -
but required knowledge includes:
algorithm theory, information and code theory, artificial intelligence,
queuing, databases, client-server architectures, computer networks,
control theory, 2D graphic programming and software ergonomy.
All this in 24 hours - nice, eh? :)

So the question again - are there any parts of all this where you think
PHP will not be enough? (Apart from the graphics, for which we'll use
PHP-GTK). If so, what kind of outside module integration do you
recommend for us?
Also, which PHP sites / resources / code libraries do you think we should
(recursively) download which might help us a lot? (Apart from php.net,
of course.)

We're really interested in your opinions - is this feasible or
are we just plain mad? :)

Thanks,
Peter Visontay
http://prodigycenter.com/cv/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Getting All Variables?

2002-04-19 Thread Devin Atencio


Is there an easy way in PHP to have it display to screen all the variables
that
it has in memory? So i can see what variables there is and what they are set
to?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] URL for "Powered by PHP" gif

2002-04-19 Thread Jason Wong

On Saturday 20 April 2002 06:46, Todd Cary wrote:
> Can someone provide me with the URL for a gif that I can place on my pages
> so that I can give credit to PHP (Apache would be nice too).

Presumably you've already looked on www.php.net?

You can get the PHP logo and a "Powered by Zend" logo using phpinfo().

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
"No, no, I don't mind being called the smartest man in the world.  I just 
wish 
 it wasn't this one."
-- Adrian Veidt/Ozymandias, WATCHMEN 
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] URL for "Powered by PHP" gif

2002-04-19 Thread Todd Cary

Can someone provide me with the URL for a gif that I can place on my pages so
that I can give credit to PHP (Apache would be nice too).

Many thanks..

Todd

--
Todd Cary
Ariste Software
2200 D Street Extension
Petaluma, CA 94952
707-773-4523
[EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] $HTTP_*_VARS ?

2002-04-19 Thread Tobias Lindqvist

Hi there.
Hoe come I cant use $HTTP_*_VARS in my script ? I have register_globals
on, track vars is also on and i have made the necessary changes in my
apache config ( the ALLOWOVERRIDE ALL ). My system is Win XP, Apache (
newest ) and newest PHP release.

Thanks.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Leading zeros in array index

2002-04-19 Thread Joshua b. Jore

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Oh it's probably because your numbers are being interpreted as octal.
Either use the array as '00' .. '09' or just 0 .. 9. 00 .. 09 is valid for
00 to 07 but there is no such thing as 08 and 09 in octal.

Joshua b. Jore
http://www.greentechnologist.org

On Fri, 19 Apr 2002, Kent Briggs wrote:

> My first post here, sorry if this has been covered before:
>
> Why does including a leading zero in an array index cause
> problems? For example, the output of this script:
>
> 
>
> $x = array("a","b","c","d","e","f","g","h","i","j");
>
> echo $x[0];
> echo $x[1];
> echo $x[2];
> echo $x[3];
> echo $x[4];
> echo $x[5];
> echo $x[6];
> echo $x[7];
> echo $x[8];
> echo $x[9];
>
> echo "";
>
> echo $x[00];
> echo $x[01];
> echo $x[02];
> echo $x[03];
> echo $x[04];
> echo $x[05];
> echo $x[06];
> echo $x[07];
> echo $x[08];
> echo $x[09];
>
> -
>
> returns this result:
>
> abcdefghij
> abcdefghaa
>
> The [08] and [09] values are messed up but [00] thru [07] are
> ok.
>
> --
> Kent Briggs, [EMAIL PROTECTED]
> Briggs Softworks, http://www.briggsoft.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (OpenBSD)
Comment: For info see http://www.gnupg.org

iD8DBQE8wJg3fexLsowstzcRAuB5AKDQHKjsW20dLYEGy1EtCjWVR33rAQCgzKvM
XrOBdgtSSpa0L23Y1jvCB40=
=RJw6
-END PGP SIGNATURE-


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Leading zeros in array index

2002-04-19 Thread Kent Briggs

My first post here, sorry if this has been covered before:

Why does including a leading zero in an array index cause
problems? For example, the output of this script:



$x = array("a","b","c","d","e","f","g","h","i","j");

echo $x[0];
echo $x[1];
echo $x[2];
echo $x[3];
echo $x[4];
echo $x[5];
echo $x[6];
echo $x[7];
echo $x[8];
echo $x[9];

echo "";

echo $x[00];
echo $x[01];
echo $x[02];
echo $x[03];
echo $x[04];
echo $x[05];
echo $x[06];
echo $x[07];
echo $x[08];
echo $x[09];

-

returns this result:

abcdefghij
abcdefghaa

The [08] and [09] values are messed up but [00] thru [07] are
ok.

-- 
Kent Briggs, [EMAIL PROTECTED]
Briggs Softworks, http://www.briggsoft.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] header redirection

2002-04-19 Thread Kevin Stone

Headers will be created whenever information is outuputted to the browser.
In this case when you include the .html file into your php script the
browser is going to create all the headers it will ever know for that page.
Obviously this does you no good if you want to add headers later.

Ways around this.  You can use output buffering to set headers in non-linear
format.  You could use a Javascript to refresh the page after it loads.  Or
the way I prefer to do it.. just echo a meta refresh tag between the 
tags of your html page.  This works with the vast majority of browsers and
you can control the number of seconds before the page redirects.

echo '';
echo 'http://www.yourdomain.com";>';
echo '';

Hope this helps,
Kevin

- Original Message -
From: "Norman Zhang" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 19, 2002 3:07 PM
Subject: [PHP] header redirection


> Hi,
>
> I use header(location: ...) for redirection to another page. But I also
want
> to include ,  and  tags in the other page. Is there a
way
> to this? Because php complains that the header already been sent.
>
> Regards,
> Norman
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] header redirection

2002-04-19 Thread Norman Zhang

Hi,

I use header(location: ...) for redirection to another page. But I also want
to include ,  and  tags in the other page. Is there a way
to this? Because php complains that the header already been sent.

Regards,
Norman



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Image functions

2002-04-19 Thread Matthew Gray

You won't get very far if you aren't outputting an image to the browser
using ImageJpeg(), etc.

Matt

Matthew J Gray
UWRF - Information Technology Services
[EMAIL PROTECTED]

Gerard Samuel wrote:

> Im trying to modify a poll script to not use the hard coded image files
> and use php's image functions.
> On the file that will be outputing the poll graphics, I tried at the top
> of the page ->
> header("Content-type: image/png");
> and
> header("Content-type: image/jpeg");
>
> For some reason, when the page is viewed, the only thing that gets
> output to the browser is the url of the page
>
> I tried using one of the examples on php.net image create routines and
> its still doing the same thing..
>
> Here is a snip
>
> 
> /*
>  *  THIS HAS TO GO HERE FOR THE IMAGE BARS
>  */
> header("Content-type: image/jpeg");
>
> $pollID = $HTTP_POST_VARS['pollID'];
> $voteID = $HTTP_POST_VARS['voteID'];
>
> <--snip->
>
> If I comment out the header call, Im back to normal...
> Im running PHP 4.1.2 with GD support
> Any thoughts
> Thanks


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] srand, array_rand

2002-04-19 Thread Miguel Cruz

On Fri, 19 Apr 2002, Gerard Samuel wrote:
> Im trying to get a random value to select a random row out of *a* 
> database.  Not just mysql.
> array_rand would do me just fine, but Im reading in the manual ->
> 
> "Don't forget to call *srand()* 
>  to seed the random 
> number generator. "
> 
> Im not too certain what it means to seed the generator, but is it 
> absolutely neccessary??
> The results Im looking for, doesn't have to be of any high precision.

Well, if you don't do it, you might get the same results each time. It's 
not very painful, so you might as well.

It's difficult for a computer to generate a number that's actually random,
because everything in the computer follows a deterministic process (how
would you write a program to pick a random number?). So there are
algorithms that will provide numbers in a non-repeating sequence (such as
the digits of pi) and these are branded as random number generators.
"Seeding" them basically means picking an arbitrary starting point in the
sequence. The typical way to do this is with the current time, since
that's at least not entirely predictable.

Some operating systems grab other bits of randomish data when they can and
use that to spice up the randomness of "random" numbers - they may take
the time interval between received network data or keyboard events or what
have you. Fancy setups used for cryptography (where randomness is very
important) even have physical devices attached that generate truly random
numbers (random based on our current understanding of physics) derived
from the observed decay of radioactive substances.

> Also I read on the srand man page that srand should only be called once.
> Does that mean one per page load or once every so often??

Once per page load is a good plan.

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] srand, array_rand

2002-04-19 Thread Gerard Samuel

Im trying to get a random value to select a random row out of *a* 
database.  Not just mysql.
array_rand would do me just fine, but Im reading in the manual ->

"Don't forget to call *srand()* 
 to seed the random 
number generator. "

Im not too certain what it means to seed the generator, but is it 
absolutely neccessary??
The results Im looking for, doesn't have to be of any high precision.

Also I read on the srand man page that srand should only be called once.
Does that mean one per page load or once every so often??

Thanks for any insight you provide.
Gerard



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: include() and require() problem

2002-04-19 Thread Vins

I'm also having a problem with including file into and include file.
my script reads.

( (strpos($PHP_SELF,"admin/")) ? include('../includes/mysql.inc.php') :
include('includes/mysql.inc.php') );
@mysql_pconnect($mysqlDBhost,$mysqlDBuser,$mysqlDBpass)
 or die ("Database access error. Please contact the site webmaster at
$webmasterEmail.");
@mysql_select_db($mysqlDBdatabase)
 or die ("Couldn't Select Database. Please contact the site webmaster at
$webmasterEmail.");

my server is running php4.1.2 and there is not problem
i am also running php4.1.2 but reads back a problem.
this one

Warning: Failed opening 'includes/mysql.inc.php' for inclusion
(include_path='c:\php4\pear') in
D:\Apache\htdocs\auction4sale\includes\config.inc.php on line 47
Database access error. Please contact the site webmaster at .

any suggestions ?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] GMT Time

2002-04-19 Thread Erik Price


On Friday, April 19, 2002, at 01:23  PM, Richard Fox wrote:

> I want to compare a timestamp(14) field in a MySQL table with the 
> current
> time. Currently I use the following pseudo-sql:
>
> select field from table where table.time <  date("YmdHis", time())
>
> only, the table timestamp is GMT time and the time function is returning
> local time. How do I convert time() to GMT time?

Okay, I have to leave work soon so I dug up the original post.  Sorry if 
I made you repost your code for nothing.

You have a timestamp(14) MySQL column:  MMDDhhmmss
You want to compare a value in this column with the current time.

$sql = "SELECT table.field
 FROM   table
 WHERE  table.time < NOW()";
$result = mysql_query($sql, $db);

You don't want to use PHP to do the comparison, it's much faster to let 
the database itself do the comparison.  This saves going back and forth 
between PHP and MySQL.

HOWEVER ... you've thrown a variable into the mix -- the MySQL TIMESTAMP 
column is in GMT.  If MySQL's internal time zone is GMT, then it's no 
problem.  But I have a feeling this isn't the case, since you said that 
PHP is returning local time.  So you can't do it the way I did it above, 
you've got to compensate for the GMT.

I don't know where you live, so it's your responsibility to find out the 
number hours difference between your time zone and GMT.  Let's say it's 
3 hours less than GMT (which I think would mean you live in the Atlantic 
ocean, but it's just an example).

3 hours X 60 mins X 60 seconds = 10800 seconds

Now, simply convert the table.time value to a Unix-style timestamp, 
which is an integer representing the number of seconds since 1970 (I 
think).  Then, add 10800 to this number, so that the server time zone 
and the TIMESTAMP column are equivalent.  Now perform the comparison.

$sql = "SELECT table.field
 FROM   table
 WHERE  UNIX_TIMESTAMP(table.time) + 10800 < NOW()";
$result = mysql_query($sql, $db);
echo "\n";
while ($row = mysql_fetch_assoc($result)) {
   echo "" . $row['field'] . "\n";
}
echo "\n";


HTH, I'm gone for the weekend.


Erik

PS: if my math was wrong or I went in the wrong direction, sorry, but do 
some playing around with what I've showed you and you should be able to 
figure it out.






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] R: file_get_contents source??

2002-04-19 Thread Giovanni Lenzi

ok thanks,
i solved my problem.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] php permissions

2002-04-19 Thread Erik Price


On Friday, April 19, 2002, at 02:44  PM, ROBERT MCPEAK wrote:

> Isn't it quite common to have php creating/editing/deleting files on
> the server?  How is this done in a secure manner?

Running Apache/PHP as 'nobody' isn't really that secure, since there may 
be other services running on the system that run as 'nobody'.  The more 
services that are run under an account, the more open to an attack and 
therefore compromise that account becomes.

Tell your sysadmin that they should create a user called "www" or 
"Apache" or something as a dedicated web server user.  Then, you can 
make this user a member of group "phpusers" or something like that.  
Each trusted user on the system can also be made a member of group 
"phpusers", so that they can make files accessible to the "www" or 
"apache" user without having access to files owned by "www" or "apache".

There's a lot to it -- did you read through that FAQ I sent you?  It's 
not as simple as posting a question to a mailing list -- there are books 
devoted to this very topic.  (Don't feel bad, I asked the same thing 
once on another mailing list, and I'm still learning about the many ways 
a system needs to be secured.)

It's like the Force -- if you try to take the easy route, the Dark side, 
sure, you can get your files on the web quickly and easily.  You can DO 
just about anything.  But you leave yourself open to exploitation by 
other users of the Dark side.

However, if you invest a lot of time and effort (A LOT) into your Jedi 
training, you can continually learn how to secure your system or write 
clean code or normalize your database tables until 900 years old you 
reach.



Erik
(another Jedi student)






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] php permissions

2002-04-19 Thread ROBERT MCPEAK

Craig, you seem very knowledgable and I appreciate your help.  I
confused matters by mentioning the word "upload."  I'm actually not
using php to upload the files.  The user ftps the files to the server,
and the ownership permissions prevent php from manipulating the files.

I'm looking for a clear answer on whether giving php permission, or
setting the directory to nobody:nogroup, or whatever, poses a security
threat.

How can php be used to edit/delete files without opening a security
hole?

Bear with me, I think I"m getting clearer.

>>> "Craig Vincent" <[EMAIL PROTECTED]> 04/19/02 03:07PM >>>
> How?  Manually each time a file is uploaded?  Or with PHP somehow?
>
> I appreciate your response, but perhaps I'm not clear enough.
>
> Isn't it quite common to have php creating/editing/deleting files on
> the server?  How is this done in a secure manner?
>
> Could you explain further?

Well technically unless your admin is using the latest PHP updates,
the
server is already open to known exploits (albeit most are pretty
difficult
to recreate).  Your admin is probably panicing as many others did when
the
exploits were announced they were mentioned as problems in the file
upload
routineshowever most people don't realize that these exploits were
usable whether file uploading was used or not.

In answer to your question the file upload system is fairly secure but
you
should never rely on it alone.  When it initially uploads the file, the
file
is stored as a temporary name (so there's no way to execute code with
a
screwy filename).  And although it shouldn't be an issue regardless, as
long
as you remove any fancy characters from the true filename before you
store
it in another area (anything not alphanumeric or a .) you should have
no
problems whatsoever.

However as was mentioned before, assuming someone did manage to use the
file
upload system ...the worst damage one could do to a system would be to
erase/modify files associated with the webserver username (or files
with
open permissions)...so really worse case scenario if your admin has
done his
job properly is one could manage to erase all the other php uploaded
files
if they found an exploit.

Sincerely,

Craig Vincent



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] php permissions

2002-04-19 Thread Craig Vincent

> How?  Manually each time a file is uploaded?  Or with PHP somehow?
>
> I appreciate your response, but perhaps I'm not clear enough.
>
> Isn't it quite common to have php creating/editing/deleting files on
> the server?  How is this done in a secure manner?
>
> Could you explain further?

Well technically unless your admin is using the latest PHP updates, the
server is already open to known exploits (albeit most are pretty difficult
to recreate).  Your admin is probably panicing as many others did when the
exploits were announced they were mentioned as problems in the file upload
routineshowever most people don't realize that these exploits were
usable whether file uploading was used or not.

In answer to your question the file upload system is fairly secure but you
should never rely on it alone.  When it initially uploads the file, the file
is stored as a temporary name (so there's no way to execute code with a
screwy filename).  And although it shouldn't be an issue regardless, as long
as you remove any fancy characters from the true filename before you store
it in another area (anything not alphanumeric or a .) you should have no
problems whatsoever.

However as was mentioned before, assuming someone did manage to use the file
upload system ...the worst damage one could do to a system would be to
erase/modify files associated with the webserver username (or files with
open permissions)...so really worse case scenario if your admin has done his
job properly is one could manage to erase all the other php uploaded files
if they found an exploit.

Sincerely,

Craig Vincent



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] creating table help

2002-04-19 Thread Craig Vincent

> Warning: Wrong parameter count for pg_exec() in
> /var/www/html/elkan/createtable.php on line 23
> The table, ghdsl could not be created

>  if (pg_exec($dbname, $query, $connect))

I assume pg_exec is a synonym for pg_query (the pg_exec command does exist
in the PHP docs).

According to the function docs
http://www.php.net/manual/en/function.pg-query.php
resource pg_query ( resource connection, string query)

It only requires two parametersyour $dbname parameter is not acceptable.
Since however you specified $dbname in the connect line you shouldn't need
to specify the dbname again.

So in theory

if (pg_exec($query, $connect))
should do what you want, although you should change pg_exec to pg_query to
keep in tune with the accepted functions.

Also in the future...please ensure you mention what version of PHP you're
using.  It can help a great deal in helping to resolve your issues.

Sincerely,

Craig Vincent



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] creating table help

2002-04-19 Thread Tyler Longren

I checked the php manual, and there doesn't seem to be a pg_exec function.
You'll probably be able to use pg_query instead.  But that error makes it
sound like pg_exec is a valid function for your version of PHP, maybe it's
not in newer versions.

http://www.php.net/manual/en/function.pg-query.php

Anyway, you get that error because you have too many (or too few) parameters
in your pg_exec() function.
- Original Message -
From: "webmaster" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 19, 2002 5:40 AM
Subject: [PHP] creating table help


> I'm very new to php and PostgreSQL.  I keep getting the following error
> when I try to create a table:
>
> Warning: Wrong parameter count for pg_exec() in
> /var/www/html/elkan/createtable.php on line 23
> The table, ghdsl could not be created
>
> Here is the code I'm using:
>
> 
> // set variables
> $tablename = "ghdsl";
> $dbname = "testingdb";
> $user = "testinguser";
> $password = "xx";
>
> $connect = "pg_connect($dbname, $user, $password)";
>
> $query = "CREATE table $tablename (id INT UNSIGNED NOT NULL
> AUTO_INCREMENT PRIMARY KEY, ip TEXT, customer TEXT, dslphone TEXT, date
> TEXT, vpivci TEXT)";
>
>  if (pg_exec($dbname, $query, $connect))
>   {
>   print ("The table, $tablename was successfully created");
>   } else {
>   print ("The table, $tablename could not be created");
>   }
>
> ?>
>
> thanks for any help.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] php permissions

2002-04-19 Thread ROBERT MCPEAK

How?  Manually each time a file is uploaded?  Or with PHP somehow?

I appreciate your response, but perhaps I'm not clear enough.

Isn't it quite common to have php creating/editing/deleting files on
the server?  How is this done in a secure manner?

Could you explain further?

Thanks.

>>> "Dave Raven" <[EMAIL PROTECTED]> 04/19/02 01:55PM >>>
chown them to nobody.


- Original Message - 
From: "ROBERT MCPEAK" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 19, 2002 7:53 PM
Subject: [PHP] php permissions


> php is running on our box  as nobody:nogroup.  I'm trying to write
php
> code that will edit/delete files uploaded to the server by other
users,
> and, obviously, I get a permissions error.
> 
> My sysadmin is hesitant to give php more access until I do some
> research about the security issues involved, and I am a relative
newbie
> and I'm not sure what the issues are or how to find out more about
> them.
> 
> How do I give php permissions to delete files etc., without opening
up
> an security hole?  Is this an issue at all?
> 
> Help!
> 
> Thanks!
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php 
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] creating table help

2002-04-19 Thread webmaster

I'm very new to php and PostgreSQL.  I keep getting the following error
when I try to create a table:

Warning: Wrong parameter count for pg_exec() in
/var/www/html/elkan/createtable.php on line 23
The table, ghdsl could not be created

Here is the code I'm using:



thanks for any help.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] php permissions

2002-04-19 Thread Erik Price


On Friday, April 19, 2002, at 01:53  PM, ROBERT MCPEAK wrote:

> My sysadmin is hesitant to give php more access until I do some
> research about the security issues involved, and I am a relative newbie
> and I'm not sure what the issues are or how to find out more about
> them.
>
> How do I give php permissions to delete files etc., without opening up
> an security hole?  Is this an issue at all?

First hit at Google:

http://www.w3.org/Security/Faq/







Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] R: file_get_contents source??

2002-04-19 Thread Giovanni Lenzi

thanks very much.
now i'll read the entire article.
However my problem is that i want to transmit characters like :
£ $ % & ^ § so file and readfile function don't work correctly.

Can you say me something more??



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: file_get_contents source??

2002-04-19 Thread CC Zona

In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Giovanni Lenzi) wrote:

> file_get_contents function is supposed to return the contents of a file in a
> binary safe manner. I tried it on two different servers which has different
> versions of APACHE+PHP but it still not works.
> The server give me this response:
> 
> Fatal error: Call to undefined function: file_get_contents() in
> /usr/home/s/a/sauzer/public_html/sfidario/readstreams/1.0/warsupcoming.php
> on line 17

>From : "file_get_contents (PHP 4 CVS 
only)".  That's why it's not in your version.  Reading further, it says 
"Identical to readfile(), except that file_get_contents() returns the file 
in a string."  So if don't need to do additional manipulation of the 
contents, there is one viable alternative.  The user annotations suggest 
two additional alternatives.

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] php permissions

2002-04-19 Thread Dave Raven

chown them to nobody.


- Original Message - 
From: "ROBERT MCPEAK" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 19, 2002 7:53 PM
Subject: [PHP] php permissions


> php is running on our box  as nobody:nogroup.  I'm trying to write php
> code that will edit/delete files uploaded to the server by other users,
> and, obviously, I get a permissions error.
> 
> My sysadmin is hesitant to give php more access until I do some
> research about the security issues involved, and I am a relative newbie
> and I'm not sure what the issues are or how to find out more about
> them.
> 
> How do I give php permissions to delete files etc., without opening up
> an security hole?  Is this an issue at all?
> 
> Help!
> 
> Thanks!
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] php permissions

2002-04-19 Thread ROBERT MCPEAK

php is running on our box  as nobody:nogroup.  I'm trying to write php
code that will edit/delete files uploaded to the server by other users,
and, obviously, I get a permissions error.

My sysadmin is hesitant to give php more access until I do some
research about the security issues involved, and I am a relative newbie
and I'm not sure what the issues are or how to find out more about
them.

How do I give php permissions to delete files etc., without opening up
an security hole?  Is this an issue at all?

Help!

Thanks!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] file_get_contents source??

2002-04-19 Thread Giovanni Lenzi

file_get_contents function is supposed to return the contents of a file in a
binary safe manner. I tried it on two different servers which has different
versions of APACHE+PHP but it still not works.
The server give me this response:

Fatal error: Call to undefined function: file_get_contents() in
/usr/home/s/a/sauzer/public_html/sfidario/readstreams/1.0/warsupcoming.php
on line 17

Surely i have to update PHP version but i can't do it onto the remote
server.
So i have to create myself this function.

Can anyone help me please??
Does anyone have the full source code of this function??



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] GMT Time

2002-04-19 Thread Erik Price


On Friday, April 19, 2002, at 01:23  PM, Richard Fox wrote:

> I want to compare a timestamp(14) field in a MySQL table with the 
> current
> time. Currently I use the following pseudo-sql:
>
> select field from table where table.time <  date("YmdHis", time())
>
> only, the table timestamp is GMT time and the time function is returning
> local time. How do I convert time() to GMT time?

MySQL has a function called NOW() which returns the current time.  Use 
it:

SELECT field
FROM table
WHERE table.time < NOW()






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] GMT Time

2002-04-19 Thread Richard Fox

Ok, I give up.

I want to compare a timestamp(14) field in a MySQL table with the current
time. Currently I use the following pseudo-sql:

select field from table where table.time <  date("YmdHis", time())

only, the table timestamp is GMT time and the time function is returning
local time. How do I convert time() to GMT time?

Thanks!



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Image functions

2002-04-19 Thread Gerard Samuel

Im trying to modify a poll script to not use the hard coded image files 
and use php's image functions.
On the file that will be outputing the poll graphics, I tried at the top 
of the page ->
header("Content-type: image/png");
and
header("Content-type: image/jpeg");

For some reason, when the page is viewed, the only thing that gets 
output to the browser is the url of the page

I tried using one of the examples on php.net image create routines and 
its still doing the same thing..

Here is a snip



If I comment out the header call, Im back to normal...
Im running PHP 4.1.2 with GD support
Any thoughts
Thanks


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Querying Oracle from PHP

2002-04-19 Thread Michael Kimsal

Jon wrote:
> Hi,
> 
> I am evaluating if it is posible to connect Oracle 8i from PHP, running a
> 
> PL/SQL procedure and returning the results, avaible in a temp table, to
> 
> HTML. Besides, I need to format the results of the query in PDF document and
> 
> make a pie chart based on he results of the contents of the table I
> 
> mentioned before. I looking for some adds-on to PHP that makes it posible to
> 
> do this all..
> 
> Any suggestions would be appreciated. Thanks in advanced
> 
> 
> 


Someone else suggested using http://www.aditus.nu/jpgraph/
which I'd aso highly recommend.  This will do some
pretty sophisticated charting/graphing.

Also, instead of PDFLib, you may want to investigate
htmldoc from easysw.com first.  You don't get as much
fine-grained detail control, but it's much easier to
work with for pdf stuff you need to crank out quickly.


Michael Kimsal
http://www.phphelpdesk.com
734-480-9961
Guaranteed PHP support when you need it.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] how to popup a new browser window from php

2002-04-19 Thread Erik Price


On Friday, April 19, 2002, at 12:42  PM, Justin French wrote:

> Sure, it opens another window, but it doesn't achieve the same affect 
> as a
> javascript alert (ok|cancel for starters), nor does it provide any 
> control
> over the size/specs of the resultant window.

Yeah, but nobody said anything about JavaScript "alert" or controlling 
the size/specs -- I was responding to the first email that Wo Chang 
sent, where Wo asked about a new browser (which I assumed meant "new 
browser window", not "javascript alert box").

Erik


> on 19/04/02 10:39 PM, Erik Price ([EMAIL PROTECTED]) wrote:
>
>>
>> On Friday, April 19, 2002, at 12:48  AM, Jason Wong wrote:
>>
>>> On Friday 19 April 2002 07:14, Wo Chang wrote:
 Dear All,

 One simple question:

 Is there any easy way to popup a new browser from PHP
 without using any Javascript?
>>>
>>> No.
>>
>> What about target="_blank" ?  I didn't think this was JavaScript, but
>> achieves the same effect.  Or is it JavaScript?
>>
>>
>> Erik
>>







Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] how to popup a new browser window from php

2002-04-19 Thread Justin French

Sure, it opens another window, but it doesn't achieve the same affect as a
javascript alert (ok|cancel for starters), nor does it provide any control
over the size/specs of the resultant window.

Justin French


Creative Director
http://Indent.com.au




on 19/04/02 10:39 PM, Erik Price ([EMAIL PROTECTED]) wrote:

> 
> On Friday, April 19, 2002, at 12:48  AM, Jason Wong wrote:
> 
>> On Friday 19 April 2002 07:14, Wo Chang wrote:
>>> Dear All,
>>> 
>>> One simple question:
>>> 
>>> Is there any easy way to popup a new browser from PHP
>>> without using any Javascript?
>> 
>> No.
> 
> What about target="_blank" ?  I didn't think this was JavaScript, but
> achieves the same effect.  Or is it JavaScript?
> 
> 
> Erik
> 
> 
> 
> 
> 
> 
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [EMAIL PROTECTED]
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Within the date format

2002-04-19 Thread Miguel Cruz

On Fri, 19 Apr 2002, Demitrious S. Kelly wrote:
> Whatever works
> 
> And the function works fine for any year after 2000

Not for 2100.

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Truncated files

2002-04-19 Thread Jason Soza

I don't have the code I used right in front of me, so I'm sorry that I 
can't give specifics, but maybe someone may have an idea about this off 
the top of their head.

I have a script that processes a form on my site where people can 
submit information and upload files. The files don't upload to a 
directory; they're attached to an e-mail and sent along with whatever 
information they give.

However, when the e-mail reaches me and I look, the file size is down 
to 646 bytes or so (from a 300kb file) and the file is unreadable. Any 
ideas?

Thanks,
Jason


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Within the date format

2002-04-19 Thread Demitrious S. Kelly

Whatever works

And the function works fine for any year after 2000

Besides... it was just a quick and dirty example

-Original Message-
From: Miguel Cruz [mailto:[EMAIL PROTECTED]] 
Sent: Friday, April 19, 2002 9:14 AM
To: Demitrious S. Kelly
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] Within the date format

1) That function isn't correct.

2) It's slow.

3) You still would have to call it once for each year in the range in 
order to figure out how many intervening leap years there are, and you'd

have to check whether the dates in question fell before or after Feb 29.

Much easier to just calculate the difference of days, months, and years.

BTW, off the top of my head (untested), here's a more accurate (and a
million times faster) way to check for a leap year:

  function is_leap ($year)
  {
return (!($year % 4) && (($year % 100) || !($year % 400)));
  }

miguel

On Fri, 19 Apr 2002, Demitrious S. Kelly wrote:
> function is_leap($) {
> $leap=0;
> $refy=2000;
> while ( $ >= $refy ) {
> if ( $refy == $ ) {
> $leap=1;
> } else if ( $refy > $ ) {
> break;
> }
> $refy++;
> $refy++;
> $refy++;
> $refy++;
> }
> return($leap);
> }
> 
> -Original Message-
> From: Miguel Cruz [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, April 19, 2002 8:52 AM
> To: Demitrious S. Kelly
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP] Within the date format
> 
> Like I said, if it crosses through a leap year, your calculation may
be 
> off. How many days are there in February when you don't know what year
> it 
> is?
> 
> miguel
> 
> On Fri, 19 Apr 2002, Demitrious S. Kelly wrote:
> > Wouldn't it be easier to convert each date into a unix timestamp,
then
> > subtract... the resulting number is the difference in seconds.  Then
> > devide by 60 for minutes, again for hours 24 for days, etc, etc
> > 
> > 
> > -Original Message-
> > From: Miguel Cruz [mailto:[EMAIL PROTECTED]] 
> > Sent: Friday, April 19, 2002 8:44 AM
> > To: Ron Allen
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP] Within the date format
> > 
> > On Fri, 19 Apr 2002, Ron Allen wrote:
> > > This is what I have right now
> > > 
> > > $totaltime= date(":H:i:s", mktime(0,0,$totaltime));
> > > 
> > > This is the result
> > > 
> > > 04:20:46
> > > 
> > > from the following dates
> > > 2002-04-25 16:30:16
> > > 2002-04-19 12:09:30
> > > 534046 seconds
> > > 
> > > I would like to be able to get the days and, if needed, the number
> of
> > months
> > > and years
> > 
> > Well, I think the easiest way is going to be to split your date
apart
> > into 
> > $day, $month, $year and then subtract.
> > 
> > You can't just do a cascading modulus calculation on the delta
between
> > the
> > timestamps, because that won't take leap years into account.
> > 
> > miguel
> > 
> > 
> > 
> 
> 
> 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Within the date format

2002-04-19 Thread Miguel Cruz

1) That function isn't correct.

2) It's slow.

3) You still would have to call it once for each year in the range in 
order to figure out how many intervening leap years there are, and you'd 
have to check whether the dates in question fell before or after Feb 29.

Much easier to just calculate the difference of days, months, and years.

BTW, off the top of my head (untested), here's a more accurate (and a
million times faster) way to check for a leap year:

  function is_leap ($year)
  {
return (!($year % 4) && (($year % 100) || !($year % 400)));
  }

miguel

On Fri, 19 Apr 2002, Demitrious S. Kelly wrote:
> function is_leap($) {
> $leap=0;
> $refy=2000;
> while ( $ >= $refy ) {
> if ( $refy == $ ) {
> $leap=1;
> } else if ( $refy > $ ) {
> break;
> }
> $refy++;
> $refy++;
> $refy++;
> $refy++;
> }
> return($leap);
> }
> 
> -Original Message-
> From: Miguel Cruz [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, April 19, 2002 8:52 AM
> To: Demitrious S. Kelly
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP] Within the date format
> 
> Like I said, if it crosses through a leap year, your calculation may be 
> off. How many days are there in February when you don't know what year
> it 
> is?
> 
> miguel
> 
> On Fri, 19 Apr 2002, Demitrious S. Kelly wrote:
> > Wouldn't it be easier to convert each date into a unix timestamp, then
> > subtract... the resulting number is the difference in seconds.  Then
> > devide by 60 for minutes, again for hours 24 for days, etc, etc
> > 
> > 
> > -Original Message-
> > From: Miguel Cruz [mailto:[EMAIL PROTECTED]] 
> > Sent: Friday, April 19, 2002 8:44 AM
> > To: Ron Allen
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP] Within the date format
> > 
> > On Fri, 19 Apr 2002, Ron Allen wrote:
> > > This is what I have right now
> > > 
> > > $totaltime= date(":H:i:s", mktime(0,0,$totaltime));
> > > 
> > > This is the result
> > > 
> > > 04:20:46
> > > 
> > > from the following dates
> > > 2002-04-25 16:30:16
> > > 2002-04-19 12:09:30
> > > 534046 seconds
> > > 
> > > I would like to be able to get the days and, if needed, the number
> of
> > months
> > > and years
> > 
> > Well, I think the easiest way is going to be to split your date apart
> > into 
> > $day, $month, $year and then subtract.
> > 
> > You can't just do a cascading modulus calculation on the delta between
> > the
> > timestamps, because that won't take leap years into account.
> > 
> > miguel
> > 
> > 
> > 
> 
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Variable name assembly

2002-04-19 Thread Jason Wong

On Friday 19 April 2002 23:52, Jason Lam wrote:
> How do I assemble strings to become a variable?
>
> These code do not work...
> $abc = 10;
> echo $('ab'.'c');

echo ${'ab'.'c'};

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
On a clear disk you can seek forever.
-- P. Denning
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] file extension validation

2002-04-19 Thread jas

Here is what I have currently to validate the file type on upload to a
server:

Right now it just checkes the file extension, I would like to know how I can
use this piece of code and add the functionality of actually checking the
file first.  If anyone can point me in the right direction that would be
great.
Thanks in advance,
Jas



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] .inc over .php

2002-04-19 Thread J Smith


3) Block downloads on .inc files, like using a  directive in 
httpd.conf or a .htaccess file in apache. (Or whatever on another web 
server.) Now, even if a user tries to view that file, it won't execute at 
all, thus perhaps saving you some memory and clock cycles. (And it's 
generally more secure than treating them as php files since the includes 
might do something to, say, a database that you don't want them to do 
unless they're included into a valid php file request.)

J


Jason Wong wrote:

> 
> There are two ways to counter this:
> 
> 1) have the .inc files in a directory outside the scope of the webserver
> directory.
> 
> 2) set the webserver to treat .inc files as php files.
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Within the date format

2002-04-19 Thread Demitrious S. Kelly

function is_leap($) {
$leap=0;
$refy=2000;
while ( $ >= $refy ) {
if ( $refy == $ ) {
$leap=1;
} else if ( $refy > $ ) {
break;
}
$refy++;
$refy++;
$refy++;
$refy++;
}
return($leap);
}

-Original Message-
From: Miguel Cruz [mailto:[EMAIL PROTECTED]] 
Sent: Friday, April 19, 2002 8:52 AM
To: Demitrious S. Kelly
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] Within the date format

Like I said, if it crosses through a leap year, your calculation may be 
off. How many days are there in February when you don't know what year
it 
is?

miguel

On Fri, 19 Apr 2002, Demitrious S. Kelly wrote:
> Wouldn't it be easier to convert each date into a unix timestamp, then
> subtract... the resulting number is the difference in seconds.  Then
> devide by 60 for minutes, again for hours 24 for days, etc, etc
> 
> 
> -Original Message-
> From: Miguel Cruz [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, April 19, 2002 8:44 AM
> To: Ron Allen
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Within the date format
> 
> On Fri, 19 Apr 2002, Ron Allen wrote:
> > This is what I have right now
> > 
> > $totaltime= date(":H:i:s", mktime(0,0,$totaltime));
> > 
> > This is the result
> > 
> > 04:20:46
> > 
> > from the following dates
> > 2002-04-25 16:30:16
> > 2002-04-19 12:09:30
> > 534046 seconds
> > 
> > I would like to be able to get the days and, if needed, the number
of
> months
> > and years
> 
> Well, I think the easiest way is going to be to split your date apart
> into 
> $day, $month, $year and then subtract.
> 
> You can't just do a cascading modulus calculation on the delta between
> the
> timestamps, because that won't take leap years into account.
> 
> miguel
> 
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Variable name assembly

2002-04-19 Thread Jason Lam

How do I assemble strings to become a variable?

These code do not work...
$abc = 10;
echo $('ab'.'c');





RE: [PHP] Within the date format

2002-04-19 Thread Miguel Cruz

Like I said, if it crosses through a leap year, your calculation may be 
off. How many days are there in February when you don't know what year it 
is?

miguel

On Fri, 19 Apr 2002, Demitrious S. Kelly wrote:
> Wouldn't it be easier to convert each date into a unix timestamp, then
> subtract... the resulting number is the difference in seconds.  Then
> devide by 60 for minutes, again for hours 24 for days, etc, etc
> 
> 
> -Original Message-
> From: Miguel Cruz [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, April 19, 2002 8:44 AM
> To: Ron Allen
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Within the date format
> 
> On Fri, 19 Apr 2002, Ron Allen wrote:
> > This is what I have right now
> > 
> > $totaltime= date(":H:i:s", mktime(0,0,$totaltime));
> > 
> > This is the result
> > 
> > 04:20:46
> > 
> > from the following dates
> > 2002-04-25 16:30:16
> > 2002-04-19 12:09:30
> > 534046 seconds
> > 
> > I would like to be able to get the days and, if needed, the number of
> months
> > and years
> 
> Well, I think the easiest way is going to be to split your date apart
> into 
> $day, $month, $year and then subtract.
> 
> You can't just do a cascading modulus calculation on the delta between
> the
> timestamps, because that won't take leap years into account.
> 
> miguel
> 
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Within the date format

2002-04-19 Thread Demitrious S. Kelly

Wouldn't it be easier to convert each date into a unix timestamp, then
subtract... the resulting number is the difference in seconds.  Then
devide by 60 for minutes, again for hours 24 for days, etc, etc


-Original Message-
From: Miguel Cruz [mailto:[EMAIL PROTECTED]] 
Sent: Friday, April 19, 2002 8:44 AM
To: Ron Allen
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Within the date format

On Fri, 19 Apr 2002, Ron Allen wrote:
> This is what I have right now
> 
> $totaltime= date(":H:i:s", mktime(0,0,$totaltime));
> 
> This is the result
> 
> 04:20:46
> 
> from the following dates
> 2002-04-25 16:30:16
> 2002-04-19 12:09:30
> 534046 seconds
> 
> I would like to be able to get the days and, if needed, the number of
months
> and years

Well, I think the easiest way is going to be to split your date apart
into 
$day, $month, $year and then subtract.

You can't just do a cascading modulus calculation on the delta between
the
timestamps, because that won't take leap years into account.

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Within the date format

2002-04-19 Thread Miguel Cruz

On Fri, 19 Apr 2002, Ron Allen wrote:
> This is what I have right now
> 
> $totaltime= date(":H:i:s", mktime(0,0,$totaltime));
> 
> This is the result
> 
> 04:20:46
> 
> from the following dates
> 2002-04-25 16:30:16
> 2002-04-19 12:09:30
> 534046 seconds
> 
> I would like to be able to get the days and, if needed, the number of months
> and years

Well, I think the easiest way is going to be to split your date apart into 
$day, $month, $year and then subtract.

You can't just do a cascading modulus calculation on the delta between the
timestamps, because that won't take leap years into account.

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Validating User Input

2002-04-19 Thread Miguel Cruz

On Fri, 19 Apr 2002, SP wrote:
> Now should I include all those special characters?  I want it to be hack
> proof so I don't want to add the user input into my database and have
> something bad happen.
> 
> Which ones are safe?
> ~ ` ! @ # $ % ^ & * ( ) _ + - = [ ] \ { } | : " ; ' < > ? , . /

All characters are safe for database use as long as they're handled
properly.

Basically that means escaping ' " and \ which should be taken care of
automatically by addslashes (or by the abominable magic_quotes_gpc if you
happen to have it on).

Now, when you're dealing with path/file names and arguments to external 
programs, you need to be more careful...

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Within the date format

2002-04-19 Thread Ron Allen

This is what I have right now

$totaltime= date(":H:i:s", mktime(0,0,$totaltime));

This is the result

04:20:46

from the following dates
2002-04-25 16:30:16
2002-04-19 12:09:30
534046 seconds

I would like to be able to get the days and, if needed, the number of months
and years




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] official statement about PHP file extensions?

2002-04-19 Thread heinisch

At 19.04.2002  14:21, you wrote:

> > >Is there any official statement (by php.net) about which file 
> extension you
> > >should use when using PHP (1, 2, 3 or 4)? I know that's server 
> related, but
> > >isn't there a standard?

> > This only belongs to the settings your webserver allows.
> > f.e. I have configured, to parse every html file, so it looks like 
> there were
> > static files, but they are php files. (not recommended on "real
> > traffic/big" sites
> > Some ISP´s suggest that you use php3/4 extensions, as they have both 
> versions
> > running.
>
>I wonder why they do this? In my experience, php3 code runs fine on a
>php4 server and on the servers I manage, the apache configuration passes
>both .php3 and .phtml scripts to php4 for execution.
>8
>Andy
Maybe PHP3 scripts work fine on 4, but if you´ve 4th, you cannot run them on 3.
And which ISP can/will guarantee that 3s work fine on 4, even in the 
beginning of 4?
(BTW some of my 3 scripts don´t work on 4)
Oliver


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] .inc over .php

2002-04-19 Thread Meir Kriheli

On Friday 19 April 2002 15:58, Erik Price wrote:
> On Friday, April 19, 2002, at 04:10  AM, Jacob Wyke wrote:
> > Why use .inc as a file extenstion when you can use .php ??
> > What are the advantages/disadvantages to using .inc?
> > Is one more secure?
> > Which is faster?
> > Which is consider a better pratice?
>
> It's just to help me organize which files I use as included files (.inc)
> and which files are actual PHP scripts that can be requested with a URI
> (.php).
>
> Also, I set an Apache directive to refuse requests for any file with the
> .inc extension, so my database connection info, password, etc is
> (theoretically) safe from being served directly.
>
>
> Erik

Those files should be placed outside DocumentRoot (if you control the server). 
Then set include_path in php.ini to include that dir, and you're done. No 
need to rely on apache for this.
-- 
Meir Kriheli


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] MySql query

2002-04-19 Thread Chris Kwasneski

Try:

SELECT gallery_name,  image_id, image_name FROM galleries, Images WHERE 
galleries.gallery_id = images.gallery_id

At 07:57 AM 4/19/2002 -0700, you wrote:
>Ok this could be the wrong place to ask this but there seems to be some
>people in here that know mysql quite well.
>My question is this; I have a database that looks like this.
>galleries
>
>gallery_id
>gallery_name
>
>
>
>Images
>
>image_id
>gallery_id
>image_name
>etc
>
>
>
>I am trying to run a SQL query that will return an array of rows from the
>images table. But I want the gallery_id "number" to be replaced with the
>actual "gallery name" from the galleries table.


-Chris


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] .inc over .php

2002-04-19 Thread Tim Ward

I've settled on .inc.php, .class.php, etc. that way you get the best of both
worlds. Your files are identified as what they are and don't get sent out
unparsed

Tim Ward
Internet Chess www.chessish.com  


--
From:  Jason Wong [SMTP:[EMAIL PROTECTED]]
Sent:  19 April 2002 09:28
To:  [EMAIL PROTECTED]
Subject:  Re: [PHP] .inc over .php

On Friday 19 April 2002 16:10, Jacob Wyke wrote:
> Just a few quick questions if anybody is out there.

Nobody here but us chickens.

> Why use .inc as a file extenstion when you can use .php ??

Just a matter of aesthetics. Some people might like to use .inc to
remind 
themselves that the file is to be included and not run on its own.

> What are the advantages/disadvantages to using .inc?

None from a technical point of view

> Is one more secure?

On default webserver settings, .inc may be less secure because by
default the 
webserver would not treat .inc files as php files and thus return
them as-is. 
Thus if people know the name of your "filename.inc" they could
potentially  
browse to it and thus see its contents. 

There are two ways to counter this:

1) have the .inc files in a directory outside the scope of the
webserver 
directory.

2) set the webserver to treat .inc files as php files.

> Which is faster?

No difference.

> Which is consider a better pratice?

As long as you take the necessary precautions then it boils down to
a matter 
of preference.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications
Development *

/*
"Home, Sweet Home" must surely have been written by a bachelor.
-- Samuel Butler
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] MySql query

2002-04-19 Thread Fifield, Mike

Ok the formatting got lost on that I will try this again. 


-Original Message-
From: Fifield, Mike [mailto:[EMAIL PROTECTED]] 
Sent: Friday, April 19, 2002 8:57 AM
To: [EMAIL PROTECTED]
Subject: [PHP] MySql query

Ok this could be the wrong place to ask this but there seems to be some
people in here that know mysql quite well. 
My question is this; I have a database that looks like this. 


galleries
gallery_id gallery_name
1   3d
2   fractals
3   abstract
4   cats
5   cars
 
Images
image_idgallery_id  image_name  etc
1   4   cat1
2   4   cat2
3   2   sky
4   2   blue
5   5   car1
 
 
I am trying to run a SQL query that will return an array of rows from the
images table. But I want the gallery_id "number" to be replaced with the
actual "gallery name" from the galleries table.

-Original Message-
From: Fifield, Mike [mailto:[EMAIL PROTECTED]] 
Sent: Friday, April 19, 2002 8:57 AM
To: [EMAIL PROTECTED]
Subject: [PHP] MySql query

Ok this could be the wrong place to ask this but there seems to be some
people in here that know mysql quite well. 
My question is this; I have a database that looks like this. 
galleries

gallery_id
gallery_name

 1
3d

2
fractals

3
abstract

4
cats

5
cars
 
Images

image_id
gallery_id
image_name
etc

1
4
cat1
 

2
4
cat2
 

3
2
sky
 

4
2
blue
 

5
5
car1
 
 
I am trying to run a SQL query that will return an array of rows from the
images table. But I want the gallery_id "number" to be replaced with the
actual "gallery name" from the galleries table. 
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Querying Oracle from PHP

2002-04-19 Thread Miguel Cruz

On Fri, 19 Apr 2002, Jon wrote:
> I am evaluating if it is posible to connect Oracle 8i from PHP, running
> a PL/SQL procedure and returning the results, avaible in a temp table,
> to HTML. Besides, I need to format the results of the query in PDF
> document and make a pie chart based on he results of the contents of the
> table I mentioned before. I looking for some adds-on to PHP that makes
> it posible to do this all..

You can do all this by building PHP with Oracle 8i and PDFlib support.

Pie charts are easy to draw with the PDFlib-provided primitives if you 
paid attention in geometry class. 

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Discarded extension on file download

2002-04-19 Thread Tom Mikulecky

This don't work for me :(
Extension .gz is still throwed away.

Tom

Danny Shepherd wrote:

> Hi,
>
> I recently had this problem and, after hours of hair pulling, found that it
> seems to work best if you send
> the words Content-Type and Content-Disposition in **lower case**. Not sure
> why it has to be like that but it was the only way I found.
>
> HTH,
>
> Danny.
>
> - Original Message -
> From: "Tomas Mikulecky" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, April 19, 2002 9:40 AM
> Subject: [PHP] Discarded extension on file download
>
> > Hi
> >
> > I am trying to offer downloading files from a web server, using PHP.
> >
> > The files are gzipped text and have all .txt.gz extensions. Now while on
> > Windows systems both IE and Netscape offers to download it under the
> > full name (althought IE adds [some_number] to the base of the file
> > name), under Unix or Linux systems (tested with netscape 4.7) the '.gz'
> > part is discarded from the file name and the file is saved with .txt
> > only. Downloaded file is still gzipped.
> >
> > The part of script serving the files is as follows:
> >
> > header("Content-type: application/octet-stream");
> > header("Content-Disposition: attachment; filename=$my_filename");
> > echo($file_body);
> >
> > What am-I doing wrong? Thanks in advance
> >
> > Tom
> >


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] MySql query

2002-04-19 Thread Fifield, Mike

Ok this could be the wrong place to ask this but there seems to be some
people in here that know mysql quite well. 
My question is this; I have a database that looks like this. 
galleries

gallery_id
gallery_name

 1
3d

2
fractals

3
abstract

4
cats

5
cars
 
Images

image_id
gallery_id
image_name
etc

1
4
cat1
 

2
4
cat2
 

3
2
sky
 

4
2
blue
 

5
5
car1
 
 
I am trying to run a SQL query that will return an array of rows from the
images table. But I want the gallery_id "number" to be replaced with the
actual "gallery name" from the galleries table. 
 
 



[PHP] Memory Leak... tracking?

2002-04-19 Thread Robert Cummings


I have written an extension that I compile into PHP in both CGI and
in module mode. The CGI version never crashes with a segfault in
my code; however, the module version almost always crashes on the
second page load. I've tracked it down to what appears to be one of
my pointers being overwritten, however, I have no way of finding out
where it is being overwritten, and Electric Fence bailed with a
free called on non malloc'd data error before the script even got
executed. Anyone know of another way I can track a buffer overflow
or underflow in PHP core code?

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: include() and require() problem

2002-04-19 Thread Michael Virnstein

be sure that the path to the include file is relative to the script that was
requested
by the user. that's important if you include include-files into included
files.
you then have to make sure that the path to your include-file in the
include-file is
relative to the file that included the file, in which the include-file is
included.
*lol* what a sentence. anyway, hope you get my meaning!
another problem is using include "/myincfiles/myfile.inc";
this way it could be searched in the root of the server, where for sure
your file can't be found. use relative path instead:
include "./myincfiles/myfile.inc";
"./" means the same directory.
or use an absolute path, which has to contain the whole path from the
server's root, e.g.:
include "/wwwroot/somedir/yourdocroot/myincfiles/myfile.inc";

Regards Michael

"Rodrigo Peres" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> List,
>
> I'm trying to include some .inc files in my project, but I got errors
> all time saying that this includes couldn't be found. I'm a newbie, so I
> can't understand what's happend, since it worked pretty good in my local
> machine and not in the ISP. I tried to speak to ISP many times but they
> couldn't solve to.
> My directorie structure is : HRM(directorie)->includes(directorie)->my
> inc files(to be included in files that is in the directorie HRM).
>
> Thank's
>
> Rodrigo
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] parse error=> doc contains no data

2002-04-19 Thread Johnson, Kirk

Sorry, I missed the main point of your original question. No more ideas
here.

> -Original Message-
> From: Pedro Garre [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 19, 2002 3:23 PM
> To: php-general
> Subject: Re: [PHP] parse error=> doc contains no data
> 
> 
> *This message was transferred with a trial version of 
> CommuniGate(tm) Pro*
> My php.ini has E_ALL and E_NOTICE
> I have tried several values with function error_reporting, including
> error_reporting(0) as recommended in the documentation. 
> 
> I am using the example of error handler function provided in the
> documentation.
> 
> Note that if I don't set my own error_handler everything 
> works and parse
> error messages are displayed as usual.
> 
> More ideas ?
> 
> Pedro.
> 
> 
> "Johnson, Kirk" escribió:
> > 
> > *This message was transferred with a trial version of 
> CommuniGate(tm) Pro*
> > Try setting error_reporting = E_ALL & ~E_NOTICE, or just 
> E_ALL, in php.ini.
> > 
> > Kirk
> > 
> > > -Original Message-
> > > From: Pedro Garre [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, April 19, 2002 11:25 AM
> > > To: php-general
> > > Subject: [PHP] parse error=> doc contains no data
> > >
> > >
> > > I set my own error handler as described in the documentation.
> > > It seems to work, as I can catch NOTICE errors.
> > >
> > > The problem is that PARSE errors do not display anywhere, nor are
> > > catched by my error handler. The browser just says "document
> > > contains no
> > > data".
> > >
> > > I know parse errors are not supposed to be catched by my
> > > error handler,
> > > but ... why are not them processed anywhere ?
> > >
> > > (display_errors is On in php.ini)
> > >
> > > Thanks in advance.
> > >
> > > Pedro.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] parse error=> doc contains no data

2002-04-19 Thread Pedro Garre

*This message was transferred with a trial version of CommuniGate(tm) Pro*
My php.ini has E_ALL and E_NOTICE
I have tried several values with function error_reporting, including
error_reporting(0) as recommended in the documentation. 

I am using the example of error handler function provided in the
documentation.

Note that if I don't set my own error_handler everything works and parse
error messages are displayed as usual.

More ideas ?

Pedro.


"Johnson, Kirk" escribió:
> 
> *This message was transferred with a trial version of CommuniGate(tm) Pro*
> Try setting error_reporting = E_ALL & ~E_NOTICE, or just E_ALL, in php.ini.
> 
> Kirk
> 
> > -Original Message-
> > From: Pedro Garre [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, April 19, 2002 11:25 AM
> > To: php-general
> > Subject: [PHP] parse error=> doc contains no data
> >
> >
> > I set my own error handler as described in the documentation.
> > It seems to work, as I can catch NOTICE errors.
> >
> > The problem is that PARSE errors do not display anywhere, nor are
> > catched by my error handler. The browser just says "document
> > contains no
> > data".
> >
> > I know parse errors are not supposed to be catched by my
> > error handler,
> > but ... why are not them processed anywhere ?
> >
> > (display_errors is On in php.ini)
> >
> > Thanks in advance.
> >
> > Pedro.
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Determine the difference between two dates

2002-04-19 Thread Ron Allen

Appreciate the assistance Danny

Figured it out
$totaltime= date("H:i:s", mktime(0,0,$totaltime));
Just followed PHP from this page
http://www.php.net/manual/en/function.mktime.php

"Ron Allen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> How is this going to give the overall time in difference... For instance
>
> A circuit went down at 17:30:45 it came back up at 18:37:49
>
> what is the difference in time between the 2 in the format Days XX Hours
XX
> Minutes XX Seconds XX
>
>
>
> "Danny Shepherd" <[EMAIL PROTECTED]> wrote in message
> 027601c1e7a9$fbe6f0f0$0200a8c0@dannys">news:027601c1e7a9$fbe6f0f0$0200a8c0@dannys...
> > use the date() command (http://www.php.net/date) - using $timeDiff as
the
> > datestamp.
> >
> > HTH
> >
> > Danny
> >
> > - Original Message -
> > From: "Ron Allen" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, April 19, 2002 2:56 PM
> > Subject: Re: [PHP] Determine the difference between two dates
> >
> >
> > > If I wanted to represent it in the format of
Days,Hours,Minutes,Seconds
> > how
> > > would that work
> > >
> > >
> > > "Danny Shepherd" <[EMAIL PROTECTED]> wrote in message
> > > 020e01c1e7a1$70098eb0$0200a8c0@dannys">news:020e01c1e7a1$70098eb0$0200a8c0@dannys...
> > > > Firstly, I assume you mean "Y-m-j H:i:s" for the date format.
> > > >
> > > > To get the difference between 2 time strings :
> > > >
> > > >  > > >
> > > > // orginal time strings
> > > > $firstTime="2002-04-19 13:49:00";
> > > > $lastTime="2002-04-19 14:00:00";
> > > >
> > > > // convert to unix timestamps
> > > > $firstTime=strtotime($firstTime);
> > > > $lastTime=strtotime($lastTime);
> > > >
> > > > // perform subtraction to get the difference (in seconds) between
> times
> > > > $timeDiff=$lastTime-$firstTime;
> > > >
> > > > //echo out the difference
> > > > printf ("Difference is %d seconds",$timeDiff);
> > > >
> > > > ?>
> > > >
> > > > HTH
> > > >
> > > > Danny.
> > > >
> > > > - Original Message -
> > > > From: "Ron Allen" <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Friday, April 19, 2002 1:08 PM
> > > > Subject: [PHP] Determine the difference between two dates
> > > >
> > > >
> > > > > If I have two variables of time both in the format of "Y-m-j
J:i:s"
> > > > > How would I go about and get the difference?
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] multidimensional array

2002-04-19 Thread Rodrigo Peres

Hi list,

In order to avoid many left joins I took an aproach that I didn't know 
if it's good, but I couldn't figure out another way. If my cliente has 
10 phone numbers I buld an array, serialize it and store in database, so 
I didn't have to create another table. The problem is now I need to 
migrate the data to this format, how can I select the multiple data and 
put in multidimensional array at runtime to store again. for example I 
need to put all fileds with graduation and all fields with discipline 
with equal id in array named school serialize it and after insert in 
another table.

Thank's

Rodrigo


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Determine the difference between two dates

2002-04-19 Thread Ron Allen

How is this going to give the overall time in difference... For instance

A circuit went down at 17:30:45 it came back up at 18:37:49

what is the difference in time between the 2 in the format Days XX Hours XX
Minutes XX Seconds XX



"Danny Shepherd" <[EMAIL PROTECTED]> wrote in message
027601c1e7a9$fbe6f0f0$0200a8c0@dannys">news:027601c1e7a9$fbe6f0f0$0200a8c0@dannys...
> use the date() command (http://www.php.net/date) - using $timeDiff as the
> datestamp.
>
> HTH
>
> Danny
>
> - Original Message -
> From: "Ron Allen" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, April 19, 2002 2:56 PM
> Subject: Re: [PHP] Determine the difference between two dates
>
>
> > If I wanted to represent it in the format of Days,Hours,Minutes,Seconds
> how
> > would that work
> >
> >
> > "Danny Shepherd" <[EMAIL PROTECTED]> wrote in message
> > 020e01c1e7a1$70098eb0$0200a8c0@dannys">news:020e01c1e7a1$70098eb0$0200a8c0@dannys...
> > > Firstly, I assume you mean "Y-m-j H:i:s" for the date format.
> > >
> > > To get the difference between 2 time strings :
> > >
> > >  > >
> > > // orginal time strings
> > > $firstTime="2002-04-19 13:49:00";
> > > $lastTime="2002-04-19 14:00:00";
> > >
> > > // convert to unix timestamps
> > > $firstTime=strtotime($firstTime);
> > > $lastTime=strtotime($lastTime);
> > >
> > > // perform subtraction to get the difference (in seconds) between
times
> > > $timeDiff=$lastTime-$firstTime;
> > >
> > > //echo out the difference
> > > printf ("Difference is %d seconds",$timeDiff);
> > >
> > > ?>
> > >
> > > HTH
> > >
> > > Danny.
> > >
> > > - Original Message -
> > > From: "Ron Allen" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Friday, April 19, 2002 1:08 PM
> > > Subject: [PHP] Determine the difference between two dates
> > >
> > >
> > > > If I have two variables of time both in the format of "Y-m-j J:i:s"
> > > > How would I go about and get the difference?
> > >
> > >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] include() and require() problem

2002-04-19 Thread Rodrigo Peres

List,

I'm trying to include some .inc files in my project, but I got errors 
all time saying that this includes couldn't be found. I'm a newbie, so I 
can't understand what's happend, since it worked pretty good in my local 
machine and not in the ISP. I tried to speak to ISP many times but they 
couldn't solve to.
My directorie structure is : HRM(directorie)->includes(directorie)->my 
inc files(to be included in files that is in the directorie HRM).

Thank's

Rodrigo


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] if elseif else

2002-04-19 Thread The_RadiX

Nope..

That is fine..


I use it all the time.. It's quite acceptable..




- Original Message -
From: "Gerard Samuel" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Saturday, April 20, 2002 12:01 AM
Subject: [PHP] if elseif else


> I redoing some code, and the original author has code like
>
> if
> elseif
> elseif
> elseif
> else
>
> I have always known it to have just one elseif, not multiple ones.
> I was going to move it to a switch/case, but there is no common switch.
> So I wanted to know if its technically ok, or just ok to use multiple
elseif
>
> Thanks
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] if elseif else

2002-04-19 Thread Leotta, Natalie (NCI/IMS)

You can use as many elseifs as you need.  I'm not sure how it affects
performance, but it works (I have one that goes through all 50 states).

-Natalie

-Original Message-
From: Gerard Samuel [mailto:[EMAIL PROTECTED]] 
Sent: Friday, April 19, 2002 10:02 AM
To: PHP
Subject: [PHP] if elseif else


I redoing some code, and the original author has code like

if
elseif
elseif
elseif
else

I have always known it to have just one elseif, not multiple ones. I was
going to move it to a switch/case, but there is no common switch. So I
wanted to know if its technically ok, or just ok to use multiple elseif

Thanks


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] if elseif else

2002-04-19 Thread Gerard Samuel

I redoing some code, and the original author has code like

if
elseif
elseif
elseif
else

I have always known it to have just one elseif, not multiple ones.
I was going to move it to a switch/case, but there is no common switch.
So I wanted to know if its technically ok, or just ok to use multiple elseif

Thanks


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Validating User Input

2002-04-19 Thread SP

Thanks Danny, that worked!

Now should I include all those special characters?  I want it to be hack
proof so I don't want to add the user input into my database and have
something bad happen.

Which ones are safe?
~ ` ! @ # $ % ^ & * ( ) _ + - = [ ] \ { } | : " ; ' < > ? , . /


-Original Message-
From: Danny Shepherd [mailto:[EMAIL PROTECTED]]
Sent: April 19, 2002 9:32 AM
To: Php
Subject: Re: [PHP] Validating User Input


Hi,

\?\,\.
\/';

$regexp='^['.$pattern.']{'.$min.','.$max.'}$';

if (ereg($regexp,$user_input))
return $user_input;
else
return $default;
 }
?>

That should take care of everything except the square brackets - not sure
how to go about getting them (escaping them didn't seem to work).

HTH

Danny.

- Original Message -
From: "SP" <[EMAIL PROTECTED]>
To: "Php" <[EMAIL PROTECTED]>
Sent: Friday, April 19, 2002 1:57 PM
Subject: [PHP] Validating User Input


> I am trying to validate an user's input.  I can get the ereg function to
> work if I just type in the pattern I'm searching for but my problem is I
> want to build the pattern through a variable first and then use that
> variable in the ereg function.
>
> For example, I want to check an input that's only text and only between 5
to
> 20 characters in length.  Is this possible?
>
> function check_input($user_input, $min=0, $max=0, $text=false,
>  $number=false, $special=false, $default="")
> {
>   if ($text) $pattern .= "a-zA-Z";
>   if ($number) $pattern .= "0-9";
>   if ($special) $pattern .= "[:space:]";
>
>   if  (ereg("^[$pattern]{$min,$max}$", $user_input))
> return $user_input;
>   else
> return $default;
> }
>
> Also, which of the following special characters is considered safe to
> accept?  I am just allowing spaces now but would like as many of the below
> characters to be included.
>
> ~ ` ! @ # $ % ^ & * ( ) _ + - = [ ] \ { } | : " ; ' < > ? , . /
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Determine the difference between two dates

2002-04-19 Thread Danny Shepherd

use the date() command (http://www.php.net/date) - using $timeDiff as the
datestamp.

HTH

Danny

- Original Message -
From: "Ron Allen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 19, 2002 2:56 PM
Subject: Re: [PHP] Determine the difference between two dates


> If I wanted to represent it in the format of Days,Hours,Minutes,Seconds
how
> would that work
>
>
> "Danny Shepherd" <[EMAIL PROTECTED]> wrote in message
> 020e01c1e7a1$70098eb0$0200a8c0@dannys">news:020e01c1e7a1$70098eb0$0200a8c0@dannys...
> > Firstly, I assume you mean "Y-m-j H:i:s" for the date format.
> >
> > To get the difference between 2 time strings :
> >
> >  >
> > // orginal time strings
> > $firstTime="2002-04-19 13:49:00";
> > $lastTime="2002-04-19 14:00:00";
> >
> > // convert to unix timestamps
> > $firstTime=strtotime($firstTime);
> > $lastTime=strtotime($lastTime);
> >
> > // perform subtraction to get the difference (in seconds) between times
> > $timeDiff=$lastTime-$firstTime;
> >
> > //echo out the difference
> > printf ("Difference is %d seconds",$timeDiff);
> >
> > ?>
> >
> > HTH
> >
> > Danny.
> >
> > - Original Message -
> > From: "Ron Allen" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, April 19, 2002 1:08 PM
> > Subject: [PHP] Determine the difference between two dates
> >
> >
> > > If I have two variables of time both in the format of "Y-m-j J:i:s"
> > > How would I go about and get the difference?
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] parse error=> doc contains no data

2002-04-19 Thread Johnson, Kirk

Try setting error_reporting = E_ALL & ~E_NOTICE, or just E_ALL, in php.ini.

Kirk

> -Original Message-
> From: Pedro Garre [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 19, 2002 11:25 AM
> To: php-general
> Subject: [PHP] parse error=> doc contains no data
> 
> 
> I set my own error handler as described in the documentation.
> It seems to work, as I can catch NOTICE errors.
> 
> The problem is that PARSE errors do not display anywhere, nor are
> catched by my error handler. The browser just says "document 
> contains no
> data".
> 
> I know parse errors are not supposed to be catched by my 
> error handler,
> but ... why are not them processed anywhere ?
> 
> (display_errors is On in php.ini)
> 
> Thanks in advance.
> 
> Pedro.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] How long does a session last? Need to have it at 20mins

2002-04-19 Thread Johnson, Kirk

Garbage collection is launched according to the gc_probablility. If it finds
a session file that has not been modified for a longer time than
gc_maxlifetime, it deletes it. So, whenever a user requests a page, they
essentially reset the session timer to zero for that particular session,
since the session file gets modified on each page request for that session.
If you want to set a hard timeout of 20 minutes, you may need to write your
own garbage collection process.

Kirk

> -Original Message-
> From: Phil Powell [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 19, 2002 1:02 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] How long does a session last? Need to have it at 20mins
> 
> 
> I had thought that a session would last only 20 mins if
> session.gc_maxlifetime is set at 1440.  Was I wrong in 
> assuming this?  I
> have pages that have session_start() at the top to persist the session
> throughout the life-cycle of these pages, however, I want the 
> session to
> expire after 20 mins or so of use.  How can I assure that the 
> session will
> expire after 20 mins?
> 
> Thanx
> Phil
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




  1   2   >