Re: [PHP] How New Is <<

2003-12-27 Thread [EMAIL PROTECTED]
By "comment[ing] out line 11", I take it you mean making a comment of line
11. I just did--as this problem woke me from a night's sleep at just past
2:30 AM--and the error message is now:

Parse error: parse error, unexpected $ in [path to file] on line 19

Where will this end?

Steve

Original Message:
-
From: Olwen Williams [EMAIL PROTECTED]
Date: Sat, 27 Dec 2003 18:25:00 +1300
To: [EMAIL PROTECTED]
Subject: Re: [PHP] How New Is << Cesar,
> 
> Sorry to have taken so long to answer. My day got complicated. Anyway,
> here's  the code all over again, with the last changes I was advised to
> make. I took out the line spaces and added line numbers. But first, the
> latest error message:
> 
>Parse error: parse error, unexpected T_VARIABLE in [path to file] on
> line 11
> 
> The code:
> 
> 1 
> 2 
> 3 
> 4 persistence demo
> 5 
> 6 
> 7 
> 8 Persistence Demo
> 9 
> 10  11 $txtBoxCounter = $_POST['txtBoxCounter'];

-- 
Olwen Williams
See my B&B site
http://www.bandbclub.com
and my new site http://www.handyman.co.nz - A virtual shed for real kiwi 
blokes.


mail2web - Check your email from the web at
http://mail2web.com/ .

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



[PHP] Problems with imagejpeg

2003-12-27 Thread René Fournier
I have a function that [is meant to] check if an image is greater than  
a certain width and height, and if it is, downsample it. The checking  
part works fine. Downsampling is happening though. Here's what I've got  
($file = "/somedirectory/photo.jpg"):

	$src_img=imagecreatefromJPEG($file);		
	$dst_img=imagecreatetruecolor($new_width,$new_height);
	 
imagecopyresampled($dst_img,$src_img,0,0,0,0,$new_width,$new_height,$siz 
e[0],$size[1]);
	imagejpeg($dst_img,$file,$img_quality);

Any ideas?

Thanks.

...Rene

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


Re: [PHP] How New Is <<

2003-12-27 Thread Olwen Williams
Interesting that it's the same variable on both lines. The second error 
would not show untill the first disappeared.  Would you have copied and 
pasted some of the line?  I'm still for retyping the lines in case 
there's something odd lurking in there and not visible.

[EMAIL PROTECTED] wrote:
By "comment[ing] out line 11", I take it you mean making a comment of line
11. I just did--as this problem woke me from a night's sleep at just past
2:30 AM--and the error message is now:
Parse error: parse error, unexpected $ in [path to file] on line 19

Where will this end?

Steve

Original Message:
-
From: Olwen Williams [EMAIL PROTECTED]
Date: Sat, 27 Dec 2003 18:25:00 +1300
To: [EMAIL PROTECTED]
Subject: Re: [PHP] How New Is <<
Comment out line 11 to checkj it's the cause of the proble.  If the 
error goes away then retype the line.  I just tested this code and got 
no errors.  It could be a character that is not what it seems.

[EMAIL PROTECTED] wrote:


Cesar,

Sorry to have taken so long to answer. My day got complicated. Anyway,
here's  the code all over again, with the last changes I was advised to
make. I took out the line spaces and added line numbers. But first, the
latest error message:
  Parse error: parse error, unexpected T_VARIABLE in [path to file] on
line 11
The code:

1 
2 
3 
4 persistence demo
5 
6 
7 
8 Persistence Demo
9 
10 

--
Olwen Williams
See my B&B site
http://www.bandbclub.com
and my new site http://www.handyman.co.nz - A virtual shed for real kiwi 
blokes.

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


RE: [PHP] How New Is <<

2003-12-27 Thread Grant Walters
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Saturday, 27 December 2003 20:56
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] How New Is << 
> 
> By "comment[ing] out line 11", I take it you mean making a comment of line
> 11. I just did--as this problem woke me from a night's sleep at just past
> 2:30 AM--and the error message is now:
> 
> Parse error: parse error, unexpected $ in [path to file] on line 19
> 
> Where will this end?
> 
> Steve
> 
> Original Message:
> -
> From: Olwen Williams [EMAIL PROTECTED]
> Date: Sat, 27 Dec 2003 18:25:00 +1300
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] How New Is << 
> 
> Comment out line 11 to checkj it's the cause of the proble.  If the 
> error goes away then retype the line.  I just tested this code and got 
> no errors.  It could be a character that is not what it seems.
> 
> [EMAIL PROTECTED] wrote:
> 
> > Cesar,
> > 
> > Sorry to have taken so long to answer. My day got complicated. Anyway,
> > here's  the code all over again, with the last changes I was advised to
> > make. I took out the line spaces and added line numbers. But first, the
> > latest error message:
> > 
> >Parse error: parse error, unexpected T_VARIABLE in [path to file] on
> > line 11
> > 
> > The code:
> > 
> > 1 
> > 2 
> > 3 
> > 4 persistence demo
> > 5 
> > 6 
> > 7 
> > 8 Persistence Demo
> > 9 
> > 10  > 11 $txtBoxCounter = $_POST['txtBoxCounter'];
> 
> -- 

For what it is worth,  I cut and pasted your full html into a file.

Under PHP version 4.3.1

It runs from the command line without fault.

Apache 1.3.22

It runs without fault (increments properly).

What text editor are you using?  I saved the code as both Unix and DOS format and it 
works for both.

I've attached my file for you to try.  Hope it helps as I can't fault the code.

Regards

Grant Walters
Brainbench 'Most Valuable Professional' for Unix Admin
Walters & Associates, P O Box 13-043 Johnsonville, Wellington, NEW ZEALAND
Telephone: +64 4 4765175 OR 4762661, CellPhone 025488265, ICQ# 23511989 

"Never argue with an idiot. They drag you down to their level, then beat you with 
experience."


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

[PHP] web based inn server

