[PHP] global variables

2003-01-16 Thread Dara Dowd
Is it "better" to pass variables through functions or to simply declare them as global 
within the function's scope?
The variables in this particular case are things like MySQL database connections and 
tablenames.
Thanks,Dara
-- 
For the largest free email in Ireland (25MB) & 
File Storage space (20MB), visit http://www.campus.ie

Powered by Outblaze

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




[PHP] Changing page orientaion for printing

2003-01-16 Thread Stanislav Skrypnik
Hi everybody,
Is it possible using PHP change page orientation in browser so that when
user clicks
on "Print" button page automatically rotated to "landscape" orientation.
I've heard that it is possible to do with ActiveX but due to security reason
ActiveX might be disabled.
Thanks for any help in advance,
Stas.



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




Re: [PHP] Php's future with Asp .NET?

2003-01-16 Thread Tariq Murtaza
Sancar Saran wrote:

On Thursday 16 January 2003 09:07, Dhaval Desai wrote:


Hello ppl,

I was just wondering what is php's future with something like Asp .Net
coming up...I have read many articles by Php guys who think Asp.Net is the
future. If that's the true case...is it really worth sticking to Php at
all?

Thanx!
-Dhaval



Hi,
My opinon is Php future is very bright. .NET is marketing mumbo jumbo, and 
java is Sun's bug yard.

It was pretty clear. None of them able to compete against PHP. ASP.NET is 
expensive, JSP is hard to config and code. Both of them slower than PHP, 
learning PHP easier than others.

Sancar "Delifisek" Saran

And Moreover its FREE :)

Tariq







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




Re: [PHP] Meta Refresh

2003-01-16 Thread Jason Wong
On Friday 17 January 2003 12:45, Edson Waite wrote:
> Hi Jason,
>
>  $colname_earlytour = "1";
> if (isset($HTTP_GET_VARS['ID'])) {
>   $colname_earlytour = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['ID'] :
> addslashes($HTTP_GET_VARS['ID']);
> }
> mysql_select_db($database_airforcemuseum, $airforcemuseum);
> $query_earlytour = sprintf("SELECT * FROM early WHERE ID = %s",
> $colname_earlytour);
> $earlytour = mysql_query($query_earlytour, $airforcemuseum) or
> die(mysql_error());
> $row_earlytour = mysql_fetch_assoc($earlytour);
> $totalRows_earlytour = mysql_num_rows($earlytour);
> ?>
>
> This code was inserted by DWMX  when I created the record set "earlytour"
> So I don't know exactly.

What does your complete code look like?

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

/*
One good turn asketh another.
-- John Heywood
*/


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




Re: [PHP] Re: Create unike variables for each record

2003-01-16 Thread Jason Sheets
Yes, the php manual is available at http://www.php.net, session
information is available at http://www.php.net/session.

Jason

On Thu, 2003-01-16 at 20:58, Lars Espelid wrote:
> Is it possible to register an array as a session variable? If so I think it
> solves my problem.
> 
> 
> Thanks.
> 
> Lars
> 
> 
> "Lars Espelid" <[EMAIL PROTECTED]> skrev i melding
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hello,
> >
> > I have a table in a MySQL-db. The primary-key-coloumn is a number which is
> > not sorted. I don't know how many records there are.
> >
> > I have a while-loop in a php-page which prints a link for each record.
> Each
> > link points to the same page (iow. page reloads).
> >
> > When someone click on one of these links I would like to create a unike
> > session-variable which identifies the links record and set it's value like
> > 1. The next time someone click on the link, the variable should be set
> like
> > 0.
> >
> > The meaning is to run another query if a record's variable is set to 1 and
> > display it. The page will then have functionality like windows explorer
> (you
> > can click on a folder and it will then display its contents).
> >
> > The problem is how I can make a unike variable for each record and know
> how
> > to call it(know it's name).
> >
> > Hope someone understands my problem. (difficult to explain)
> >
> > Thanks.
> >
> > Lars
> >
> >
> 
> 
> 
> -- 
> 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] Meta Refresh

2003-01-16 Thread Edson Waite
Hi Jason,



This code was inserted by DWMX  when I created the record set "earlytour" So
I don't know exactly.

[EMAIL PROTECTED]
> On Friday 17 January 2003 11:25, Edson Waite wrote:
> > Hi All,
> >
> > I am trying to make an automated tour as a section of my site, using the
> > following.
> >
> >  > $NewID = $colname_earlytour + 1;
> > ?>
> >  > "$NewID";?>>
> >
> > This works great going from early-tour?ID=1 to early-tour?ID=2 but I
can't
> > get it to continue on to ID=3, ID=4 etc. It just keeps reloading the
data
> > from ID=2
> >
> > The data for each page is in a row identified by a unique ID# I just
want
> > the page to reload with the data from the next ID# after a givin time 15
> > seconds.
>
> Where does $colname_earlytour come from?
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> Credit ... is the only enduring testimonial to man's confidence in man.
> -- James Blish
> */
>



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




Re: [PHP] Meta Refresh

2003-01-16 Thread Jason Wong
On Friday 17 January 2003 11:25, Edson Waite wrote:
> Hi All,
>
> I am trying to make an automated tour as a section of my site, using the
> following.
>
>  $NewID = $colname_earlytour + 1;
> ?>
>  "$NewID";?>>
>
> This works great going from early-tour?ID=1 to early-tour?ID=2 but I can't
> get it to continue on to ID=3, ID=4 etc. It just keeps reloading the data
> from ID=2
>
> The data for each page is in a row identified by a unique ID# I just want
> the page to reload with the data from the next ID# after a givin time 15
> seconds.

Where does $colname_earlytour come from?

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

/*
Credit ... is the only enduring testimonial to man's confidence in man.
-- James Blish
*/


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




Re: [PHP] Create unike variables for each record

2003-01-16 Thread Justin French
wouldn't you use the primary key as the unique identifier?



";
echo "{$myrow['firstname']} {$myrow['lastname']}";
}
}
else
{
// show the details of a specific contact
$sql = "select * from contacts where id='{$_GET['id]}' LIMIT 1";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
echo "{$myrow['firstname']} {$myrow['lastname']}";
echo "{$myrow['phone']}";
echo "{$myrow['fax']}";
echo "{$myrow['email']}";
}
?>




the key line here is
echo "";

which puts the ID into the URL, and is used to decide if you want to show
all records (no ID in URL) or just one (id in the URL).


Have fun,

Justin







on 17/01/03 2:17 PM, Lars Espelid ([EMAIL PROTECTED]) wrote:

> Hello,
> 
> I have a table in a MySQL-db. The primary-key-coloumn is a number which is
> not sorted. I don't know how many records there are.
> 
> I have a while-loop in a php-page which prints a link for each record. Each
> link points to the same page (iow. page reloads).
> 
> When someone click on one of these links I would like to create a unike
> session-variable which identifies the links record and set it's value like
> 1. The next time someone click on the link, the variable should be set like
> 0.
> 
> The meaning is to run another query if a record's variable is set to 1 and
> display it. The page will then have functionality like windows explorer (you
> can click on a folder and it will then display its contents).
> 
> The problem is how I can make a unike variable for each record and know how
> to call it(know it's name).
> 
> Hope someone understands my problem. (difficult to explain)
> 
> Thanks.
> 
> Lars
> 
> 


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




[PHP] --with-mcal=/usr/local/mcal compilation issue

2003-01-16 Thread Roger Thomas
php-4.3
libmcal-0.5 (i intend to use Horde's Kronolith and the README said it cannot
work with libmcal-0.6)

configure gave this error:
checking for MCAL support... yes
configure: error: Unable to locate your libmcal header files - cal_misc.h
should be in the directory you specify or in the include/ subdirectory below it
- default search location is /usr/local

please advise.


__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




[PHP] Re: Create unike variables for each record

2003-01-16 Thread Lars Espelid
Is it possible to register an array as a session variable? If so I think it
solves my problem.


Thanks.

Lars


"Lars Espelid" <[EMAIL PROTECTED]> skrev i melding
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello,
>
> I have a table in a MySQL-db. The primary-key-coloumn is a number which is
> not sorted. I don't know how many records there are.
>
> I have a while-loop in a php-page which prints a link for each record.
Each
> link points to the same page (iow. page reloads).
>
> When someone click on one of these links I would like to create a unike
> session-variable which identifies the links record and set it's value like
> 1. The next time someone click on the link, the variable should be set
like
> 0.
>
> The meaning is to run another query if a record's variable is set to 1 and
> display it. The page will then have functionality like windows explorer
(you
> can click on a folder and it will then display its contents).
>
> The problem is how I can make a unike variable for each record and know
how
> to call it(know it's name).
>
> Hope someone understands my problem. (difficult to explain)
>
> Thanks.
>
> Lars
>
>



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




[PHP] Meta Refresh

2003-01-16 Thread Edson Waite
Hi All,

I am trying to make an automated tour as a section of my site, using the
following.


>

This works great going from early-tour?ID=1 to early-tour?ID=2 but I can't
get it to continue on to ID=3, ID=4 etc. It just keeps reloading the data
from ID=2

The data for each page is in a row identified by a unique ID# I just want
the page to reload with the data from the next ID# after a givin time 15
seconds.

Thanks in advance for any ideas,
Edson Waite III
http://www.sportsvideooutlet.com





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




RE: [PHP] postfix instead of sendmail

2003-01-16 Thread Timothy Hitchens \(HiTCHO\)
I don't use postfix but as far as I know it is a drop in replacement and
you should just change the entry in php.ini

look for:

 ; For Unix only.  You may supply arguments as well (default: "sendmail
-t -i").
 ;sendmail_path =


Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: [EMAIL PROTECTED]

> -Original Message-
> From: HPS [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, 17 January 2003 11:50 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] postfix instead of sendmail 
> 
> 
> what should i do if i want to use PostFix in the php, but not 
> SendMail?
> 
> thx very much
> HPS
> 
> 
> 
> 
> 
> 
> -- 
> 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] Create unike variables for each record

2003-01-16 Thread Lars Espelid
Hello,

I have a table in a MySQL-db. The primary-key-coloumn is a number which is
not sorted. I don't know how many records there are.

I have a while-loop in a php-page which prints a link for each record. Each
link points to the same page (iow. page reloads).

When someone click on one of these links I would like to create a unike
session-variable which identifies the links record and set it's value like
1. The next time someone click on the link, the variable should be set like
0.

The meaning is to run another query if a record's variable is set to 1 and
display it. The page will then have functionality like windows explorer (you
can click on a folder and it will then display its contents).

The problem is how I can make a unike variable for each record and know how
to call it(know it's name).

Hope someone understands my problem. (difficult to explain)

Thanks.

Lars



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




RE: [PHP] output sql

2003-01-16 Thread Timothy Hitchens \(HiTCHO\)
SELECT first_name AS first FROM clients

As you can see the first_name field will now be accessable as first.



Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: [EMAIL PROTECTED]

> -Original Message-
> From: Paul Marinas [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, 17 January 2003 12:58 PM
> To: Ezequiel Sapoznik
> Cc: [EMAIL PROTECTED]
> Subject: [PHP] output sql
> 
> 
> 
> Dose anyone know how can i do that:
> - select some data form a sql db and put it in a web page. 
> the problem is that i whant to change the value (name) of a 
> column that is selected form the database and then put in a 
> web page with the diferent name.
> 
> Thanks, Paul
> 
> -- 
> 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] output sql

2003-01-16 Thread Paul Marinas

Dose anyone know how can i do that:
- select some data form a sql db and put it in a web page. the
problem is that i whant to change the value (name) of a column that is
selected form the database and then put in a web page with the diferent
name.

Thanks, Paul

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




Re: [PHP] fit window to image

2003-01-16 Thread Ezequiel Sapoznik
ok, I try with



to then use the x and y with a javascript code like:

window.open
('win_sizer.html','Photo','toolbar=yes,status=yes,scrollbars=yes,location=ye
s,menubar=yes,directories=yes,width=x,height=y')

But in the php part, I am receiving the following error:

Warning: getimagesize: Unable to open '../images/1817.jpg' for reading. in
/home/sites/site8/web/prueba.php on line 12

I'd like to add that I changed mode to 777 (UNIX)

Thank you for your help.

Ezequiel


"Justin French" <[EMAIL PROTECTED]> escribió en el mensaje
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> php can help, but remember, PHP only outputs HTML code to the browser...
it
> can't actually resize the window, because that's a client-side thing like
> javascript.
>
> but you can find out the x and y of an image with
> http://www.php.net/manual/en/function.getimagesize.php
>
> Then use this information in a javascript which resizes the browser
window.
>
>
> Of course for the javascripts, you'd need to ask a JS list, and remember
> that not everyone has javascript, and not everyone enjoys the web
developer
> resizing their windows and 'taking control' of their browsers :)
>
>
> Justin
>
>
> on 17/01/03 12:37 PM, Ezequiel Sapoznik ([EMAIL PROTECTED]) wrote:
>
> > Hi!
> >
> > Is there anyway in php to fit the window to the size of an image?
> >
> > Thanks!
> >
> > Ezequiel
> >
> >
>



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




Re: [PHP] fit window to image

2003-01-16 Thread Justin French
php can help, but remember, PHP only outputs HTML code to the browser... it
can't actually resize the window, because that's a client-side thing like
javascript.

but you can find out the x and y of an image with
http://www.php.net/manual/en/function.getimagesize.php

Then use this information in a javascript which resizes the browser window.


Of course for the javascripts, you'd need to ask a JS list, and remember
that not everyone has javascript, and not everyone enjoys the web developer
resizing their windows and 'taking control' of their browsers :)


Justin


on 17/01/03 12:37 PM, Ezequiel Sapoznik ([EMAIL PROTECTED]) wrote:

> Hi!
> 
> Is there anyway in php to fit the window to the size of an image?
> 
> Thanks!
> 
> Ezequiel
> 
> 


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




Re: [PHP] Display Dates in English o_O

2003-01-16 Thread Rick Emery
look at mysql's DATE_FORMAT()   Let mysql do it for you, instead of PHP
- Original Message -
From: Stephen
To: PHP List
Sent: Thursday, January 16, 2003 7:16 PM
Subject: [PHP] Display Dates in English o_O


I have a PHP driven site that as a time schedule. Since the site isn't exactly filled 
with very
intellagent people who just LOVE to translate times and dates from a weird format 
(Such as the
format used in MySQL), I'd like to take these from a MySQL table (the table's types 
are DATE and
TIME) and translate the date to something like "Thrusday, January 16th, 2003" when the 
date strate
from the table is "2003-01-16." Then with time, I'd like it to read something like 
"8:00 PM" when it
reads straight from the table "20:00:00." Another feature I'd like to have it 
timezones but that's
not the point of this message. If you don't mind, though, could you also tell me how 
to configure
the times according the the timezone a user has chosen?

Thanks,
Stephen Craton
http://www.melchior.us

"What's the point in appearance if your true love, doesn't care about it?" -- 
http://www.melchior.us



--
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] Display Dates in English o_O

