php-general Digest 3 Nov 2002 22:57:54 -0000 Issue 1683

Topics (messages 122547 through 122581):

Send mail in HTML FORMAT
        122547 by: Kevin Fradkin
        122566 by: Jennifer Swofford

Variables
        122548 by: Bryan McLemore
        122550 by: David Jackson
        122553 by: Hugh Danaher

Re: Cookies disabled, new session ID each click!
        122549 by: Steve Fatula
        122567 by: Oleg Krogius

how can me know the disbaled functions in php?
        122551 by: Alawi
        122552 by: Rasmus Lerdorf

max_ execution_time for scripts launched from command line
        122554 by: gap

fread() fails with large files
        122555 by: Sora B. Harbater

what i'm doing wrong? (mysql/php)
        122556 by: Mr. BuNgL3
        122557 by: John W. Holmes

Re: Session Management
        122558 by: John W. Holmes
        122560 by: Robert Samuel White

Re: Send $out embedded in a mail in HTML FORMAT
        122559 by: John W. Holmes
        122561 by: Jonathan Sharp
        122581 by: Manuel Lemos

Your opinion on globals/reference
        122562 by: Gerard Samuel

Re: Geographic IP location
        122563 by: Gerard Samuel
        122580 by: Mika Tuupola

Re: need help with project
        122564 by: Kevin Myrick

Been looking for a tutorial on how to create themes in general
        122565 by: Kevin Myrick

Calendar script - help
        122568 by: Ray Healy \(Data Net Services\)

Am I blind? simple 15 line code producing error
        122569 by: Paul
        122570 by: Sascha Cunz
        122572 by: Paul
        122573 by: Sascha Cunz
        122577 by: Jason Wong
        122579 by: Hugh Danaher

Re: Quarter question..
        122571 by: Jim Hatridge

ASTemplate
        122574 by: Adam Atlas
        122578 by: Jonathan Sharp

Kxparse 0.2
        122575 by: Khalid El-Kary

Re: XSLT Sablotron output
        122576 by: Daniele Baroncelli

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
I read from a template, insert data and save it as a new file with html
code...
i want to send that file that is the same as $out via mail embedded in it...

i do

$fifi = fopen ('/'.$cursada.$cuatrimestre.'/'.$registronro.'.htm', "w");
$fp = $fifi;
fputs ($fifi, $out . "");
fclose ($fifi);
mail("[EMAIL PROTECTED]", "subject",$out , "From: website");

but when i receive that mail.. i get the source of the file with <html>
<body> bla bla bla.... not in HTML FORMAT..

thnx in advance!..

Spooky

--- End Message ---
--- Begin Message ---
You also need to add the text/html header, such as:

$headers = "Content-Type: text/html \r\n";

mail("[EMAIL PROTECTED]", "subject",$out , "From: website", $headers);

jen

> I read from a template, insert data and save it as a new file with html
> code...
> i want to send that file that is the same as $out via mail embedded in
it...
>
> i do
>
> $fifi = fopen ('/'.$cursada.$cuatrimestre.'/'.$registronro.'.htm', "w");
> $fp = $fifi;
> fputs ($fifi, $out . "");
> fclose ($fifi);
> mail("[EMAIL PROTECTED]", "subject",$out , "From: website");
>
> but when i receive that mail.. i get the source of the file with <html>
> <body> bla bla bla.... not in HTML FORMAT..
>
> thnx in advance!..
>
> Spooky



--- End Message ---
--- Begin Message ---
What is a variables value before said value has been assigned a value?

Thanks
Bryan
--- End Message ---
--- Begin Message ---
Bryan McLemore wrote:
What is a variables value before said value has been assigned a value?

Thanks
Bryan

Wouldn't it be null or empty " "?

Just a guess,
David


--- End Message ---
--- Begin Message ---
Bryan,
I don't think the variable has any value before assignment--it isn't zerro
nor is it null.  Check the manual for isset() and empty()'
Hope this helps.
Hugh

----- Original Message -----
From: "Bryan McLemore" <[EMAIL PROTECTED]>
To: "PHP - General" <[EMAIL PROTECTED]>
Sent: Sunday, November 03, 2002 1:01 AM
Subject: [PHP] Variables


What is a variables value before said value has been assigned a value?

Thanks
Bryan