2003-12-27 Thread Jayanta Debnath
hi,
we have a inn news server running on linux machine in
our institute. we want to make a web interface for
this. can anyone please suggest where and how to start
with. 
--Jayanta

__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

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



[PHP] Failed error_log directive

2003-12-27 Thread Aidan Lister
Hello,

I am trying to log all php script errors from a virtualhost to a file.
A callback function is not the solution I am looking for.

I have tried to the following settings in my httpd.conf (apache) to no
avail.

php_admin_flag display_errors off
php_admin_flag log_errors on
php_admin_flag error_log /tmp/phplog

When an erroneous file is viewed, errors are not displayed (as expected),
however the file /tmp/phplog is not created.

I'd be grateful for any help.

Thank you.

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



[PHP] PHP Session Variables Not Being Set For Certain Browsers

2003-12-27 Thread Andy Higgins
Hello All,

I have been racking my head over a problem where a large percentage of users
are unable to log into my php site due to what seems to be a problem with
setting php session variables on certain end user browsers (certain versions
of AOL seem to be particularly problematic). Below are some snippets of code
that are used to do the authentication/ login.

Has anyone encountered the same problem and if so do you have a solution?
The only solution I can think of is to pass the session using PHPSESSION in
the URL however I would like to avoid this if at all possible as it involves
a major re-write of the code (as session variables are used elsewhere in the
session) and if I am not mistaken if a user accesses a non-php page then the
session is lost requiring them to log in again.

Currently the following code is used to check whether a user is logged in:



And in Login.php after doing a check on the username and password the
following session variables are set:

   session_start();

   session_register("authenticatedUser");
   $HTTP_SESSION_VARS['authenticatedUser'] = $userId;

   session_register("loginIpAddress");
   $HTTP_SESSION_VARS['loginIpAddress'] = $_SERVER["REMOTE_ADDR"];

It is the setting of the above session variables in Login.php that appears
to be failing for some browsers resulting in users using these browsers
continually being redirected to the Login page when the above check to see
if they are logged in is done.

Any help that could be supplied would be greatly appreciated.

Thank you.

Regards,
Andy


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



[PHP] how to get mails in digest mode

2003-12-27 Thread Jayanta Debnath
somebody please tell me how can i get the mails from
this list in digest mode.
--Jayanta

__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

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



Re: [PHP] How New Is <<

2003-12-27 Thread David T-G
Steve --

From your private reply to me, we know that ripping out the <

RE: [PHP] PHP Session Variables Not Being Set For Certain Browsers

2003-12-27 Thread Andras Kende
-Original Message-
From: Andy Higgins [mailto:[EMAIL PROTECTED] 
Sent: Saturday, December 27, 2003 6:04 AM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP Session Variables Not Being Set For Certain Browsers

Hello All,

I have been racking my head over a problem where a large percentage of users
are unable to log into my php site due to what seems to be a problem with
setting php session variables on certain end user browsers (certain versions
of AOL seem to be particularly problematic). Below are some snippets of code
that are used to do the authentication/ login.

Has anyone encountered the same problem and if so do you have a solution?
The only solution I can think of is to pass the session using PHPSESSION in
the URL however I would like to avoid this if at all possible as it involves
a major re-write of the code (as session variables are used elsewhere in the
session) and if I am not mistaken if a user accesses a non-php page then the
session is lost requiring them to log in again.

Currently the following code is used to check whether a user is logged in:



And in Login.php after doing a check on the username and password the
following session variables are set:

   session_start();

   session_register("authenticatedUser");
   $HTTP_SESSION_VARS['authenticatedUser'] = $userId;

   session_register("loginIpAddress");
   $HTTP_SESSION_VARS['loginIpAddress'] = $_SERVER["REMOTE_ADDR"];

It is the setting of the above session variables in Login.php that appears
to be failing for some browsers resulting in users using these browsers
continually being redirected to the Login page when the above check to see
if they are logged in is done.

Any help that could be supplied would be greatly appreciated.

Thank you.

Regards,
Andy



-

Andy,

Not sure, but maybe AOL users on proxy and their ip address can change.

Andras Kende
http://www.kende.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] SESSION Query

2003-12-27 Thread Aniruddha
Hi PhpTeam,

Iam runing PHP 4.3.0 on Apache server.

Iam expiriencing following problem when managing session:

1) I start session and register session variable by setting $_SESSION:

session_start();
$_SESSION["session_referer"] = "abc.com";

2) The above step does not register the variable "session_referer".
I have following code in another page altogether:

session_start();

if(isset($_SESSION["session_referer"])) {
   go to abc.com;
}
else {
   // CONTROL ALWAYS GETS HERE
   go to xyz.com;
}

3) However if I redirect immediately after (1) the variable is
registered properly!!? and the first "if" condition in (2) gets
satisfied.

4) I use session_register then there is no problem at all. Only thing is 
I get a Notice that this is no more an advised 
method.


What is the reason behind this behaviour?

With regards,
Aniruddha Deshpande



!-- Virus-Free Mail Using PostMaster AvAc & QuickHeal Engine --!



-
QuantumLink Communications Pvt Ltd, Mumbai, India



-
QuantumLink Communications Pvt Ltd, Mumbai, India

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



Re: [PHP] PHP Session Variables Not Being Set For Certain Browsers

2003-12-27 Thread Andy Higgins
Hi Andras,

Yes, good point Thank you. It could be that the IP address of the user is
changing on each HTTP request that is made, which would explain the problem
(although that does seem quite odd). Can anyone confirm whether AOL (or any
other ISPs for that matter) change a user's IP address as seen by the web
server (for eample through a proxy) within the same session?

Assuming that the above is the problem, does any one know whether by
removing the check in the authentication to see whether the user is using
the same IP address as they logged in with comprises the security of the
login i.e. will it be possible for some one to hijack the login if this
check is not there? Or does anyone have any other suggesstions for doing
authentication?

Thank you.

Regards,
Andy