2003-01-16 Thread Justin French
start with http://php.net/strtotime and http://php.net/date



OR



For the 24hr time to 12hr time conversion, something like:

= 12) { $suffix = 'pm'; } else { $suffix = 'am'; }
if($h > 12) { $h = $h - 12; }
echo "{$h}:{$m}{$suffix}";
?>

Untested code of course, but it should do the job, and would be easy to wrap
into a re-useable function :)


Timezones:  I haven't looked into them too much, but you should consider
storing every date in GMT, rather than 'picking' a timezone to suit
everyone, which is of course impossible.  I think you can add the keyword
GMT to strtotime to achieve this.

strtotime() gives you a number of seconds since 1970... It's pretty
convenient to work with (but not for a human to read), because to add an
hour to the date, you just add 3600 (60s * 60m) to the number.  There must
be a way of finding out how many hours ahead/behind the GMT the user is, and
using that figure (3 hours = 3 x 3600) to alter the stamp to reflect their
time.

And then let's talk about daylight savings :)


If I were you, I'd just implement everything in GMT, unless you want to
spend a little while sorting all this out.


Justin




on 17/01/03 12:16 PM, Stephen ([EMAIL PROTECTED]) wrote:

> I have a PHP driven site that as a time schedule. Since the site isn't exactly
> filled with very intellagent people who just LOVE to translate times and dates
> from a weird format (Such as the format used in MySQL), I'd like to take these
> from a MySQL table (the table's types are DATE and TIME) and translate the
> date to something like "Thrusday, January 16th, 2003" when the date strate
> from the table is "2003-01-16." Then with time, I'd like it to read something
> like "8:00 PM" when it reads straight from the table "20:00:00." Another
> feature I'd like to have it timezones but that's not the point of this
> message. If you don't mind, though, could you also tell me how to configure
> the times according the the timezone a user has chosen?
> 
> Thanks,
> Stephen Craton
> http://www.melchior.us
> 
> "What's the point in appearance if your true love, doesn't care about it?" --
> http://www.melchior.us


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




[PHP] postfix instead of sendmail

2003-01-16 Thread HPS
what should i do if i want to use PostFix in the php, but not SendMail?

thx very much
HPS






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




Re: [PHP] fit window to image

2003-01-16 Thread Weston Houghton

This wouldn't really be done in PHP. This is a Javascript element, as 
it requires work to be done on the client side. You could easily make a 
combination of PHP and Javascript to do this with any set of images 
though.

Wes


On Thursday, January 16, 2003, at 08:37  PM, Ezequiel Sapoznik wrote:

Hi!

Is there anyway in php to fit the window to the size of an image?

Thanks!

Ezequiel



--
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] fit window to image

2003-01-16 Thread Timothy Hitchens \(HiTCHO\)
This can be achieved by using image features of php to get the size then
rewrite
your html or use JavaScript to do the same.


Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: [EMAIL PROTECTED]

> -Original Message-
> From: Ezequiel Sapoznik [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, 17 January 2003 11:38 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] fit window to image
> 
> 
> Hi!
> 
> Is there anyway in php to fit the window to the size of an image?
> 
> Thanks!
> 
> Ezequiel
> 
> 
> 
> -- 
> 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] fit window to image

2003-01-16 Thread Ezequiel Sapoznik
Hi!

Is there anyway in php to fit the window to the size of an image?

Thanks!

Ezequiel



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




[PHP] Display Dates in English o_O

2003-01-16 Thread Stephen



I have a PHP driven site that as a time schedule. Since the 
site isn't exactly filled with very intellagent people who just LOVE to 
translate times and dates from a weird format (Such as the format used in 
MySQL), I'd like to take these from a MySQL table (the table's types are DATE 
and TIME) and translate the date to something like "Thrusday, January 16th, 
2003" when the date strate from the table is "2003-01-16." Then with time, I'd 
like it to read something like "8:00 PM" when it reads straight from the table 
"20:00:00." Another feature I'd like to have it timezones but that's not the 
point of this message. If you don't mind, though, could you also tell me how to 
configure the times according the the timezone a user has 
chosen?
Thanks,Stephen Cratonhttp://www.melchior.us
 
"What's the point in appearance if your true love, doesn't care about it?" 
-- http://www.melchior.us
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] What's the PHP-equivalent of Perl's AUTOLOAD feature?

2003-01-16 Thread Chip Castle
Hello -

I just read an interesting article in The Perl Journal (TPJ) about using
AUTOLOAD as a layer of abstraction for accessing database columns and I
would like to write something similar in PHP.  Is this possible?

I have written a number of PHP/MySQL applications, but do not consider
myself an expert.  I cannot find anything on various PHP-related
websites and was hoping someone with more in depth knowledge would be
able to make a few suggestions.

Thanks!

Chip Castle
chip (at) chipcastle (dot) com


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




Re: [PHP] REQUEST_URI, which part of $_ is it from??

2003-01-16 Thread Philip Olson

> Which part of $_ is the REQUEST_URI be found from?


It's a web server predefined variable so only lives
in $_SERVER.

  http://www.php.net/variables.predefined

Regards,
Philip


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




Re: [PHP] Session Length

2003-01-16 Thread Justin French
Check out the 'max lifetime' session settings in the sessions part of
php.ini

Justin


on 17/01/03 7:11 AM, Pushpinder Singh Garcha ([EMAIL PROTECTED]) wrote:

> Hello Everyone:
> 
> I am using Sessions to secure parts of my website. I need to know if
> there is a way to set a lifetime for these sessions , so that they are
> automatically destroyed when say the user is inactive for 30 minutes.
> 
> Any help will be greatly appreciated. Thanks in advance
> 
> Pushpinder Singh
> 


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




Re: [PHP] Re: Ever complained about lousy PHP programmers?

2003-01-16 Thread Justin French
on 17/01/03 5:44 AM, Peter Hutnick ([EMAIL PROTECTED]) wrote:

> Because short tags are evil ;-)  My provider has short tags enabled, so
> there is no getting around this bit of ugliness.

Can you set the php.ini value to disallow short tags locally via a .htaccess
file??

Justin


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




Re: [PHP] "document contained no data"

2003-01-16 Thread Justin French
I wrote a simple test script which increments a sessions counter, as per the
manual.  That way they couldn't complain about having to debug mountains of
code, etc etc.

Intead of the usual 1,2,3,4,5...50 it was more like
1,2,3,0,4,5,1,6,7,2,8,9,3

I emailed them, and they've switched the sessions over from 'mm' (memory) to
'files' for the moment... and we'll see if that works.

I *think* one of the accounts on the server is triggering the segfaults (not
me!), which in tuen is hurthing the server, sessions, etc.


Just thought I'd let everyone know where it's at :)


Justin


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




Re: [PHP] Re: List items in table with a hypertext link

2003-01-16 Thread Hugh Danaher
Al,
Something like the following should enable you to display a list of
whatever, then click on the record id to edit the record.  This is a portion
of code which does the display, you'll need another portion to display the
record for editing.

Hugh
snip from street.php
 Click on an ID number to edit the information of that
record.";
 print "
   ID
   Scientific Name (Common Name)
   Address
   District
   ";
 while ($array_result=mysql_fetch_array($result))
  {
   print "".stripslashes($array_result[id])."
 ".stripslashes($array_result[scientific_name])."
(".stripslashes($array_result[common_name]).")
 ".stripslashes($array_result[address])."
".stripslashes($array_result[comments])." 

".stripslashes($array_result[district])." ";
  }
 print "";

?>
- Original Message -
From: "Al" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 16, 2003 2:14 PM
Subject: [PHP] Re: List items in table with a hypertext link


> This may be a bit more than you are looking for.
>
> http://sourceforge.net/projects/phpmyedit/
>
>
>
> Mike Tuller wrote:
> > I have been looking for an example of how to create a listing of items
> > in a table where you have the first item in the list have a link so that
> > when you click on it, it will open a page for editing the contents of
> > that item. So for instance you have a list of employees, and you want to
> > change their phone number you could go to the list and click on the
> > employee id number and it would open a page where you can edit the
> > employee information.
> >
> > I haven't been able to find a good example of this, so if anyone knows
> > where I could find one, please let me know.
> >
> > Mike
> >
>
>
> --
> 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] package-stats-graph.php

2003-01-16 Thread Eskil Kvalnes
Hey,

I'm trying to get package-stats-graph.php to work (got it off of pear
cvs), but no matter what date I insert in my downloads table (mysql),
it all ends up in one bar on the graph.

Here's my two relevant tables:

#
# Table structure for table `downloads`
#

CREATE TABLE downloads (
  downloadId int(4) NOT NULL auto_increment,
  downloadDate int(10) default NULL,
  downloadName varchar(100) default NULL,
  downloadPackageId int(10) default NULL,
  PRIMARY KEY  (downloadId)
) TYPE=MyISAM;

#
# Dumping data for table `downloads`
#

INSERT INTO downloads VALUES (1, 1042681964, 'shoutBOX', 3); # Date is in
January 2003
INSERT INTO downloads VALUES (2, 1025559732, 'shoutBOX', 3); # Date is in
July 2002

#
# Table structure for table `scripts`
#

CREATE TABLE scripts (
  scriptId int(4) NOT NULL default '0',
  scriptKey int(4) default NULL,
  scriptDate int(10) default NULL,
  scriptName varchar(255) default NULL,
  scriptRequirements varchar(100) default NULL,
  scriptFeatures text,
  scriptDescription text,
  scriptVersion varchar(4) default NULL,
  scriptLocation varchar(255) default NULL,
  scriptViews int(10) default NULL,
  scriptDownloads int(10) default '0',
  PRIMARY KEY  (scriptId)
) TYPE=MyISAM;

#
# Dumping data for table `scripts`
#

INSERT INTO scripts VALUES (3, 1, 1004398159, 'shoutBOX', 'PHP/MySQL',
'..', '2.6', 'scripts/shoutBOX-2.6.zip', 652, 849);