--- End Message ---
--- Begin Message --- Not using trans_sid, but it is set for this example and it doesn't matter either way, intentionally putting the SID on the link myself, this is the way the vendor software is set up. So, I want someone to run this example, and see if it works for them, and if it does, what might be the reason it does not work for me?

Steve

Chris Shiflett wrote:

Steve,

Check your php.ini file. PHP uses cookies for maintaining your Web client's unique ID, and unless you have use_trans_sid set, it will not attempt to pass the unique ID on the URL for those who have cookies disabled.

Chris

Steve Fatula wrote:

When you click on the link in the code, it gives you a session ID. Then, when you click again, it goes away. The SID appears to be blank every other time.

Why would that be? I am using PHP 4.2.0 and 4.2.2, BSD and Linux, and Apache 1.3.20 something. Two different hosts. Same result. Client is IE5.5 with cookies disabled, running on NT.



--- End Message ---
--- Begin Message ---
You do not need to add any "SID" to your links. Those will be added
automatically by the php session system when needed.

-----Original Message-----
From: Steve Fatula [mailto:sfatula@;usa.net] 
Sent: Saturday, November 02, 2002 10:29 PM
To: [EMAIL PROTECTED]
Subject: Cookies disabled, new session ID each click!

I posted this but not sure Google works, so using my own account as it 
did not show up yet.

I am fairly new to PHP, and am running a shopping cart app written in 
PHP. Most people using this cart do not have this issue, but I do!

I have boiled the program down to a few lines, and it doesn't work. When

you click on the link in the code, it gives you a session ID. Then, when

you click again, it goes away. The SID appears to be blank every other
time.

Why would that be? I am using PHP 4.2.0 and 4.2.2, BSD and Linux, and 
Apache 1.3.20 something. Two different hosts. Same result. Client is 
IE5.5 with cookies disabled, running on NT. New session file is 
generated even though one already existed. This happens every other 
click as SID is blank every other click.

Please help me understand what the issue is.

Steve

<?php
session_name('Steve');
session_start();
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html">
<title>Test Page</title>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" 
leftmargin="0" rightmargin="0">
<?php echo '<a href="http://linux.office.home/catalog/default_test.php?'

. SID . '">link to me</a>'; ?>
</body>
</html>




--- End Message ---
--- Begin Message ---
How can me know?
--- End Message ---
--- Begin Message ---
phpinfo()

On Sun, 3 Nov 2002, Alawi wrote:

>
> How can me know?

--- End Message ---
--- Begin Message ---
Does the execution time limit apply to scripts that have been launched from
the shell command line and run independent from the http server (that is,
not as CGI and not through the server module)? If I give a script a shebang
line (#!/usr/bin/php -q), and make it executable, will it run for as long as
it takes to complete?

And if I don't have shell access, how can I run the script (I suppose that
calling it via the web server will limit its execution time)?

Thanks.


--- End Message ---
--- Begin Message --- Hi. I am using Linux/Apache with PHP 4.1.2. I have been experiencing this problem since upgrading from an earlier version of PHP 4.

My script forces a download of a PDF file after looking up some info in a database. The code looks like this:


$file="/path/to/file";
$fp = fopen($file, "r");
$size=filesize($file);
$contents = fread($fp, $size);
fclose($fp);

Header("Content-Type: $type");
Header("Content-Disposition: attachment; filename=$downloadname");
header("Content-Length: $size");
header("Content-Transfer-Encoding: binary");
echo $contents;

filesize() is reporting the size properly. The code works perfectly for smaller files, but the fread() fails for files larger than 19 MB or so and I got a page cannot be displayed error. I know that it is fread() which is causing the problem because I commented out all the code that follows it and still get the error. All the files being downloaded are PDF files.

Can anyone shed some light on this?


--- End Message ---
--- Begin Message ---
I can't validate this two variables ($logintxt, $passwdtxt)

<?
$logintxt = $HTTP_POST_VARS['logintxt'];
$passwdtxt= $HTTP_POST_VARS['passwdtxt'];