"Andras Kende" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> -Original Message-
> From: Andy Higgins [mailto:[EMAIL PROTECTED]
> Sent: Saturday, December 27, 2003 6:04 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] PHP Session Variables Not Being Set For Certain Browsers
>
> Hello All,
>
> I have been racking my head over a problem where a large percentage of
users
> are unable to log into my php site due to what seems to be a problem with
> setting php session variables on certain end user browsers (certain
versions
> of AOL seem to be particularly problematic). Below are some snippets of
code
> that are used to do the authentication/ login.
>
> Has anyone encountered the same problem and if so do you have a solution?
> The only solution I can think of is to pass the session using PHPSESSION
in
> the URL however I would like to avoid this if at all possible as it
involves
> a major re-write of the code (as session variables are used elsewhere in
the
> session) and if I am not mistaken if a user accesses a non-php page then
the
> session is lost requiring them to log in again.
>
> Currently the following code is used to check whether a user is logged in:
>
> 
> $notAuthenticated = !isset($HTTP_SESSION_VARS['authenticatedUser']);
>
> $notLoginIp = isset($HTTP_SESSION_VARS['loginIpAddress']) &&
> ($HTTP_SESSION_VARS['loginIpAddress'] != $_SERVER["REMOTE_ADDR"]);
>
> if ($notAuthenticated || $notLoginIp) {
>
>  if (!session_is_registered("targetURL"))
>session_register("targetURL");
>
>  $HTTP_SESSION_VARS['targetURL'] = $_SERVER["REQUEST_URI"];
>
>  header("Location: /smartbid/php/Login.php");
>
> }
>
> ?>
>
> And in Login.php after doing a check on the username and password the
> following session variables are set:
>
>session_start();
>
>session_register("authenticatedUser");
>$HTTP_SESSION_VARS['authenticatedUser'] = $userId;
>
>session_register("loginIpAddress");
>$HTTP_SESSION_VARS['loginIpAddress'] = $_SERVER["REMOTE_ADDR"];
>
> It is the setting of the above session variables in Login.php that appears
> to be failing for some browsers resulting in users using these browsers
> continually being redirected to the Login page when the above check to see
> if they are logged in is done.
>
> Any help that could be supplied would be greatly appreciated.
>
> Thank you.
>
> Regards,
> Andy
>
>
>
> -
>
> Andy,
>
> Not sure, but maybe AOL users on proxy and their ip address can
change.
>
> Andras Kende
> http://www.kende.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] Re: SESSION Query

2003-12-27 Thread Andy Higgins
Hi Aniruddha,

Try using

session_start();
$HTTP_SESSION_VARS['session_referer'] = "abc.com";

and

if (session_is_registered('session_referer'))
go to abc.com;

Regards,
Andy


"Aniruddha" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi PhpTeam,
>
> Iam runing PHP 4.3.0 on Apache server.
>
> Iam expiriencing following problem when managing session:
>
> 1) I start session and register session variable by setting $_SESSION:
>
> session_start();
> $_SESSION["session_referer"] = "abc.com";
>
> 2) The above step does not register the variable "session_referer".
> I have following code in another page altogether:
>
> session_start();
>
> if(isset($_SESSION["session_referer"])) {
>go to abc.com;
> }
> else {
>// CONTROL ALWAYS GETS HERE
>go to xyz.com;
> }
>
> 3) However if I redirect immediately after (1) the variable is
> registered properly!!? and the first "if" condition in (2) gets
> satisfied.
>
> 4) I use session_register then there is no problem at all. Only thing is
> I get a Notice that this is no more an advised
> method.
>
>
> What is the reason behind this behaviour?
>
> With regards,
> Aniruddha Deshpande
>
>
>
> !-- Virus-Free Mail Using PostMaster AvAc & QuickHeal Engine --!
>
>
>
> -
> QuantumLink Communications Pvt Ltd, Mumbai, India
>
>
>
> -
> QuantumLink Communications Pvt Ltd, Mumbai, India

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



[PHP] encoding problem

2003-12-27 Thread Pedro Salgueiro
Hi.

I have made a script in php that calls a java program.
This java program will make a connection to a
PostgreSQL db and do some operations. That java
program works just fine if I run it on a console, but
when it is php to runing it, it gives some errors
related to the charset encoding.
The error that apears in "error.log" of Apache is the
following:

Java.sql.SQLException: ERROR:  Could not convert UTF-8
to ISO8859-1

I think that the problem is than Apache or PHP is
runing the java program with UTF-8 encoding, while it
should be running with iso8859-1.

Does anyone knows how to solve this problem?

Thanks.
Pedro Salgueiro.

__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

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



Re: [PHP] How New Is <<

2003-12-27 Thread [EMAIL PROTECTED]
Okay, everyone, here's some real progress.

I retyped the file from scratch. I'm both attaching it--it's not a big
file--and printing it below:



persistence demo


Persistence Demo





The hidden value is $hdnCounter



HERE;

?>





My results were mixed, but definitely moved me forward.

The H1 head--Persistence Demo--displayed, as did a field with the number
"1" in it.

After a blank line was printed "The hidden value is 1".

That was followed by another blank line space, and then a button with
"click to increment counters in it".

When I click the button, I get a box dropping down that says the info I've
entered "is to be sent over an unencrypted connection" and could be read by
others, and do I still want to send it. I click "Continue", and that box
disappears.

There ends my success. I'm left with:

The H1 head--Persistence Demo--displayed, and the number "1" in it.

The blank line followed by "The hidden value is 1".

The other blank line space, and then the button with "click to increment
counters in it".

No seeming advance to the counters.

Whattaya think?

Steve Tiano


mail2web - Check your email from the web at
http://mail2web.com/ .


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

Re: [PHP] PHP Session Variables Not Being Set For Certain Browsers