and this is my code wich won't work:
$statsSql = 'SELECT UNIX_TIMESTAMP(d.downloadDate) AS date, COUNT(*) AS
downloads FROM scripts s, downloads d WHERE d.downloadPackageId =
s.scriptId AND s.scriptId = '.$_GET['id'].' GROUP BY MONTH(d.downloadDate)
ORDER BY YEAR(d.downloadDate) DESC, MONTH(d.downloadDate) DESC';
if($statsResult = $db->query($statsSql)) {
if (DB::isError($statsResult)) {
die($statsResult->getDebugInfo());
}

while ($statsRow = $statsResult->fetchRow(DB_FETCHMODE_ASSOC)) {
$y_axis[date('n', $statsRow['date'])] = $statsRow['downloads'];
}
}

An example is available here:
http://www.phpnetwork.net/package-stats-graph.php?id=3

I've searched mysql.com for documentation on group by but I couldn't fix
it... Also tried several irc chans... :/
I would appreciate any help I can get.

---
Sincerely,
Eskil Kvalnes
[EMAIL PROTECTED]



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




[PHP] REQUEST_URI, which part of $_ is it from??

2003-01-16 Thread Scott Fletcher
Hi!

Which part of $_ is the REQUEST_URI be found from?

I did the print_r on GLOBALS and found that it is part of $_GET.  I'm
sure it will work on $_POST also.  So, it meant it shoudl work on
$_REQUEST["REQUEST_URI"] also  Can this also be part of
$_SERVER["."]???

Thanks for your input

Scott F.



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




[PHP] Re: List items in table with a hypertext link

2003-01-16 Thread Al
This may be a bit more than you are looking for.

http://sourceforge.net/projects/phpmyedit/



Mike Tuller wrote:

I have been looking for an example of how to create a listing of items 
in a table where you have the first item in the list have a link so that 
when you click on it, it will open a page for editing the contents of 
that item. So for instance you have a list of employees, and you want to 
change their phone number you could go to the list and click on the 
employee id number and it would open a page where you can edit the 
employee information.

I haven't been able to find a good example of this, so if anyone knows 
where I could find one, please let me know.

Mike



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




RE: [PHP] More OOP

2003-01-16 Thread Cal Evans
personally, I would ditch the Error class and put raise_error in Base.

=C=

*
* Cal Evans
* Stay plugged into your audience.
* http://www.christianperformer.com
*


-Original Message-
From: Jordan Elver [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 3:52 PM
To: [EMAIL PROTECTED]
Subject: [PHP] More OOP


Hi guys,
After your previous advice. I have been looking at some more OOP for my
application. Is this the sort of way a proper OOP application should be
constructed?

I want to use smarty as my template language as well, how could I integrate
that?

";

// get connections details
list($host, $username, $password, $type) = $details;

// connect to the database
if($connection = mysql_connect($host, $username, $password)) {

$this->raise_error();
}
}
}

class Login extends Database {

function Login() {

echo "Hello, I'm the Login class";

// connect to the database
$this->connect();
}
}

$c = new Database;
$c->connect();

Any pointers would be great :)

Cheers,
Jord
--
Jordan Elver
You don't have to be mad to work here, but you do have to be on time, well
presented, a team player, customer service focused and sober!! -- David
Brent
(The Office)


--
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] More OOP

2003-01-16 Thread Jordan Elver
Hi guys,
After your previous advice. I have been looking at some more OOP for my 
application. Is this the sort of way a proper OOP application should be 
constructed?

I want to use smarty as my template language as well, how could I integrate 
that?

";

// get connections details
list($host, $username, $password, $type) = $details;

// connect to the database
if($connection = mysql_connect($host, $username, $password)) {

$this->raise_error();
}
}
}

class Login extends Database {

function Login() {

echo "Hello, I'm the Login class";

// connect to the database
$this->connect();
}
}

$c = new Database;
$c->connect();

Any pointers would be great :)

Cheers,
Jord
-- 
Jordan Elver
You don't have to be mad to work here, but you do have to be on time, well 
presented, a team player, customer service focused and sober!! -- David Brent 
(The Office)


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




RE: [PHP] x12 837

2003-01-16 Thread Cal Evans
yea, mine is all array based.  I pull the data from a FoxPro table via XML
(and jump through several hoops.)  Then I have a main loop that spins
through the data (which is ordered) and

* creates a new PO if the PO number has changes (PO Object)
* Create a PoLineItem for each line in the PO (POLineItemObject)
* repeat.

* PO's own POLineItems
* All PO's are owned by the X12_850 object.

Once everything is nicely sliced and diced into objects I call
X12_850->generateX12(). This spits out all the necessary headers and then
calls generateX12() on each PO. Each PO spits out all the necessary headers
and then calls generateX12() on each POLine Item.  Then it spits out the
necessary trailers and bumps control back up the line.

Once it's finished, I have a (honkin' big) string that represents the 850
document. Currently, I dump this out to a file for ftping but you could just
as easily use CURL to call a SOAP process somewhere if your X12 partner had
a brain. (mine does not, the company I was a consultant for in the medical
insurance industry did not either)

Anyhow, I'm happy to share what I know if you have questions.

HTH,
=C=

*
* Cal Evans
* Stay plugged into your audience.
* http://www.christianperformer.com
* http://www.calevans.com
*


-Original Message-
From: Edward Peloke [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 3:55 PM
To: Php-General@Lists. Php. Net
Subject: RE: [PHP] x12 837


Cal,

You used php for this?  I am pretty sure that an 850 is on our list of
things to do somewhere.

Eddie

-Original Message-
From: Cal Evans [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 4:22 PM
To: Edward Peloke; Php-General@Lists. Php. Net
Subject: RE: [PHP] x12 837


I've created an 850 and a base class x12. It's not terribly hard. I did not
find much in the way of useful classes already built though.

=C=

*
* Cal Evans
* Stay plugged into your audience.
* http://www.christianperformer.com
*


-Original Message-
From: Edward Peloke [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 3:39 PM
To: Php-General@Lists. Php. Net
Subject: [PHP] x12 837


Ok, I know this is a longshot but does anyone on this list work in the
healthcare industry and have created an 837 with php?  I am thinking of
attempting to create one in php and didn't want to reinvent the wheel.

Thanks,
Eddie


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



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



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



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




RE: [PHP] x12 837

2003-01-16 Thread Edward Peloke
Cal,

You used php for this?  I am pretty sure that an 850 is on our list of
things to do somewhere.

Eddie

-Original Message-
From: Cal Evans [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 4:22 PM
To: Edward Peloke; Php-General@Lists. Php. Net
Subject: RE: [PHP] x12 837


I've created an 850 and a base class x12. It's not terribly hard. I did not
find much in the way of useful classes already built though.

=C=

*
* Cal Evans
* Stay plugged into your audience.
* http://www.christianperformer.com
*


-Original Message-
From: Edward Peloke [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 3:39 PM
To: Php-General@Lists. Php. Net
Subject: [PHP] x12 837


Ok, I know this is a longshot but does anyone on this list work in the
healthcare industry and have created an 837 with php?  I am thinking of
attempting to create one in php and didn't want to reinvent the wheel.

Thanks,
Eddie


--
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] x12 837

2003-01-16 Thread Edward Peloke
My company currently uses a tool that we wrote to do things like this
although we are looking for other options now to create the 837 claim so I
was thinking of attempting to create one using php.  The end result is just
a text file but it has tons of logic and loops when processing the data.

Eddie

-Original Message-
From: Edward Peloke [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 4:51 PM
To: Php-General@Lists. Php. Net
Subject: RE: [PHP] x12 837


I apologize, an 837 is a 'Professional Health Care Claim'.  Basically what
the healthcare organizations use to submit to the state to get money.  It
pulls in all sorts of data and generates a claim that is then submitted to
the state.

Eddie



-Original Message-
From: Marco Tabini [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 4:03 PM
To: Rodney Green
Cc: Edward Peloke; Php-General@Lists. Php. Net
Subject: Re: [PHP] x12 837


On Thu, 2003-01-16 at 16:10, Rodney Green wrote:
> Just curious. What is an 837?

I'm curious, too... what is it?

Not a good start, if you were hoping to get an answer eh? :-)))

Marco
--

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!


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



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



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




RE: [PHP] x12 837

2003-01-16 Thread Cal Evans
I've created an 850 and a base class x12. It's not terribly hard. I did not
find much in the way of useful classes already built though.

=C=

*
* Cal Evans
* Stay plugged into your audience.
* http://www.christianperformer.com
*


-Original Message-
From: Edward Peloke [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 3:39 PM
To: Php-General@Lists. Php. Net
Subject: [PHP] x12 837


Ok, I know this is a longshot but does anyone on this list work in the
healthcare industry and have created an 837 with php?  I am thinking of
attempting to create one in php and didn't want to reinvent the wheel.

Thanks,
Eddie


--
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] x12 837

2003-01-16 Thread Edward Peloke
I apologize, an 837 is a 'Professional Health Care Claim'.  Basically what
the healthcare organizations use to submit to the state to get money.  It
pulls in all sorts of data and generates a claim that is then submitted to
the state.

Eddie



-Original Message-
From: Marco Tabini [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 4:03 PM
To: Rodney Green
Cc: Edward Peloke; Php-General@Lists. Php. Net
Subject: Re: [PHP] x12 837


On Thu, 2003-01-16 at 16:10, Rodney Green wrote:
> Just curious. What is an 837?

I'm curious, too... what is it?

Not a good start, if you were hoping to get an answer eh? :-)))

Marco
--

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!


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



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




Re: [PHP] x12 837

2003-01-16 Thread Paul Marinas
:)))

Paul Marinas
Technical Support
RDS Craiova


Phone:  +402-51-410-194
Mobile: +407-22-451-439
Fax:+402-51-416-579
www.rdsnet.ro
.

Privileged/Confidential Information may be contained in this message. If you
are not the addressee indicated in this
message (or responsible for delivery of the message to such person), you may
not copy or deliver this message to
anyone. In such a case, you should destroy this message and kindly notify
the sender by reply e-mail.

On Thu, 16 Jan 2003, Marco Tabini wrote:

> On Thu, 2003-01-16 at 16:10, Rodney Green wrote:
> > Just curious. What is an 837?
>
> I'm curious, too... what is it?
>
> Not a good start, if you were hoping to get an answer eh? :-)))
>
> Marco
> --
> 
> php|architect - The Monthly Magazine for PHP Professionals
> Come check us out on the web at http://www.phparch.com!
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

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




Re: [PHP] x12 837

2003-01-16 Thread Marco Tabini
On Thu, 2003-01-16 at 16:10, Rodney Green wrote:
> Just curious. What is an 837?

I'm curious, too... what is it?

Not a good start, if you were hoping to get an answer eh? :-)))

Marco
-- 

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!


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




Re: [PHP] x12 837

2003-01-16 Thread Rodney Green
: Ok, I know this is a longshot but does anyone on this list work in
the
: healthcare industry and have created an 837 with php?  I am thinking
of
: attempting to create one in php and didn't want to reinvent the
wheel.

Just curious. What is an 837?




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




[PHP] x12 837

2003-01-16 Thread Edward Peloke
Ok, I know this is a longshot but does anyone on this list work in the
healthcare industry and have created an 837 with php?  I am thinking of
attempting to create one in php and didn't want to reinvent the wheel.

Thanks,
Eddie


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




Re: [PHP] get the $email string

2003-01-16 Thread Steve Edberg
At 5:04 PM + 1/16/03, Miguel Br·s wrote:

Hi,

i made a page to display some user details and then clicking on the user
name it goes to another page to send a mail via mail() function.

here is the line of the first page
name;
?>

when click on user name, it goes to the mail_active.php?[EMAIL PROTECTED]