if (!$logintxt || !$passwdtxt)
{
 include('login.htm');
}
else
{
 $ligacao=mysql_connect("localhost","","");
 if (!$ligacao)
 {
  echo "
  <html>
  <title>ERROR!!</title>
  <body>Problemas na ligação á base de dados!</body>
  ";
 }
 else
 {
  $pass=md5($passwdtxt);
  $sql="SELECT login,passwd FROM users WHERE (login='$logintxt') &&
(passwd='$pass')";
  $result=mysql_db_query("mysite",$sql) or die (mysql_error());
  if ($result)
  {
   $reg=mysql_fetch_array($result);
   if ($pass==$reg["passwd"] && $logintxt==$reg["login"])
   {
    echo "
    <html>
    <title>Xaram!!</title>
    <body>User logged in</body>
    ";
   }
   else
   {
    echo "
    <html>
    <title>ERROR!!</title>
    <body>User não existente ou inválido</body>
    ";
   }

  }
  else
  {
   echo "
   <html>
   <title>ERROR!!</title>
   <body>No result</body>
   ";
  }


 }
 mysql_close();
}
?>

it keeps telling me "User não existente ou inválido" i guess that the
problem is in the line code "if ($pass==$reg["passwd"] &&
$logintxt==$reg["login"])" but i can't figure it out!! what i'm doing wrong?

Thanks for the help...



--- End Message ---
--- Begin Message ---
Don't use mysql_db_query() for one. Use mysql_select_db() and
mysql_query(). 

Also, what's the structure of your table and how are you putting the
user's login and password in the table. If you're getting that message,
then that means there were no rows matched, plain and simple. It could
be for a variety of reasons. You might want to echo out the query before
you execute it just to make sure it's what you think it is. 

---John Holmes...

> -----Original Message-----
> From: Mr. BuNgL3 [mailto:mrbungle@;netcabo.pt]
> Sent: Sunday, November 03, 2002 9:43 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] what i'm doing wrong? (mysql/php)
> 
> I can't validate this two variables ($logintxt, $passwdtxt)
> 
> <?
> $logintxt = $HTTP_POST_VARS['logintxt'];
> $passwdtxt= $HTTP_POST_VARS['passwdtxt'];
> 
> if (!$logintxt || !$passwdtxt)
> {
>  include('login.htm');
> }
> else
> {
>  $ligacao=mysql_connect("localhost","","");
>  if (!$ligacao)
>  {
>   echo "
>   <html>
>   <title>ERROR!!</title>
>   <body>Problemas na ligação á base de dados!</body>
>   ";
>  }
>  else
>  {
>   $pass=md5($passwdtxt);
>   $sql="SELECT login,passwd FROM users WHERE (login='$logintxt') &&
> (passwd='$pass')";
>   $result=mysql_db_query("mysite",$sql) or die (mysql_error());
>   if ($result)
>   {
>    $reg=mysql_fetch_array($result);
>    if ($pass==$reg["passwd"] && $logintxt==$reg["login"])
>    {
>     echo "
>     <html>
>     <title>Xaram!!</title>
>     <body>User logged in</body>
>     ";
>    }
>    else
>    {
>     echo "
>     <html>
>     <title>ERROR!!</title>
>     <body>User não existente ou inválido</body>
>     ";
>    }
> 
>   }
>   else
>   {
>    echo "
>    <html>
>    <title>ERROR!!</title>
>    <body>No result</body>
>    ";
>   }
> 
> 
>  }
>  mysql_close();
> }
> ?>
> 
> it keeps telling me "User não existente ou inválido" i guess that the
> problem is in the line code "if ($pass==$reg["passwd"] &&
> $logintxt==$reg["login"])" but i can't figure it out!! what i'm doing
> wrong?
> 
> Thanks for the help...
> 
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



--- End Message ---
--- Begin Message ---
> These were all the same assumptions I made, thanks.  I knew that it
was
> more of an "HTTP" thing than a "PHP" thing when it came to the "blind
> faith" thing...  I was just hoping that was something "better out
> there."  I'm not willing to use session management as blindly as it is
> currently implemented.  I will find my own solution.

If you find a better method, please let everyone know. But I think this
is about the best you can do over HTTP. 

---John Holmes...


--- End Message ---
--- Begin Message ---
I already know how best to go about this.  I've been up too long to
explain this now.  But since eNetwizard Content Management Server is an
open source project, you'll be able to make use of its code if you so
choose, just wait till I release the next version.  ;-)

Session Management for eNetwizard is handled by the $State class, so it
shouldn't be too hard for others to make use of it independently for
their own projects.