2003-12-27 Thread Gerard Samuel
On Saturday 27 December 2003 07:03 am, Andy Higgins wrote:
> Hello All,
>
> I have been racking my head over a problem where a large percentage of
> users are unable to log into my php site due to what seems to be a problem
> with setting php session variables on certain end user browsers (certain
> versions of AOL seem to be particularly problematic). Below are some
> snippets of code that are used to do the authentication/ login.
>
> Has anyone encountered the same problem and if so do you have a solution?
> The only solution I can think of is to pass the session using PHPSESSION in
> the URL however I would like to avoid this if at all possible as it
> involves a major re-write of the code (as session variables are used
> elsewhere in the session) and if I am not mistaken if a user accesses a
> non-php page then the session is lost requiring them to log in again.
>

Im just putting the finishing touches to my code, that I had to rewrite for 
similar reasons as you.
You're going to have to include the session id in the url for those users who 
do not allow cookies.
Using this fact about the constant SID
a)  If the user's browser accepts cookies, SID will be empty ""
b)  If the user's browser does not accept cookies, SID will be "PHPSESSID=xxx"

So what I did, was append the constant SID to all urls/forms and php header() 
(for redirection) functions that point to the site that is serving the 
content (dont append SID to urls going to other sites).

So the final results will be
a) If the user's browser accepts cookies, urls/forms/php header() will be 
normal
b)  If the user's browser does not accept cookies, the session id is appended 
to urls/forms/php header()

OR 

you can take the easy way out, and turn on transparent ids with ->
http://us2.php.net/manual/en/
install.configure.php#install.configure.enable-trans-sid

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



Re: [PHP] How New Is <<

2003-12-27 Thread Asegu
It looks like your form tag is missing some attributes needed to point
your browser to the script as to where to submit the data.

if you were to try with your form tag as  ??

Andrew.

ps: if that doesn't work, may I recommend inserting
   echo(""); print_r($_POST); echo("");
to see what your post data is?


> Okay, everyone, here's some real progress.
>
> I retyped the file from scratch. I'm both attaching it--it's not a big
file--and printing it below:
>
> 
> 
> persistence demo
> 
> 
> Persistence Demo
> 
> 
> $txtBoxCounter = $_POST['txtBoxCounter'];
> $hdnCounter = $_POST['hdnCounter'];
>
> //increment the counters
> $txtBoxCounter++;
> $hdnCounter++;
>
> print <<
>  name = "txtBoxCounter"
> value = "$txtBoxCounter">
>
>  name = "hdnCounter"
> value = "$hdnCounter">
>
> The hidden value is $hdnCounter
>
>  value = "click to increment counters">
>
> HERE;
>
> ?>
>
> 
> 
> 
>
> My results were mixed, but definitely moved me forward.
>
> The H1 head--Persistence Demo--displayed, as did a field with the number
"1" in it.
>
> After a blank line was printed "The hidden value is 1".
>
> That was followed by another blank line space, and then a button with
"click to increment counters in it".
>
> When I click the button, I get a box dropping down that says the info
I've entered "is to be sent over an unencrypted connection" and could be
read by
> others, and do I still want to send it. I click "Continue", and that box
disappears.
>
> There ends my success. I'm left with:
>
> The H1 head--Persistence Demo--displayed, and the number "1" in it.
>
> The blank line followed by "The hidden value is 1".
>
> The other blank line space, and then the button with "click to increment
counters in it".
>
> No seeming advance to the counters.
>
> Whattaya think?
>
> Steve Tiano
>
> 
mail2web - Check your email from the web at
> http://mail2web.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] PHP Session Variables Not Being Set For Certain Browsers

2003-12-27 Thread Andy Higgins
Hi  Gerard,

Thank you very much for the response. Please can you clarify the following:

1. At the time of login will the login code need to check if the clients
browser accepts cookies and if not then append the SID as described? If so,
do you perhaps have a sample piece of code that does this?
2. Am I correct in understanding that if the client has logged in (with no
cookies enabled i.e. the SID needs to be passed) and the site contains other
static pages (that cannot pass the SID) that if the client browses any of
these static pages and then returns to a page that required the client to be
logged that they will have to log in again?
3. For forms, where the SID need to be passed, do you pass this as a hidden
form variable or do you do it on the URL?

You help is greatly appreciated.

Thanks again.

Regards,
Andy


"Gerard Samuel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Saturday 27 December 2003 07:03 am, Andy Higgins wrote:
> > Hello All,
> >
> > I have been racking my head over a problem where a large percentage of
> > users are unable to log into my php site due to what seems to be a
problem
> > with setting php session variables on certain end user browsers (certain
> > versions of AOL seem to be particularly problematic). Below are some
> > snippets of code that are used to do the authentication/ login.
> >
> > Has anyone encountered the same problem and if so do you have a
solution?
> > The only solution I can think of is to pass the session using PHPSESSION
in
> > the URL however I would like to avoid this if at all possible as it
> > involves a major re-write of the code (as session variables are used
> > elsewhere in the session) and if I am not mistaken if a user accesses a
> > non-php page then the session is lost requiring them to log in again.
> >
>
> Im just putting the finishing touches to my code, that I had to rewrite
for
> similar reasons as you.
> You're going to have to include the session id in the url for those users
who
> do not allow cookies.
> Using this fact about the constant SID
> a)  If the user's browser accepts cookies, SID will be empty ""
> b)  If the user's browser does not accept cookies, SID will be
"PHPSESSID=xxx"
>
> So what I did, was append the constant SID to all urls/forms and php
header()
> (for redirection) functions that point to the site that is serving the
> content (dont append SID to urls going to other sites).
>
> So the final results will be
> a) If the user's browser accepts cookies, urls/forms/php header() will be
> normal
> b)  If the user's browser does not accept cookies, the session id is
appended
> to urls/forms/php header()
>
> OR
>
> you can take the easy way out, and turn on transparent ids with ->
> http://us2.php.net/manual/en/
> install.configure.php#install.configure.enable-trans-sid

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



RE: [PHP] PHP Session Variables Not Being Set For Certain Browsers