on the mail_active.php page, how do I get the e-mail address to send?
I mean, the mail function is mail ("$to","$subject","$message","From:
$sender");
How can I take the $to string to be [EMAIL PROTECTED]?



IN this case you could use

	mail ($_GET['email'],"$subject","$message","From:$sender");
or
	mail ($_REQUEST['email'],"$subject","$message","From:$sender");

See
	http://www.php.net/manual/en/language.variables.external.php

for more information on variable handling.

Also keep in mind that the script as you've shown it is looks very
insecure; anybody, including joe-spammer, could send mails to people
simply by calling your URL

	http://your.domain/mail_active.php?[EMAIL PROTECTED]

It's best to pass some sort of obscure ID instead of the data. I
would check out the use of sessions here:

	http://www.php.net/manual/en/ref.session.php

-steve


--
++
| Steve Edberg  [EMAIL PROTECTED] |
| University of California, Davis  (530)754-9127 |
| Programming/Database/SysAdmin   http://pgfsun.ucdavis.edu/ |
++
| SETI@Home: 1001 Work units on 23 oct 2002  |
| 3.152 years CPU time, 3.142 years SETI user... and STILL no aliens...  |
++

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




[PHP] Session Length

2003-01-16 Thread Pushpinder Singh Garcha
Hello Everyone:

I am using Sessions to secure parts of my website. I need to know if 
there is a way to set a lifetime for these sessions , so that they are 
automatically destroyed when say the user is inactive for 30 minutes.

Any help will be greatly appreciated. Thanks in advance

Pushpinder Singh


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



[PHP] PHP and PDF Forms

2003-01-16 Thread ed

 Anyone have some good examples of using PDF forms and parsing the form
using PHP? I've done some searching (ala google and manual) but all they
seem to mention is parsing a .fdf file. Seemingly when you use a PDF form
and set the action to a php script a file is still generated on the client
machine in the temp directory that inserts the context of the action taken
by the script it's sending the form data to. 

 For instance, I set a pdf form to pass the form data to a file called
pdfform.php on my server. The pdfform.php file parses the data then stores
it in a database. This works. From there the pdfform.php script sends the
user to my homepage. What happens from here is the page comes up but is
being called by a file on the local machine. The file po3426.html located
in my temp directory is actually made up of the source code for my
homepage. All I really want to do is yuse the data from the form and
continue on with my script. How do I go about that?

TIA,

Ed



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




[PHP] Re: session_destroy have strange effect....

2003-01-16 Thread Scott Fletcher
Oh never mind.  I found a work around to it.  I can use the passthru
command.  Like this...

--clip--
passthru("rm -f /tmp/sess_*")
--clip--

"Scott Fletcher" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> session_destroy() do work when I logged out of the website.  But if I'm
> logged in and open a 2nd browser and try to log in.  This where the script
I
> use to detect exisitng session and destroy it before generating a new one.
> Problem is that session_destroy does not work on the 2nd browser...
>
> So, my question is what is the workaround to using session_destroy() 
> How do I unset it  Etc
>
> I tried this one but it had no effect if I'm the 2nd user...
>
> ---
>
> $_SESSION = array();
> session_destroy();
>
> ---
>
>



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




[PHP] Re: Security in included PHP files

2003-01-16 Thread Jacob Copsey
This should work as long as you are only including your include files from
scripts named index.php.

--Jacob


"Philippe Saladin" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > directly. My main question is if all of the code inside an included PHP
> file
> > is put inside one or more functions this should prevent anyone from
> running
> > any of that code by directly calling that PHP file correct? There is no
> way
> > for them to invoke a function just from a URL assuming I have no code at
> all
> > outside the functions.
> Just a small tip : to be *sure* that no one runs directly my included
files,
> they begin with
>
> if (basename($_ENV["SCRIPT_NAME"]) != 'index.php') {
>  // redirection
> }
>
> So, even if the code is not in a function or class, I'm safe.
> Am I wrong or do you think it could be ok?
> Regards,
> Philippe
>
>



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




Re: [PHP] HTTP_REFERER work without a problem....

2003-01-16 Thread Scott Fletcher
IP address is not an effective solution.  Anyone can use a 2nd browser on
the same machine.  Also, if for a company with 1000 machine behind the
firewall, they all get one and the same IP address outside the firewall.


"Kevin Stone" <[EMAIL PROTECTED]> wrote in message
00a701c2bcdd$316349a0$6601a8c0@kevin">news:00a701c2bcdd$316349a0$6601a8c0@kevin...
> You can never fully rely on any information given to you by the browser.
> You can't rely it being accurate or even being there at all.  What I
suggest
> to you is code a solution around the IP address.  The IP address of
course,
> like any information coming from the client, can be tampered with but more
> than likely it's not going to change while the user is browsing your
> website.  Right?  So you just use it as a temporary ID.  Log the IP to the
> database, track the IP's movements on your website, log those actions to a
> database.  That's the best way to do it without having to force the user
to
> login.  If you're concerned about people browsing from network IP then
code
> a solution using Sessions and track the session id.  And finally if you
need
> to know that a client has 'returned' to your website set a cookie on their
> computer.  I'm sure you'll find ways to elaborate from there.  You can do
> all of this without requiring the user to "login".
> -Kevin
>
> - Original Message -
> From: "Scott Fletcher" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, January 15, 2003 2:07 PM
> Subject: Re: [PHP] HTTP_REFERER work without a problem
>
>
> > It's not a PHP bug.  Many PHP programmer tried to their best to use
> > HTTP_REFERER so they can keep track of which webpages on the current
> website
> > did the user last visited.  That way, they can keep out the unauthorized
> > access to the website without first logging in to the website.
> >
> > Well, my company's website use both SSL and Session ID.  They are good
for
> > starter but they aren't any secure if anyone can make a direct access
> > without logging in.  That's where I use HTTP_REFERER to see what last
page
> > did he or she visited, if the last page being visited is outside of my
> > company's website then php moved the end user to the login page.  It is
> > pretty effective.
> >
> > The common problem with the browsers is that they aren't compactible so
> > HTTP_REFERER don't alway work right and sometime return a blank if those
> > three are being used.  I had been observing it for a few years.  Those
> three
> > are  1) HierMenus, 2) location.replace('') and 3) location.href=''.
When
> > either one of these are in use, some browsers return with a blank in
> > HTTP_REFERER.
> >
> > Cheers
> >
> > "Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > --- Scott Fletcher <[EMAIL PROTECTED]> wrote:
> > > > Here's what I found so interesting
> > > >
> > > > This code, $_SERVER['HTTP_REFERER'] have worked without a
> > > > problem when I use the latest Mozilla build. It even work
> > > > with the HierMenus,
> > > location.replace('http://whatever.com'),
> > > > and location.href = http://whatever.com...
> > > >
> > > > This is a good news for PHP everywhere.
> > > >
> > > > Unfortunately, Internet Explorer still have this
> > > > bug...
> > >
> > > What bug is that?
> > >
> > > Is there a question here somewhere? I think I am having a
> > > hard time interpreting it.
> > >
> > > Chris
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>



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




[PHP] session_destroy have strange effect....

2003-01-16 Thread Scott Fletcher
session_destroy() do work when I logged out of the website.  But if I'm
logged in and open a 2nd browser and try to log in.  This where the script I
use to detect exisitng session and destroy it before generating a new one.
Problem is that session_destroy does not work on the 2nd browser...

So, my question is what is the workaround to using session_destroy() 
How do I unset it  Etc

I tried this one but it had no effect if I'm the 2nd user...

---

$_SESSION = array();
session_destroy();

---



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




[PHP] Set element closeness measure

2003-01-16 Thread typea
Give about 1 MILLION sets of 1 to ~20 integers such as:

(15, 42, 57, 314, 1024)

I need to be able to compare any two sets and determine if any of their
elements are within, say, 20 of each other.

Example:

(10, 100, 1000) CLOSETO (50, 150, 1050) ==> FALSE
(10, 100, 1000) CLOSETO (15, 150, 1050) ==> TRUE   [abs(15 - 10) < 20]
(10, 100, 1000) CLOSETO (115, 1050) ==> TRUE   [abs(115 - 110) < 20]

The sets are actually ordered sets, monotonicly increasing, if that helps.

Each set has another 36 bytes of associated data, of which 32 (two int4)
can be composed for a unique ID.  Or I could just assign an ID to each
one.

I could, of course, create a table of about 10 MILLION rows and be
searching through that...  But my gut says there should be an easier way.

I've look at the ~/contrib/array and even considered converting each set
to a built-in "path" datatype -- But neither of those seems to provide a
"any_vertex_near" function for comparing two objects.

Any ideas?...




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




[PHP] List items in table with a hypertext link

2003-01-16 Thread Mike Tuller
I have been looking for an example of how to create a listing of items 
in a table where you have the first item in the list have a link so 
that when you click on it, it will open a page for editing the contents 
of that item. So for instance you have a list of employees, and you 
want to change their phone number you could go to the list and click on 
the employee id number and it would open a page where you can edit the 
employee information.

I haven't been able to find a good example of this, so if anyone knows 
where I could find one, please let me know.

Mike


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



RE: [PHP] Imagecreatefromjpeg()

2003-01-16 Thread Matt Schroebel
> 
>  Header("Content-type: image/jpeg");
> $im = ImageCreateFromJpeg('1234_1.jpg');
> ImageJpeg($im);?>
> 
>   The file is in the folder, it has execute and write
> permissions set, and the error given is "The image
> cannot be displayed, because it contains errors.",
> which is not very useful.  Anyone have any suggestions?

Comment out the header statement and see if gd tells you anything.

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




[PHP] Re: Fw: HTTP_REFERER work without a problem....

2003-01-16 Thread Joel Boonstra
On Wed, 15 Jan 2003, Kevin Stone wrote:
> Chris I appreciate your response but please read my post again.  I did not
> suggest using the IP for user identification.  I suggested using it as a
> temporary id.  I went on further to suggest to use sessions to identify
> individual users behind a proxy server.

But he also mentioned a round-robin proxy messing things up.  I've had
personal experience with IP addresses from AOL clients changing with
each new connection.  If your AOL users click through your site a few
times, it's possible that their IP address will change between those
clicks, thus making even a temporary id based on the IP address
unreliable, and perhaps frustrating if your site keeps 'forgetting'
things about the user.

Joel

-- 
[ joel boonstra | [EMAIL PROTECTED] ]


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




[PHP] Imagecreatefromjpeg()

2003-01-16 Thread Sara Keesler
Hi,

  I've seen this bounced around on the archives a bit,
but none of the advice on there is working for me.
I'm trying to do something very simple:



  The file is in the folder, it has execute and write
permissions set, and the error given is "The image
cannot be displayed, because it contains errors.",
which is not very useful.  Anyone have any suggestions?

Thanks,
Sara Keesler


[PHP] Passing Arrays Through Forms

2003-01-16 Thread @ Nilaab
Hello Everyone,

I've attempted this many times, but have failed to understand it each time.
I want to make it easier for myself to deal with passing variables through a
form. So I thought, why not use a single array variable to do that. If I do
such a thing, what steps do I need to take to ensure that the values in the
array are intact just as the user entered it? How do I serialize array data
from an initial form? Here's a simple example of what I might have:


   
   
   
   
   
   


Now, how do I ensure that the values in the associated array, that will be
sent over to some_page.php, are the values entered by the user? How do I
serialize this array from this form? Or if I cannot do that, what other
steps do I need to take to ensure the preservation of the values passed to
another page as an array?


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




[PHP] mail via php. 2 questions...

2003-01-16 Thread Øystein Håland
The first problem I cannot solve on my own:
I get the mail content from a cookie. Quite a big cookie since it is a
collection of 30 - 40 form values from another page. When recieving the
mail, the content come in ONE long string, and in some places with a \.
Of course, i dont want this to be printed (but I want the function, a line
break). So, how can I get a line break in my javascript cookie (yeah, I have
already tried \n).
The second problem:
I want the mail to be sent automatically when the visitor have filled in all
the forms in the document and goes to the next document.



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




Re: [PHP] Re: Ever complained about lousy PHP programmers?

2003-01-16 Thread Peter Hutnick
Leon Mergen said:

> Now, first of all, why did you this:
>
> "); ?>
>
> and not just:
>
> 

Because short tags are evil ;-)  My provider has short tags enabled, so
there is no getting around this bit of ugliness.

> only that I personally prefer to call a print() statement for
> everything

Do you mean as opposed to echo?

If so, would you mind saying a few word as to why?

I read that echo is a "language construct."  It seems like it would be
preferable to print() for this reason.  On top of that, it will take
multiple strings as input.  I think I will remove the parentheses, though.

-Peter



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




[PHP] Any "Web Application Development Studio" available?