-Samuel | http://enetwizard.net


-----Original Message-----
From: John W. Holmes [mailto:holmes072000@;charter.net] 
Sent: Sunday, November 03, 2002 9:56 AM
To: 'Robert Samuel White'; [EMAIL PROTECTED]
Subject: RE: [PHP] Session Management

> These were all the same assumptions I made, thanks.  I knew that it
was
> more of an "HTTP" thing than a "PHP" thing when it came to the "blind
> faith" thing...  I was just hoping that was something "better out
> there."  I'm not willing to use session management as blindly as it is
> currently implemented.  I will find my own solution.

If you find a better method, please let everyone know. But I think this
is about the best you can do over HTTP. 

---John Holmes...






--- End Message ---
--- Begin Message ---
Search the archives or google for HTML email with PHP and you'll get a
ton of examples. You just have to send a Content-Type: header to tell
the mail reader it's HTML.

---John Holmes...

> -----Original Message-----
> From: Kevin Fradkin [mailto:kfradkin@;ciudad.com.ar]
> Sent: Saturday, November 02, 2002 7:53 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Send $out embedded in a mail in HTML FORMAT
> 
> I read from a template, insert data and save it as a new file with
html
> code...
> i want to send that file that is the same as $out via mail embedded in
> it...
> 
> i do
> 
> $fifi = fopen ('/'.$cursada.$cuatrimestre.'/'.$registronro.'.htm',
"w");
> $fp = $fifi;
> fputs ($fifi, $out . "");
> fclose ($fifi);
> mail("[EMAIL PROTECTED]", "subject",$out , "From: website");
> 
> but when i receive that mail.. i get the source of the file with
<html>
> <body> bla bla bla.... not in HTML FORMAT..
> 
> thnx in advance!..
> 
> Spooky
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