2003-12-27 Thread Mark Charette
> -Original Message-
> From: Andy Higgins [mailto:[EMAIL PROTECTED]
> Can anyone confirm whether
> AOL (or any
> other ISPs for that matter) change a user's IP address as seen by the web
> server (for eample through a proxy) within the same session?

It's been pointed out and confirmed many, many times here. An IP is not
useful for authentication in the general case (you may have a specific case
on an intranet, but major players like AOL put everything through load
balancing proxies that change from request to request).

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



[PHP] Re: how to get mails in digest mode

2003-12-27 Thread Website Managers, LLC
Go to http://www.php.net/mailing-lists.php and check the box of your choice.
Or, subscribe to the newsgroup.

Jim

"Jayanta Debnath" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> somebody please tell me how can i get the mails from
> this list in digest mode.
> --Jayanta
>
> __
> Do you Yahoo!?
> New Yahoo! Photos - easier uploading and sharing.
> http://photos.yahoo.com/

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



Re: [PHP] PHP Session Variables Not Being Set For Certain Browsers

2003-12-27 Thread Andy Higgins
Hi Mark,

Thank you for confirming that for me. I am new to the list and did do a
search though past messages but did not find this point (obvioulsy I did not
look hard enough).

Thanks again.

Regards,
Andy


"Mark Charette" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > -Original Message-
> > From: Andy Higgins [mailto:[EMAIL PROTECTED]
> > Can anyone confirm whether
> > AOL (or any
> > other ISPs for that matter) change a user's IP address as seen by the
web
> > server (for eample through a proxy) within the same session?
>
> It's been pointed out and confirmed many, many times here. An IP is not
> useful for authentication in the general case (you may have a specific
case
> on an intranet, but major players like AOL put everything through load
> balancing proxies that change from request to request).

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



Re: [PHP] PHP Session Variables Not Being Set For Certain Browsers

2003-12-27 Thread Gerard Samuel
On Saturday 27 December 2003 10:54 am, Andy Higgins wrote:

> 1. At the time of login will the login code need to check if the clients
> browser accepts cookies and if not then append the SID as described? If so,
> do you perhaps have a sample piece of code that does this?

No, php does this for you.  Thats why I gave the explanation of the value of 
SID when browsers accept, or dont accept cookies.

Sample code
CLICK ME';

?>

If the browser does accept cookies, on the first page load, it will report 
"Cookie doesn't exist" because the cookie wont become available till the next 
page load.  After the initial page load, it will report "Cookie Exists".
If the browser does not accept cookies, it will always say "Cookie doesnt 
exists".

> 2. Am I correct in understanding that if the client has logged in (with no
> cookies enabled i.e. the SID needs to be passed) and the site contains
> other static pages (that cannot pass the SID) that if the client browses
> any of these static pages and then returns to a page that required the
> client to be logged that they will have to log in again?

Yes that is correct.  The session id must stay in all urls within the site.
If you are able to direct them to a static page, you should still be able to 
pass the SID in the url/form/iframe/etc they click.

> 3. For forms, where the SID need to be passed, do you pass this as a hidden
> form variable or do you do it on the URL?
>

I have it passing in the form's action attribute, so it stays in $_GET domain 
like regular links.
echo '

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



Re: [PHP] Maths dumbass

2003-12-27 Thread David T-G
Ryan --

...and then Ryan A said...
% 
% Hi guys,
% Its not 5am here and have started on a blasted problem where am feeling like
% a maths dumbass...the old noodle is just not working, any help appreciated.

*grin*


% 
% Problem, selling 4 packages rangeing from $27.50-$99.00 a month...the
% subscriber can change anytime he wants from one package to the other
% (upgrade), if so I have to calculate how many days he has is with us and
% then he just pays the balance...

In my opinion, you're making this way too complex.  Divide each month at
the 15th and credit 'em half if they've only used part of the first half.
It's enough that you're letting them change plans with no extra fees or
anything else :-)


HTH & HAND & Happy Holidays

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] Regular Expression

2003-12-27 Thread Joshua
Hi all,

I'm trying to change the string, for example,

$string = "11.abcd.32.efgh.53.ijk";

to

11.abcd.

32.efgh.

53.ijk.

with ereg_replace.

Like 

ereg_replace("\.[0-9]","",$string);

How can I recover the original characters 
after replacing them with  
in ereg_replace? 

ereg_replace("\.[0-9]","\\0",$string) gives me the
wrong result like:

11.abcd.

32.efgh.

53.ijk.


thank you in advance.

Joshua 

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



[PHP] HELP! -- Problem with imagejpeg()

2003-12-27 Thread René Fournier
Hello,

I have a function that is meant to check if an image is greater than
a certain width and height, and if it is, downsample it. The checking
part works fine. Downsampling is not happening though. Here's what I've  
got
(btw, $file = "/somedirectory/photo.jpg"):

$src_img=imagecreatefromJPEG($file);		
$dst_img=imagecreatetruecolor($new_width,$new_height);
	
imagecopyresampled($dst_img,$src_img,0,0,0,0,$new_width,$new_height,$siz 
e[0],$size[1]);
imagejpeg($dst_img,$file,$img_quality);

Any ideas?

Thanks.

...Rene

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


Re: [PHP] PHP Session Variables Not Being Set For Certain Browsers

2003-12-27 Thread Andy Higgins
Hi Gerard,

Thank you for your assistance you have been of enormous help.

Regards,
Andy

"Gerard Samuel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Saturday 27 December 2003 10:54 am, Andy Higgins wrote:
>
> > 1. At the time of login will the login code need to check if the clients
> > browser accepts cookies and if not then append the SID as described? If
so,
> > do you perhaps have a sample piece of code that does this?
>
> No, php does this for you.  Thats why I gave the explanation of the value
of
> SID when browsers accept, or dont accept cookies.
>
> Sample code
> 
> session_start();
> if (SID === '')
> {
> echo 'Cookie Exists';
> }
> else
> {
> echo 'Cookie doesnt exist';
> }
>
> echo 'CLICK
ME';
>
> ?>
>
> If the browser does accept cookies, on the first page load, it will report
> "Cookie doesn't exist" because the cookie wont become available till the
next
> page load.  After the initial page load, it will report "Cookie Exists".
> If the browser does not accept cookies, it will always say "Cookie doesnt
> exists".
>
> > 2. Am I correct in understanding that if the client has logged in (with
no
> > cookies enabled i.e. the SID needs to be passed) and the site contains
> > other static pages (that cannot pass the SID) that if the client browses
> > any of these static pages and then returns to a page that required the
> > client to be logged that they will have to log in again?
>
> Yes that is correct.  The session id must stay in all urls within the
site.
> If you are able to direct them to a static page, you should still be able
to
> pass the SID in the url/form/iframe/etc they click.
>
> > 3. For forms, where the SID need to be passed, do you pass this as a
hidden
> > form variable or do you do it on the URL?
> >
>
> I have it passing in the form's action attribute, so it stays in $_GET
domain
> like regular links.
> echo '

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