2003-01-16 Thread Steve Magruder
I realize that Zend produces a PHP development studio, but I'm looking for
something that helps the programmer use PHP (along with Javascript, CSS,
"web GUI" languages, etc.) to develop enterprise web _applications_ (like
for production data entry).  I'd also like this studio to make available a
set of UI widgets like that found in common Windows IDEs, and further make
it easy to utilize J2EE objects (including EJB's) within an application
design.  As an added bonus, I'd like something that produces apps that work
across many different "brands" of browsers, although that's probably not
absolutely necessary for my requirements.

Any ideas?

Regards,
  Steve



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




[PHP] Re: Ever complained about lousy PHP programmers?

2003-01-16 Thread Leon Mergen

"Peter Hutnick" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm soliciting comments on style, technique, etc.  Be brutal, but don't
> get your feelings hurt if I don't take your comments as gospel.
> References will help me take comments to heart.

Heck, I don't have anything better to do at the moment anyway. All I can say
in first, I will not judge your style - it's all up to you.

Now, first of all, why did you this:

"); ?>

and not just:



? Less parsing for PHP :P

But other than that, I couldn't find anything very wrong about it... only
that I personally prefer to call a print() statement for everything, and
don't use PHP as an embedded language but just as a normal programming
language... But that's just me :P

Hope this helps you a little bit...

Regards,

Leon Mergen
http://www.antrophia.com/




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




RE: [PHP] Re: get the $email string

2003-01-16 Thread Brian T. Allen
Hi,

If you have a URL like:
http://www.whatever.com/page.php?[EMAIL PROTECTED]

Then in your script $email will already be set to "[EMAIL PROTECTED]".

This depends on register_globals being on, if I remember correctly, and
you'll want to be aware of the order for variable assignment (for POST,
GET, cookie, and session variables).

Thanks,
Brian Allen


> -Original Message-
> From: Rafael Rodrigo - NSI [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, January 16, 2003 12:03 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: get the $email string
> 
> 
> I don't know how do you get this answer, but try this:
> name;
> ?>
> 
> Rafael Rodrigo
> 
> > Hi,
> >
> > i made a page to display some user details and then 
> clicking on the user
> > name it goes to another page to send a mail via mail() function.
> >
> > here is the line of the first page
> >  > color="#808080"> echo $row->name;
> > ?>
> >
> > when click on user name, it goes to the 
> mail_active.php?[EMAIL PROTECTED]
> >
> > on the mail_active.php page, how do I get the e-mail 
> address to send?
> > I mean, the mail function is mail 
> ("$to","$subject","$message","From:
> > $sender");
> > How can I take the $to string to be [EMAIL PROTECTED]?
> >
> > 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] Apache 2.0.43 and PHP 4.3.0 on Windows - Problems

2003-01-16 Thread Beauford.2002
Here we go again.

I installed Apache and it works fine, I then installed PHP and all tests
show it works fine - but when I try to get the PHP modules loaded for Apache
in httpd.conf, the Apache server won't start again. The only error I get is
a Windows error box that says "The requested operation has failed". The
event viewer shows:

The Apache service named reported the following error:
>>> Cannot load E:/Apache2/bin/php4apache.dll into server. The specified
module could not be found.

Well, the file(s) are in the appropriate place(s) as outlined in the PHP
install guide (below). So I'm at a loss as to where to go next. This is a
perfect testement as to why not to use Windows.I guess I am just a
sucker for punishment.
Any help is appreciated.

TIA

  Installing PHP for Apache as module
  ~~~

  Now that version 4.1 introduces a safer sapi module, we recommend
  that you configure PHP as a module in Apache.

  To accomplish this, you have to load the php4apache.dll in your
  Apache httpd.conf.

  !! NOTE !!
  Whereever you load php4apache.dll from, php4apache.dll also
  needs the php4ts.dll also included in the PHP4 distribution.
  php4apache.dll depends on php4ts.dll which is loaded as soon as
  Apache loads php4apache.dll. If php4ts.dll can't be found, you
  usually get an error like (also see the "Problems?" section at
  the end of the file):

Cannot load c:/php/sapi/php4apache.dll into server

  So where does php4ts.dll has to be to be properly loaded ?
  php4ts.dll is searched in the following order:

  1) in the directory where apache.exe is start from
  2) in the directory where php4apache.dll is loaded from
  3) in your %SYSTEMROOT%\System32, %SYSTEMROOT%\system and
 %SYSTEMROOT% directory.
 Note: %SYSTEMROOT%\System32 only applies to Windows NT/2000/XP)
  4) in your whole %PATH%

  Note: What is %SYSTEMROOT% ? Depending on your Windows
installation this may be for example c:\winnt or C:\windows

  Usually you would just copy it over to %SYSTEMROOT%\System32.
  But if you want to have multiple PHP installations (for
  whatever reason) this is a bad idea. For this circumstance the
  safest thing is to let php4ts.dll reside in the same directory
  where php4apache.dll is loaded from (see point 2 above).


  After you've set up the file layout properly, you're ready to
  finally configure Apache to load the PHP4 module. Just add the
  following lines to your httpd.conf:

   LoadModule php4_module c:/php/sapi/php4apache.dll
   AddModule mod_php4.c
   AddType application/x-httpd-php .php

  Note: Especially newer versions of Apache do not need the
AddModule directive anymore, your milage may vary.


  Where do I have to put the php.ini ?
   The php.ini files is only searched in two places:
   1) in your Apache installation directory (e.g. c:\apache\apache)
   2) in your %SYSTEMROOT% directory.



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




[PHP] Re: get the $email string

2003-01-16 Thread Rafael Rodrigo - NSI
I don't know how do you get this answer, but try this:
name;
?>

Rafael Rodrigo

> Hi,
>
> i made a page to display some user details and then clicking on the user
> name it goes to another page to send a mail via mail() function.
>
> here is the line of the first page
>  color="#808080">name;
> ?>
>
> when click on user name, it goes to the mail_active.php?[EMAIL PROTECTED]
>
> on the mail_active.php page, how do I get the e-mail address to send?
> I mean, the mail function is mail ("$to","$subject","$message","From:
> $sender");
> How can I take the $to string to be [EMAIL PROTECTED]?
>
> Miguel
>
>



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




Re: [PHP] OOP

2003-01-16 Thread Jordan Elver
Thanks John,

> Inheriting would probably be the most modular.

I thought this would be the way to go. Ill need to read up on this.

> > I haven't found any clear examples of this kind of OOP, only the real
> > basics
> > (which I still need help with by the way :) ).
>
> Use google. Do some more studying before you try to tackle this, or look
> on phpclasses.org for some examples.
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/

Nice work on php archittect by the way :)
Thanks again,
Jordan
-- 
Jordan Elver
The office is like an army, and I'm the field general. You're my footsoldiers 
and customer quality is the WAR!!! -- David Brent (The Office)


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




Re: [PHP] OOP

2003-01-16 Thread Jordan Elver
Thanks Greg,
I know a bit of PHP but the OOP is a bit harder to understand I think :)
I'll check out the PEAR classes.

Cheers,
Jordan

On Thursday 16 Jan 2003 12:25 am, Greg Beaver wrote:
> Hi Jordan,
>
> If you are doing this to learn PHP, that is great, keep plugging.  If you
> want to see working examples of the things you've described, there are a
> number of scripts out there, both in pear (pear.php.net) and at other
> repositories like phpbuilder.com and phpclasses.org.  You would benefit
> from examining how other authors have solved the same problems even if you
> are simply trying to learn php
>
> Take care,
> Greg

-- 
Jordan Elver
Statistics are like a lamp-post to a drunken man - more for leaning on than 
illumination. -- David Brent (The Office)


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




RE: [PHP] Adding HTTP URL Code

2003-01-16 Thread ELLIOTT,KATHERINE A (HP-FtCollins,ex1)
Thanks for all your help with my URL code problem!

I have come up with a solution that seems to half work and I can't
figure out what I need to do to get it fully functional.  Given my
data string (text) from my database, this is what I do to replace the
URL text with a functioning link.  I am asking folks that, if they 
include a URL in their results to surround it by [] so that I can search
for the brackets.  This is what my text replace line looks like:

$data_str = eregi_replace ("(\[http://)([^]]*)", "\\0", $data_str);

So, if the URL is (for example) [http://www.cleanrun.com] (in plain text),
it will show up for viewing in my browser as http://www.cleanrun.com
but the URL associated with it will be that of the directory in the browser
"Location" (i.e. http://wrong.url.com/Test_Results).

I've tried all sorts of things with the call to eregi_replace but can't
figure out what is going on.

What the hec???  Can someone help?

Many thanks!!

Katherine Elliott

-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 08, 2003 2:05 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Adding HTTP URL Code


On Thursday 09 January 2003 04:07, ELLIOTT,KATHERINE A (HP-FtCollins,ex1) 
wrote:
> OK, so I've gotten NO responses to my query below so I
> thought I'd ask for something slightly different and see what
> I get.

With regards to your original query, the answer is in the archives. Try 
searching for something like "regex url" or "regex hyperlink" etc.


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

/*
NOTICE: alloc: /dev/null: filesystem full
*/


-- 
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] Strange behavior on backtick operator execution environment

2003-01-16 Thread Jason Wong
On Friday 17 January 2003 01:37, Marc Cluet wrote:
> Hi guys
> I have upgraded from PHP 4.2.2 to PHP 4.3.0 and some of my php script
> got broken due to that.
> This scripts use backticks to execute functions, the problem is the
> environment where that functions are executed.
>
> I have this test code:
>  $dir=`pwd`;
> echo "I am on directory: $dir";
> ?>
>
> If I execute this code using PHP 4.2.2 I get this result:
>
> root@test:/root# php /var/www/html/test.php
> I am on directory: /var/www/html
>
> If I execute this code using PHP 4.3.0 I get this different result:
> root@test:/root# php /var/www/html/test.php
> I am on directory: /root
>
> I have not touched php.ini from one version to the other (I'm still
> using my one), I'm with safe_mode = Off so it should not affect this.
>
> Anybody have a clue about if this is a bug or is a feature of the new
> version? I'm really confused about it.

You're probably using the CLI version of PHP (which is built by default 
starting with 4.3) as opposed to the earlier CGI versions.

  manual > "Using PHP from the command line" 

tells you the differences between CLI and CGI, one of them being "it does not 
change the working directory to that of the script".


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

/*
Can you buy friendship?  You not only can, you must.  It's the
only way to obtain friends.  Everything worthwhile has a price.
-- Robert J. Ringer
*/


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




RE: [PHP] Redirecting - here is the code

2003-01-16 Thread Marios Adamantopoulos
I think your problem is with the  tag
 <--
header

Also I'm not sure but the 
might cause problems too

Try the if statement at the top of the document.

One more thing. I think that you can't add header info after , but I'm
not sure about this.

What I usually use for redirection is something like:
(a page after the LOGIN page that check for correct/incorrect logins)

top.location=\"cms_home.php\"

";
// IF NOT (you can display HTML here instead of redirecting)
} else {
echo"

top.location=\"cms_index.php\"

";
 }
?>  

I hope that helps

Mario
_
Marios Adamantopoulos
Senior Developer

Tonic
+44 (0)20 7691 2227
+44 (0)7970 428 372
www.tonic.co.uk

Recent projects
www.polydor.co.uk
www.adcecreative.org
www.sony-europe.com/pocketlife


Opinions, conclusions and other information in this message that do not
relate to the official business of Tonic Design Limited shall be
understood as neither given nor endorsed by them.




-Original Message-
From: Denis L. Menezes [mailto:[EMAIL PROTECTED]] 
Sent: 16 January 2003 17:07
To: PHP general list
Subject: [PHP] Redirecting - here is the code


I tried. But I get an error as follows :

Warning: Cannot add header information - headers already sent by (output
started at /usr/local/www/virtual2/66/175/19/84/html/maintenance.php:11) in
/usr/local/www/virtual2/66/175/19/84/html/maintenance.php on line 30

My code is as follows:

 
 Untitled Document   

  

  Site
maintenance page\n";
 }
 $sql="SELECT AdminFirstName,AdminLoginId,AdminPassword FROM Administrators
where
  AdminLoginId = '$AdminLoginId' and AdminPassword ='$AdminPassword'";
  if ($result=mysql_query($sql)) {
   $numofrows=mysql_num_rows($result);
if ($numofrows==0){
 header("Location: http://www.php-faq.com/";);
Print "We are
sorry.";
}
  if ($numofrows==1){
 Print "Welcome
".$AdminFirstName."";
}
 if ($numofrows>1){
 Print "Something wrong";
 }
 while($row=mysql_fetch_array($result)){
 Print"$row[AdminFirstName]";
 }

 }
 ?>
  





Unquote.