--- End Message ---
--- Begin Message ---
search google for 'phpmailer' (I think http://phpmailer.sourceforge.net)

-js


John W. Holmes wrote:
> Search the archives or google for HTML email with PHP and you'll get a
> ton of examples. You just have to send a Content-Type: header to tell
> the mail reader it's HTML.
> 
> ---John Holmes...
> 
> 
>>-----Original Message-----
>>From: Kevin Fradkin [mailto:kfradkin@;ciudad.com.ar]
>>Sent: Saturday, November 02, 2002 7:53 PM
>>To: [EMAIL PROTECTED]
>>Subject: [PHP] Send $out embedded in a mail in HTML FORMAT
>>
>>I read from a template, insert data and save it as a new file with
> 
> html
> 
>>code...
>>i want to send that file that is the same as $out via mail embedded in
>>it...
>>
>>i do
>>
>>$fifi = fopen ('/'.$cursada.$cuatrimestre.'/'.$registronro.'.htm',
> 
> "w");
> 
>>$fp = $fifi;
>>fputs ($fifi, $out . "");
>>fclose ($fifi);
>>mail("[EMAIL PROTECTED]", "subject",$out , "From: website");
>>
>>but when i receive that mail.. i get the source of the file with
> 
> <html>
> 
>><body> bla bla bla.... not in HTML FORMAT..
>>
>>thnx in advance!..
>>
>>Spooky
>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> 
> 



--- End Message ---
--- Begin Message ---
Hello,

On 11/02/2002 10:52 PM, Kevin Fradkin wrote:
I read from a template, insert data and save it as a new file with html
code...
i want to send that file that is the same as $out via mail embedded in it...

i do

$fifi = fopen ('/'.$cursada.$cuatrimestre.'/'.$registronro.'.htm', "w");
$fp = $fifi;
fputs ($fifi, $out . "");
fclose ($fifi);
mail("[EMAIL PROTECTED]", "subject",$out , "From: website");

but when i receive that mail.. i get the source of the file with <html>
<body> bla bla bla.... not in HTML FORMAT..
You need to use the Content-Type: text/html header in the 4th argument.

Anyway, if you send HTML only messages many spam filters will discard the messages you send because that is a pattern of many spammers messages.

What you need to do is to compose a message with both the text and HTML versions in the body as alternatives and so the spam filters will not discard the message.

In that case you may want to try this class that makes it easy to compose and send messages with text and HTML alternative versions in the same body and also other useful things like embedded images in the HTML page, attachments, etc...

http://www.phpclasses.org/mimemessage


--

Regards,
Manuel Lemos

--- End Message ---
--- Begin Message ---
Something I just thought of about using global in a function.
Mostly I global objects in a function like ->

function foo()
{
   global $bar_object;
   $bar_object->do_something();
}

Is it better, more effiecient, if I pass it by reference, like ->
function foo(&$bar_object)
{
   $bar_object->do_something();
}

Thanks for your thoughts...

--
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/


--- End Message ---
--- Begin Message ---
Try GeoIP.  http://www.maxmind.com/app/php

olinux wrote:

Hi all,

I am looking for a way to determine the geographic
location based on IP address. I understand that 100%
accuracy is impossible.
Does anyone know of a good software or service
provider that provides quality geographic detection to
US state level based on IP of website visitors. I have
tried several and find that they simply use whois
records. This is great but seems highly inaccurate.

Ideally I am looking for a utility that I can feed a
list of IP's to and then use this data to update mysql
records.
These two services look pretty decent.

http://www.geobytes.com

http://www.serviceobjects.com/products/dots_ipgeo.asp

Thanks for any input,
olinux

__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/


--
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/



--- End Message ---
--- Begin Message ---
On Sat, 2 Nov 2002, olinux wrote:

> I am looking for a way to determine the geographic
> location based on IP address. I understand that 100%
> accuracy is impossible. 
        
        There is a Net_Geo PEAR class, which uses CAIDA data.

        http://pear.php.net/package-info.php?pacid=55

-- 
Mika Tuupola                      http://www.appelsiini.net/~tuupola/

--- End Message ---
--- Begin Message ---
Check out FFL on Sourceforge.net. Currently, it is
still a standalone PHP app, but in the near/coming
soon future they are going to have it as a PHPWebsite
Module.

That is nice for me, since I have just converted to
PHPWebsite (would have used nuke, but it pissed me off
when it wouldn't let me do ANYTHING to config and
install), so I will probably go ahead and download it,
add it to my site somewhere, then use the module when
it comes out.

Will be nice to see how it works.

Hope that helps somewhat.

Kevin Myrick
www.ultimatealchemy.com

--- David Jackson <[EMAIL PROTECTED]> wrote:
> Karl --
> Before you go "reinventing the wheel" , you might
> check 
> http://freshmeat.net ... of course there is nothing
> actually wrong with 
>   "reinventing the wheel" *grin*
> 
> David Jackson
> 
> Karl James wrote:
> > Hello people
> >  
> > Im in need help with creating a system where it
> will let me 
> > Add/drop players off a web page..basically of a
> roster with salary cap
> > control
> > And I want to do trades as well
> > This is for a fantasy football page.
> >  
> > And I need to have username and passwords so my
> owners can login and
> > there is no cheating..
> >  
> > http://www.ultimatefootballleague.com/index4.shtml
> >  
> > This is my site.
> >  
> > Please email me directly if you are interested in
> helping.
> >  
> > Thanks
> > Karl james 
> >  
> >  
> > 
> 
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/
--- End Message ---
--- Begin Message ---
Ok, like I stated in my last message, I am using
PHPWebsite as my portal system.

However, I would like to learn how to do custom
themes, because like sooo many aspiring web
designers/programmers, I got an imagination a mile
long and deep.

So, anyone want to point me in the right direction on
a theme creation tutorial, seeing as Sourceforge
doesn't want to help me out?

Thanks,
Kevin Myrick
www.ultimatealchemy.com

__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/
--- End Message ---
--- Begin Message ---
Dear All

I spent days and days on this little project but still cannot get it to work (new to 
PHP as you might guess).

I have a script which is a combination of tutorial scripts and free code to display a 
calendar with colour coded cells for the events on each day.

The only way to enter events is to enter them one at a time. What I want to do is to 
be able to enter either a start date and end date or start date and the number of 
days. This will then enter a new line in the mySQL database for each day. There would 
only ever be one vent per day.

I have the following fields at present in the database and would probably need another 
field (say number of days)
id int (auto_increment) - eventdate date ('0000-00-00') - title (varchar) - event 
(blob)

Can anyone help me as I have searched them web and mail lists to no avail. Everything 
that is available is excellent but does too much for what I need.

Summary:- a calendar that can colour code the background cells if there is an event 
title in the mySQL database and to be able to enter the event for multiple days.

Any help would be very much appreciated.

Thanks for your time

Ray
--- End Message ---
--- Begin Message ---
Perhaps I am blind but I have the following simple code that gets me
errors:
<?php
                session_start();
                require_once ("config.inc");
                require_once "classes/HtmlTemplate.class";

if ($HTTP_SESSION_VARS[user_id]){
//do something
 } else {
        $message= "*** Area is restricted! Please login! ***";
                                $m= urlencode($message);
                                $sid_value="&PHPSESSID=".session_id();
                                header("Location:
index.php?error_message=$m$sid_value");
                                exit;
   }
?>

The error is:
Warning: Cannot add header information - headers already sent by (output
started by.. ..line 6) ...on line 12

Line 6 is the line with if ($HTTP_SESSION_VARS[user_id])
Line 12 is the line starting with header


--- End Message ---
--- Begin Message ---
>               require_once ("config.inc");
>               require_once "classes/HtmlTemplate.class";

> The error is:
> Warning: Cannot add header information - headers already sent by (output
> started by.. ..line 6) ...on line 12
>
> Line 6 is the line with if ($HTTP_SESSION_VARS[user_id])
> Line 12 is the line starting with header

You should check, if these include files contain anything after their closing 
?>.

-Sascha
--- End Message ---
--- Begin Message ---
Yes, I use those in other pages with no problem..it just this page
causes some problems..

-----Original Message-----
From: Sascha Cunz [mailto:Sascha@;GaNoAn.org] 
Sent: Sunday, November 03, 2002 1:03 PM
To: Paul; [EMAIL PROTECTED]
Subject: Re: [PHP] Am I blind? simple 15 line code producing error

>               require_once ("config.inc");
>               require_once "classes/HtmlTemplate.class";

> The error is:
> Warning: Cannot add header information - headers already sent by
(output
> started by.. ..line 6) ...on line 12
>
> Line 6 is the line with if ($HTTP_SESSION_VARS[user_id])
> Line 12 is the line starting with header

You should check, if these include files contain anything after their
closing 
?>.

-Sascha


--- End Message ---
--- Begin Message ---
> Yes, I use those in other pages with no problem..it just this page
> causes some problems..

Do you use Header('Location:...') in those other scripts? I can't see any 
reason inside the script you posted, that could produce this behaviour. Can 
you try it without the two require's, just to be sure?

btw: $HTTP_SESSION_VARS[user_id] should really be 
$HTTP_SESSION_VARS['user_id']

-Sascha

>
> -----Original Message-----
> From: Sascha Cunz [mailto:Sascha@;GaNoAn.org]
> Sent: Sunday, November 03, 2002 1:03 PM
> To: Paul; [EMAIL PROTECTED]
> Subject: Re: [PHP] Am I blind? simple 15 line code producing error
>
> >             require_once ("config.inc");
> >             require_once "classes/HtmlTemplate.class";
> >
> > The error is:
> > Warning: Cannot add header information - headers already sent by
>
> (output
>
> > started by.. ..line 6) ...on line 12
> >
> > Line 6 is the line with if ($HTTP_SESSION_VARS[user_id])
> > Line 12 is the line starting with header
>
> You should check, if these include files contain anything after their
> closing
> ?>.
>
> -Sascha

--- End Message ---
--- Begin Message ---
On Monday 04 November 2002 02:25, Paul wrote:
> Yes, I use those in other pages with no problem..it just this page
> causes some problems..
>
> -----Original Message-----
> From: Sascha Cunz [mailto:Sascha@;GaNoAn.org]
> Sent: Sunday, November 03, 2002 1:03 PM
> To: Paul; [EMAIL PROTECTED]
> Subject: Re: [PHP] Am I blind? simple 15 line code producing error
>
> >             require_once ("config.inc");
> >             require_once "classes/HtmlTemplate.class";
> >
> > The error is:
> > Warning: Cannot add header information - headers already sent by

Search for the above error in google (or search the archives). This kind of 
problem has been covered so MANY times before!

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

/*
Total strangers need love, too; and I'm stranger than most.
*/

--- End Message ---
--- Begin Message ---
Paul,
Got any spaces or lines above the "<?" ??  Spaces there will kill the
script.
Hugh
----- Original Message -----
From: "Paul" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, November 03, 2002 9:53 AM
Subject: [PHP] Am I blind? simple 15 line code producing error


> Perhaps I am blind but I have the following simple code that gets me
> errors:
> <?php
> session_start();
> require_once ("config.inc");
> require_once "classes/HtmlTemplate.class";
>
> if ($HTTP_SESSION_VARS[user_id]){
> //do something
>  } else {
> $message= "*** Area is restricted! Please login! ***";
> $m= urlencode($message);
> $sid_value="&PHPSESSID=".session_id();
> header("Location:
> index.php?error_message=$m$sid_value");
> exit;
>    }
> ?>
>
> The error is:
> Warning: Cannot add header information - headers already sent by (output
> started by.. ..line 6) ...on line 12
>
> Line 6 is the line with if ($HTTP_SESSION_VARS[user_id])
> Line 12 is the line starting with header
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Hi JS et al...

Thanks! This was what I was looking for. Also thanks for the color code, much 
smaller!

JIM


On Saturday 02 November 2002 18:54, Jonathan Sharp wrote:
> try this:
>
> -js
>
> <table border=1>
> <?
> $i = 0;
> while ( $myrow = mysql_fetch_array($result) )
> {
>     $c = ( ++$i % 2 ? 'yellow' : 'white' );
>     echo "<tr bgcolor=\"$c\">";
>     printf('<td><a href="%s?id=%s&delete=yes">Delete</a></td>',
> $PHP_SELF, $myrow['id'] );
>     $q = ceil( 4/(int)date('n', strtotime($mydata['date']) ));
>     printf('<td><a
> href="%s?id=%s&submit=yes">%s</a></td><td>%s</td><td>%s</td></tr>',
> 'update-inv.php', $myrow['id'], $myrow['name'], $myrow['details'], $q);
> }
> ?>
> </table>
>
> Jim Hatridge wrote:
> > HI all,
> >
> > In the code below I'm trying to get the last column to show 1, 2, 3, or 4
> > according to which quarter of the year it is. But all it shows in that
> > column is " Resource ID # X". The X starts with #3 and goes to 18. There
> > are (at the moment) 15 items in the table.  Any ideas what's wrong?
> >
> > Thanks
> >
> > JIM
> >
> > #############################
> > <?php
> > echo "<table border=1> \n";
> > $i=1;
> > while ($myrow = mysql_fetch_array($result)) {
> > if($i % 2) { //this means if there is a remainder
> >         echo "<TR bgcolor=\"yellow\">\n";
> >     } else { //if there isn't a remainder we will do the else
> >         echo "<TR bgcolor=\"white\">\n";
> >     }
> > $qdate=$myrow["date"];
> > $sql = "select quarter($qdate)" or die("not work #3");
> > $yyy = mysql_query ($sql) or die("not work #4");
> >
> > printf("<td><a href=\"%s?id=%s&delete=yes\">Delete</a></td>", $PHP_SELF,
> > $myrow["id"]);
> > printf("<td><a href=\"%s?id=%s&submit=yes\">Update</td><td>%s</td><td>
> > %s</td><td>  %s</td></a></tr>",
> >     "update-inv.php", $myrow["id"], $myrow["name"], $myrow["details"],
> > $yyy); $i=$i+1;
> > }
> > echo "</table>\n";
> > }
> > ?>
> > #############################

-- 
                                    Vielfeind -- Viel Ehr'
Antiamerikanische Propaganda in der Philatelie des 20. Jahrhunderts
          http:/www.fecundswamp.net/~hatridge/stamps/index.html
--- End Message ---
--- Begin Message --- First post!!! Um, yeah... anyway...

Hi people, I just got a beta of my ASTemplate code out. It's a PHP template system that uses an XML-based format to specify template format and text files (that can be HTML or any other text format) that make up the body of its output. If you're looking for a good template system for a PHP project, why don't you give ASTemplate a try? It's beta right now, so if you find any bugs, tell me and I'll try to fix it.

So, if you want to help me beta test it, or you think it might be useful (I wrote it for my own purposes, but now I'm releasing it in case others might find it useful) download it:
http://www.atommic.com/software/php/ASTemplate.tgz (GZipped tarball, for *nix and Mac- 11k)
http://www.atommic.com/software/php/ASTemplate.zip (ZIP archive, for Windows- 12k)

Currently it's distributed under the GNU GPL, but I might change it to the LGPL later so it can be more widely used. Anyway, I hope people enjoy ASTemplate!

--Adam Atlas


--
Adam Atlas

Your mouse has moved. Windows has to reboot for changes to take effect. [ OK ]

--- End Message ---
--- Begin Message ---
Benchmarks?

-js


Adam Atlas wrote:
> First post!!! Um, yeah... anyway...
> 
> Hi people, I just got a beta of my ASTemplate code out. It's a PHP
> template system that uses an XML-based format to specify template format
> and text files (that can be HTML or any other text format) that make up
> the body of its output. If you're looking for a good template system for
> a PHP project, why don't you give ASTemplate a try? It's beta right now,
> so if you find any bugs, tell me and I'll try to fix it.
> 
> So, if you want to help me beta test it, or you think it might be useful
> (I wrote it for my own purposes, but now I'm releasing it in case others
> might find it useful) download it:
> http://www.atommic.com/software/php/ASTemplate.tgz (GZipped tarball, for
> *nix and Mac- 11k)
> http://www.atommic.com/software/php/ASTemplate.zip (ZIP archive, for
> Windows- 12k)
> 
> Currently it's distributed under the GNU GPL, but I might change it to
> the LGPL later so it can be more widely used. Anyway, I hope people
> enjoy ASTemplate!
> 
> --Adam Atlas
> 
> 
> -- 
> Adam Atlas
> 
> Your mouse has moved. Windows has to reboot for changes to take effect.
> [ OK ]
> 
> 



--- End Message ---
--- Begin Message --- hi,

i want to just tell you about the new release of Kxparse (a XML parser)
you can find everything about the new release here

http://creaturesx.ma.cx/kxparse/

khalid







_________________________________________________________________
Surf the Web without missing calls! Get MSN Broadband. http://resourcecenter.msn.com/access/plans/freeactivation.asp

--- End Message ---
--- Begin Message ---
No one replied yet, so I suppose no one was able to solve this.

By the way, is there anyone that actually experienced the same situation?


Cheers

Daniele



"Daniele Baroncelli" <[EMAIL PROTECTED]> wrote in message
news:20021102212518.34728.qmail@;pb1.pair.com...
> Hi guys,
>
> I have typed a simple script to test the Sablotron module recently
> installed.
> I found out that the HTML is output all in one line, without newlines,
which
> is very annoying.
> Anyone can tell me if this is a bug of the module, or I have to specify
> something somewhere?
>
> Here is the script on the server, where you can watch the result:
> http://www.rockit.it/redazione/sixth/prova.php
>
> Below you can find my PHP, XML and XSL files.
>
>
> Cheers
>
> Daniele
>
>
> ==========
>
> PHP file
> ----------
>
>
> <?php
>
> // Allocate a new XSLT processor
> $xh = xslt_create();
>
> // call the XSLT processor directly
> xslt_process($xh, 'prova.xml', 'prova.xsl', 'prova.html');
>
> // output the result
> readfile('prova.html');
>
> xslt_free($xh);
>
> ?>
>
> ==========
>
> XML file
> -----------
>
> <?xml version="1.0"?>
> <me>
>  <name>John Doe</name>
>  <address>94, Main Street, Nowheresville 16463, XY</address>
>  <tel>738 2838</tel>
>  <email>[EMAIL PROTECTED]</email>
>  <url>http://www.unknown_and_unsung.com/</url>
> </me>
>
> ===========
>
> XSL file
> ---------
>
> <?xml version="1.0"?>
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
>
> <xsl:template match="/">
>
>  <html>
>  <head>
>  </head>
>  <body>
>  <h1>Contact information for <b><xsl:value-of select="me/name" /></b></h1>
>
>  <h2>Mailing address:</h2>
>  <xsl:value-of select="me/address" />
>
>  <h2>Phone:</h2>
>  <xsl:value-of select="me/tel" />
>
>  <h2>Email address:</h2>
>  <xsl:value-of select="me/email" />
>
>  <h2>Web site URL:</h2>
>  <xsl:value-of select="me/url" />
>
>  </body>
>  </html>
>
> </xsl:template>
>
> </xsl:stylesheet>
>
> ==========
>
>


--- End Message ---

Reply via email to