Re: [PHP] Regular Expression

2003-12-27 Thread Kelly Hallman
On Sat, 27 Dec 2003, Joshua wrote:
> I'm trying to change the string, for example,
>
> $string = "11.abcd.32.efgh.53.ijk";
> to
> 
> 11.abcd.
> 32.efgh.
> 53.ijk.
> 
> with ereg_replace. Like 
> ereg_replace("\.[0-9]","",$string);
> How can I recover the original characters after replacing them with 
> in ereg_replace?
> 
> ereg_replace("\.[0-9]","\\0",$string) gives me the
> wrong result like:
> 
> 11.abcd.
> 32.efgh.
> 53.ijk.

Since the output you want and the output you didn't want are identical in
your post, it was hard to tell what you were trying to do, but...

I think this is what you want..
ereg_replace("(\.)([0-9])","\\1\\2",$string);
(minus the last decimal point, missing from your original string)

-- 
Kelly Hallman
// Ultrafancy

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



php-general Digest 27 Dec 2003 19:27:49 -0000 Issue 2497

2003-12-27 Thread php-general-digest-help

php-general Digest 27 Dec 2003 19:27:49 - Issue 2497

Topics (messages 173355 through 173382):

Re: File Uploads
173355 by: Jough Jeaux

Re: How New Is <<--- Begin Message ---
Hmm, well, to answer my own question, it looks like
the following will do.  Sorry to make an ass of
myself.  Hope you were all entertained!!



Send this file: 




--- Jough Jeaux <[EMAIL PROTECTED]> wrote:
> Greetings all, I want to allow users to upload
> images
> to an online profile.  Anyone know how to let the
> user
> browse his/her local filesystem from the web page?
> 
> 
> __
> Do you Yahoo!?
> New Yahoo! Photos - easier uploading and sharing.
> http://photos.yahoo.com/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/
--- End Message ---
--- Begin Message ---
By "comment[ing] out line 11", I take it you mean making a comment of line
11. I just did--as this problem woke me from a night's sleep at just past
2:30 AM--and the error message is now:

Parse error: parse error, unexpected $ in [path to file] on line 19

Where will this end?

Steve

Original Message:
-
From: Olwen Williams [EMAIL PROTECTED]
Date: Sat, 27 Dec 2003 18:25:00 +1300
To: [EMAIL PROTECTED]
Subject: Re: [PHP] How New Is << Cesar,
> 
> Sorry to have taken so long to answer. My day got complicated. Anyway,
> here's  the code all over again, with the last changes I was advised to
> make. I took out the line spaces and added line numbers. But first, the
> latest error message:
> 
>Parse error: parse error, unexpected T_VARIABLE in [path to file] on
> line 11
> 
> The code:
> 
> 1 
> 2 
> 3 
> 4 persistence demo
> 5 
> 6 
> 7 
> 8 Persistence Demo
> 9 
> 10  11 $txtBoxCounter = $_POST['txtBoxCounter'];

-- 
Olwen Williams
See my B&B site
http://www.bandbclub.com
and my new site http://www.handyman.co.nz - A virtual shed for real kiwi 
blokes.


mail2web - Check your email from the web at
http://mail2web.com/ .
--- End Message ---
--- Begin Message ---
Interesting that it's the same variable on both lines. The second error 
would not show untill the first disappeared.  Would you have copied and 
pasted some of the line?  I'm still for retyping the lines in case 
there's something odd lurking in there and not visible.

[EMAIL PROTECTED] wrote:
By "comment[ing] out line 11", I take it you mean making a comment of line
11. I just did--as this problem woke me from a night's sleep at just past
2:30 AM--and the error message is now:
Parse error: parse error, unexpected $ in [path to file] on line 19

Where will this end?

Steve

Original Message:
-
From: Olwen Williams [EMAIL PROTECTED]
Date: Sat, 27 Dec 2003 18:25:00 +1300
To: [EMAIL PROTECTED]
Subject: Re: [PHP] How New Is <<
Comment out line 11 to checkj it's the cause of the proble.  If the 
error goes away then retype the line.  I just tested this code and got 
no errors.  It could be a character that is not what it seems.

[EMAIL PROTECTED] wrote:


Cesar,

Sorry to have taken so long to answer. My day got complicated. Anyway,
here's  the code all over again, with the last changes I was advised to
make. I took out the line spaces and added line numbers. But first, the
latest error message:
  Parse error: parse error, unexpected T_VARIABLE in [path to file] on
line 11
The code:

1 
2 
3 
4 persistence demo
5 
6 
7 
8 Persistence Demo
9 
10 

--
Olwen Williams
See my B&B site
http://www.bandbclub.com
and my new site http://www.handyman.co.nz - A virtual shed for real kiwi 
blokes.
--- End Message ---
--- Begin Message ---
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Saturday, 27 December 2003 20:56
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] How New Is << 
> 
> By "comment[ing] out line 11", I take it you mean making a comment of line
> 11. I just did--as this problem woke me from a night's sleep at just past
> 2:30 AM--and the error message is now:
> 
> Parse error: parse error, unexpected $ in [path to file] on line 19
> 
> Where will this end?
> 
> Steve
> 
> Original Message:
> -
> From: Olwen Williams [EMAIL PROTECTED]
> Date: Sat, 27 Dec 2003 18:25:00 +1300
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] How New Is << 
> 
> Comment out line 11 to checkj it's the cause of the proble.  If the 
> error goes away then retype the line.  I just tested this code and got 
> no errors.  It could be a character that is not what it seems.
> 
> [EMAIL PROTECTED] wrote:
> 
> > Cesar,
> > 
> > Sorry to have taken so long to answer. My day got complicated. Anyway,
> > here's  the code all over again, with the last changes I was advised to
> > make. I took out the line spaces and added line numbers. But first,