Line no. 30 is the one with the line : header("Location:
http://www.php-faq.com/";);

Can you please tell me what is wrong?

thanks
denis



Re: [PHP] Redirecting - here is the code

2003-01-16 Thread Joci
Hi!

>From manual (http://www.php.net/manual/en/function.header.php):
Remember that header() must be called before any actual output is sent,
either by normal HTML tags, blank linek in a file, or from PHP.
You need to start with header()...

Example:
http://www.example.com/');
?>


or you can use ob_start and ob_end_flush();

Best Regards

- Original Message -
From: "Denis L. Menezes" <[EMAIL PROTECTED]>
To: "PHP general list" <[EMAIL PROTECTED]>
Sent: Thursday, January 16, 2003 6:07 PM
Subject: [PHP] Redirecting - here is the code


I tried. But I get an error as follows :

Warning: Cannot add header information - headers already sent by (output
started at /usr/local/www/virtual2/66/175/19/84/html/maintenance.php:11) in
/usr/local/www/virtual2/66/175/19/84/html/maintenance.php on line 30

My code is as follows:




Untitled Document




  

  Site
maintenance page\n";
 }
 $sql="SELECT AdminFirstName,AdminLoginId,AdminPassword FROM Administrators
where
  AdminLoginId = '$AdminLoginId' and AdminPassword ='$AdminPassword'";
  if ($result=mysql_query($sql)) {
   $numofrows=mysql_num_rows($result);
if ($numofrows==0){
 header("Location: http://www.php-faq.com/";);
Print "We are
sorry.";
}
  if ($numofrows==1){
 Print "Welcome
".$AdminFirstName."";
}
 if ($numofrows>1){
 Print "Something wrong";
 }
 while($row=mysql_fetch_array($result)){
 Print"$row[AdminFirstName]";
 }

 }
 ?>
  





Unquote.

Line no. 30 is the one with the line : header("Location:
http://www.php-faq.com/";);

Can you please tell me what is wrong?

thanks
denis



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




Re: [PHP] Redirecting - here is the code

2003-01-16 Thread Mike Morton
You cannot have ANY output b4 sending a header unless you are buffering your
output.  In your example you are sending HTML before your redirect - the
redirect has to happen before you do any kind of HTML or any characters that
would get output to the browser.

On 1/16/03 12:40 PM, "Denis L. Menezes" <[EMAIL PROTECTED]> wrote:

> I ahve tried everything jason. It says that there should be no output before
> the header().
> 
> I cannot still find the error. Can you please help in locating the error?
> 
> thanks
> Denis
> - Original Message -
> From: "Jason Wong" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, January 17, 2003 1:10 AM
> Subject: Re: [PHP] Redirecting - here is the code
> 
> 
>> On Friday 17 January 2003 01:07, Denis L. Menezes wrote:
>>> I tried. But I get an error as follows :
>>> 
>>> Warning: Cannot add header information - headers already sent by (output
>> 
>> Try searching the archives on the above error.
>> 
>> --
>> Jason Wong -> Gremlins Associates -> www.gremlins.biz
>> Open Source Software Systems Integrators
>> * Web Design & Hosting * Internet & Intranet Applications Development *
>> 
>> /*
>> Stenderup's Law:
>> The sooner you fall behind, the more time you will have to catch up.
>> */
>> 
>> 
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--
Cheers

Mike Morton


*
*  E-Commerce for Small Business
*  http://www.dxstorm.com
*
* DXSTORM.COM
* 824 Winston Churchill Blvd,
* Oakville, ON, CA L6J 7X2
* Tel: 905-842-8262
* Fax: 905-842-3255
* Toll Free: 1-877-397-8676
*


"Indeed, it would not be an exaggeration to describe the history of the
computer industry for the past decade as a massive effort to keep up with
Apple."
- Byte Magazine

Given infinite time, 100 monkeys could type out the complete works of
Shakespeare. Win 98 source code? Eight monkeys, five minutes.
-- NullGrey 


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




[PHP] imageCreate() error

2003-01-16 Thread Ed
I'm running PHP 4.3 and W2k with IIS 5.0.  I have enabled php_gd and it does
show up when I do a phpinfo.  The php_gd.dll is in the winnt/system32
directory (I've also tried it in almost every other directory too) and I get
these error messages:

Cannot add header information - headers already sent by (output started at
C:\Inetpub\wwwroot\template\index.php:1) in
C:\Inetpub\wwwroot\template\index.php on line 3

Fatal error:  Call to undefined function:  imagecreate() in
C:\Inetpub\wwwroot\template\index.php on line 4

Here's the code:

Any help would be appreciated.



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




Re: [PHP] Redirecting - here is the code

2003-01-16 Thread Denis L. Menezes
I ahve tried everything jason. It says that there should be no output before
the header().

I cannot still find the error. Can you please help in locating the error?

thanks
Denis
- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, January 17, 2003 1:10 AM
Subject: Re: [PHP] Redirecting - here is the code


> On Friday 17 January 2003 01:07, Denis L. Menezes wrote:
> > I tried. But I get an error as follows :
> >
> > Warning: Cannot add header information - headers already sent by (output
>
> Try searching the archives on the above error.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> Stenderup's Law:
> The sooner you fall behind, the more time you will have to catch up.
> */
>
>
> --
> 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] Strange behavior on backtick operator execution environment

2003-01-16 Thread Marc Cluet
Hi guys
I have upgraded from PHP 4.2.2 to PHP 4.3.0 and some of my php script 
got broken due to that.
This scripts use backticks to execute functions, the problem is the 
environment where that functions are executed.

I have this test code:

$dir=`pwd`;
echo "I am on directory: $dir";
?>

If I execute this code using PHP 4.2.2 I get this result:

root@test:/root# php /var/www/html/test.php
I am on directory: /var/www/html

If I execute this code using PHP 4.3.0 I get this different result:
root@test:/root# php /var/www/html/test.php
I am on directory: /root

I have not touched php.ini from one version to the other (I'm still 
using my one), I'm with safe_mode = Off so it should not affect this.

Anybody have a clue about if this is a bug or is a feature of the new 
version? I'm really confused about it.

Best Regards



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



RE: [PHP] Re: Images : Store in dB or disk?

2003-01-16 Thread Daniel Kushner
You must remember that Images are embedded in HTML using the  tag. Each
image displayed on a Webpage is a result of a seperate HTTP request to the
server; i.e. a PHP call in this case. Unless you are cache the SQL result,
at least one query is needed per image.

Regards,
Daniel Kushner
_
Need hosting? http://thehostingcompany.us


> -Original Message-
> From: Bobby Patel [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 16, 2003 12:34 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: Images : Store in dB or disk?
>
>
> With regards to Marek,
> I don't see how there would be two queries, because there row conisists of
> image properties and image data. So when i select the required row(s), I
> will have properties and images. So it will be 1 query, of course it is a
> big (size-wise) query.
>
> With regards to Jason,
> Your approach is reasonable. I guess I will have to judge for myself!
>
>
>
> "Bobby Patel" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hello,
> > I have the Images table setup with columns (width, height, size, type,
> > etc...) the question is should I have the image data stored in
> this table
> or
> > disk?
> >
> > I know, alot of people have said it is faster in disk, which is 1 page
> I/O.
> > But I need these images for displaying product pages, and I believe that
> it
> > would be faster to just pluck the properties from the dB (including the
> > image file) .
> >
> > Usually I will need to pull 6 or 10 images per page, this is my rational
> for
> > this situation:
> >
> > If all stored on db:
> > One query  - will take about 4-5 page I/O (assumiing index on filename)
> >
> > If just properties stored on dB and image on disk:
> > One query to grab the rows of properties - 2-3 page I/O
> > to grab 6 or 10 images - 6 or 10 page I/O
> > Total - 8 - 13 Page I/O's
> >
> > If all images stored on disk, no dB whatso ever:
> > to grab 6 or 10 images - 6 or 10 page I/O
> > cpu time to run getimagesize()  for each image - CPU time unknown?
> >
> > I assume that "page I/O" is that same as "disk access".
> >
> > I AGREE that storing images strored on disk is a valid approach PROVIDED
> > that you only need 1 image per page, but if you need to grab a
> bunch at a
> > time, I do beleieve that storing the actual file on the dB is faster.
> >
> > I would like to hear from the list, of people that have worked
> with images
> > and PHP. I just started with images, so I just want to take the right
> path.
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


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




[PHP] Re: Images : Store in dB or disk?

2003-01-16 Thread Bobby Patel
With regards to Marek,
I don't see how there would be two queries, because there row conisists of
image properties and image data. So when i select the required row(s), I
will have properties and images. So it will be 1 query, of course it is a
big (size-wise) query.

With regards to Jason,
Your approach is reasonable. I guess I will have to judge for myself!



"Bobby Patel" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello,
> I have the Images table setup with columns (width, height, size, type,
> etc...) the question is should I have the image data stored in this table
or
> disk?
>
> I know, alot of people have said it is faster in disk, which is 1 page
I/O.
> But I need these images for displaying product pages, and I believe that
it
> would be faster to just pluck the properties from the dB (including the
> image file) .
>
> Usually I will need to pull 6 or 10 images per page, this is my rational
for
> this situation:
>
> If all stored on db:
> One query  - will take about 4-5 page I/O (assumiing index on filename)
>
> If just properties stored on dB and image on disk:
> One query to grab the rows of properties - 2-3 page I/O
> to grab 6 or 10 images - 6 or 10 page I/O
> Total - 8 - 13 Page I/O's
>
> If all images stored on disk, no dB whatso ever:
> to grab 6 or 10 images - 6 or 10 page I/O
> cpu time to run getimagesize()  for each image - CPU time unknown?
>
> I assume that "page I/O" is that same as "disk access".
>
> I AGREE that storing images strored on disk is a valid approach PROVIDED
> that you only need 1 image per page, but if you need to grab a bunch at a
> time, I do beleieve that storing the actual file on the dB is faster.
>
> I would like to hear from the list, of people that have worked with images
> and PHP. I just started with images, so I just want to take the right
path.
>
>



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




Re: [PHP] Redirecting - here is the code

2003-01-16 Thread Jason Wong
On Friday 17 January 2003 01:07, Denis L. Menezes wrote:
> I tried. But I get an error as follows :
>
> Warning: Cannot add header information - headers already sent by (output

Try searching the archives on the above error.

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

/*
Stenderup's Law:
The sooner you fall behind, the more time you will have to catch up.
*/


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




[PHP] Redirecting - here is the code

2003-01-16 Thread Denis L. Menezes
I tried. But I get an error as follows :

Warning: Cannot add header information - headers already sent by (output
started at /usr/local/www/virtual2/66/175/19/84/html/maintenance.php:11) in
/usr/local/www/virtual2/66/175/19/84/html/maintenance.php on line 30

My code is as follows:




Untitled Document




  

  Site
maintenance page\n";
 }
 $sql="SELECT AdminFirstName,AdminLoginId,AdminPassword FROM Administrators
where
  AdminLoginId = '$AdminLoginId' and AdminPassword ='$AdminPassword'";
  if ($result=mysql_query($sql)) {
   $numofrows=mysql_num_rows($result);
if ($numofrows==0){
 header("Location: http://www.php-faq.com/";);
Print "We are
sorry.";
}
  if ($numofrows==1){
 Print "Welcome
".$AdminFirstName."";
}
 if ($numofrows>1){
 Print "Something wrong";
 }
 while($row=mysql_fetch_array($result)){
 Print"$row[AdminFirstName]";
 }

 }
 ?>
  





Unquote.

Line no. 30 is the one with the line : header("Location:
http://www.php-faq.com/";);

Can you please tell me what is wrong?

thanks
denis



[PHP] get the $email string

2003-01-16 Thread Miguel Brás
Hi,

i made a page to display some user details and then clicking on the user
name it goes to another page to send a mail via mail() function.

here is the line of the first page
name;
?>

when click on user name, it goes to the mail_active.php?[EMAIL PROTECTED]

on the mail_active.php page, how do I get the e-mail address to send?
I mean, the mail function is mail ("$to","$subject","$message","From:
$sender");
How can I take the $to string to be [EMAIL PROTECTED]?

Miguel



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




Re: [PHP] Send email when some action

2003-01-16 Thread Miguel Brás
thx for the replies

Miguel
"Maxim Maletsky" <[EMAIL PROTECTED]> escreveu na mensagem
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

mail() function @ http://php.net/mail


--
Maxim Maletsky
[EMAIL PROTECTED]



"Miguel Brás" <[EMAIL PROTECTED]> wrote... :

> Hi gents,
>
> i have a script to manage the registered users on my site.
> have also a table with id, name, uname, passwrd, email, datejoined, level
> and status
>
> my question is...
> it there any possibility to inform a member by mail that his (let'say)
> current status changed from inactive to active, or from active to
inactive?
> I mean, whenever a change occur on member's details, a mail is sent to him
> telling what was changed. Any posssibility?
>
> 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] Ever complained about lousy PHP programmers?

2003-01-16 Thread Peter Hutnick
Well, here's your chance to criticize a newbie.

As an exercise in learning PHP I have written a rot-13 script.  It is at
http://hutnick.com/rot13/index.html?show_content=1 .

I'm soliciting comments on style, technique, etc.  Be brutal, but don't
get your feelings hurt if I don't take your comments as gospel. 
References will help me take comments to heart.

It will be easier on me if you send or CC comments to [EMAIL PROTECTED]

Thanks a million!

-Peter



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




Re: [PHP] Redirecting

2003-01-16 Thread Chris Shiflett
--- "Denis L. Menezes" <[EMAIL PROTECTED]> wrote:
> I want ot redirect users to another page after successful
> login. Can someone please help me with the PHP code for
> redirecting?

You have many options:

1. After a successful login, display the proper page to the
user instead of redirecting. This is my preference.
2. Use a Location header to cause a protocol-level
redirect. For example, header("Location:
http://www.google.com/";);
3. Use an HTML meta tag for redirecting.

Chris

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




Re: [PHP] nl2br too?

2003-01-16 Thread gamin

"Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> --- Cesar Aracena <[EMAIL PROTECTED]> wrote:
> > When I make a form in a web site for a visitor to
> > send me some comments, I use nl2br() to put things
> > like line breaks and see what the visitor wants me
> > to see.
> >
> > But what happens if I have a web form to input some
> > text into a TEXT cell in MySQL and want to retrieve
> > it like I wrote it?
>
> My advice is to store in MySQL exactly what the user types.
> This way, you can decide when you retrieve this data
> whether you want to display it on a page (in which case you
> would use nl2br) or display it in a text field for editing
> (in which case you would leave the data raw).
>
> Chris

Condier using mysql_escape_string() before inserting into your table to
protect your database server from simple attacks

g



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




Re: [PHP] Redirecting

2003-01-16 Thread Andrew Brampton
php.net/header
check out the examples

Andrew
- Original Message -
From: "Denis L. Menezes" <[EMAIL PROTECTED]>
To: "PHP general list" <[EMAIL PROTECTED]>
Sent: Thursday, January 16, 2003 4:21 PM
Subject: [PHP] Redirecting


Hello friends.

I want ot redirect users to another page after successful login. Can someone
please help me with the PHP code for redirecting? Or point me to some help
page?

thanks
denis


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




[PHP] Re: Security in included PHP files

2003-01-16 Thread Philippe Saladin
> directly. My main question is if all of the code inside an included PHP
file
> is put inside one or more functions this should prevent anyone from
running
> any of that code by directly calling that PHP file correct? There is no
way
> for them to invoke a function just from a URL assuming I have no code at
all
> outside the functions.
Just a small tip : to be *sure* that no one runs directly my included files,
they begin with

if (basename($_ENV["SCRIPT_NAME"]) != 'index.php') {
 // redirection
}

So, even if the code is not in a function or class, I'm safe.
Am I wrong or do you think it could be ok?
Regards,
Philippe



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




[PHP] Redirecting

2003-01-16 Thread Denis L. Menezes
Hello friends.

I want ot redirect users to another page after successful login. Can someone please 
help me with the PHP code for redirecting? Or point me to some help page?

thanks
denis


Re: [PHP] Getting a dynamic IP address

2003-01-16 Thread Danny Shepherd
$_SERVER['SERVER_ADDR'] gives the address of the server running the php
script
$_SERVER['REMOTE_ADDR'] gives the client address or the proxy address. (be
careful here, storing a proxy's IP is next to useless)
$_SERVER[' HTTP_X_FORWARDED_FOR'] gives the client address if they're behind
a proxy (if this isn't set then they probably aren't behind a proxy so you
can use the remote_addr instead)

HTH

Danny.


- Original Message -
From: "Kyle Lampkin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 15, 2003 11:41 PM
Subject: [PHP] Getting a dynamic IP address


>Hello all,
> Newbie here I need to know if there is a way I can get my dynamic IP
> address for use in a php script?
> --
> Your favorite stores, helpful shopping tools and great gift ideas.
> Experience the convenience of buying online with Shop@Netscape!
> http://shopnow.netscape.com/
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




Re: [PHP] "document contained no data"

2003-01-16 Thread Marek Kilimajer
Someone else might be, you just happened to request a page from the same 
server process

Justin French wrote:

on 16/01/03 11:59 PM, Marek Kilimajer ([EMAIL PROTECTED]) wrote:

 

If the server crashes, it is definetly NOT fault of your scripts, the
server/php should return errors when there is something wrong, not
crash. Remember that on multithreaded server you are taking other
requests down too. The server, php, some extenssion might have been
miscompiled, wrong versions of libraries are used, there is a bug,
anything. But you should not be able to take server down from a script
language.
Take a look at extenssions used, if any of them is unstable/experimental
   


Well, I know *I* aren't using any extensions that you wouldn't find in a
base install.

Thanks for the words of encouragement though :)

Justin




 

Justin French wrote:

   

Just as an update, the sysadmin definitely thinks it's my code... I'm not
convinced, but I'm faced with the task of finding out :)



 

It appears your site is causing the webserver to segfault (crash), which is
why nothing comes up some times - these crashes are logged in the main
Apache
logfile, which is why you saw nothing in your site logfile when this
happened.
I don't know exactly what is causing it to crash, but it is definately
something in your PHP code.


   

I asked for a copy of the logfiles she talked about:



 

[Wed Jan 15 08:23:32 2003] [notice] child pid 8153 exit signal Segmentation
fault (11)
[Wed Jan 15 08:34:57 2003] [notice] child pid 7702 exit signal Segmentation
fault (11)
[Wed Jan 15 08:34:58 2003] [notice] child pid 7366 exit signal Segmentation
fault (11)
[Wed Jan 15 08:34:59 2003] [notice] child pid 7511 exit signal Segmentation
fault (11)
[Wed Jan 15 08:35:00 2003] [notice] child pid 7512 exit signal Segmentation
fault (11)



   

Not very helpfull :)


As far as I can tell, the error I receive (basically a "document contained
no data" error) is the result of the server shitting itself because of
ANOTHER script on my site, that was accessed before it.

This makes debugging even worse, because I don't even know what script to
look in!

It could be in any include()'d file in my header or footer, or the guts of
any script on my site!!  Yay!!


The other possibility is that the crash occurs on the actual script I'm
calling, which IS a bit easier to debug... I think!


The sysadmin has pretty much ruled out memory leaks:



 

I checked the httpd processes
to see if any memory was leaking (if the memory usage climbs constantly,
memory is being leaked), but it was all fine.


   

Has any one got any suggestions on how I might track down this bug, or
ascertain which script/include file is causing the server to segfault?


Justin




 



 



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




Re: [PHP] nl2br too?

2003-01-16 Thread Chris Shiflett
--- Cesar Aracena <[EMAIL PROTECTED]> wrote:
> When I make a form in a web site for a visitor to
> send me some comments, I use nl2br() to put things
> like line breaks and see what the visitor wants me
> to see.
> 
> But what happens if I have a web form to input some
> text into a TEXT cell in MySQL and want to retrieve
> it like I wrote it?

My advice is to store in MySQL exactly what the user types.
This way, you can decide when you retrieve this data
whether you want to display it on a page (in which case you
would use nl2br) or display it in a text field for editing
(in which case you would leave the data raw).

Chris

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




Re: [PHP] system(): access denied

2003-01-16 Thread Chris Boget
> > system("mysql -uroot -p < the_dump_file.sql")
> > it doesn't know where the command ends and the input
> > begins. So what's going on is that the command thinks
> > that the password is coming from the "the_dump_file.sql".
> It knows exactly where the command ends and the input
> begins. It is the < symbol. :-)

Ok, I wasn't sure.  It just seemed like it could go either way.
 
> Also, in your example (which strays from the poster's
> example), 

No.  They both do the same thing.  They take the data from
the .sql file and make mysql use it.

> once you provide the password (which it prompts for). It
> does not try to use it for the password as you seem to be
> thinking.

Again, it seemed like it could go either way. :p
 
> Anyway, the reason the poster wrote it like this:
> mysqldump -uroot -p > the_dump_file.sql
> is so that the output of mysqldump (the dump file) is sent
> to the_dump_file.sql rather than stdout.

Right.  And the problem the original poster had was getting 
mysql use that data that mysqldump dumped.  This is the
problmatic command:

system("mysql -uroot -p < the_dump_file.sql")

and that is the same thing as this:

system( "cat the_dump_file.sql | mysql -uroot -p" );

just doing it a different way.  It just clears up any kind of
ambiguity w/r/t what the "the_dump_file.sql" is being used
for.

Chris


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




Re: [PHP] intermittent session loss

2003-01-16 Thread Marek Kilimajer
Check the cookies you have stored in your browser. I once had similar 
problem, when I had 2 cookies of the same name set, but different in 
path, one had "/directory" the other one "/directory/"

Justin French wrote:

on 17/01/03 1:24 AM, 1LT John W. Holmes ([EMAIL PROTECTED]) wrote:

 

Is there any kind of load balancing on your server?
   


It's a single server, so to the best of my knowledge, no.


 

If you watch the session
files in /tmp, are they getting erased?
   


No, because they reappear and page or two later.  I confirmed this with a
simple incrementing session counter, and the results were bizarre.  You
would expect the number to increase in sequence:

0,1,2,3,4,5,6,7,8,9,10...50

But instead, I got:

0,1,2,3,0,4,5,1,6,7,2,8,9,3,10,11,12,13,14,15,16,17,18,4

I can see two sessions in there... one that gets to 18, the other getting to
4.

Again, this is NOT a repeatable bug... right now, it just counted perfectly
up to 25 before I got bored... :)


Justin



 

---John Holmes...

- Original Message -
From: "Justin French" <[EMAIL PROTECTED]>
To: "php" <[EMAIL PROTECTED]>
Sent: Thursday, January 16, 2003 2:55 AM
Subject: [PHP] intermittent session loss


   

Hi,

I think I may have made some headway with my server problems.  I loaded
 

the
   

site onto another account within the same machine, and I can't seem to
replicate the "document contained no data" error at all.

BUT I did notice that once I login (it says "you are logged in as justin"
across the top of the screen), if I refresh the same page a few times, it
will MOSTLY say "you are logged in as..." but OCCASIONALLY it says "click
here to login"...

The server does use trans-sid, but in my case, it's using cookies... the
session doesn't get LOST (because it's "back" next time I refresh), but I
 

do
   

appear to be "logged out" until I refresh again.

VERY strange.

To investigate further, I turned off cookies, and tried again... after 5
 

or
   

so refreshes, I lost the session ID out of the URL.


Whilst I can't repeat the problem on the original account, I have a
 

feeling
   

these two issues are related.


What's likely to cause this?


Here's the Session section of phpinfo():

--
Session Support enabled
Directive   Local Value Master Value
session.auto_start  Off Off
session.cache_expire180 180
session.cache_limiter   nocache nocache
session.cookie_domain   no valueno value
session.cookie_lifetime 0   0
session.cookie_path /   /
session.cookie_secure   Off Off
session.entropy_file/dev/urandom/dev/urandom
session.entropy_length  256 256
session.gc_maxlifetime  900 900
session.gc_probability  1   1
session.namePHPSID  PHPSID
session.referer_check   no valueno value
session.save_handlermm  mm
session.save_path   /tmp/tmp
session.serialize_handler   php php
session.use_cookies On  On
session.use_trans_sid   1   1
--

My LAN server's values (not compiled with trans-sid) are:
--
Session Support enabled
Directive   Local Value Master Value
session.auto_start  Off Off
session.cache_expire180 180
session.cache_limiter   nocache nocache
session.cookie_domain   no valueno value
session.cookie_lifetime 0   0
session.cookie_path /   /
session.cookie_secure   Off Off
session.entropy_fileno valueno value
session.entropy_length  0   0
session.gc_maxlifetime  14401440
session.gc_probability  1   1
session.namePHPSESSID   PHPSESSID
session.referer_check   no valueno value
session.save_handlerfiles   files
session.save_path   /tmp/tmp
session.serialize_handler   php php
session.use_cookies On  On
--

Biggest difference I can see (not that I really know what I'm looking for)
is that locally, the save_handler is 'mm' (memory?), and on the server,
 

it's
   

files.  And the entropy stuff, which I don't understand :)


So, what could cause the session to drop (then kick back in again) by
 

simply
   

refreshing the page a few times?


Many thanks in advance,

Justin French





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

 

---
[This E-mail scanned for viruses]


   



 



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




[PHP] experience in OOP & PHP combination needed

2003-01-16 Thread Hannes Smit
Hello,

I want to build an object oriented application and i don't know how to do
it. Should i store everything in class instances and let those object
communicate with each other? I think that would be the real OOP.
I need some articles, tutorials or just people with experience in building
OO-applications with PHP.

Please help!

Hannes Smit




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




[PHP] nl2br too?

2003-01-16 Thread Cesar Aracena
Hi all,

When I make a form in a web site for a visitor to send me some comments,
I use nl2br() to put things like line breaks and see what the visitor
wants me to see.

But what happens if I have a web form to input some text into a TEXT
cell in MySQL and want to retrieve it like I wrote it? Should I use
nl2br too? How should I use it and What's gonna end up stored in the DB?

Thanks in advance,

Cesar L. Aracena
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(0299) 156-356688
Neuquén (8300) Capital
Argentina




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




Re: [PHP] system(): access denied

2003-01-16 Thread Chris Shiflett
--- Chris Boget <[EMAIL PROTECTED]> wrote:
> system("mysql -uroot -p < the_dump_file.sql")
> 
> it doesn't know where the command ends and the input
> begins. So what's going on is that the command thinks
> that the password is coming from the "the_dump_file.sql".


It knows exactly where the command ends and the input
begins. It is the < symbol. :-)

Also, in your example (which strays from the poster's
example), the_dump_file.sql is simply executed by mysql
once you provide the password (which it prompts for). It
does not try to use it for the password as you seem to be
thinking.

Anyway, the reason the poster wrote it like this:

mysqldump -uroot -p > the_dump_file.sql

is so that the output of mysqldump (the dump file) is sent
to the_dump_file.sql rather than stdout.

Chris

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




Re: [PHP] system(): access denied

2003-01-16 Thread Adam Voigt




This is infact not the case, using the < operator does not make the mysqldump

program read that file and interpret the data in the file as the password, if you have

a proper password set and use the -p option (even with a < operator) it will still ask

you for a password.



On Thu, 2003-01-16 at 10:33, Chris Boget wrote:

> But why it is ok when i use system("mysqldump -uroot -p >my_dump_file.sql")?



As alluded to by the last user (who got the command wrong), when you 

do:



system("mysql -uroot -p < the_dump_file.sql")



it doesn't know where the command ends and the input begins.  So what's

going on is that the command thinks that the password is coming from the

"the_dump_file.sql".  So while you think that is the data you are passing to

the "mysql" executable, the system call thinks it's what you are passing

to the "-p" option.



Try doing this instead and see if it doesn't work:



system( "cat the_dump_file.sql | mysql -uroot -p" );



Chris





-- 

PHP General Mailing List (http://www.php.net/)

To unsubscribe, visit: http://www.php.net/unsub.php






-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part


Re: [PHP] "document contained no data"

2003-01-16 Thread Justin French
on 16/01/03 11:59 PM, Marek Kilimajer ([EMAIL PROTECTED]) wrote:

> If the server crashes, it is definetly NOT fault of your scripts, the
> server/php should return errors when there is something wrong, not
> crash. Remember that on multithreaded server you are taking other
> requests down too. The server, php, some extenssion might have been
> miscompiled, wrong versions of libraries are used, there is a bug,
> anything. But you should not be able to take server down from a script
> language.
> Take a look at extenssions used, if any of them is unstable/experimental

Well, I know *I* aren't using any extensions that you wouldn't find in a
base install.

Thanks for the words of encouragement though :)

Justin




> Justin French wrote:
> 
>> Just as an update, the sysadmin definitely thinks it's my code... I'm not
>> convinced, but I'm faced with the task of finding out :)
>> 
>> 
>> 
>>> It appears your site is causing the webserver to segfault (crash), which is
>>> why nothing comes up some times - these crashes are logged in the main
>>> Apache
>>> logfile, which is why you saw nothing in your site logfile when this
>>> happened.
>>> I don't know exactly what is causing it to crash, but it is definately
>>> something in your PHP code.
>>> 
>>> 
>> 
>> I asked for a copy of the logfiles she talked about:
>> 
>> 
>> 
>>> [Wed Jan 15 08:23:32 2003] [notice] child pid 8153 exit signal Segmentation
>>> fault (11)
>>> [Wed Jan 15 08:34:57 2003] [notice] child pid 7702 exit signal Segmentation
>>> fault (11)
>>> [Wed Jan 15 08:34:58 2003] [notice] child pid 7366 exit signal Segmentation
>>> fault (11)
>>> [Wed Jan 15 08:34:59 2003] [notice] child pid 7511 exit signal Segmentation
>>> fault (11)
>>> [Wed Jan 15 08:35:00 2003] [notice] child pid 7512 exit signal Segmentation
>>> fault (11)
>>> 
>>> 
>>> 
>> 
>> Not very helpfull :)
>> 
>> 
>> As far as I can tell, the error I receive (basically a "document contained
>> no data" error) is the result of the server shitting itself because of
>> ANOTHER script on my site, that was accessed before it.
>> 
>> This makes debugging even worse, because I don't even know what script to
>> look in!
>> 
>> It could be in any include()'d file in my header or footer, or the guts of
>> any script on my site!!  Yay!!
>> 
>> 
>> The other possibility is that the crash occurs on the actual script I'm
>> calling, which IS a bit easier to debug... I think!
>> 
>> 
>> The sysadmin has pretty much ruled out memory leaks:
>> 
>> 
>> 
>>> I checked the httpd processes
>>> to see if any memory was leaking (if the memory usage climbs constantly,
>>> memory is being leaked), but it was all fine.
>>> 
>>> 
>> 
>> 
>> Has any one got any suggestions on how I might track down this bug, or
>> ascertain which script/include file is causing the server to segfault?
>> 
>> 
>> Justin
>> 
>> 
>> 
>> 
> 


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




Re: SPAM: Re: [PHP] intermittent session loss

2003-01-16 Thread Justin French
on 17/01/03 1:24 AM, 1LT John W. Holmes ([EMAIL PROTECTED]) wrote:

> Is there any kind of load balancing on your server?

It's a single server, so to the best of my knowledge, no.


> If you watch the session
> files in /tmp, are they getting erased?

No, because they reappear and page or two later.  I confirmed this with a
simple incrementing session counter, and the results were bizarre.  You
would expect the number to increase in sequence:

0,1,2,3,4,5,6,7,8,9,10...50

But instead, I got:

0,1,2,3,0,4,5,1,6,7,2,8,9,3,10,11,12,13,14,15,16,17,18,4

I can see two sessions in there... one that gets to 18, the other getting to
4.

Again, this is NOT a repeatable bug... right now, it just counted perfectly
up to 25 before I got bored... :)


Justin



> ---John Holmes...
> 
> - Original Message -
> From: "Justin French" <[EMAIL PROTECTED]>
> To: "php" <[EMAIL PROTECTED]>
> Sent: Thursday, January 16, 2003 2:55 AM
> Subject: [PHP] intermittent session loss
> 
> 
>> Hi,
>> 
>> I think I may have made some headway with my server problems.  I loaded
> the
>> site onto another account within the same machine, and I can't seem to
>> replicate the "document contained no data" error at all.
>> 
>> BUT I did notice that once I login (it says "you are logged in as justin"
>> across the top of the screen), if I refresh the same page a few times, it
>> will MOSTLY say "you are logged in as..." but OCCASIONALLY it says "click
>> here to login"...
>> 
>> The server does use trans-sid, but in my case, it's using cookies... the
>> session doesn't get LOST (because it's "back" next time I refresh), but I
> do
>> appear to be "logged out" until I refresh again.
>> 
>> VERY strange.
>> 
>> To investigate further, I turned off cookies, and tried again... after 5
> or
>> so refreshes, I lost the session ID out of the URL.
>> 
>> 
>> Whilst I can't repeat the problem on the original account, I have a
> feeling
>> these two issues are related.
>> 
>> 
>> What's likely to cause this?
>> 
>> 
>> Here's the Session section of phpinfo():
>> 
>> --
>> Session Support enabled
>> Directive   Local Value Master Value
>> session.auto_start  Off Off
>> session.cache_expire180 180
>> session.cache_limiter   nocache nocache
>> session.cookie_domain   no valueno value
>> session.cookie_lifetime 0   0
>> session.cookie_path /   /
>> session.cookie_secure   Off Off
>> session.entropy_file/dev/urandom/dev/urandom
>> session.entropy_length  256 256
>> session.gc_maxlifetime  900 900
>> session.gc_probability  1   1
>> session.namePHPSID  PHPSID
>> session.referer_check   no valueno value
>> session.save_handlermm  mm
>> session.save_path   /tmp/tmp
>> session.serialize_handler   php php
>> session.use_cookies On  On
>> session.use_trans_sid   1   1
>> --
>> 
>> My LAN server's values (not compiled with trans-sid) are:
>> --
>> Session Support enabled
>> Directive   Local Value Master Value
>> session.auto_start  Off Off
>> session.cache_expire180 180
>> session.cache_limiter   nocache nocache
>> session.cookie_domain   no valueno value
>> session.cookie_lifetime 0   0
>> session.cookie_path /   /
>> session.cookie_secure   Off Off
>> session.entropy_fileno valueno value
>> session.entropy_length  0   0
>> session.gc_maxlifetime  14401440
>> session.gc_probability  1   1
>> session.namePHPSESSID   PHPSESSID
>> session.referer_check   no valueno value
>> session.save_handlerfiles   files
>> session.save_path   /tmp/tmp
>> session.serialize_handler   php php
>> session.use_cookies On  On
>> --
>> 
>> Biggest difference I can see (not that I really know what I'm looking for)
>> is that locally, the save_handler is 'mm' (memory?), and on the server,
> it's
>> files.  And the entropy stuff, which I don't understand :)
>> 
>> 
>> So, what could cause the session to drop (then kick back in again) by
> simply
>> refreshing the page a few times?
>> 
>> 
>> Many thanks in advance,
>> 
>> Justin French
>> 
>> 
>> 
>> 
>> 
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
> 
> ---
> [This E-mail scanned for viruses]
> 
> 


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




RE: [PHP] No constants being set. HUH?

2003-01-16 Thread Ford, Mike [LSS]
> -Original Message-
> From: Mako Shark [mailto:[EMAIL PROTECTED]]
> Sent: 16 January 2003 15:26
> To: [EMAIL PROTECTED]
> Subject: [PHP] No constants being set. HUH?
> 
> 
> I just JUST installed PHP onto a new server (my
> first--kinda scary, new foray) and my pre-defined
> constants (HTTP_SERVER, SCRIPT_NAME, etc.)

Not predefined constants, predefined *global variables* -- and there's the clue.

>  aren't
> being set. Any ideas? What switch do I have to flick?

Almost certainly register_globals -- but don't!  (Unless you have legacy code that 
must run asap.)  Much better to leave register_globals=Off and get used to using the 
superglobal arrays -- in this case, you will want (iirc) $_SERVER['HTTP_SERVER'] and 
$_SERVER['SCRIPT_NAME'].

For more on this topic, refer to the manula page on Predefined variables: 
http://www.php.net/manual/en/language.variables.predefined.php 

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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




Re: [PHP] system(): access denied

2003-01-16 Thread Chris Shiflett
--- [EMAIL PROTECTED] wrote:
> no, i use mysqldump -uroot -p > my_dump_file.sql
> it is not '<' but '>'

That syntax is fine, and it should prompt you for a
password.

My suggestion is to give the root account a password and
don't worry about all of this. I think I read that it is
currently empty, right? Just assign it a proper password,
and move on to the next problem. :-)

Chris

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




Re: [PHP] system(): access denied

2003-01-16 Thread Chris Boget
> But why it is ok when i use system("mysqldump -uroot -p >my_dump_file.sql")?

As alluded to by the last user (who got the command wrong), when you 
do:

system("mysql -uroot -p < the_dump_file.sql")

it doesn't know where the command ends and the input begins.  So what's
going on is that the command thinks that the password is coming from the
"the_dump_file.sql".  So while you think that is the data you are passing to
the "mysql" executable, the system call thinks it's what you are passing
to the "-p" option.

Try doing this instead and see if it doesn't work:

system( "cat the_dump_file.sql | mysql -uroot -p" );

Chris


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




  1   2   >