Re: [PHP] How New Is <<

2003-12-27 Thread [EMAIL PROTECTED]
Bingo!

Thanks, everyone! And thanks especially to Andrew! You were right: I needed
the action and method attributes. And then it does increment.

My last question on this episode: Why did it work before this for some of
you trying it out for me? I mean, the code is the code, right? And either
it's correct or it's not. How come it worked without these other attributes
for some of you?

Steve 

-

It looks like your form tag is missing some attributes needed to point
your browser to the script as to where to submit the data.

if you were to try with your form tag as  ??

Andrew.


mail2web - Check your email from the web at
http://mail2web.com/ .

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



Re: [PHP] How New Is <<

2003-12-27 Thread Olwen Williams
It incrementeted for me only after I changed $_POST to $_GET, but never 
gave errors.

[EMAIL PROTECTED] wrote:

Bingo!

Thanks, everyone! And thanks especially to Andrew! You were right: I needed
the action and method attributes. And then it does increment.
My last question on this episode: Why did it work before this for some of
you trying it out for me? I mean, the code is the code, right? And either
it's correct or it's not. How come it worked without these other attributes
for some of you?
Steve 

-

It looks like your form tag is missing some attributes needed to point
your browser to the script as to where to submit the data.
if you were to try with your form tag as  ??
Andrew.


mail2web - Check your email from the web at
http://mail2web.com/ .
--
Olwen Williams
See my B&B site
http://www.bandbclub.com
and my new site http://www.handyman.co.nz - A virtual shed for real kiwi 
blokes.

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


[PHP] Re: HELP! -- Problem with imagejpeg()

2003-12-27 Thread Al
Here is a complete function I wrote a few months ago.  It should do it 
for you or give you hints for fixing your problem. 

René fournier wrote:

Hello,

I have a function that is meant to check if an image is greater than
a certain width and height, and if it is, downsample it. The checking
part works fine. Downsampling is not happening though. Here's what 
I've  got
(btw, $file = "/somedirectory/photo.jpg"):

$src_img=imagecreatefromJPEG($file);   
$dst_img=imagecreatetruecolor($new_width,$new_height);

imagecopyresampled($dst_img,$src_img,0,0,0,0,$new_width,$new_height,$siz 
e[0],$size[1]);
imagejpeg($dst_img,$file,$img_quality);

Any ideas?

Thanks.

...Rene

 100, "new_width" => 200, "quality" =>100, "backup_org" => "no");
 * 
 *   quality = percent [e.g. "quality" => 90] meaning 90%
 *   width = pixels [e.g., "new_width" => 200] i.e., 200 pixels.
 *   backup_org [original file] "yes" or "no".  "no" is the default
 * 
 * Use this to fetch $resize_stats:
 * 		foreach($resize_stats as $key => $value)
 * {
 * echo $key . " = " . $value;
 * }
 */


function resize_width($file_location, $resize_args, $auto)
{
global $DOCUMENT_ROOT;

if (empty($resize_args)) die("Code error, argument(s) in \$resize_arg missing in resize_width.  ");

	if($auto== "yes"){

		if ($_FILES['username']['error'] == 0) {
	
			$name = key($_FILES); 			//could use the register variables, but this is safer.
			
	$org_img = $_FILES[$name]['name'];
	
	$org_img = filename_fixer($org_img);
			
			$org_img = $file_location . $org_img;
		}
	}
	else{$org_img = $file_location;}
	
if ($resize_args['backup_org'] == "yes") {
file_backup($org_img);
} 

$org_img = $DOCUMENT_ROOT . $org_img;
	
	if (!file_exists($org_img))die("Code error, $org_img missing or incorrect file name in resize_width() ");

$new_width = $resize_args['new_width'];
$quality = $resize_args['quality'];

$imagehw = GetImageSize($org_img);
$org_width = $imagehw[0];
$org_height = $imagehw[1];

if ($new_width !== $org_width) {
$imagevsize = $org_height * $new_width / $org_width;
$new_height = ceil($imagevsize);

$src_img = imagecreatefromjpeg($org_img);
$dest_img = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($dest_img, $src_img, 0, 0, 0, 0, $new_width, $new_height, $org_width, $org_height);
imagejpeg($dest_img, $org_img, $quality);
imagedestroy($src_img);
imagedestroy($dest_img);
} else {
$newheight = $org_height;
} 
// see above how to use array
$resize_stats = array("Orginal width" => $org_width, "Orginal height" => $org_height, "New width" => $new_width, "New height" => $new_height);

if ($resize_args['show_stats'] == "yes") {
foreach($resize_stats as $key => $value) {
echo $key . " = " . $value . "\r\n";
} 
} 

return $resize_stats;
} 


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

Re: [PHP] Regular Expression

2003-12-27 Thread Joshua
Thank you!! It worked!!

The wrong sample was 'dot'11'dot'abcd, but
the first dot was not shown properly...

And, now I have another problem:
In fact, the input strings are lines from a webpage, and
they sometimes have line-feed as in:

11.abcd.32.efgh.54.ij <--here
kh.41.lmno. <--here
63.pqrs

And, with ereg_replace("(\.)([0-9])","\\1\\2",$string),
 the result I expect is:

 11.abcd.

32.efgh.

54.ijkh.

41.lmno.

63.pqrs.

But, the actual result is:

11.abcd.

32.efgh.

54.ij <-- problem
kh.

41.lmno.
63.pqrs. <-- problem

I tried some more regular expressions to solve this, but
they don work yet.
So, please help me~~

Thank you in advance.

Joshua

- Original Message -
From: "Kelly Hallman" <[EMAIL PROTECTED]>
To: "Joshua" <[EMAIL PROTECTED]>
Cc: "PHP General list" <[EMAIL PROTECTED]>
Sent: Saturday, December 27, 2003 1:27 PM
Subject: Re: [PHP] Regular Expression


> On Sat, 27 Dec 2003, Joshua wrote:
> > I'm trying to change the string, for example,
> >
> > $string = "11.abcd.32.efgh.53.ijk";
> > to
> >
> > 11.abcd.
> > 32.efgh.
> > 53.ijk.
> >
> > with ereg_replace. Like
> > ereg_replace("\.[0-9]","",$string);
> > How can I recover the original characters after replacing them with 
> > in ereg_replace?
> >
> > ereg_replace("\.[0-9]","\\0",$string) gives me the
> > wrong result like:
> >
> > 11.abcd.
> > 32.efgh.
> > 53.ijk.
>
> Since the output you want and the output you didn't want are identical in
> your post, it was hard to tell what you were trying to do, but...
>
> I think this is what you want..
> ereg_replace("(\.)([0-9])","\\1\\2",$string);
> (minus the last decimal point, missing from your original string)
>
> --
> Kelly Hallman
> // Ultrafancy
>
> --
> 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] newbie mysql and php

2003-12-27 Thread tony
hello

I'm new with php just learning and i have just a problem with the following
code

$dbconnect = mysql_connect("localhost", "prog_tony","PASSWORD");
mysql_select_db("prog_dealer", $dbconnect);
$stop = 0;
$counter = 1;
while(!$stop){
$query = "SELECT name FROM category WHERE id = $counter";
$dbdo = mysql_query($query,$dbconnect);
while($row= mysql_fetch_array($dbdo)){
if($row[0]){
$counter++;
}else{
$stop=1;
}
$row[0] = "";
}

}



I'm getting an error with mysql_fetch_array() which is line 14 because I
didn't show the other lines since it is not relevant.
here is the error
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in /home/prog/public_html/php/cateadded.php on line 14

Thank you

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



[PHP] PHP5 XML functions

2003-12-27 Thread TopTenNut
I've just gotten PHP5 B3 working using the precompiled binaries under Win XP, 
but the dom xml functions of PHP4 don't seem to be immediately available.  
Does anyone have suggestions on how to learn to use the new XML functionality?  
The source code?

Greg Steffenson


[PHP] Printing out html

2003-12-27 Thread Labunski
Hello, I have just entered PHP "world" and I have many questions. I have
already made PHP script that send's htm form values via e-mail.
Now I want to build PHP based web page..

>> 1.question>>
For example I have index.php file, but I want HTML (index.html) file to be
"printed out". How php code should look like?

>> 2.question >>
I know that code for IP address ($ip) is:
  $ip = getenv ("REMOTE_ADDR");

For example I have Index.php file, and I want an IP adders to be viewed in
the TD:

 IP address 

How should I write it?


Sorry for my dumb questions and bad english,
Regards,
Lab.

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



Re: [PHP] newbie mysql and php

2003-12-27 Thread Brad Pauly
On Sat, 2003-12-27 at 17:17, tony wrote:
> hello
> 
> I'm new with php just learning and i have just a problem with the following
> code
> 
> $dbconnect = mysql_connect("localhost", "prog_tony","PASSWORD");
> mysql_select_db("prog_dealer", $dbconnect);
> $stop = 0;
> $counter = 1;
> while(!$stop){
> $query = "SELECT name FROM category WHERE id = $counter";
> $dbdo = mysql_query($query,$dbconnect);
> while($row= mysql_fetch_array($dbdo)){
> if($row[0]){
> $counter++;
> }else{
> $stop=1;
> }
> $row[0] = "";
> }
> 
> }
> 
> 
> 
> I'm getting an error with mysql_fetch_array() which is line 14 because I
> didn't show the other lines since it is not relevant.
> here is the error
> Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
> resource in /home/prog/public_html/php/cateadded.php on line 14

Try checking your query results. mysql_query might return false which is
not a valid result.

$dbdo = mysql_query($query, $dbconnect)
or die(mysql_error());

That should let you know what is going on.

- Brad

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



RE: [PHP] Printing out html

2003-12-27 Thread Mike Brum
1. if you have index.php, then just get rid of index.html and print your
content via print or echo statements. 

2. 

$ip = getenv("REMOTE_ADDR"); 
print "IP Address: " . $ip . "";

(there's a few ways you can do that - this is just the standard I use)

Regards

-M

-Original Message-
From: Labunski [mailto:[EMAIL PROTECTED] 
Sent: Saturday, December 27, 2003 9:47 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Printing out html

Hello, I have just entered PHP "world" and I have many questions. I have
already made PHP script that send's htm form values via e-mail.
Now I want to build PHP based web page..

>> 1.question>>
For example I have index.php file, but I want HTML (index.html) file to be
"printed out". How php code should look like?

>> 2.question >>
I know that code for IP address ($ip) is:
  $ip = getenv ("REMOTE_ADDR");

For example I have Index.php file, and I want an IP adders to be viewed in
the TD:

 IP address 

How should I write it?


Sorry for my dumb questions and bad english, Regards, Lab.

--
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] newb: stop file process

2003-12-27 Thread Jed R. Brubaker
This one should be simple.

I am wondering if there is a simple way in which to stop the processing of a
file.

The current example is a program that checks to see if the user is logged
in. In the past I have done something like this:

if ($loggedIn != true) {
echo "You are not logged in.";
}
else {
echo "Welcome";
}

This, however, becomes a substantial problem (or at least annoyance) when
the else is pages long. I would prefer to have something like:

if ($loggedIn != true) {
echo "You're not logged in.";
// stop process of file here
}
// Page content (with no else)

The ultimate objective is to have a simple function in the my class include
file to verify that the user is always logged in.

Thanks in advance.

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