Re: [PHP] Include Part 2

2002-09-29 Thread Justin French

Is this to pull the rows out of a database??

You could start with a simple example, which is just a basic config setting,
and use the $myrow array in your sql while loop to do a lot of the work.

?
// set your column names
$colsToSelect = 'title, format, category';

// select
$sql = SELECT {$colsToSelect} FROM tablename LIMIT 2;
$result = mysql_query($sql);
while($myrow = mysql_fetch_array($result))
{
foreach($myrow as $key = $value)
{
echo {$key}: {$value}br /\n;
}
echo br /\n;
}
?

For the above query, this would echo something like:

title: contents of titlebr /
format: contents of format br /
category: contents of category br /
br /
title: contents of titlebr /
format: contents of format br /
category: contents of category br /
br /


The next from there, to get more control over your rows might be an array
with the columns you wish to query...


Justin French




on 29/09/02 4:06 PM, Chuck PUP Payne ([EMAIL PROTECTED]) wrote:

 What I was wanting to do was store the myrows under let say, db_info.inc
 file. So that I can add or delete what myrows I want to call on.
 
 I am thinking this what I need  to do...
 
 Function row ($row) { //These are the rows to call on...
 $title = $myrow[title];
 $format = myrow[format];
 $category =$myrow[category];
 }
 
 This way I can add more myrow to call upon at a later date or delete for
 that matter.
 
 I hope that helps...
 
 Chuck
 
 On 9/29/02 1:48 AM, Justin French [EMAIL PROTECTED] wrote:
 
 Not sure I fully understand, but usually this stuff calls for either a
 function, or an included file of code... in your case, sounds like a
 function is required, but I may not fully understand...
 
 Regards,
 
 Justin
 
 
 on 29/09/02 3:29 PM, Chuck PUP Payne ([EMAIL PROTECTED]) wrote:
 
 Ok, I am trying to make my design a lot easier. I want to know if I can do
 this...
 
 I want to set up in my php page this...
 
 
 $rows;
 
 Under my db_info.inc I want to store this so that I can add delete from it.
 
 $row = $title = myrow[title]; $format = myrow[format]; $category =
 myrow[category];
 
 Am I wrong to try this way? Do I need to set it up as fuction to call on?
 
 Chuck Payne
 
 
 


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




Re: [PHP] Include Part 2

2002-09-29 Thread Chris Shiflett

Chuck PUP Payne wrote:

By the way I have time this but what is happen and maybe this will clear up
things.


That certainly made things clear. :-)

I only calling this first myrow call titles. It's not going on to
the other two. Now in my php page I have this...

$myrow = mysql_fetch_array($result);

$row;

Now this doesn't work.


No kidding. What is the line $row; supposed to do exactly?

But this does.

$myrow = mysql_fetch_array($result);

$title = $myrow[title];
$format = $myrow[format];
$category =$myrow[category];


Yes, this looks better. You should place your array keys in quotes, such 
as $myrow[title].

I don't see how this relates at all to your example above.

So want I wanted to do  but I am see you can was to make $row be called from
db_info.inc so that if lets say I wanted to add ratings I can add it to the
db_info.inc.


It's best to either include your code and reference file names or leave 
them out entirely. You sound like you assume we are looking at your 
screen and know what db_info.inc is.

The reasoning for this is about 50 pages and I am getting tried
of change each one I like to be able to change just one file. You know make
it easier. Better design.


I think you have the right idea. I really have no idea what the question 
is, but you should maybe consider the include() function to help you 
out. For example, you could have a script fetch_row.inc like this:

$myrow = mysql_fetch_array($result);
$title = $myrow[title];
$format = $myrow[format];
$category =$myrow[category];

Then every time you wanted to fetch a row from a result set consisting 
of these columns, you could just do this:

include(/path/to/fetch_row.inc);

Maybe that helps? I'm not really understanding what code you are 
repeating 50 times.

Happy hacking.

Chris


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




[PHP] Static constants? Server persistent?

2002-09-29 Thread Jean-Christian Imbeault

This is a bit hard for me to explain but is there any way to have PHP 
store a persistent server-side constant. Something that will stay in RAM 
and is not dependent on client connection.

For example I have this code in consts.inc file:

define (HOME_PAGE, http://myip.com/index.html);

But if I want access to the constant I need to include the file in every 
script that needs it.

I am hoping there is some way to say to the PHP engine, this is a 
static constant that will never change, keep it RAM, and share it 
between invocations/children.

Is this feasible? Is it is I could then cache whole blocks of static 
HTML and that would speed up my scripts quite a bit ... AND my my life 
as a programmer easier since I wouldn't have to always have an 
include(conts.inc) statement at the top of each of my scripts ...

Jc


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




Re: [PHP] Static constants? Server persistent?

2002-09-29 Thread Justin French

There is a directive in php.ini which allows a file to be included on EVERY
page that php parses... one at the very start, and one at the very end of
the script.

So in theory, you could include consts.inc as a always-include file at the
top of every script, by setting the right directive in php.ini

I'm pretty sure this is server-wide, but maybe it could be site- or
directory-wide by setting the variable in a .htaccess file.


Cheers,

Justin




on 29/09/02 8:59 PM, Jean-Christian Imbeault ([EMAIL PROTECTED])
wrote:

 This is a bit hard for me to explain but is there any way to have PHP
 store a persistent server-side constant. Something that will stay in RAM
 and is not dependent on client connection.
 
 For example I have this code in consts.inc file:
 
 define (HOME_PAGE, http://myip.com/index.html);
 
 But if I want access to the constant I need to include the file in every
 script that needs it.
 
 I am hoping there is some way to say to the PHP engine, this is a
 static constant that will never change, keep it RAM, and share it
 between invocations/children.
 
 Is this feasible? Is it is I could then cache whole blocks of static
 HTML and that would speed up my scripts quite a bit ... AND my my life
 as a programmer easier since I wouldn't have to always have an
 include(conts.inc) statement at the top of each of my scripts ...
 
 Jc
 


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




Re: [PHP] Static constants? Server persistent?

2002-09-29 Thread Jean-Christian Imbeault

Justin French wrote:

 There is a directive in php.ini which allows a file to be included on EVERY
 page that php parses... one at the very start, and one at the very end of
 the script
 
 I'm pretty sure this is server-wide, but maybe it could be site- or
 directory-wide by setting the variable in a .htaccess file.

I'll check again but I think that it isn't. It's as you say, it's 
include on  *every* page. It doesn't reside in memory it just cause PHP 
to pre-pend and append a file to every script ...

But maybe PHP is smart enough to keep that file in memory between script 
invocation and not have to read it off the disk every time a script is 
called?

Jc


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




[PHP] connection

2002-09-29 Thread DC

Hi,

OK I have my first php/mysql web site complete  working on my computer
using apache server. When I transfer the files to web space, I receive
errors regarding connection to database. Obviously the various pieces of
code I have used to connect it all up eg
?
$dbcnx = mysql_connect(localhost,,);
mysql_select_db(databaseName,$dbcnx);
?

etc etc

needs to be changed to what to see the site working live ?

Any ideas or tips greatly appreciated!!!

Thanks

DC






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




Re: [PHP] connection

2002-09-29 Thread Justin French

You need to set the parameters to whatever your ISP granted you for use of
MySQL... 

$dbcnx = mysql_connect(servername,username,password);

You should ask your ISP what these are.


Justin French



on 29/09/02 9:54 PM, DC ([EMAIL PROTECTED]) wrote:

 Hi,
 
 OK I have my first php/mysql web site complete  working on my computer
 using apache server. When I transfer the files to web space, I receive
 errors regarding connection to database. Obviously the various pieces of
 code I have used to connect it all up eg
 ?
 $dbcnx = mysql_connect(localhost,,);
 mysql_select_db(databaseName,$dbcnx);
 ?
 
 etc etc
 
 needs to be changed to what to see the site working live ?
 
 Any ideas or tips greatly appreciated!!!
 
 Thanks
 
 DC
 
 
 
 
 


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




[PHP] auto_prepend: *Exactly* like include()?

2002-09-29 Thread Jean-Christian Imbeault

Does using the auto_prepend config option in the php.ini file act 
exactly like and include() call.

An include call will read the file off disk ... will auto.prepend do the 
same thing or will PHP keep the file in memory for quick retrival?

Jc


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




Re: [PHP] Static constants? Server persistent?

2002-09-29 Thread Justin French

on 29/09/02 9:36 PM, Jean-Christian Imbeault ([EMAIL PROTECTED])
wrote:

 Justin French wrote:
 
 There is a directive in php.ini which allows a file to be included on EVERY
 page that php parses... one at the very start, and one at the very end of
 the script
 
 I'm pretty sure this is server-wide, but maybe it could be site- or
 directory-wide by setting the variable in a .htaccess file.
 
 I'll check again but I think that it isn't. It's as you say, it's
 include on  *every* page. It doesn't reside in memory it just cause PHP
 to pre-pend and append a file to every script ...
 
 But maybe PHP is smart enough to keep that file in memory between script
 invocation and not have to read it off the disk every time a script is
 called?

You're right... it's an include... THEN the vars will be in memory...

This is the best you can do, AFAIK, without hacking the source of PHP :)


Justin


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




Re: [PHP] Static constants? Server persistent?

2002-09-29 Thread Jean-Christian Imbeault

Justin French wrote:
 
 You're right... it's an include... THEN the vars will be in memory...
 
 This is the best you can do, AFAIK, without hacking the source of PHP :)

Just asking, do you know the source well enough to say with *certainty* 
that the auto prepend file is not kept in memory? If  not I'll try and 
ask the developers, though they might not lie this sort of simple 
question ;)

Since PHP has to keep prepending a certain file *all* the time it is 
called it would seem like a smart thing to have it keep the file in 
memory ...

Thanks,

Jc


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




Re: [PHP] Static constants? Server persistent?

2002-09-29 Thread Justin French

on 29/09/02 10:09 PM, Jean-Christian Imbeault ([EMAIL PROTECTED])
wrote:

 Just asking, do you know the source well enough to say with *certainty*
 that the auto prepend file is not kept in memory?

I'm merely guessing.

Justin


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




Re: [PHP] Static constants? Server persistent?

2002-09-29 Thread Jean-Christian Imbeault

Justin French wrote:
 
 I'm merely guessing.

Ok. Thanks for the guess. I'll post on the dev list and see if I can get 
a definitive answer.

Jc


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




RE: [PHP] passing select list variable from page1 to insertstatement astable name on page2

2002-09-29 Thread John W. Holmes

The variable is being passed properly; it just doesn't have a value.
Where are you setting $listbox??

---John Holmes...

 -Original Message-
 From: Chip Wiegand [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, August 06, 2002 9:28 AM
 To: 1LT John W. Holmes
 Cc: php
 Subject: Re: [PHP] passing select list variable from page1 to
 insertstatement astable name on page2
 
 On Mon, 2002-08-05 at 23:21, 1LT John W. Holmes wrote:
  Change this:
 
  mysql_query($sql) or die (mysql_error());
 
  to this:
 
  mysql_query($sql) or die (Error in this query $sql :  .
  mysql_error());
 
  And the error will probably be obvious to you. $listbox is not
getting a
  value. Why doesn't listbox appear in your second URL?
 
  ---John Holmes...
 
 Thanks for the better error statement. It does shed some more light on
 the subject - the table-name variable is not being passed on submit of
 the second page -
 
  Error in this query insert into (today,exercise,reps,comments)
values
 ('08-06','120','20','test') : You have an error in your SQL syntax
 near '(today,exercise,reps,comments) values
('08-06','120','20','test')'
 at line 1
 
 No matter if I quote the variable or not, always the same error. The
sql
 code is just below a couple paragraphs, I am at a loss as to how to
get
 that variable to be passed properly.
 
 --
 Chip W
 www.wiegand.org
 [EMAIL PROTECTED]
 
  - Original Message -
  From: Chip Wiegand [EMAIL PROTECTED]
  To: php [EMAIL PROTECTED]
  Sent: Tuesday, August 06, 2002 1:06 AM
  Subject: [PHP] passing select list variable from page1 to insert
 statement
  astable name on page2
 
 
  
   I have a page with a select list that will contain as many as 20
   options, allowing only one choice, not multiple. I have a second
page
   that is loaded on submit that wants that select list variable for
the
   table name in an insert statement. On the second page is a form
for
   entering data into the table, chosen from the select list on the
first
   page.
  
   I can echo the variable on the second page, so I know it is being
sent
   from page1 to page2 appropriately. I see in the url that it is
being
   send appropriately, and upon filling in the form, again the url
shows
   the data that is to be sent to the database. All appears to be
okay,
   except I get a syntax error message.
  
   Below is copied messages I have been exchanging with another user
on
   this subject, it contains a complete history, and the code for the
two
   pages, at the bottom.
  
   I hope someone can help solve this perplexing problem.
  
   --
   Chip W
   www.wiegand.org
   [EMAIL PROTECTED]
  
   Begin previous posts --
  


=
  
   Well, I think we're getting closer, in that the correct data is
being
   sent, as seen here -
  
   http://192.168.1.53/test2.php?listbox=legliftsexerciselist=
  
   Then when I enter some data and press submit the correct data is
sent
 -
  
  
 

http://192.168.1.53/test2.php?exercise=80reps=12comments=testsubmit=S
en
 d+
  Data
  
   But at the same time I get this error -
  
You have an error in your SQL syntax near
   '(date,exercise,reps,comments) values ('08-05','80','12','test')'
at
   line 1
  
   My entire sql statement looks like this -
  
 ?
 if(isset($submit)):
 $db = mysql_connect(localhost,,);
 if(!$db) error_message(sql_error());
 mysql_select_db(workout,$db) or die (mysql_error());
 $date = date(m-d);
 $sql = insert into $listbox (date,exercise,reps,comments)
   values ('$date','$exercise','$reps','$comments');
 mysql_query($sql) or die (mysql_error());
 endif;
 echo $listbox;
 ?
  
   As for the variable $listbox in the insert statement, I have tried
to
   quote it - .$listbox. - and also like this - $listbox - both
of
   which result in the same error as above, and then this version -
   '$listbox' - causing a T-Variable error which crashes the page.
   I don't see any syntax error in there. I will be posting this on
the
   lists also.
  
   --
   Chip W
   www.wiegand.org
   [EMAIL PROTECTED]
  
   On Mon, 2002-08-05 at 20:18, Rich Hutchins wrote:
Chip,
   
I'm going to take one more shot here, because, frankly, I'm
stumped
   too.
   
If you look at your URL, you see:
   
  
  http://192.168.1.53/workout-
 absflexor.php?exerciselist=%24listboxexercise=1
20
reps=12date=1-1comments=testsubmit=Send+Data
   
The part that reads ?exerciselist=%24listbox is what worries me.
exerciselist should have the value from the listbox in it and
   exerciselist
is what you should be referencing in your sql. So this part of
the
 URL
should look something like:
   
...?exerciselist=crunches...
   
Then you'd use a reference to $exerciselist in your SQL, not
 $listbox.
   
Forget what the book says for a moment. They're prone to errors
just
   like
you and me.
   
Variables are passed in name/value pairs. Everything to 

RE: [PHP] Problems with dbase_create function

2002-09-29 Thread John W. Holmes

Does the web server have permission to write to the directory where you
are trying to create the database? PHP runs as the web server when
installed as a module and it needs permission to write in that
directory. 

---John Holmes...

 -Original Message-
 From: Matt Neimeyer [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, September 29, 2002 2:19 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Problems with dbase_create function
 
 Hey All,
 
 I'm trying to build a DBF for exporting selected data as a download to
the
 end users... But I can't get further than this...
 
   error_reporting(E_ALL);
   $DBFName = Test.dbf;
   $Fields = array( array (Test,C,32) );
   if(dbase_create($DBFName, $Fields))
   { echo Good!; } else { echo Bad!; }
 
 It doesn't show an error... and it doesn't create the dbf... it just
shows
 Bad! and nothing else.
 
 Any ideas where I should begin looking? I admit I'm not the most savvy
 Linux user but I at least got it to admit that the function existed
(under
 a freshly compiled php with --enable-dbase on Redhat Linux 7.2)
 
 I've also tried $DBFName=./Test.dbf and
 /full_path_from_root_to_html_folder/Test.dbf and neither work. I've
also
 looked through the archives for this list and for the php-db list and
 haven't seen anything that helps (other than my earlier problem of not
 having enabled dbase, which appears to be fixed, before it wouldn't
even
 show Bad!. )
 
 Thanks in advance for any ideas...
 
 Matt
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




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




[PHP] date question

2002-09-29 Thread Jonas Geiregat

I have a date ex 24/08/02
and I need to see if that date is the same date as it is today (only one 
month later) but 5day's in advanced = that would be 24/09/02
so if(date == date now - 5)
{true}
else{false}

how can I do this right ?


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




[PHP] Re: date question

2002-09-29 Thread Jean-Christian Imbeault

Jonas Geiregat wrote:

 I have a date ex 24/08/02
 and I need to see if that date is the same date as it is today (only one 
 month later) but 5day's in advanced = that would be 24/09/02
 so if(date == date now - 5)
 {true}
 else{false}
 
 how can I do this right ?

Look at the online docs and read up on date() and strtotime() which can 
accept things like (today - 5days) as arguments.

Jc


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




Re: [PHP] date question

2002-09-29 Thread Justin French

Not sure why you need the 5 days in advance bit, but this might give you the
tools to work it all out.

I prefer to work with dates in unix timestamp format (seconds).

To get now, use time()

To get next month, there's a kewl function called strtotime(), which
converts english phrases into timestamps... eg strtotime(+1 month) might
do the job, or next month... experiment, use the manual, etc etc

To get now - 5 days either use strtotime(-5 days) or

?
$nowMinus5days = time() - 432000; // 432000 = 5x24x60x60
$nowMinus5days = date('d/m/y', $nowMinus5days);
?


Hope this helps,

Justin


on 29/09/02 3:04 PM, Jonas Geiregat ([EMAIL PROTECTED]) wrote:

 I have a date ex 24/08/02
 and I need to see if that date is the same date as it is today (only one
 month later) but 5day's in advanced = that would be 24/09/02
 so if(date == date now - 5)
 {true}
 else{false}
 
 how can I do this right ?
 


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




[PHP] Re: date question

2002-09-29 Thread Jonas Geiregat

and If I want to calculate from given date the next month
like strtotime(next month) gives me the date of one month in advanced 
from NOW
but I want to get the date one month in advanced from a given date not NOW

Jonas Geiregat wrote:
 I have a date ex 24/08/02
 and I need to see if that date is the same date as it is today (only one 
 month later) but 5day's in advanced = that would be 24/09/02
 so if(date == date now - 5)
 {true}
 else{false}
 
 how can I do this right ?
 


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




Re: [PHP] Re: date question

2002-09-29 Thread Matt

 From: Jonas Geiregat [EMAIL PROTECTED]
 Sent: Sunday, September 29, 2002 10:56 AM
 Subject: [PHP] Re: date question


 and If I want to calculate from given date the next month
 like strtotime(next month) gives me the date of one month in advanced
 from NOW
 but I want to get the date one month in advanced from a given date not NOW

If you have mysql lying around, it has a bunch of date functions that can do
what you want:
http://www.mysql.com/doc/en/Date_and_time_functions.html



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




[PHP] Copying a remote graphic to my server.

2002-09-29 Thread scott


Hello there
I am trying to copy a remote graphic from http://blah.com/blah.jpg to my
server. How would I achieve this in php I have looked on the archives
but can't seem to find the best way. I am running 4.1.2 on apache unix.

I understand copy will not work on remote files (tried it) but I am not
sure of the correct fopen fwrite etc code! Any sample code or pointers
are most helpful Best regards Scott


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




Re: [PHP] Copying a remote graphic to my server.

2002-09-29 Thread Rasmus Lerdorf

In PHP 4.3 you can actually just use copy().  In previous versions if you
just want to dump it out you can use readfile(), or if you want to store
it, use a simple fopen(), while(!feof()) fread() loop.

-Rasmus

On Sun, 29 Sep 2002, scott wrote:


 Hello there
 I am trying to copy a remote graphic from http://blah.com/blah.jpg to my
 server. How would I achieve this in php I have looked on the archives
 but can't seem to find the best way. I am running 4.1.2 on apache unix.

 I understand copy will not work on remote files (tried it) but I am not
 sure of the correct fopen fwrite etc code! Any sample code or pointers
 are most helpful Best regards Scott


 --
 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 Digest 29 Sep 2002 15:43:02 -0000 Issue 1614

2002-09-29 Thread php-general-digest-help


php-general Digest 29 Sep 2002 15:43:02 - Issue 1614

Topics (messages 118035 through 118078):

Posting a value to one form to another
118035 by: Uma Shankari T.
118037 by: Thoenen, Peter  Mr.  EPS
118040 by: Sascha Cunz
118041 by: Uma Shankari T.
118042 by: Sascha Cunz
118043 by: Uma Shankari T.
118044 by: Chris Shiflett
118045 by: Uma Shankari T.
118046 by: Chris Shiflett
118048 by: Uma Shankari T.

Include...
118036 by: Chuck \PUP\ Payne
118038 by: Chuck PUP Payne
118039 by: Chris Shiflett
118053 by: John Hinton

Include Part 2
118047 by: Chuck PUP Payne
118049 by: Justin French
118054 by: John W. Holmes
118055 by: Chuck PUP Payne
118057 by: Chuck PUP Payne
118058 by: Justin French
118059 by: Chris Shiflett

Re: Help! Can't set cookie or redirect!!!
118050 by: John W. Holmes

Re: John Holmes-Re: [PHP] Challenging problem for you programing gurus...
118051 by: John W. Holmes

Re: Dear all
118052 by: John W. Holmes

Problems with dbase_create function
118056 by: Matt Neimeyer
118071 by: John W. Holmes

Static constants? Server persistent?
118060 by: Jean-Christian Imbeault
118061 by: Justin French
118062 by: Jean-Christian Imbeault
118066 by: Justin French
118067 by: Jean-Christian Imbeault
118068 by: Justin French
118069 by: Jean-Christian Imbeault

connection
118063 by: DC
118064 by: Justin French

auto_prepend: *Exactly* like include()?
118065 by: Jean-Christian Imbeault

Re: passing select list variable from page1 to insertstatement astable name on page2
118070 by: John W. Holmes

date question
118072 by: Jonas Geiregat
118073 by: Jean-Christian Imbeault
118074 by: Justin French
118075 by: Jonas Geiregat
118076 by: Matt

Copying a remote graphic to my server.
118077 by: scott
118078 by: Rasmus Lerdorf

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]


--

---BeginMessage---


Hello ,

a href=Delay.php?hid=?php echo $hid+1; ?img src=Gif/nextque.gif 
border=0/a

While clicking this link the $hid value get incremented and fetch the value 
from the database according to that..the same thing is working in linux 
platform and it is not working for the windows platform..the value is not 
getting increment..Can anyone please tell me how to go about with this..??

Regards,
Uma



---End Message---
---BeginMessage---

You are using method GET correct?  This will not work for POST's on any
platform that I know of.  Browser default behavior for clicks are GET.  You
could create a custom browser to POST all clicks..but wouldn't work very
well :)

Only reason I am asking is Posting a value ...though Posting might != POST
:)

On the receiving form ... try the following code and see if anything looks
out of place.

##

  echo $_SERVER['REQUEST_METHOD'].'br/br/';
  echo 'GETbr/';
  foreach ($_GET as $key = $value) {
echo Key: $key; Value: $valuebr/;
  }
  echo 'POSTbr/';
  foreach ($_POST as $key = $value) {
echo Key: $key; Value: $valuebr/;
  }
  die;

##3

Cheers,

-Peter


 -Original Message-
 From: Uma Shankari T. [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, September 29, 2002 05:45
 To: PHP
 Subject: [PHP] Posting a value to one form to another
 
 
 
 Hello ,
 
 a href=Delay.php?hid=?php echo $hid+1; ?img 
 src=Gif/nextque.gif 
 border=0/a
 
 While clicking this link the $hid value get incremented and 
 fetch the value 
 from the database according to that..the same thing is 
 working in linux 
 platform and it is not working for the windows platform..the 
 value is not 
 getting increment..Can anyone please tell me how to go about 
 with this..??
 
 Regards,
 Uma
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

---End Message---
---BeginMessage---

I think your linux plattform has a version of PHP older than 4.2.0 and your 
Windows machine has a newer Version. In this old Versions, Register_Globals 
was turned on.
Try to access $hid by using: ?php echo $_GET['hid']; ?

Regards
Sascha

 Hello ,

 a href=Delay.php?hid=?php echo $hid+1; ?img src=Gif/nextque.gif
 border=0/a

 While clicking this link the $hid value get incremented and fetch the value
 from the database according to that..the same thing is working in linux
 platform and it is not working for the windows platform..the value is not
 getting increment..Can anyone please tell me how to go about with this..??

 Regards,
 Uma


---End Message---
---BeginMessage---



Hello,


On 

RE: [PHP] Problems with dbase_create function

2002-09-29 Thread Matt Neimeyer

I considered that...

Problem is I'm not 100% certain how to set that the correct way... (so as 
not to screw anything else up)

Recommendations?

Thanks

PS It's good to know I wasn't completely off base... thanks millions!

Does the web server have permission to write to the directory where you
are trying to create the database? PHP runs as the web server when
installed as a module and it needs permission to write in that
directory.

---John Holmes...

  -Original Message-
  From: Matt Neimeyer [mailto:[EMAIL PROTECTED]]
  Sent: Sunday, September 29, 2002 2:19 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Problems with dbase_create function
 
  Hey All,
 
  I'm trying to build a DBF for exporting selected data as a download to
the
  end users... But I can't get further than this...
 
error_reporting(E_ALL);
$DBFName = Test.dbf;
$Fields = array( array (Test,C,32) );
if(dbase_create($DBFName, $Fields))
{ echo Good!; } else { echo Bad!; }
 
  It doesn't show an error... and it doesn't create the dbf... it just
shows
  Bad! and nothing else.
 
  Any ideas where I should begin looking? I admit I'm not the most savvy
  Linux user but I at least got it to admit that the function existed
(under
  a freshly compiled php with --enable-dbase on Redhat Linux 7.2)
 
  I've also tried $DBFName=./Test.dbf and
  /full_path_from_root_to_html_folder/Test.dbf and neither work. I've
also
  looked through the archives for this list and for the php-db list and
  haven't seen anything that helps (other than my earlier problem of not
  having enabled dbase, which appears to be fixed, before it wouldn't
even
  show Bad!. )
 
  Thanks in advance for any ideas...
 
  Matt
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php




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


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




Re: [PHP] Static constants? Server persistent?

2002-09-29 Thread Mike Mannakee

Just out of curiosity, what problem are you trying to solve?  Including a
file is so easy and takes so little time I wonder how this could be a
problem.  I've worked for a web site that was getting millions of page views
per day (Billions per month) running php/mysql and the issue never came up.
As long as you have enough bandwidth and servers, speed is no problem.

Mike


Jean-Christian Imbeault [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Justin French wrote:
 
  I'm merely guessing.

 Ok. Thanks for the guess. I'll post on the dev list and see if I can get
 a definitive answer.

 Jc




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




[PHP] Session Not Saving?

2002-09-29 Thread Stephen Craton

I'm having another problem with my member's area script. When someone
logs in, it's supposed to register their username into a session and it
displays fine on the first page. But once you navigate to another part
of the area, it does not tell you you are logged in, instead it gives me
the error I set it to give You are  not logged in. Here's the code
that checks to see if the user is valid:

function check_valid()
{
  global $valid_user;
  if (session_is_registered(valid_user))
  {
  echo font size='2'Welcome $valid_user!/font;
  }
  else
  {
 echo You are not logged in.;
 exit;
  }  
}

Here's the code that's supposed to save the session:

include_once(funcs.php);
session_start();
if($user  $pass)
{
if(login($user, $pass))
{
$valid_user = $user;
session_register(valid_user);
}
else
{
echo font face='Arial, Helvetica, sans-serif'
size='3'centerbYou supplied an invalid username and password combo.
Try again please./b/center;
exit;
}
}

Please help again!!!

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



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




Re: [PHP] Static constants? Server persistent?

2002-09-29 Thread Jean-Christian Imbeault

Mike Mannakee wrote:

 Just out of curiosity, what problem are you trying to solve?  Including a
 file is so easy and takes so little time I wonder how this could be a
 problem.

Good question, glad you asked.

I have a header on all my pages. The header is HTML and contains images. 
So of course I do an include(header.html) on all my pages ...

The header is about 20K, having PHP read 20k off the disk everytime a 
user visits my page seemed inneficient. So I was trying to find a way to 
get PHP to cache the file in memory so it wouldn't have to read it off 
disk all the time ...

I have lots of bandwidth but not enough money to pay for a proper 
SCSI/RAID disk set. All I have is a poor 7,2000 IDE HD. So the less disk 
seeks thebetter :)

Jc


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




Re: [PHP] Session Not Saving?

2002-09-29 Thread debbie_dyer

Are you calling session_start() on the other pages inside the secure area?

- Original Message - 
From: Stephen Craton [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, September 29, 2002 5:23 PM
Subject: [PHP] Session Not Saving?


 I'm having another problem with my member's area script. When someone
 logs in, it's supposed to register their username into a session and it
 displays fine on the first page. But once you navigate to another part
 of the area, it does not tell you you are logged in, instead it gives me
 the error I set it to give You are  not logged in. Here's the code
 that checks to see if the user is valid:
 
 function check_valid()
 {
   global $valid_user;
   if (session_is_registered(valid_user))
   {
   echo font size='2'Welcome $valid_user!/font;
   }
   else
   {
  echo You are not logged in.;
  exit;
   }  
 }
 
 Here's the code that's supposed to save the session:
 
 include_once(funcs.php);
 session_start();
 if($user  $pass)
 {
 if(login($user, $pass))
 {
 $valid_user = $user;
 session_register(valid_user);
 }
 else
 {
 echo font face='Arial, Helvetica, sans-serif'
 size='3'centerbYou supplied an invalid username and password combo.
 Try again please./b/center;
 exit;
 }
 }
 
 Please help again!!!
 
 Thanks,
 Stephen
 http://www.melchior.us
 http://php.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] Static constants? Server persistent?

2002-09-29 Thread John Hinton

Jean-Christian Imbeault wrote:

 Mike Mannakee wrote:


 Just out of curiosity, what problem are you trying to solve?  
 Including a
 file is so easy and takes so little time I wonder how this could be a
 problem.


 Good question, glad you asked.

 I have a header on all my pages. The header is HTML and contains 
 images.So of course I do an include(header.html) on all my pages 
 ...

 The header is about 20K, having PHP read 20k off the disk everytime a 
 user visits my page seemed inneficient. So I was trying to find a way 
 to get PHP to cache the file in memory so it wouldn't have to read it 
 off disk all the time ...

 I have lots of bandwidth but not enough money to pay for a proper 
 SCSI/RAID disk set. All I have is a poor 7,2000 IDE HD. So the less 
 disk seeks thebetter :)

 Jc


If you are running under Linux.. load it up with RAM... the OS will hold 
any recent disk reads in cache... particularly a simple html document 
with a few locally held images. I've watched disk access on some of my 
boxes, some sites serving 1gig per day, and the disk just barely blips 
along... most being served from cache. Linux rules!

John Hinton



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




[PHP] calling session_start()

2002-09-29 Thread Børge Strand


Hi All,

When does session_start() have to be called? I have the following
setting:

A bunch of php pages are placed in a frameset. If someone tries to
access one of these pages without the session-id cookie being set, the
page calls a reloading of the frameset. The frameset page itself is
the first to call session_start()

Am I right to believe that session_start() has to be called before one
can do if (!isset($_SESSION['foo']))? It is this test that determines
whether or not to reload the frameset. 

On my development system this works just fine, but going into
production on a web hotel, I get a lot more warnings. Every page in
the frameset says Warning: Cannot send session cache limiter -
heaaders already sent... in response to session_start() in the test I
described above.

Which setting in php.ini enables this warning?
Do you know how I can test for the presense of a session without
getting this error?

Regards, 

Børge

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




Re: [PHP] Session Not Saving?

2002-09-29 Thread Chris Shiflett

I'm not sure why you are trying to use session_is_registered() to 
validate a user, but you should get rid of that.

With sessions, you want to start the session on every page you need 
session management. If you have a session module that you include 
everywhere, you can do this by registering each session variable, as 
that will implicitly start the session as well.

If you want to greet a user by name, simply have a session variable 
called first_name or something. Then, if it's not blank, greet them.

I'm not sure if that helps, but you at least need to rethink what you 
are trying to do.

Chris

Stephen Craton wrote:

Here's the code
that checks to see if the user is valid:

function check_valid()
{
  global $valid_user;
  if (session_is_registered(valid_user))
  {
  echo font size='2'Welcome $valid_user!/font;
  }
  else
  {
 echo You are not logged in.;
 exit;
  }  
}



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




[PHP] %e blank with date_format() on windows

2002-09-29 Thread Gerard


%e with date_format doesn't print out anything on my windows 2k/xp
machines, but does on linux. All other chars print fine. Is this a locale
setting issue or something?

Gerard


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




Re: [PHP] calling session_start()

2002-09-29 Thread debbie_dyer

session_start() has to be called on every page where you want to use the
session, before you try referencing it - you also have to call it before
outputting anything else (you must be doing it after and this is what is
causing your error)

- Original Message -
From: Børge Strand [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, September 29, 2002 6:12 PM
Subject: [PHP] calling session_start()



 Hi All,

 When does session_start() have to be called? I have the following
 setting:

 A bunch of php pages are placed in a frameset. If someone tries to
 access one of these pages without the session-id cookie being set, the
 page calls a reloading of the frameset. The frameset page itself is
 the first to call session_start()

 Am I right to believe that session_start() has to be called before one
 can do if (!isset($_SESSION['foo']))? It is this test that determines
 whether or not to reload the frameset.

 On my development system this works just fine, but going into
 production on a web hotel, I get a lot more warnings. Every page in
 the frameset says Warning: Cannot send session cache limiter -
 heaaders already sent... in response to session_start() in the test I
 described above.

 Which setting in php.ini enables this warning?
 Do you know how I can test for the presense of a session without
 getting this error?

 Regards,

 Børge

 --
 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] Forms: How-to not display it if user hits back?

2002-09-29 Thread Jean-Christian Imbeault

I have the following scenario

1- user comes to page A, clicks a button to get to page B
2- Page B is a form the user fills and hits the submit button
3- form data is received and I use header() to send him back to page A

So A - B - A

The problem I have is with Netscape 7, possibly other browsers too. If 
the user clicks the back button at stage 3, an annoying warning pops up:

The page you are trying to view contains POST data that has expired 
from the cache .

Is the anyway for me to code around this in PHP. Preferably the user 
would get sent back to A and not B. But if this is not possible can I do 
something so the warring does not pop up?

Thanks!

Jc


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




RE: [PHP] Forms: How-to not display it if user hits back?

2002-09-29 Thread John W. Holmes

Use GET instead of POST. Other than that, I don't think so. It's a
client side issue and all browsers handle it differently, I think.

---John Holmes...

 -Original Message-
 From: Jean-Christian Imbeault [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, September 29, 2002 1:24 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Forms: How-to not display it if user hits back?
 
 I have the following scenario
 
 1- user comes to page A, clicks a button to get to page B
 2- Page B is a form the user fills and hits the submit button
 3- form data is received and I use header() to send him back to page A
 
 So A - B - A
 
 The problem I have is with Netscape 7, possibly other browsers too. If
 the user clicks the back button at stage 3, an annoying warning pops
up:
 
 The page you are trying to view contains POST data that has expired
 from the cache .
 
 Is the anyway for me to code around this in PHP. Preferably the user
 would get sent back to A and not B. But if this is not possible can I
do
 something so the warring does not pop up?
 
 Thanks!
 
 Jc
 
 
 --
 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] calling session_start()

2002-09-29 Thread John W. Holmes



 -Original Message-
 From: Børge Strand [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, September 29, 2002 1:12 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] calling session_start()
 
 
 Hi All,
 
 When does session_start() have to be called? I have the following
 setting:
 
 A bunch of php pages are placed in a frameset. If someone tries to
 access one of these pages without the session-id cookie being set, the
 page calls a reloading of the frameset. The frameset page itself is
 the first to call session_start()
 
 Am I right to believe that session_start() has to be called before one
 can do if (!isset($_SESSION['foo']))? It is this test that determines
 whether or not to reload the frameset.

Yep.

 On my development system this works just fine, but going into
 production on a web hotel, I get a lot more warnings. Every page in
 the frameset says Warning: Cannot send session cache limiter -
 heaaders already sent... in response to session_start() in the test I
 described above.

What's the exact error. Session_start() has to be called before any
output. The error message tells you exactly where the output started.
It'll give you the path to some page followed by :X, where the X is the
line number of that file where the output started. 

 Which setting in php.ini enables this warning?
 Do you know how I can test for the presense of a session without
 getting this error?

You can work around it by using output_buffering, but I'd just recommend
you fix your code so things are in the right order...

---John Holmes...



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




RE: [PHP] Problems with dbase_create function

2002-09-29 Thread John W. Holmes

You pretty much have to give the directory 777 permissions. On a shared
server, this is not the ideal solution, but it's the only one. No
worries if you're on a dedicated server.

---John Holmes...

 -Original Message-
 From: Matt Neimeyer [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, September 29, 2002 11:55 AM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] Problems with dbase_create function
 
 I considered that...
 
 Problem is I'm not 100% certain how to set that the correct way... (so
as
 not to screw anything else up)
 
 Recommendations?
 
 Thanks
 
 PS It's good to know I wasn't completely off base... thanks millions!
 
 Does the web server have permission to write to the directory where
you
 are trying to create the database? PHP runs as the web server when
 installed as a module and it needs permission to write in that
 directory.
 
 ---John Holmes...
 
   -Original Message-
   From: Matt Neimeyer [mailto:[EMAIL PROTECTED]]
   Sent: Sunday, September 29, 2002 2:19 AM
   To: [EMAIL PROTECTED]
   Subject: [PHP] Problems with dbase_create function
  
   Hey All,
  
   I'm trying to build a DBF for exporting selected data as a
download to
 the
   end users... But I can't get further than this...
  
 error_reporting(E_ALL);
 $DBFName = Test.dbf;
 $Fields = array( array (Test,C,32) );
 if(dbase_create($DBFName, $Fields))
 { echo Good!; } else { echo Bad!; }
  
   It doesn't show an error... and it doesn't create the dbf... it
just
 shows
   Bad! and nothing else.
  
   Any ideas where I should begin looking? I admit I'm not the most
savvy
   Linux user but I at least got it to admit that the function
existed
 (under
   a freshly compiled php with --enable-dbase on Redhat Linux 7.2)
  
   I've also tried $DBFName=./Test.dbf and
   /full_path_from_root_to_html_folder/Test.dbf and neither work.
I've
 also
   looked through the archives for this list and for the php-db list
and
   haven't seen anything that helps (other than my earlier problem of
not
   having enabled dbase, which appears to be fixed, before it
wouldn't
 even
   show Bad!. )
  
   Thanks in advance for any ideas...
  
   Matt
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 --
 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] Not Displaying From Vars??

2002-09-29 Thread Stephen Craton

I bet you're getting sick of hearing from me but yet again, I'm having
trouble. I have a form that you type in a number for how many hours an
employee has worked. When they submit the form, it's supposed to
display, again, what they typed in and record them to a database to be
used for a later use. The form, evidently, submits fine but what my
problem is, is that it won't display what they typed in.

All I'm doing is putting in this:

?php echo $sun_reg; ?

The input field looks like this:

input name=sun_reg type=text class=hours id=sun_reg
size=4 maxlength=3

Does anyone see the problem? I can assign the form method to be GET and
it displays all the field values in the URL just fine, it's just not
displaying in the page itself.

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



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




[PHP] pdf question

2002-09-29 Thread Jonas Geiregat

this is my code
?php

$pdf = pdf_new();

pdf_open_file($pdf);
pdf_begin_page($pdf, 595, 842);
pdf_set_font($pdf, Times-Roman, 30, host);
pdf_set_value($pdf, textrendering, 1);
pdf_show_xy($pdf, text here, 50, 750);
pdf_end_page($pdf);
pdf_close($pdf);

$data = pdf_get_buffer($pdf);

header(Content-type: application/pdf);
header(Content-disposition: inline; filename=test.pdf);
header(Content-length:  . strlen($data));

echo $data;

?

I can't save the pdf file on server cause webserver doesn't have write 
permission to the dir I normally wanted to be in
but I just want to generate a pdf file and send it as attachement with email
how can I do this by generating the pdf in memory


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




[PHP] error suppresion

2002-09-29 Thread Gary

I have a form, the action is PHP_SELF. When the form is submitted it 
prints the info lower on the page. The problem, the errors for the empty 
fields are printed until the form is submitted. What would be the best 
way of suppressing these error?

TIA
Gary


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




RE: [PHP] Not Displaying From Vars??

2002-09-29 Thread John W. Holmes

Try $_POST['sun_reg'] or $_GET['sun_reg'], depending on the method of
your form.

You probably have register globals off, that's why $sun_reg isn't
created. That's a good thing.

---John Holmes...

 -Original Message-
 From: Stephen Craton [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, September 29, 2002 2:01 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Not Displaying From Vars??
 
 I bet you're getting sick of hearing from me but yet again, I'm having
 trouble. I have a form that you type in a number for how many hours an
 employee has worked. When they submit the form, it's supposed to
 display, again, what they typed in and record them to a database to be
 used for a later use. The form, evidently, submits fine but what my
 problem is, is that it won't display what they typed in.
 
 All I'm doing is putting in this:
 
   ?php echo $sun_reg; ?
 
 The input field looks like this:
 
   input name=sun_reg type=text class=hours id=sun_reg
 size=4 maxlength=3
 
 Does anyone see the problem? I can assign the form method to be GET
and
 it displays all the field values in the URL just fine, it's just not
 displaying in the page itself.
 
 Thanks,
 Stephen
 http://www.melchior.us
 http://php.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] Not Displaying From Vars??

2002-09-29 Thread Stephen Craton

I just tried it and it doesn't work either.

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

:: -Original Message-
:: From: John W. Holmes [mailto:[EMAIL PROTECTED]] 
:: Sent: Sunday, September 29, 2002 1:07 PM
:: To: 'Stephen Craton'; [EMAIL PROTECTED]
:: Subject: RE: [PHP] Not Displaying From Vars??
:: 
:: 
:: Try $_POST['sun_reg'] or $_GET['sun_reg'], depending on the 
:: method of your form.
:: 
:: You probably have register globals off, that's why $sun_reg 
:: isn't created. That's a good thing.
:: 
:: ---John Holmes...
:: 
::  -Original Message-
::  From: Stephen Craton [mailto:[EMAIL PROTECTED]]
::  Sent: Sunday, September 29, 2002 2:01 PM
::  To: [EMAIL PROTECTED]
::  Subject: [PHP] Not Displaying From Vars??
::  
::  I bet you're getting sick of hearing from me but yet 
:: again, I'm having 
::  trouble. I have a form that you type in a number for how 
:: many hours an 
::  employee has worked. When they submit the form, it's supposed to 
::  display, again, what they typed in and record them to a 
:: database to be 
::  used for a later use. The form, evidently, submits fine 
:: but what my 
::  problem is, is that it won't display what they typed in.
::  
::  All I'm doing is putting in this:
::  
:: ?php echo $sun_reg; ?
::  
::  The input field looks like this:
::  
:: input name=sun_reg type=text class=hours 
:: id=sun_reg size=4 
::  maxlength=3
::  
::  Does anyone see the problem? I can assign the form method to be GET
:: and
::  it displays all the field values in the URL just fine, 
:: it's just not 
::  displaying in the page itself.
::  
::  Thanks,
::  Stephen
::  http://www.melchior.us
::  http://php.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] error suppresion

2002-09-29 Thread John W. Holmes

 I have a form, the action is PHP_SELF. When the form is submitted it
 prints the info lower on the page. The problem, the errors for the
empty
 fields are printed until the form is submitted. What would be the best
 way of suppressing these error?

The best way to suppress your errors is to fix them. :)

Or you can work around it by using the error_reporting() function.

---John Holmes...



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




[PHP] Copying a remote graphic to my server.

2002-09-29 Thread scott


Hello there
I am trying to copy a remote graphic from http://blah.com/blah.jpg to my
server. How would I achieve this in php I have looked on the archives
but can't seem to find the best way. I am running 4.1.2 on apache unix.

I understand copy will not work on remote files (tried it) but I am not
sure of the correct fopen fwrite etc code! Any sample code or pointers
are most helpful Best regards Scott


-- 
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] Not Displaying From Vars??

2002-09-29 Thread debbie_dyer

Yeah got to be register_globals and also a tip to save future problems if
you are working with forms and u want to redisplay submitted data you will
need to learn about stripslashes (if you have magic_quotes_gpc on) and
htmlspecialchars.

And for the db additions addslashes (for if magic_quotes_gpc is off)


- Original Message -
From: Stephen Craton [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, September 29, 2002 7:00 PM
Subject: [PHP] Not Displaying From Vars??


 I bet you're getting sick of hearing from me but yet again, I'm having
 trouble. I have a form that you type in a number for how many hours an
 employee has worked. When they submit the form, it's supposed to
 display, again, what they typed in and record them to a database to be
 used for a later use. The form, evidently, submits fine but what my
 problem is, is that it won't display what they typed in.

 All I'm doing is putting in this:

 ?php echo $sun_reg; ?

 The input field looks like this:

 input name=sun_reg type=text class=hours id=sun_reg
 size=4 maxlength=3

 Does anyone see the problem? I can assign the form method to be GET and
 it displays all the field values in the URL just fine, it's just not
 displaying in the page itself.

 Thanks,
 Stephen
 http://www.melchior.us
 http://php.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




[PHP] mail + memory question

2002-09-29 Thread Jonas Geiregat

this is my code what I want to do is
generate a pdf file(not save it on hd of server but in memory)
then send it as attachement to someone

$pdf = pdf_new();

pdf_open_file($pdf,);
pdf_begin_page($pdf, 595, 842);
pdf_set_font($pdf, Times-Roman, 30, host);
pdf_set_value($pdf, textrendering, 1);
pdf_show_xy($pdf, A PDF document created in memory!, 50, 
750);
pdf_end_page($pdf);
pdf_close($pdf);
$data = pdf_get_buffer($pdf);


/**
* Filename...: example.3.php
* Project: HTML Mime Mail class
* Last Modified..: 15 July 2002
*/
error_reporting(E_ALL);
include('htmlMimeMail.php');

/**
* Example of usage. This example shows
* how to use the class to send a plain
* text email with an attachment. No html,
* or embedded images.
*
* Create the mail object.
*/
$mail = new htmlMimeMail();

/**
* Read the file test.zip into $attachment.
*/
$attachment = $mail-getFile('test.pdf');

/**
* Since we're sending a plain text email,
* we only need to read in the text file.
*/
$text = $mail-getFile('example.txt');

/**
* To set the text body of the email, we
* are using the setText() function. This
* is an alternative to the setHtml() function
* which would obviously be inappropriate here.
*/  
$mail-setText($text);

/**
* This is used to add an attachment to
* the email.
*/
$mail-addAttachment($attachment, 'test.pdf', 'application/zip');

/**
* Sends the message.
*/
$mail-setFrom('Joe [EMAIL PROTECTED]');
$result = $mail-send(array('Richard [EMAIL PROTECTED]'));

echo $result ? 'Mail sent!' : 'Failed to send mail';


the mail get's send but I get this error
Warning: fopen(test.pdf, rb) - No such file or directory in 
/home/web/intranet/httpdocs/htmlMimeMail.php on line 162
and test.pdf is included in the mail but is 0kb big
anyone sees the prob ?


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




[PHP] Multivalue RDBMS's

2002-09-29 Thread Bill Farrell

Hi, all,

Just out of curiosity, are there any people out there
using PHP with UniVerse/UniData, Pick, mvBase or any
other multivalue database?  I'm getting brave with PHP
and writing some connection and Dynamic String Array
(Pick record) handling objects and wonder if anyone
has been down this road before.

I'm using VantagePoint Software's MVGateway as the
connection middleware.  So far it's starting to work
pretty good (thanks to all the tips from this list!
Y'all are a very informative bunch!).

So far, I've emulated the most important mvBASIC
functions in PHP and can now handle MV records and
record sets directly. If anyone is using an MV RDBMS
it might be useful to compare notes on what's
practical and what's not to use in forms generation
and data handling.

I'm becoming hooked on PHP...seems there isn't
anything you can't do with it.  If you can conceive
it, you can code it to work :-)

Best regards,
B


=
Bill Farrell
Multivalue and *nix Support Specialist

Phone: (828) 667-2245
Fax:   (928) 563-5189
Web:   http://www.jwfarrell.com

__
Do you Yahoo!?
New DSL Internet Access from SBC  Yahoo!
http://sbc.yahoo.com

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




[PHP] mail + pdf + memory question

2002-09-29 Thread Jonas Geiregat

this is my code what I want to do is
generate a pdf file(not save it on hd of server but in memory)
then send it as attachement to someone

$pdf = pdf_new();

pdf_open_file($pdf,);
pdf_begin_page($pdf, 595, 842);
pdf_set_font($pdf, Times-Roman, 30, host);
pdf_set_value($pdf, textrendering, 1);
pdf_show_xy($pdf, A PDF document created in memory!, 50, 
750);
pdf_end_page($pdf);
pdf_close($pdf);
$data = pdf_get_buffer($pdf);


/**
* Filename...: example.3.php
* Project: HTML Mime Mail class
* Last Modified..: 15 July 2002
*/
error_reporting(E_ALL);
include('htmlMimeMail.php');

/**
* Example of usage. This example shows
* how to use the class to send a plain
* text email with an attachment. No html,
* or embedded images.
*
* Create the mail object.
*/
$mail = new htmlMimeMail();

/**
* Read the file test.zip into $attachment.
*/
$attachment = $mail-getFile('test.pdf');

/**
* Since we're sending a plain text email,
* we only need to read in the text file.
*/
$text = $mail-getFile('example.txt');

/**
* To set the text body of the email, we
* are using the setText() function. This
* is an alternative to the setHtml() function
* which would obviously be inappropriate here.
*/  
$mail-setText($text);

/**
* This is used to add an attachment to
* the email.
*/
$mail-addAttachment($attachment, 'test.pdf', 'application/zip');

/**
* Sends the message.
*/
$mail-setFrom('Joe [EMAIL PROTECTED]');
$result = $mail-send(array('Richard [EMAIL PROTECTED]'));

echo $result ? 'Mail sent!' : 'Failed to send mail';


the mail get's send but I get this error
Warning: fopen(test.pdf, rb) - No such file or directory in 
/home/web/intranet/httpdocs/htmlMimeMail.php on line 162
and test.pdf is included in the mail but is 0kb big
anyone sees the prob ?


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




Re: [PHP] error suppresion

2002-09-29 Thread Gary

John W. Holmes wrote:
I have a form, the action is PHP_SELF. When the form is submitted it
prints the info lower on the page. The problem, the errors for the
 
 empty
 
fields are printed until the form is submitted. What would be the best
way of suppressing these error?
 
 
 The best way to suppress your errors is to fix them. :)
 
 Or you can work around it by using the error_reporting() function.
 
 ---John Holmes...
 
 

They are not really errors they are reporting that the form fields are 
empty until the form is submitted.
Notice: Undefined index:

Gary


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




RE: [PHP] error suppresion

2002-09-29 Thread John W. Holmes

Just reduce the error_reporting() level while you display the form,
then. Set it so it does not show NOTICES. 

---John Holmes...

 -Original Message-
 From: Gary [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, September 29, 2002 2:29 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] error suppresion
 
 John W. Holmes wrote:
 I have a form, the action is PHP_SELF. When the form is submitted it
 prints the info lower on the page. The problem, the errors for the
 
  empty
 
 fields are printed until the form is submitted. What would be the
best
 way of suppressing these error?
 
 
  The best way to suppress your errors is to fix them. :)
 
  Or you can work around it by using the error_reporting() function.
 
  ---John Holmes...
 
 
 
 They are not really errors they are reporting that the form fields are
 empty until the form is submitted.
 Notice: Undefined index:
 
 Gary
 
 
 --
 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] Not Displaying From Vars??

2002-09-29 Thread John W. Holmes

Post your code...

 -Original Message-
 From: Stephen Craton [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, September 29, 2002 2:11 PM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] Not Displaying From Vars??
 
 I just tried it and it doesn't work either.
 
 Thanks,
 Stephen
 http://www.melchior.us
 http://php.melchior.us
 
 :: -Original Message-
 :: From: John W. Holmes [mailto:[EMAIL PROTECTED]]
 :: Sent: Sunday, September 29, 2002 1:07 PM
 :: To: 'Stephen Craton'; [EMAIL PROTECTED]
 :: Subject: RE: [PHP] Not Displaying From Vars??
 ::
 ::
 :: Try $_POST['sun_reg'] or $_GET['sun_reg'], depending on the
 :: method of your form.
 ::
 :: You probably have register globals off, that's why $sun_reg
 :: isn't created. That's a good thing.
 ::
 :: ---John Holmes...
 ::
 ::  -Original Message-
 ::  From: Stephen Craton [mailto:[EMAIL PROTECTED]]
 ::  Sent: Sunday, September 29, 2002 2:01 PM
 ::  To: [EMAIL PROTECTED]
 ::  Subject: [PHP] Not Displaying From Vars??
 :: 
 ::  I bet you're getting sick of hearing from me but yet
 :: again, I'm having
 ::  trouble. I have a form that you type in a number for how
 :: many hours an
 ::  employee has worked. When they submit the form, it's supposed to
 ::  display, again, what they typed in and record them to a
 :: database to be
 ::  used for a later use. The form, evidently, submits fine
 :: but what my
 ::  problem is, is that it won't display what they typed in.
 :: 
 ::  All I'm doing is putting in this:
 :: 
 ::   ?php echo $sun_reg; ?
 :: 
 ::  The input field looks like this:
 :: 
 ::   input name=sun_reg type=text class=hours
 :: id=sun_reg size=4
 ::  maxlength=3
 :: 
 ::  Does anyone see the problem? I can assign the form method to be
GET
 :: and
 ::  it displays all the field values in the URL just fine,
 :: it's just not
 ::  displaying in the page itself.
 :: 
 ::  Thanks,
 ::  Stephen
 ::  http://www.melchior.us
 ::  http://php.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




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




Re: [PHP] Not Displaying From Vars??

2002-09-29 Thread debbie_dyer

Its a setting in php.ini where PHP creates vars from form data/cookies if
its on. If it is on - its a security risk because anyone can change the
value of the data in your script by passing values in thru the URL.

So you need to keep it switched off (whereby vars will not be created from
form data) and use the superglobals $_POST, $_GET, etc to access your data
instead.

- Original Message -
From: Stephen Craton [EMAIL PROTECTED]
To: 'debbie_dyer' [EMAIL PROTECTED]
Sent: Sunday, September 29, 2002 7:29 PM
Subject: RE: [PHP] Not Displaying From Vars??


 Sorry if I'm acting all noobish but, how do I register_globals?

 I already know about stripslashes and addslashes, I usually use those to
 store secured information.

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

 :: -Original Message-
 :: From: debbie_dyer [mailto:[EMAIL PROTECTED]]
 :: Sent: Sunday, September 29, 2002 1:14 PM
 :: To: [EMAIL PROTECTED]
 :: Subject: Re: [PHP] Not Displaying From Vars??
 ::
 ::
 :: Yeah got to be register_globals and also a tip to save
 :: future problems if you are working with forms and u want to
 :: redisplay submitted data you will need to learn about
 :: stripslashes (if you have magic_quotes_gpc on) and htmlspecialchars.
 ::
 :: And for the db additions addslashes (for if magic_quotes_gpc is off)
 ::
 ::
 :: - Original Message -
 :: From: Stephen Craton [EMAIL PROTECTED]
 :: To: [EMAIL PROTECTED]
 :: Sent: Sunday, September 29, 2002 7:00 PM
 :: Subject: [PHP] Not Displaying From Vars??
 ::
 ::
 ::  I bet you're getting sick of hearing from me but yet
 :: again, I'm having
 ::  trouble. I have a form that you type in a number for how
 :: many hours an
 ::  employee has worked. When they submit the form, it's supposed to
 ::  display, again, what they typed in and record them to a
 :: database to be
 ::  used for a later use. The form, evidently, submits fine
 :: but what my
 ::  problem is, is that it won't display what they typed in.
 :: 
 ::  All I'm doing is putting in this:
 :: 
 ::  ?php echo $sun_reg; ?
 :: 
 ::  The input field looks like this:
 :: 
 ::  input name=sun_reg type=text class=hours
 :: id=sun_reg size=4
 ::  maxlength=3
 :: 
 ::  Does anyone see the problem? I can assign the form method
 :: to be GET
 ::  and it displays all the field values in the URL just fine,
 :: it's just
 ::  not displaying in the page itself.
 :: 
 ::  Thanks,
 ::  Stephen
 ::  http://www.melchior.us
 ::  http://php.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
 ::
 ::
 ::




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




Re: [PHP] error suppresion

2002-09-29 Thread Jean-Christian Imbeault

Gary wrote:
 
 They are not really errors they are reporting that the form fields are 
 empty until the form is submitted.
 Notice: Undefined index:

That means your code is not doing any checking of the incoming data. You 
should always check that the data coming is what you expect it to be. 
It's good programming practice and helps security.

Just add the following to your code and every thing will be fine 
(assuming POST, but works with GET or any other):

if (isset($_POST[myvar name])) {
   $value = $_POST[myvar name];
}
else {
   $value = ;
}

I always turn error reporting way up when coding and debugging, it helps 
me to find places where I have undefined variables when the variables 
really *should* be defined ... meaning I have a bug ;)

Jc


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




[PHP] OT-best PDF creation tool

2002-09-29 Thread Ryan A

Hey guys,
I know this is totally off topic on a php list but I have a client who wants a PDF 
document and since I have never made one before...which is the easiest and best tool 
(hopefully free) to make a PDF form?
I know a lot of you guys make websites yourselfs and most proberly worked on something 
like this so any comments,suggestions or links are appreciated.
Cheers,
-Ryan.



Re: [PHP] OT-best PDF creation tool

2002-09-29 Thread debbie_dyer

hey! you cant say hey guys these days - there are females in the industry
too u know :)

- Original Message -
From: Ryan A [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, September 29, 2002 7:40 PM
Subject: [PHP] OT-best PDF creation tool


Hey guys,
I know this is totally off topic on a php list but I have a client who wants
a PDF document and since I have never made one before...which is the easiest
and best tool (hopefully free) to make a PDF form?
I know a lot of you guys make websites yourselfs and most proberly worked on
something like this so any comments,suggestions or links are appreciated.
Cheers,
-Ryan.



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




[PHP] hash function secret

2002-09-29 Thread Pablo Oliva

I was reading the sept. issue of linux magazine and they discussed
security issues with web apps.
 
They mentioned that to generate signatures, you should include a secret
with your hash function:
s = S(m) = H(secret, H(m, secret))
 
What is the secret, just a sort of secret code that you include, like
some sort of random password:  gr8ckret46eme  as an example ???



Re: [PHP] hash function secret

2002-09-29 Thread debbie_dyer

I don't see how it could be randomly generated else how would you be able to
use it for authenticating etc but then I'm not a security expert. I use a
long character string known only to me and stored outside my web directory.
Maybe other ppl do differently I don't know.


- Original Message -
From: Pablo Oliva [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, September 29, 2002 7:52 PM
Subject: [PHP] hash function secret


 I was reading the sept. issue of linux magazine and they discussed
 security issues with web apps.

 They mentioned that to generate signatures, you should include a secret
 with your hash function:
 s = S(m) = H(secret, H(m, secret))

 What is the secret, just a sort of secret code that you include, like
 some sort of random password:  gr8ckret46eme  as an example ???



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




[PHP] Debbie-Re: [PHP] OT-best PDF creation tool

2002-09-29 Thread Ryan A

Hey Debbie,
thanks for writing,

Sorry, no offense meant but I call all my pals guys.

Yeah, I know there are females in the industary and i'm sure most of them
work for Microsoft writing the error messages that keep on nagging and that
make absolutely no sense!

hehhehehe couldnt resist, just kidding.

But before you decide to sell my soul to the devil I promise I shall try to
amend my ways and will not so selfishly and meanly write to this OR any
other mailing list addressing people with term guys. :-)

And in closing...let me say, nice name.
Cheers,
-Ryan.

 hey! you cant say hey guys these days - there are females in the industry
 too u know :)

 - Original Message -
 From: Ryan A [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Sunday, September 29, 2002 7:40 PM
 Subject: [PHP] OT-best PDF creation tool


 Hey guys,
 I know this is totally off topic on a php list but I have a client who
wants
 a PDF document and since I have never made one before...which is the
easiest
 and best tool (hopefully free) to make a PDF form?
 I know a lot of you guys make websites yourselfs and most proberly worked
on
 something like this so any comments,suggestions or links are appreciated.
 Cheers,
 -Ryan.



 --
 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: Debbie-Re: [PHP] OT-best PDF creation tool

2002-09-29 Thread debbie_dyer

Ryan

LOL ok - no offence taken.

And be careful what u promise - tens (hundreds even dont know how many are
on this list) of females probably just received it and I am sure you will be
well spotted if you break it :)

Debbie

- Original Message -
From: Ryan A [EMAIL PROTECTED]
To: debbie_dyer [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Sunday, September 29, 2002 7:59 PM
Subject: Debbie-Re: [PHP] OT-best PDF creation tool


 Hey Debbie,
 thanks for writing,

 Sorry, no offense meant but I call all my pals guys.

 Yeah, I know there are females in the industary and i'm sure most of them
 work for Microsoft writing the error messages that keep on nagging and
that
 make absolutely no sense!

 hehhehehe couldnt resist, just kidding.

 But before you decide to sell my soul to the devil I promise I shall try
to
 amend my ways and will not so selfishly and meanly write to this OR any
 other mailing list addressing people with term guys. :-)

 And in closing...let me say, nice name.
 Cheers,
 -Ryan.

  hey! you cant say hey guys these days - there are females in the
industry
  too u know :)
 
  - Original Message -
  From: Ryan A [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Sunday, September 29, 2002 7:40 PM
  Subject: [PHP] OT-best PDF creation tool
 
 
  Hey guys,
  I know this is totally off topic on a php list but I have a client who
 wants
  a PDF document and since I have never made one before...which is the
 easiest
  and best tool (hopefully free) to make a PDF form?
  I know a lot of you guys make websites yourselfs and most proberly
worked
 on
  something like this so any comments,suggestions or links are
appreciated.
  Cheers,
  -Ryan.
 
 
 
  --
  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] Not Displaying From Vars??

2002-09-29 Thread Stephen Craton

Here's the part that's supposed to display the information. I've only
filled in one area so far:

tr 
tdfont size=2 face=Arial, Helvetica,
sans-serifSunday/font/td
td align=center valign=middle?php echo
$_GET[sung_reg]; ?/td
td align=center valign=middle
class=linenbsp;/td
td align=center valign=middle
class=line2nbsp;/td
td align=center valign=middlenbsp;/td
td align=center valign=middlenbsp;/td
td align=center valign=middlenbsp;/td
td align=center valign=middlenbsp;/td
td align=center valign=middlenbsp;/td
td align=center valign=middlenbsp;/td
  /tr

Here's the form for the same area:

  tr 
tdfont size=2 face=Arial, Helvetica,
sans-serifSunday/font/td
td align=center valign=middle input
name=sun_reg type=text class=hours id=sun_reg size=4
maxlength=3 
/td
td align=center valign=middle
class=linefont size=2 face=Arial, Helvetica, sans-serif 
  input name=sun_over type=text
class=hours id=sun_over size=4 maxlength=3
  /font/td
td align=center valign=middle
class=line2font size=2 face=Arial, Helvetica, sans-serif 
  input name=sun_vac type=text
class=hours id=sun_vac size=4 maxlength=3
  /font/td
td align=center valign=middlefont
size=2 face=Arial, Helvetica, sans-serif 
  input name=sun_hol type=text
class=hours id=sun_hol size=4 maxlength=3
  /font/td
td align=center valign=middlefont
size=2 face=Arial, Helvetica, sans-serif 
  input name=sun_sick type=text
class=hours id=sun_sick size=4 maxlength=3
  /font/td
td align=center valign=middlefont
size=2 face=Arial, Helvetica, sans-serif 
  input name=sun_funer type=text
class=hours id=sun_funer size=4 maxlength=3
  /font/td
td align=center valign=middlefont
size=2 face=Arial, Helvetica, sans-serif 
  input name=sun_edu type=text
class=hours id=sun_edu size=4 maxlength=3
  /font/td
td align=center valign=middlefont
size=2 face=Arial, Helvetica, sans-serif 
  input name=sun_per type=text
class=hours id=sun_per2 size=4 maxlength=3
  /font/td
td align=center valign=middlefont
size=2 face=Arial, Helvetica, sans-serif 
  input name=sun_other type=text
class=hours id=sun_other size=4 maxlength=3
  /font/td
  /tr

Hope that helps!

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

:: -Original Message-
:: From: John W. Holmes [mailto:[EMAIL PROTECTED]] 
:: Sent: Sunday, September 29, 2002 1:33 PM
:: To: 'Stephen Craton'; [EMAIL PROTECTED]
:: Subject: RE: [PHP] Not Displaying From Vars??
:: 
:: 
:: Post your code...
:: 
::  -Original Message-
::  From: Stephen Craton [mailto:[EMAIL PROTECTED]]
::  Sent: Sunday, September 29, 2002 2:11 PM
::  To: [EMAIL PROTECTED]
::  Subject: RE: [PHP] Not Displaying From Vars??
::  
::  I just tried it and it doesn't work either.
::  
::  Thanks,
::  Stephen
::  http://www.melchior.us
::  http://php.melchior.us
::  
::  :: -Original Message-
::  :: From: John W. Holmes [mailto:[EMAIL PROTECTED]]
::  :: Sent: Sunday, September 29, 2002 1:07 PM
::  :: To: 'Stephen Craton'; [EMAIL PROTECTED]
::  :: Subject: RE: [PHP] Not Displaying From Vars??
::  ::
::  ::
::  :: Try $_POST['sun_reg'] or $_GET['sun_reg'], depending on the
::  :: method of your form.
::  ::
::  :: You probably have register globals off, that's why $sun_reg
::  :: isn't created. That's a good thing.
::  ::
::  :: ---John Holmes...
::  ::
::  ::  -Original Message-
::  ::  From: Stephen Craton [mailto:[EMAIL PROTECTED]]
::  ::  Sent: Sunday, September 29, 2002 2:01 PM
::  ::  To: [EMAIL PROTECTED]
::  ::  Subject: [PHP] Not Displaying From Vars??
::  :: 
::  ::  I bet you're getting sick of hearing from me but yet
::  :: again, I'm having
::  ::  trouble. I have a form that you type in a number for how
::  :: many hours an
::  ::  employee has worked. When they submit the form, it's 
:: supposed to
::  ::  display, again, what they typed in and record them to a
::  :: database to be
::  ::  used for a later use. The form, evidently, submits fine
::  :: but what my
::  ::  problem is, is that it won't display what they typed in.
::  :: 
::  ::  All I'm doing is putting in this:
::  :: 
::  ::

Re: [PHP] Not Displaying From Vars??

2002-09-29 Thread debbie_dyer

Wheres the form tag?

- Original Message - 
From: Stephen Craton [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Sunday, September 29, 2002 8:19 PM
Subject: RE: [PHP] Not Displaying From Vars??


 Here's the part that's supposed to display the information. I've only
 filled in one area so far:
 
 tr 
 tdfont size=2 face=Arial, Helvetica,
 sans-serifSunday/font/td
 td align=center valign=middle?php echo
 $_GET[sung_reg]; ?/td
 td align=center valign=middle
 class=linenbsp;/td
 td align=center valign=middle
 class=line2nbsp;/td
 td align=center valign=middlenbsp;/td
 td align=center valign=middlenbsp;/td
 td align=center valign=middlenbsp;/td
 td align=center valign=middlenbsp;/td
 td align=center valign=middlenbsp;/td
 td align=center valign=middlenbsp;/td
   /tr
 
 Here's the form for the same area:
 
   tr 
 tdfont size=2 face=Arial, Helvetica,
 sans-serifSunday/font/td
 td align=center valign=middle input
 name=sun_reg type=text class=hours id=sun_reg size=4
 maxlength=3 
 /td
 td align=center valign=middle
 class=linefont size=2 face=Arial, Helvetica, sans-serif 
   input name=sun_over type=text
 class=hours id=sun_over size=4 maxlength=3
   /font/td
 td align=center valign=middle
 class=line2font size=2 face=Arial, Helvetica, sans-serif 
   input name=sun_vac type=text
 class=hours id=sun_vac size=4 maxlength=3
   /font/td
 td align=center valign=middlefont
 size=2 face=Arial, Helvetica, sans-serif 
   input name=sun_hol type=text
 class=hours id=sun_hol size=4 maxlength=3
   /font/td
 td align=center valign=middlefont
 size=2 face=Arial, Helvetica, sans-serif 
   input name=sun_sick type=text
 class=hours id=sun_sick size=4 maxlength=3
   /font/td
 td align=center valign=middlefont
 size=2 face=Arial, Helvetica, sans-serif 
   input name=sun_funer type=text
 class=hours id=sun_funer size=4 maxlength=3
   /font/td
 td align=center valign=middlefont
 size=2 face=Arial, Helvetica, sans-serif 
   input name=sun_edu type=text
 class=hours id=sun_edu size=4 maxlength=3
   /font/td
 td align=center valign=middlefont
 size=2 face=Arial, Helvetica, sans-serif 
   input name=sun_per type=text
 class=hours id=sun_per2 size=4 maxlength=3
   /font/td
 td align=center valign=middlefont
 size=2 face=Arial, Helvetica, sans-serif 
   input name=sun_other type=text
 class=hours id=sun_other size=4 maxlength=3
   /font/td
   /tr
 
 Hope that helps!
 
 Thanks,
 Stephen
 http://www.melchior.us
 http://php.melchior.us
 
 :: -Original Message-
 :: From: John W. Holmes [mailto:[EMAIL PROTECTED]] 
 :: Sent: Sunday, September 29, 2002 1:33 PM
 :: To: 'Stephen Craton'; [EMAIL PROTECTED]
 :: Subject: RE: [PHP] Not Displaying From Vars??
 :: 
 :: 
 :: Post your code...
 :: 
 ::  -Original Message-
 ::  From: Stephen Craton [mailto:[EMAIL PROTECTED]]
 ::  Sent: Sunday, September 29, 2002 2:11 PM
 ::  To: [EMAIL PROTECTED]
 ::  Subject: RE: [PHP] Not Displaying From Vars??
 ::  
 ::  I just tried it and it doesn't work either.
 ::  
 ::  Thanks,
 ::  Stephen
 ::  http://www.melchior.us
 ::  http://php.melchior.us
 ::  
 ::  :: -Original Message-
 ::  :: From: John W. Holmes [mailto:[EMAIL PROTECTED]]
 ::  :: Sent: Sunday, September 29, 2002 1:07 PM
 ::  :: To: 'Stephen Craton'; [EMAIL PROTECTED]
 ::  :: Subject: RE: [PHP] Not Displaying From Vars??
 ::  ::
 ::  ::
 ::  :: Try $_POST['sun_reg'] or $_GET['sun_reg'], depending on the
 ::  :: method of your form.
 ::  ::
 ::  :: You probably have register globals off, that's why $sun_reg
 ::  :: isn't created. That's a good thing.
 ::  ::
 ::  :: ---John Holmes...
 ::  ::
 ::  ::  -Original Message-
 ::  ::  From: Stephen Craton [mailto:[EMAIL PROTECTED]]
 ::  ::  Sent: Sunday, September 29, 2002 2:01 PM
 ::  ::  To: [EMAIL PROTECTED]
 ::  ::  Subject: [PHP] Not Displaying From Vars??
 ::  :: 
 ::  ::  I bet you're getting sick of hearing from me but yet
 ::  :: again, I'm having
 ::  ::  trouble. I have a form that you type in a number for how
 ::  :: many hours an
 ::  ::  employee has worked. 

Re: [PHP] Not Displaying From Vars??

2002-09-29 Thread Chris Shiflett

Your description of register_globals is good, except that the security 
risk is a matter of opinion. I would argue that register_globals only 
presents a security risk to inexperienced developers.

The client can submit any data to your application regardless of any 
configuration (and even regardless of language used). PHP's 
register_globals provides a convenient mechanism for receiving data from 
the client. In general, there are two types of data:

1. Data from the client
2. Data residing on the server

Code that allows data from the client to overwrite data residing on the 
server is poorly written code, and this is the scenario that creates 
this misconception of register_globals being a security risk. Data 
residing on the server can be information in a database, session data, 
etc. It is quite trivial to ensure that this data is overwritten. When a 
script begins execution, the client can no longer submit data. It is 
finished and can do no more so to speak. This makes things very easy. 
Thus, consider this:

$logged_in=0;

if (is_valid($password))
{
 $logged_in=1;
}

Guess what? The client cannot make $logged_in = 1 unless the password 
they provide passes the is_valid() function (a function you create to 
validate a password - just a hypothetical example). There is no way a 
client can submit any data in between these statements. The problem is 
when people fail to set $logged_in to 0 initially, so that a failed 
password simply avoids the if statement but doesn't explicitly set 
$logged_in to 0. This is poor programming.

For session data, try to override data that is initialized with 
session_register() and see if it works. What you will find is that 
whatever the client sends is overwritten by the data in the session, so 
this scenario is also easy to avoid.

My point is that most risks can be avoided by understanding how the Web 
operates and programming to the transactional nature of it. It is so 
easy to make sure that the client cannot overwrite server data. I think 
register_globals is far too often blamed for misunderstandings.

Chris

debbie_dyer wrote:

If it is on - its a security risk because anyone can change the
value of the data in your script by passing values in thru the URL.



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




[PHP] navigatie doesn't work in this script

2002-09-29 Thread danny

I made a MySQL database with a dictionary in it. Above there is a form in
wich you can specify some parameters. The problem is that the navigation
doesn't work well. I always get the first 5 results. Can somebody help me
out? There are about 56 records in the database.

The (not quite) working thing is on:
http://www.oostendseverhalen.be/test_met_navigatie3.php

html
head
titleUntitled Document/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head

body

?php

/* hieronder volgt het formulier */
echo '
table width=100%  border=0 align=center cellpadding=2
  tr
td height=198 form name=form1 method=post action=
table width=100% height=89  border=0 align=center
cellpadding=2 summary=interactief woordenboek Oostends nederlands, Engels
en Frans.
  caption
  font color=#003399 size=6 face=TahomaOstensche
encyclopedie /font
  /caption
  tr align=left valign=middle bordercolor=#33
bgcolor=#CC
td width=33% height=47 align=left
valign=middleemstrongfont size=2 face=Tahoma
  label
  input name=taalkeuze type=radio value=woord_ost
checked
  Oostends-Drooghenbroodt/label
  br
  label
  input type=radio name=taalkeuze value=woord_des
  Oostends-desnerck/label
  /font/strong/em/td
td width=22% valign=middlep emstrongfont size=2
face=Tahoma
label
input type=radio name=taalkeuze value=woord_nl
Nederlands/label
br
label
input type=radio name=taalkeuze value=woord_fr
Frans/label
/font/strong/em/p/td
td width=25%emstrongfont size=2 face=Tahoma
  label
  input type=radio name=taalkeuze value=woord_eng
  Engels/label
  br
  label
  input type=radio name=taalkeuze value=verklaring
  Verklaring/label
  /font/strong/em/td
td width=20%div align=centerfont size=2
face=TahomaHulp
bij het zoeken/font/div/td
  /tr
  tr align=left valign=middle bordercolor=#33
bgcolor=#FF
td height=33 colspan=4 align=center valign=top
bgcolor=#CCpfont size=2 face=Tahoma
input name=zoekwoord type=text id=zoekwoord2 value=
size=50 maxlength=40
input type=submit name=Submit value=Zoekn
/fontfont size=2 face=Tahoma /font/p
  blockquote
  /blockquote/td
  /tr
/table
  /form

  /tr
/table';


if ($taalkeuze === NULL)
{
$taalkeuze = woord_ost;
}


$van = 0;
$tot = 5;


mysql_connect(**.**.**.**, **, ) or die (mysql_error());

$Query_beperkte_records = SELECT woordenboek.* FROM woordenboek WHERE 
.$taalkeuze.  LIKE '% .$zoekwoord. %' ORDER BY woordenboek.woord_ost ASC
LIMIT .$van.,.$tot;
$Query_alle_records = SELECT woordenboek.* FROM woordenboek WHERE 
.$taalkeuze.  LIKE '% .$zoekwoord. %';
$result = mysql(oostends,$Query_beperkte_records) or die(mysql_error());
$query = mysql(oostends,$Query_alle_records) or die(mysql_error());
$num3 = mysql_num_rows($query);
$num2 = $num3 / $tot;.
$num = ceil($num2);.


if ($num  1)
 {
 for ($i = 1; $i = $num; $i++)


  $van2 = ($i * $tot) - $tot;
  if ($i == $page)
   $pages[$i] = font face=\trebuchet ms\
color=\#C0C0C0\b$i/b/font;.
  else
   $pages[$i] = font face=\trebuchet ms\ba
href=\$php_self?page=$ivan=$van2tot=$tot\$i/a/b/font;
}
 $pages = implode(b | /b, $pages);
 $vorige = ($page-1) ? font face=\trebuchet ms\ba
href=\$php_self?page= . ($page - 1) . van= . ($van - $tot) .
tot=$tot\lt; Vorige/a/b/font : ;
 $volgende = ($page-$num) ? font face=\trebuchet ms\ba
href=\$php_self?page= . ($page + 1) . van= . ($van + $tot) .
tot=$tot\Volgende gt;/a/b/font : ;

 if ($vorige  $volgende)
  $navigation = $vorige | $pages | $volgende;
 else
  $navigation = $vorige | $pages | $volgende;
 }
print $navigation;


while ($gegevens=mysql_fetch_object($result))
{ 
echo
table width=\100%\  border=\0\cellpadding=\2\ summary=\oostends interactief 
woordenboek\
  tr 
td width=\18%\ colspan=\1\ rowspan=\2\valign=\top\div 
align=\left\font color=\#80\ strongfont size=\3\ face=\Tahoma\. 
$gegevens-woord_ost. /strong/div/p;
 if ($gegevens-geluid  != NULL)
  {
   echo a href=\. $gegevens-geluid. \img src=\plaatjes/button_luister.gif\ 
width=\21\ height=\24\ border=\0\/a;}
  else 
 { 
  echo ;
 }
  
  echo  
  a href=\. $gegevens-geluid. \img src=\plaatjes/button_statistiek.gif\ 
width=\21\ height=\24\ border=\0\/a 
 a href=\. $gegevens-geluid. \img src=\plaatjes/button_stemmen.gif\ 
width=\21\ height=\24\ border=\0\/adiv align=\left\ 
/td
td width=\6%\ rowspan=\2\ align=\left\ valign=\top\div 
align=\left\strongfont size=\1\ 
face=\Tahoma\Volgnr/font/strong/div/td
td width=\76%\ align=\left\ valign=\top\font 

RE: [PHP] navigatie doesn't work in this script

2002-09-29 Thread John W. Holmes

You have LIMIT 0,5 in your query...what do you expect to happen? You're
only going to get five rows with that in there.

---John Holmes...

 -Original Message-
 From: danny [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, September 29, 2002 3:21 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] navigatie doesn't work in this script
 
 I made a MySQL database with a dictionary in it. Above there is a form
in
 wich you can specify some parameters. The problem is that the
navigation
 doesn't work well. I always get the first 5 results. Can somebody help
me
 out? There are about 56 records in the database.
 
 The (not quite) working thing is on:
 http://www.oostendseverhalen.be/test_met_navigatie3.php
 
 html
 head
 titleUntitled Document/title
 meta http-equiv=Content-Type content=text/html;
charset=iso-8859-1
 /head
 
 body
 
 ?php
 
 /* hieronder volgt het formulier */
 echo '
 table width=100%  border=0 align=center cellpadding=2
   tr
 td height=198 form name=form1 method=post action=
 table width=100% height=89  border=0 align=center
 cellpadding=2 summary=interactief woordenboek Oostends nederlands,
 Engels
 en Frans.
   caption
   font color=#003399 size=6 face=TahomaOstensche
 encyclopedie /font
   /caption
   tr align=left valign=middle bordercolor=#33
 bgcolor=#CC
 td width=33% height=47 align=left
 valign=middleemstrongfont size=2 face=Tahoma
   label
   input name=taalkeuze type=radio value=woord_ost
 checked
   Oostends-Drooghenbroodt/label
   br
   label
   input type=radio name=taalkeuze value=woord_des
   Oostends-desnerck/label
   /font/strong/em/td
 td width=22% valign=middlep emstrongfont
size=2
 face=Tahoma
 label
 input type=radio name=taalkeuze value=woord_nl
 Nederlands/label
 br
 label
 input type=radio name=taalkeuze value=woord_fr
 Frans/label
 /font/strong/em/p/td
 td width=25%emstrongfont size=2 face=Tahoma
   label
   input type=radio name=taalkeuze value=woord_eng
   Engels/label
   br
   label
   input type=radio name=taalkeuze value=verklaring
   Verklaring/label
   /font/strong/em/td
 td width=20%div align=centerfont size=2
 face=TahomaHulp
 bij het zoeken/font/div/td
   /tr
   tr align=left valign=middle bordercolor=#33
 bgcolor=#FF
 td height=33 colspan=4 align=center valign=top
 bgcolor=#CCpfont size=2 face=Tahoma
 input name=zoekwoord type=text id=zoekwoord2
 value=
 size=50 maxlength=40
 input type=submit name=Submit value=Zoekn
 /fontfont size=2 face=Tahoma /font/p
   blockquote
   /blockquote/td
   /tr
 /table
   /form
 
   /tr
 /table';
 
 
 if ($taalkeuze === NULL)
 {
 $taalkeuze = woord_ost;
 }
 
 
 $van = 0;
 $tot = 5;
 
 
 mysql_connect(**.**.**.**, **, ) or die
(mysql_error());
 
 $Query_beperkte_records = SELECT woordenboek.* FROM woordenboek WHERE

 .$taalkeuze.  LIKE '% .$zoekwoord. %' ORDER BY
woordenboek.woord_ost
 ASC
 LIMIT .$van.,.$tot;
 $Query_alle_records = SELECT woordenboek.* FROM woordenboek WHERE 
 .$taalkeuze.  LIKE '% .$zoekwoord. %';
 $result = mysql(oostends,$Query_beperkte_records) or
die(mysql_error());
 $query = mysql(oostends,$Query_alle_records) or die(mysql_error());
 $num3 = mysql_num_rows($query);
 $num2 = $num3 / $tot;.
 $num = ceil($num2);.
 
 
 if ($num  1)
  {
  for ($i = 1; $i = $num; $i++)
 
 
   $van2 = ($i * $tot) - $tot;
   if ($i == $page)
$pages[$i] = font face=\trebuchet ms\
 color=\#C0C0C0\b$i/b/font;.
   else
$pages[$i] = font face=\trebuchet ms\ba
 href=\$php_self?page=$ivan=$van2tot=$tot\$i/a/b/font;
 }
  $pages = implode(b | /b, $pages);
  $vorige = ($page-1) ? font face=\trebuchet ms\ba
 href=\$php_self?page= . ($page - 1) . van= . ($van - $tot) .
 tot=$tot\lt; Vorige/a/b/font : ;
  $volgende = ($page-$num) ? font face=\trebuchet ms\ba
 href=\$php_self?page= . ($page + 1) . van= . ($van + $tot) .
 tot=$tot\Volgende gt;/a/b/font : ;
 
  if ($vorige  $volgende)
   $navigation = $vorige | $pages | $volgende;
  else
   $navigation = $vorige | $pages | $volgende;
  }
 print $navigation;
 
 
 while ($gegevens=mysql_fetch_object($result))
 {
 echo
 table width=\100%\  border=\0\cellpadding=\2\
summary=\oostends
 interactief woordenboek\
   tr
 td width=\18%\ colspan=\1\ rowspan=\2\valign=\top\div
 align=\left\font color=\#80\ strongfont size=\3\
 face=\Tahoma\.
 $gegevens-woord_ost. /strong/div/p;
  if ($gegevens-geluid  != NULL)
   {
echo a href=\. $gegevens-geluid. \img
 src=\plaatjes/button_luister.gif\ width=\21\ height=\24\
 

Re: [PHP] Not Displaying From Vars??

2002-09-29 Thread debbie_dyer

Chris

Yes you are right in what you say but:-

I would argue that register_globals only presents a security risk to
inexperienced developers.

And how many of these are putting code on the net? - Thousands.

Also, all programmers (even the most experienced) are only human and prone
to error and in my opinion anything that makes it easy to write bad code
cannot be good.

Debbie

- Original Message -
From: Chris Shiflett [EMAIL PROTECTED]
To: debbie_dyer [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Sunday, September 29, 2002 8:21 PM
Subject: Re: [PHP] Not Displaying From Vars??


 Your description of register_globals is good, except that the security
 risk is a matter of opinion. I would argue that register_globals only
 presents a security risk to inexperienced developers.

 The client can submit any data to your application regardless of any
 configuration (and even regardless of language used). PHP's
 register_globals provides a convenient mechanism for receiving data from
 the client. In general, there are two types of data:

 1. Data from the client
 2. Data residing on the server

 Code that allows data from the client to overwrite data residing on the
 server is poorly written code, and this is the scenario that creates
 this misconception of register_globals being a security risk. Data
 residing on the server can be information in a database, session data,
 etc. It is quite trivial to ensure that this data is overwritten. When a
 script begins execution, the client can no longer submit data. It is
 finished and can do no more so to speak. This makes things very easy.
 Thus, consider this:

 $logged_in=0;

 if (is_valid($password))
 {
  $logged_in=1;
 }

 Guess what? The client cannot make $logged_in = 1 unless the password
 they provide passes the is_valid() function (a function you create to
 validate a password - just a hypothetical example). There is no way a
 client can submit any data in between these statements. The problem is
 when people fail to set $logged_in to 0 initially, so that a failed
 password simply avoids the if statement but doesn't explicitly set
 $logged_in to 0. This is poor programming.

 For session data, try to override data that is initialized with
 session_register() and see if it works. What you will find is that
 whatever the client sends is overwritten by the data in the session, so
 this scenario is also easy to avoid.

 My point is that most risks can be avoided by understanding how the Web
 operates and programming to the transactional nature of it. It is so
 easy to make sure that the client cannot overwrite server data. I think
 register_globals is far too often blamed for misunderstandings.

 Chris

 debbie_dyer wrote:

 If it is on - its a security risk because anyone can change the
 value of the data in your script by passing values in thru the URL.
 



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




Re: [PHP] navigatie doesn't work in this script

2002-09-29 Thread danny

In production this database will be verry big (about 1 records) and for
almost every record a MP3 or picture. So i want to show only 5 records at a
time. Therefore i tried to create a navigation system. And it isn't working
properly now. (It doesn't go up), i always get the same five records. the
variables $van and $tot have to be the limits (van = from and tot means
to)

John W. Holmes [EMAIL PROTECTED] schreef in berichtnieuws
001401c267ee$e6a510d0$[EMAIL PROTECTED]
 You have LIMIT 0,5 in your query...what do you expect to happen? You're
 only going to get five rows with that in there.

 ---John Holmes...

  -Original Message-
  From: danny [mailto:[EMAIL PROTECTED]]
  Sent: Sunday, September 29, 2002 3:21 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] navigatie doesn't work in this script
 
  I made a MySQL database with a dictionary in it. Above there is a form
 in
  wich you can specify some parameters. The problem is that the
 navigation
  doesn't work well. I always get the first 5 results. Can somebody help
 me
  out? There are about 56 records in the database.
 
  The (not quite) working thing is on:
  http://www.oostendseverhalen.be/test_met_navigatie3.php
 
  html
  head
  titleUntitled Document/title
  meta http-equiv=Content-Type content=text/html;
 charset=iso-8859-1
  /head
 
  body
 
  ?php
 
  /* hieronder volgt het formulier */
  echo '
  table width=100%  border=0 align=center cellpadding=2
tr
  td height=198 form name=form1 method=post action=
  table width=100% height=89  border=0 align=center
  cellpadding=2 summary=interactief woordenboek Oostends nederlands,
  Engels
  en Frans.
caption
font color=#003399 size=6 face=TahomaOstensche
  encyclopedie /font
/caption
tr align=left valign=middle bordercolor=#33
  bgcolor=#CC
  td width=33% height=47 align=left
  valign=middleemstrongfont size=2 face=Tahoma
label
input name=taalkeuze type=radio value=woord_ost
  checked
Oostends-Drooghenbroodt/label
br
label
input type=radio name=taalkeuze value=woord_des
Oostends-desnerck/label
/font/strong/em/td
  td width=22% valign=middlep emstrongfont
 size=2
  face=Tahoma
  label
  input type=radio name=taalkeuze value=woord_nl
  Nederlands/label
  br
  label
  input type=radio name=taalkeuze value=woord_fr
  Frans/label
  /font/strong/em/p/td
  td width=25%emstrongfont size=2 face=Tahoma
label
input type=radio name=taalkeuze value=woord_eng
Engels/label
br
label
input type=radio name=taalkeuze value=verklaring
Verklaring/label
/font/strong/em/td
  td width=20%div align=centerfont size=2
  face=TahomaHulp
  bij het zoeken/font/div/td
/tr
tr align=left valign=middle bordercolor=#33
  bgcolor=#FF
  td height=33 colspan=4 align=center valign=top
  bgcolor=#CCpfont size=2 face=Tahoma
  input name=zoekwoord type=text id=zoekwoord2
  value=
  size=50 maxlength=40
  input type=submit name=Submit value=Zoekn
  /fontfont size=2 face=Tahoma /font/p
blockquote
/blockquote/td
/tr
  /table
/form
 
/tr
  /table';
 
 
  if ($taalkeuze === NULL)
  {
  $taalkeuze = woord_ost;
  }
 
 
  $van = 0;
  $tot = 5;
 
 
  mysql_connect(**.**.**.**, **, ) or die
 (mysql_error());
 
  $Query_beperkte_records = SELECT woordenboek.* FROM woordenboek WHERE
 
  .$taalkeuze.  LIKE '% .$zoekwoord. %' ORDER BY
 woordenboek.woord_ost
  ASC
  LIMIT .$van.,.$tot;
  $Query_alle_records = SELECT woordenboek.* FROM woordenboek WHERE 
  .$taalkeuze.  LIKE '% .$zoekwoord. %';
  $result = mysql(oostends,$Query_beperkte_records) or
 die(mysql_error());
  $query = mysql(oostends,$Query_alle_records) or die(mysql_error());
  $num3 = mysql_num_rows($query);
  $num2 = $num3 / $tot;.
  $num = ceil($num2);.
 
 
  if ($num  1)
   {
   for ($i = 1; $i = $num; $i++)
 
 
$van2 = ($i * $tot) - $tot;
if ($i == $page)
 $pages[$i] = font face=\trebuchet ms\
  color=\#C0C0C0\b$i/b/font;.
else
 $pages[$i] = font face=\trebuchet ms\ba
  href=\$php_self?page=$ivan=$van2tot=$tot\$i/a/b/font;
  }
   $pages = implode(b | /b, $pages);
   $vorige = ($page-1) ? font face=\trebuchet ms\ba
  href=\$php_self?page= . ($page - 1) . van= . ($van - $tot) .
  tot=$tot\lt; Vorige/a/b/font : ;
   $volgende = ($page-$num) ? font face=\trebuchet ms\ba
  href=\$php_self?page= . ($page + 1) . van= . ($van + $tot) .
  tot=$tot\Volgende gt;/a/b/font : ;
 
   if ($vorige  

RE: [PHP] navigatie doesn't work in this script

2002-09-29 Thread John W. Holmes

Search the archives for previous next links and you'll see a ton of
ways to do this. You are setting the variables to 0 and 5 and then
issuing the query. You have to put some logic in there to only set it to
those values if it's the first time this page is called. If a $tot or
$van value is passed in the URL, then you should use that. 

---John Holmes...

 -Original Message-
 From: danny [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, September 29, 2002 3:56 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] navigatie doesn't work in this script
 
 In production this database will be verry big (about 1 records)
and
 for
 almost every record a MP3 or picture. So i want to show only 5 records
at
 a
 time. Therefore i tried to create a navigation system. And it isn't
 working
 properly now. (It doesn't go up), i always get the same five records.
the
 variables $van and $tot have to be the limits (van = from and tot
 means
 to)
 
 John W. Holmes [EMAIL PROTECTED] schreef in berichtnieuws
 001401c267ee$e6a510d0$[EMAIL PROTECTED]
  You have LIMIT 0,5 in your query...what do you expect to happen?
You're
  only going to get five rows with that in there.
 
  ---John Holmes...
 
   -Original Message-
   From: danny [mailto:[EMAIL PROTECTED]]
   Sent: Sunday, September 29, 2002 3:21 PM
   To: [EMAIL PROTECTED]
   Subject: [PHP] navigatie doesn't work in this script
  
   I made a MySQL database with a dictionary in it. Above there is a
form
  in
   wich you can specify some parameters. The problem is that the
  navigation
   doesn't work well. I always get the first 5 results. Can somebody
help
  me
   out? There are about 56 records in the database.
  
   The (not quite) working thing is on:
   http://www.oostendseverhalen.be/test_met_navigatie3.php
  
   html
   head
   titleUntitled Document/title
   meta http-equiv=Content-Type content=text/html;
  charset=iso-8859-1
   /head
  
   body
  
   ?php
  
   /* hieronder volgt het formulier */
   echo '
   table width=100%  border=0 align=center cellpadding=2
 tr
   td height=198 form name=form1 method=post action=
   table width=100% height=89  border=0 align=center
   cellpadding=2 summary=interactief woordenboek Oostends
nederlands,
   Engels
   en Frans.
 caption
 font color=#003399 size=6 face=TahomaOstensche
   encyclopedie /font
 /caption
 tr align=left valign=middle bordercolor=#33
   bgcolor=#CC
   td width=33% height=47 align=left
   valign=middleemstrongfont size=2 face=Tahoma
 label
 input name=taalkeuze type=radio
value=woord_ost
   checked
 Oostends-Drooghenbroodt/label
 br
 label
 input type=radio name=taalkeuze
value=woord_des
 Oostends-desnerck/label
 /font/strong/em/td
   td width=22% valign=middlep emstrongfont
  size=2
   face=Tahoma
   label
   input type=radio name=taalkeuze
value=woord_nl
   Nederlands/label
   br
   label
   input type=radio name=taalkeuze
value=woord_fr
   Frans/label
   /font/strong/em/p/td
   td width=25%emstrongfont size=2
face=Tahoma
 label
 input type=radio name=taalkeuze
value=woord_eng
 Engels/label
 br
 label
 input type=radio name=taalkeuze
value=verklaring
 Verklaring/label
 /font/strong/em/td
   td width=20%div align=centerfont size=2
   face=TahomaHulp
   bij het zoeken/font/div/td
 /tr
 tr align=left valign=middle bordercolor=#33
   bgcolor=#FF
   td height=33 colspan=4 align=center
valign=top
   bgcolor=#CCpfont size=2 face=Tahoma
   input name=zoekwoord type=text
id=zoekwoord2
   value=
   size=50 maxlength=40
   input type=submit name=Submit value=Zoekn
   /fontfont size=2 face=Tahoma /font/p
 blockquote
 /blockquote/td
 /tr
   /table
 /form
  
 /tr
   /table';
  
  
   if ($taalkeuze === NULL)
   {
   $taalkeuze = woord_ost;
   }
  
  
   $van = 0;
   $tot = 5;
  
  
   mysql_connect(**.**.**.**, **, ) or die
  (mysql_error());
  
   $Query_beperkte_records = SELECT woordenboek.* FROM woordenboek
WHERE
  
   .$taalkeuze.  LIKE '% .$zoekwoord. %' ORDER BY
  woordenboek.woord_ost
   ASC
   LIMIT .$van.,.$tot;
   $Query_alle_records = SELECT woordenboek.* FROM woordenboek WHERE

   .$taalkeuze.  LIKE '% .$zoekwoord. %';
   $result = mysql(oostends,$Query_beperkte_records) or
  die(mysql_error());
   $query = mysql(oostends,$Query_alle_records) or
die(mysql_error());
   $num3 = mysql_num_rows($query);
   $num2 = $num3 / 

Re: [PHP] mail + pdf + memory question

2002-09-29 Thread Rasmus Lerdorf

$mail-getFile() obviously reads in a file from the disk.  You already
have your attachment in memory, so don't call that function.  Just do
$attachment = $data;

-Rasmus

On Sun, 29 Sep 2002, Jonas Geiregat wrote:

 this is my code what I want to do is
 generate a pdf file(not save it on hd of server but in memory)
 then send it as attachement to someone

   $pdf = pdf_new();

   pdf_open_file($pdf,);
   pdf_begin_page($pdf, 595, 842);
   pdf_set_font($pdf, Times-Roman, 30, host);
   pdf_set_value($pdf, textrendering, 1);
   pdf_show_xy($pdf, A PDF document created in memory!, 50, 
750);
   pdf_end_page($pdf);
   pdf_close($pdf);
   $data = pdf_get_buffer($pdf);


   /**
 * Filename...: example.3.php
 * Project: HTML Mime Mail class
 * Last Modified..: 15 July 2002
 */
   error_reporting(E_ALL);
   include('htmlMimeMail.php');

 /**
 * Example of usage. This example shows
 * how to use the class to send a plain
 * text email with an attachment. No html,
 * or embedded images.
 *
 * Create the mail object.
 */
   $mail = new htmlMimeMail();

 /**
 * Read the file test.zip into $attachment.
 */
   $attachment = $mail-getFile('test.pdf');

 /**
 * Since we're sending a plain text email,
 * we only need to read in the text file.
 */
   $text = $mail-getFile('example.txt');

 /**
 * To set the text body of the email, we
 * are using the setText() function. This
 * is an alternative to the setHtml() function
 * which would obviously be inappropriate here.
 */
   $mail-setText($text);

 /**
 * This is used to add an attachment to
 * the email.
 */
   $mail-addAttachment($attachment, 'test.pdf', 'application/zip');

 /**
 * Sends the message.
 */
   $mail-setFrom('Joe [EMAIL PROTECTED]');
   $result = $mail-send(array('Richard [EMAIL PROTECTED]'));

   echo $result ? 'Mail sent!' : 'Failed to send mail';


 the mail get's send but I get this error
 Warning: fopen(test.pdf, rb) - No such file or directory in
 /home/web/intranet/httpdocs/htmlMimeMail.php on line 162
 and test.pdf is included in the mail but is 0kb big
 anyone sees the prob ?


 --
 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] Not Displaying From Vars??

2002-09-29 Thread John W. Holmes

Does just a simple form work?

form method=GET
input type=text name=test
input type=submit name=submit
/form
? 
if(isset($_GET['submit']))
{ echo $_GET['test'] .  was submitted; }
?

---John Holmes...

 -Original Message-
 From: Stephen Craton [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, September 29, 2002 3:19 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: RE: [PHP] Not Displaying From Vars??
 
 Here's the part that's supposed to display the information. I've only
 filled in one area so far:
 
 tr
 tdfont size=2 face=Arial, Helvetica,
 sans-serifSunday/font/td
 td align=center valign=middle?php echo
 $_GET[sung_reg]; ?/td
 td align=center valign=middle
 class=linenbsp;/td
 td align=center valign=middle
 class=line2nbsp;/td
 td align=center valign=middlenbsp;/td
 td align=center valign=middlenbsp;/td
 td align=center valign=middlenbsp;/td
 td align=center valign=middlenbsp;/td
 td align=center valign=middlenbsp;/td
 td align=center valign=middlenbsp;/td
   /tr
 
 Here's the form for the same area:
 
   tr
 tdfont size=2 face=Arial, Helvetica,
 sans-serifSunday/font/td
 td align=center valign=middle input
 name=sun_reg type=text class=hours id=sun_reg size=4
 maxlength=3
 /td
 td align=center valign=middle
 class=linefont size=2 face=Arial, Helvetica, sans-serif
   input name=sun_over type=text
 class=hours id=sun_over size=4 maxlength=3
   /font/td
 td align=center valign=middle
 class=line2font size=2 face=Arial, Helvetica, sans-serif
   input name=sun_vac type=text
 class=hours id=sun_vac size=4 maxlength=3
   /font/td
 td align=center valign=middlefont
 size=2 face=Arial, Helvetica, sans-serif
   input name=sun_hol type=text
 class=hours id=sun_hol size=4 maxlength=3
   /font/td
 td align=center valign=middlefont
 size=2 face=Arial, Helvetica, sans-serif
   input name=sun_sick type=text
 class=hours id=sun_sick size=4 maxlength=3
   /font/td
 td align=center valign=middlefont
 size=2 face=Arial, Helvetica, sans-serif
   input name=sun_funer type=text
 class=hours id=sun_funer size=4 maxlength=3
   /font/td
 td align=center valign=middlefont
 size=2 face=Arial, Helvetica, sans-serif
   input name=sun_edu type=text
 class=hours id=sun_edu size=4 maxlength=3
   /font/td
 td align=center valign=middlefont
 size=2 face=Arial, Helvetica, sans-serif
   input name=sun_per type=text
 class=hours id=sun_per2 size=4 maxlength=3
   /font/td
 td align=center valign=middlefont
 size=2 face=Arial, Helvetica, sans-serif
   input name=sun_other type=text
 class=hours id=sun_other size=4 maxlength=3
   /font/td
   /tr
 
 Hope that helps!
 
 Thanks,
 Stephen
 http://www.melchior.us
 http://php.melchior.us
 
 :: -Original Message-
 :: From: John W. Holmes [mailto:[EMAIL PROTECTED]]
 :: Sent: Sunday, September 29, 2002 1:33 PM
 :: To: 'Stephen Craton'; [EMAIL PROTECTED]
 :: Subject: RE: [PHP] Not Displaying From Vars??
 ::
 ::
 :: Post your code...
 ::
 ::  -Original Message-
 ::  From: Stephen Craton [mailto:[EMAIL PROTECTED]]
 ::  Sent: Sunday, September 29, 2002 2:11 PM
 ::  To: [EMAIL PROTECTED]
 ::  Subject: RE: [PHP] Not Displaying From Vars??
 :: 
 ::  I just tried it and it doesn't work either.
 :: 
 ::  Thanks,
 ::  Stephen
 ::  http://www.melchior.us
 ::  http://php.melchior.us
 :: 
 ::  :: -Original Message-
 ::  :: From: John W. Holmes [mailto:[EMAIL PROTECTED]]
 ::  :: Sent: Sunday, September 29, 2002 1:07 PM
 ::  :: To: 'Stephen Craton'; [EMAIL PROTECTED]
 ::  :: Subject: RE: [PHP] Not Displaying From Vars??
 ::  ::
 ::  ::
 ::  :: Try $_POST['sun_reg'] or $_GET['sun_reg'], depending on the
 ::  :: method of your form.
 ::  ::
 ::  :: You probably have register globals off, that's why $sun_reg
 ::  :: isn't created. That's a good thing.
 ::  ::
 ::  :: ---John Holmes...
 ::  ::
 ::  ::  -Original Message-
 ::  ::  From: Stephen Craton [mailto:[EMAIL PROTECTED]]
 ::  ::  Sent: Sunday, September 29, 2002 2:01 PM
 ::  ::  To: [EMAIL PROTECTED]
 ::  ::  Subject: [PHP] Not Displaying From Vars??
 ::  :: 
 ::  ::  I bet you're getting sick 

Re: [PHP] navigatie doesn't work in this script

2002-09-29 Thread danny

John,

Ik took this script from a script-library. The problem (i think) is that the
counter $tot isn't going up. It remains 5
ex:
http://www.oostendseverhalen.be/test_met_navigatie3.php?page=8van=35tot=5

John W. Holmes [EMAIL PROTECTED] schreef in berichtnieuws
001a01c267f3$90b8a8d0$[EMAIL PROTECTED]
 Search the archives for previous next links and you'll see a ton of
 ways to do this. You are setting the variables to 0 and 5 and then
 issuing the query. You have to put some logic in there to only set it to
 those values if it's the first time this page is called. If a $tot or
 $van value is passed in the URL, then you should use that.

 ---John Holmes...

  -Original Message-
  From: danny [mailto:[EMAIL PROTECTED]]
  Sent: Sunday, September 29, 2002 3:56 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] navigatie doesn't work in this script
 
  In production this database will be verry big (about 1 records)
 and
  for
  almost every record a MP3 or picture. So i want to show only 5 records
 at
  a
  time. Therefore i tried to create a navigation system. And it isn't
  working
  properly now. (It doesn't go up), i always get the same five records.
 the
  variables $van and $tot have to be the limits (van = from and tot
  means
  to)
 
  John W. Holmes [EMAIL PROTECTED] schreef in berichtnieuws
  001401c267ee$e6a510d0$[EMAIL PROTECTED]
   You have LIMIT 0,5 in your query...what do you expect to happen?
 You're
   only going to get five rows with that in there.
  
   ---John Holmes...
  
-Original Message-
From: danny [mailto:[EMAIL PROTECTED]]
Sent: Sunday, September 29, 2002 3:21 PM
To: [EMAIL PROTECTED]
Subject: [PHP] navigatie doesn't work in this script
   
I made a MySQL database with a dictionary in it. Above there is a
 form
   in
wich you can specify some parameters. The problem is that the
   navigation
doesn't work well. I always get the first 5 results. Can somebody
 help
   me
out? There are about 56 records in the database.
   
The (not quite) working thing is on:
http://www.oostendseverhalen.be/test_met_navigatie3.php
   
html
head
titleUntitled Document/title
meta http-equiv=Content-Type content=text/html;
   charset=iso-8859-1
/head
   
body
   
?php
   
/* hieronder volgt het formulier */
echo '
table width=100%  border=0 align=center cellpadding=2
  tr
td height=198 form name=form1 method=post action=
table width=100% height=89  border=0 align=center
cellpadding=2 summary=interactief woordenboek Oostends
 nederlands,
Engels
en Frans.
  caption
  font color=#003399 size=6 face=TahomaOstensche
encyclopedie /font
  /caption
  tr align=left valign=middle bordercolor=#33
bgcolor=#CC
td width=33% height=47 align=left
valign=middleemstrongfont size=2 face=Tahoma
  label
  input name=taalkeuze type=radio
 value=woord_ost
checked
  Oostends-Drooghenbroodt/label
  br
  label
  input type=radio name=taalkeuze
 value=woord_des
  Oostends-desnerck/label
  /font/strong/em/td
td width=22% valign=middlep emstrongfont
   size=2
face=Tahoma
label
input type=radio name=taalkeuze
 value=woord_nl
Nederlands/label
br
label
input type=radio name=taalkeuze
 value=woord_fr
Frans/label
/font/strong/em/p/td
td width=25%emstrongfont size=2
 face=Tahoma
  label
  input type=radio name=taalkeuze
 value=woord_eng
  Engels/label
  br
  label
  input type=radio name=taalkeuze
 value=verklaring
  Verklaring/label
  /font/strong/em/td
td width=20%div align=centerfont size=2
face=TahomaHulp
bij het zoeken/font/div/td
  /tr
  tr align=left valign=middle bordercolor=#33
bgcolor=#FF
td height=33 colspan=4 align=center
 valign=top
bgcolor=#CCpfont size=2 face=Tahoma
input name=zoekwoord type=text
 id=zoekwoord2
value=
size=50 maxlength=40
input type=submit name=Submit value=Zoekn
/fontfont size=2 face=Tahoma /font/p
  blockquote
  /blockquote/td
  /tr
/table
  /form
   
  /tr
/table';
   
   
if ($taalkeuze === NULL)
{
$taalkeuze = woord_ost;
}
   
   
$van = 0;
$tot = 5;
   
   
mysql_connect(**.**.**.**, **, ) or die
   (mysql_error());
   
$Query_beperkte_records = SELECT 

[PHP] Size of SHA1 or MD5 hash hex-encoded?

2002-09-29 Thread Eivind Olsen

Hello.

I'm just trying to mess around with the MHASH-library functions to create 
MD5 and SHA1 hashes. Is there a limit to how large the output from 
mhash(MHASH_MD5, $input) or mhash(MHASH_SHA1, $input) will be? I'd like to 
store some MD5 (or SHA1) hashes in a database (after converting them from 
binary to hex) and I need to know how large the hashes can be.

I've tried looking at the PHP documentation on the 'net but have not been 
able to find this out by myself. Can anyone help?

-- 
Eivind Olsen
[EMAIL PROTECTED]


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




RE: [PHP] Update identical table

2002-09-29 Thread David Freeman


  I have 2 identical tables called tmp_data and data. (on 
  the same mysql database).
  What would be the simple and more convenient way to update 
  table data with a row from table tmp_data.

What about getting rid of tmp_data completely and adding an extra
column to your data table.  The extra column, say approved would act
as a flag that, if set (ie. = 1) means that the data is confirmed and,
if not set, means the data is not confirmed.

Using this, you could use the setting in your approved column in
queries to find data that you've not yet confirmed or whatever.  Saves
the whole mess of reading in data from one table to write to another
table and also avoids the potential for errors if you change your
database structure at all (and forget to make the change in both
tables).

CYA, Dave




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




Re: [PHP] error suppresion

2002-09-29 Thread Gary

Jean-Christian Imbeault wrote:
 Gary wrote:
 

 They are not really errors they are reporting that the form fields are 
 empty until the form is submitted.
 Notice: Undefined index:
 
 
 That means your code is not doing any checking of the incoming data. You 
 should always check that the data coming is what you expect it to be. 
 It's good programming practice and helps security.
 
 Just add the following to your code and every thing will be fine 
 (assuming POST, but works with GET or any other):
 
 if (isset($_POST[myvar name])) {
   $value = $_POST[myvar name];
 }
 else {
   $value = ;
 }
 
The problem is the vars will never be set until the form is submitted. 
The e-notice's are for the
empty form elements before the form submission. So the else value 
would be, turn off error reporting until submission.

Gary


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




[PHP] Undefined constant error

2002-09-29 Thread Voisine

Hello,

I'm learning PHP from a book PHP for newbie writen in French and I
have an error on one of the exemple. Undifined constant 'compteur' on
line 15 which is :
if (compteur == 1) {

What I'm doing wrong? This is the script

?php
include(config.inc.php);
$query = SELECT * FROM Type ORDER BY animalType;
$result = mysql_query($query) or die (Exécution de la sélection
impossible);

echo h1 align='center'Catalogue/h1ph3Quel type d'animal
cherchez-vous ?/h3\n;
echo form action='montre_animaux.php' method='post'\n;
echo table cellpadding='5' border='1';
$compteur = 1;
while ($ligne = mysql_fetch_array($result)) {
 extract($ligne);
 echo trtd valign='top' width='15%';
 echo input type='radio' name='interet' value='$animalType';
 if (compteur == 1) {
  echo checked;
 }
 echo font
size='+1'b$animalType/b/font/tdtd$typeDescription/td/tr;

 $compteur++;
}
echo /table;
echo pinput type='submit' name='submit' value='Faites votre
choix'/form;
?


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




Re: [PHP] Undefined constant error

2002-09-29 Thread Sascha Cunz

There seems to be a print-error in this book. It's missing a '$'
This line:
  if (compteur == 1) {
should be:
  if ($compteur == 1) {

Sascha

Am Montag, 30. September 2002 01:52 schrieb Voisine:
 Hello,

 I'm learning PHP from a book PHP for newbie writen in French and I
 have an error on one of the exemple. Undifined constant 'compteur' on
 line 15 which is :
 if (compteur == 1) {

 What I'm doing wrong? This is the script

 ?php
 include(config.inc.php);
 $query = SELECT * FROM Type ORDER BY animalType;
 $result = mysql_query($query) or die (Exécution de la sélection
 impossible);

 echo h1 align='center'Catalogue/h1ph3Quel type d'animal
 cherchez-vous ?/h3\n;
 echo form action='montre_animaux.php' method='post'\n;
 echo table cellpadding='5' border='1';
 $compteur = 1;
 while ($ligne = mysql_fetch_array($result)) {
  extract($ligne);
  echo trtd valign='top' width='15%';
  echo input type='radio' name='interet' value='$animalType';
  if (compteur == 1) {
   echo checked;
  }
  echo font
 size='+1'b$animalType/b/font/tdtd$typeDescription/td/tr;

  $compteur++;
 }
 echo /table;
 echo pinput type='submit' name='submit' value='Faites votre
 choix'/form;
 ?


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




Re: [PHP] Update identical table

2002-09-29 Thread Justin French

on 30/09/02 8:09 AM, David Freeman ([EMAIL PROTECTED]) wrote:

 What about getting rid of tmp_data completely and adding an extra
 column to your data table.  The extra column, say approved would act
 as a flag that, if set (ie. = 1) means that the data is confirmed and,
 if not set, means the data is not confirmed.
 
 Using this, you could use the setting in your approved column in
 queries to find data that you've not yet confirmed or whatever.  Saves
 the whole mess of reading in data from one table to write to another
 table and also avoids the potential for errors if you change your
 database structure at all (and forget to make the change in both
 tables).

totally agree

Justin


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




Re: [PHP] Undefined constant error

2002-09-29 Thread Matt


 From: Voisine [EMAIL PROTECTED]
 Sent: Sunday, September 29, 2002 7:52 PM
 Subject: [PHP] Undefined constant error


 I'm learning PHP from a book PHP for newbie writen in French and I
 have an error on one of the exemple. Undifined constant 'compteur' on
 line 15 which is :
 if (compteur == 1) {

 What I'm doing wrong? This is the script

 ?php
 include(config.inc.php);
 $query = SELECT * FROM Type ORDER BY animalType;
 $result = mysql_query($query) or die (Exécution de la sélection
 impossible);

 echo h1 align='center'Catalogue/h1ph3Quel type d'animal
 cherchez-vous ?/h3\n;
 echo form action='montre_animaux.php' method='post'\n;
 echo table cellpadding='5' border='1';
 $compteur = 1;
 while ($ligne = mysql_fetch_array($result)) {
  extract($ligne);
  echo trtd valign='top' width='15%';
  echo input type='radio' name='interet' value='$animalType';
  if (compteur == 1) {
you're missing the $ in from of compteur.  Should be:
if ($compteur == 1) {
make sure you have register_globals on in php.ini or your next question will
be 'why isn't $compteur set to the value posted?'  Better would be to change
the line to the new magic globals, and learn the right way from scratch:

if ($_POST['compteur'] == 1) {

For the full explaination see:
http://www.php.net/manual/fr/language.variables.predefined.php

   echo checked;
  }

Also, I think this code needs to place the 'checked' within the input
type=radio tag
so you end up with:

echo input type='radio' name='interet' value='$animalType';
if ($_POST['compteur'] == 1) {
  echo checked;
}
echo ;





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




Re: [PHP] Undefined constant error

2002-09-29 Thread Sascha Cunz

 make sure you have register_globals on in php.ini or your next question
 will be 'why isn't $compteur set to the value posted?'  Better would be to
 change the line to the new magic globals, and learn the right way from
 scratch:

I agree with you as far, as to learn the right way from scratch - but this is 
no POST-Var here. 

 echo input type='radio' name='interet' value='$animalType';
 if ($_POST['compteur'] == 1) {
   echo checked; 
 }
 echo ;

This is another bug in the script. Considering that, it would be correctly:
(Note the space between '' and 'checked')

  echo input type='radio' name='interet' value='$animalType';
  if ($compteur == 1) {
echo  checked;
  }
  echo ;

or shorter:

  echo
input type='radio' name='interet' value='$animalType'.
($compteur == 1 ? ' checked' : '') . ;

Regards Sascha

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




[PHP] Re: Thanks

2002-09-29 Thread Voisine

Thank you Sascha and Matt you got it ! Everything is working fine now.
There is a lot of printing error in this book :(

Regards!
Voisine

Voisine wrote:

 Hello,

 I'm learning PHP from a book PHP for newbie writen in French and I
 have an error on one of the exemple. Undifined constant 'compteur' on
 line 15 which is :
 if (compteur == 1) {

 What I'm doing wrong? This is the script

 ?php
 include(config.inc.php);
 $query = SELECT * FROM Type ORDER BY animalType;
 $result = mysql_query($query) or die (Exécution de la sélection
 impossible);

 echo h1 align='center'Catalogue/h1ph3Quel type d'animal
 cherchez-vous ?/h3\n;
 echo form action='montre_animaux.php' method='post'\n;
 echo table cellpadding='5' border='1';
 $compteur = 1;
 while ($ligne = mysql_fetch_array($result)) {
  extract($ligne);
  echo trtd valign='top' width='15%';
  echo input type='radio' name='interet' value='$animalType';
  if (compteur == 1) {
   echo checked;
  }
  echo font
 size='+1'b$animalType/b/font/tdtd$typeDescription/td/tr;

  $compteur++;
 }
 echo /table;
 echo pinput type='submit' name='submit' value='Faites votre
 choix'/form;
 ?


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




Re: [PHP] Re: Thanks

2002-09-29 Thread Sascha Cunz

 Thank you Sascha and Matt you got it ! Everything is working fine now.
 There is a lot of printing error in this book :(

Sadly that's a property of most IT-Books :-( I've hardly ever seen another 
kind of books with more printing errors than IT books used to have...

Sascha

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




RE: [PHP] Member's Area Script

2002-09-29 Thread Stephen Craton

I'm having the error again this time on my webserver. I have it set as a
global variable but it's not working. It can be found at
http://mom.melchior.us. Type in test for the username and password.
Why???

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

:: -Original Message-
:: From: debbie_dyer [mailto:[EMAIL PROTECTED]] 
:: Sent: Saturday, September 28, 2002 6:03 PM
:: To: [EMAIL PROTECTED]
:: Subject: Re: [PHP] Member's Area Script
:: 
:: 
:: 
::   $conn = $main; - that line is the problem - you cant use 
:: global vars inside functions without declaring them as global
:: 
:: - Original Message -
:: From: Stephen Craton [EMAIL PROTECTED]
:: To: [EMAIL PROTECTED]
:: Sent: Saturday, September 28, 2002 11:49 PM
:: Subject: [PHP] Member's Area Script
:: 
:: 
::  Hello again,
:: 
::  I'm trying to write a script that has a member's area in 
:: it. So far 
::  I've been able to successfully validate only one username 
:: and only one 
::  password but now I'm going big and trying to compare it 
:: with a table 
::  in my MySQL database. Everything goes nice and smooth 
:: until I actually 
::  try and enter in my username and password. I type it in, copy and 
::  paste, whaetever and it tells me the error I wanted it to say The 
::  username and password is not a good combo. I've copied 
:: and pasted the 
::  username and password from the database directly yet it 
:: still gives me 
::  this error. Here's my code for the login() function that 
:: logs the user 
::  in:
:: 
::  function login($username, $password)
::  {
::$conn = $main;
::if (!$conn)
::  return 0;
:: 
::$result = mysql_query(select * from user
::   where username='$username'
::   and passwd = '$password');
::if (!$result)
::   return 0;
:: 
::if (mysql_num_rows($result)0)
::   return 1;
::else
::   return 0;
::  }
:: 
::  Here's the code for the part that calls the login() function:
:: 
::  if(login($user, $pass))
::  {
::  $valid_user = $user;
::  session_register(valid_user);
::  }
::  else
::  {
::  echo font face='Arial, Helvetica, sans-serif' 
::  size='3'centerbYou supplied an invalid username and password 
::  combo. Try again please./b/center; exit;
::  }
:: 
::  And here's the part that connects to the database:
:: 
::  ?php
::  # FileName=Connection_php_mysql.htm
::  # Type=MYSQL
::  # HTTP=true
::  $hostname_main = localhost;
::  $database_main = mom;
::  $username_main = root;
::  $password_main = ;
::  $main = mysql_pconnect($hostname_main, $username_main, 
:: $password_main) 
::  or die(mysql_error()); ?
:: 
::  Does anyone see why it's doing this to me? Please help!!
:: 
::  Thanks,
::  Stephen
::  http://www.melchior.us
::  http://php.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
:: 
:: 



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




Re: [PHP] navigatie doesn't work in this script

2002-09-29 Thread Tom Rogers

Hi,

Monday, September 30, 2002, 5:20:48 AM, you wrote:
d I made a MySQL database with a dictionary in it. Above there is a form in
d wich you can specify some parameters. The problem is that the navigation
d doesn't work well. I always get the first 5 results. Can somebody help me
d out? There are about 56 records in the database.

d The (not quite) working thing is on:
d http://www.oostendseverhalen.be/test_met_navigatie3.php

d html
d head
d titleUntitled Document/title
d meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
d /head

d body

d ?php

d /* hieronder volgt het formulier */
d echo '
d table width=100%  border=0 align=center cellpadding=2
d   tr
d td height=198 form name=form1 method=post action=
d table width=100% height=89  border=0 align=center
d cellpadding=2 summary=interactief woordenboek Oostends nederlands, Engels
en Frans.
d   caption
d   font color=#003399 size=6 face=TahomaOstensche
d encyclopedie /font
d   /caption
d   tr align=left valign=middle bordercolor=#33
bgcolor=#CC
d td width=33% height=47 align=left
valign=middleemstrongfont size=2 face=Tahoma
d   label
d   input name=taalkeuze type=radio value=woord_ost
checked
d   Oostends-Drooghenbroodt/label
d   br
d   label
d   input type=radio name=taalkeuze value=woord_des
d   Oostends-desnerck/label
d   /font/strong/em/td
d td width=22% valign=middlep emstrongfont size=2
face=Tahoma
d label
d input type=radio name=taalkeuze value=woord_nl
d Nederlands/label
d br
d label
d input type=radio name=taalkeuze value=woord_fr
d Frans/label
d /font/strong/em/p/td
d td width=25%emstrongfont size=2 face=Tahoma
d   label
d   input type=radio name=taalkeuze value=woord_eng
d   Engels/label
d   br
d   label
d   input type=radio name=taalkeuze value=verklaring
d   Verklaring/label
d   /font/strong/em/td
d td width=20%div align=centerfont size=2
face=TahomaHulp
d bij het zoeken/font/div/td
d   /tr
d   tr align=left valign=middle bordercolor=#33
bgcolor=#FF
d td height=33 colspan=4 align=center valign=top
bgcolor=#CCpfont size=2 face=Tahoma
d input name=zoekwoord type=text id=zoekwoord2 value=
d size=50 maxlength=40
d input type=submit name=Submit value=Zoekn
d /fontfont size=2 face=Tahoma /font/p
d   blockquote
d   /blockquote/td
d   /tr
d /table
d   /form

d   /tr
d /table';


d if ($taalkeuze === NULL)
d {
d $taalkeuze = woord_ost;
d }


d $van = 0;
d $tot = 5;


d mysql_connect(**.**.**.**, **, ) or die (mysql_error());

d $Query_beperkte_records = SELECT woordenboek.* FROM woordenboek WHERE 
d .$taalkeuze.  LIKE '% .$zoekwoord. %' ORDER BY woordenboek.woord_ost ASC
d LIMIT .$van.,.$tot;
d $Query_alle_records = SELECT woordenboek.* FROM woordenboek WHERE 
d .$taalkeuze.  LIKE '% .$zoekwoord. %';
d $result = mysql(oostends,$Query_beperkte_records) or die(mysql_error());
d $query = mysql(oostends,$Query_alle_records) or die(mysql_error());
d $num3 = mysql_num_rows($query);
d $num2 = $num3 / $tot;.
d $num = ceil($num2);.

...snip
Here is a class that will create a google like pagination of results

?
class page_class {
var $count = 0; //total pages
var $start = 0; //starting record
var $pages = 0; //number of pages available
var $page = 1;  //current page
var $maxpages;  //shows up to 2 * this number and makes a sliding scale
var $show;  //number of results per page
function page_class($count=0,$show=5,$max=9){
$this-count = $count;
$this-show = $show;
$this-maxpages = $max;
($this-count % $this-show == 0)? $this-pages = 
intval($this-count/$this-show) :$this-pages = intval($this-count/$this-show) +1;
if(!empty($_GET['search_page'])){
$this-page = $_GET['search_page'];
$this-start = $this-show * $this-page - $this-show;
}
}
function get_limit(){
$limit = '';
if($this-count  $this-show) $limit = 'LIMIT 
'.$this-start.','.$this-show;
return $limit;
}
function make_head_string($pre){
$r = $pre.' ';
$end = $this-start + $this-show;
if($end  $this-count) $end = $this-count;
$r .= ($this-start +1).' - '.$end.' of '.$this-count;
return $r;
}

[PHP] How to specify to browser to cache contents?

2002-09-29 Thread Jean-Christian Imbeault

Is the a particular header() call or other setting I can use to tell the 
client browser to cache the contents of my php pages? (I am using Apache).

It seems like my browser (N7) doesn't even cache the images on the pages 
even though those are static ...

Jc


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




[PHP] syntax question

2002-09-29 Thread Jeff Bluemel

couple of questions...  I'm am learning php  mysql without any books (will
also be using postgres, and informix, but assuming most of these are about
the same other then sql syntax), and through internet resources.  there are
a lot of good step throughs on a lot of stuff, but there are some things I'm
having a hard time finding how to's on...

for instance - if there a command that will give me the name of the fields
in the result set?  how to I test for a null value?  how do I go from one
row to the next, or how do I filter a result set based on a value in a
column?  is there a way to sum a specific field?

would appreciate whatever help I can get, and even better if somebody know's
a step through that goes through all the basic's of database syntaxes in
php.
--

Thanks,

Jeff Bluemel



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




Re: [PHP] syntax question

2002-09-29 Thread Justin French

on 30/09/02 2:44 PM, Jeff Bluemel ([EMAIL PROTECTED]) wrote:

if there a command that will give me the name of the fields
 in the result set?

mysql_field_name() might help... but generally I know what fields I want to
grab, so I don't need this...  I found this answer on http://php.net/mysql.
just as you could :)


 how to I test for a null value?

empty()?  isset()?  if($var == )?  if($var == NULL)??  have a look in
the php manual for string functions, and comparison operators


 how do I go from one row to the next

A while loop for the result set, row by row would look something like this,
printing the id, author and date for each row in the table

?
$sql = SELECT * FROM tablename WHERE blah blah;
$result = mysql_query($sql);
if($result)
{
while($myrow = mysql_fetch_array($result))
{
echo $myrow['id'];
echo $myrow['title'];
echo $myrow['author'];
}
}
?


 or how do I filter a result set based on a value in a
 column?

rather than filter a result set, write the right query to start with:

SELECT * FROM tablename WHERE colname='value' AND colname2='othervalue'

also check out:

ORDER BY colname 

and

LIMIT

in the mysql manual


 is there a way to sum a specific field?

SELECT SUM(colname) as mysum FROM tablename WHERE type='fiction'



 would appreciate whatever help I can get, and even better if somebody know's
 a step through that goes through all the basic's of database syntaxes in
 php.

It's not PHP that you neccessarily need to read up on the real power
comes from the SQL queries you write.  You need to spend time playing around
with code, and then asking us specific questions... needless to say, a hunt
through the manuals first would help, as would a search of the archives :)

This page is a pretty good start for MySQL:
http://www.mysql.com/doc/en/Function_Index.html


Justin French


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




Re: [PHP] How to specify to browser to cache contents?

2002-09-29 Thread Justin French

If there's a noticeable difference between two browsers, and you're
currently NOT setting any headers for caching, the blame will probably lie
in the preference setting of the browser, not in your code.

Justin French


on 30/09/02 2:24 PM, Jean-Christian Imbeault ([EMAIL PROTECTED])
wrote:

 Is the a particular header() call or other setting I can use to tell the
 client browser to cache the contents of my php pages? (I am using Apache).
 
 It seems like my browser (N7) doesn't even cache the images on the pages
 even though those are static ...
 
 Jc
 


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




[PHP] preg_match problem

2002-09-29 Thread Chris N

Ok heres the situation, I have a string like this

$this-_item[title]  = 28.09.02 - Some silly Text (First) (Second);

Im trying to do a preg_match on it to check it to make sure its in a certian
format. Heres my preg_match

preg_match(/^(\d+)\.(\d+)\.(\d+)\s+\-\s+(.+)\s+\((.+)\)$,
$this-_item[title], $matches);
list($all, $one, $two, $three, $four, $five) = $matches;

What Im getting returned in this

$one = 28
$two = 09
$three = 02
$four = Some silly Text
$five = First) (Second

What I want is

$four = Some silly Text (First)
$five = Second

Can anyone see where Im going wrong? The match may be really crude, Im still
pretty new to regular expressions. But it works just fine as long as there
is only one set of ().

Chris N.



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




[PHP] algorithm design

2002-09-29 Thread Pablo Oliva

I have a new project that I might be working on and need some guidance
from the more experienced software designers on this list. The project
is taking input from users and sorting the users, based on the input,
into 4 or 5 separate types of users, categorizing them into these
categories. I have never done anything like this, and would like to know
if you could point me in the right direction as far as sources, where I
could look to learn about this type of algorithm design. Anything would
help, psychology, algorithm design, etc. Thanks in advance.


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




Re: [PHP] syntax question

2002-09-29 Thread Chris Shiflett

Justin French wrote:

on 30/09/02 2:44 PM, Jeff Bluemel ([EMAIL PROTECTED]) wrote:
  

how to I test for a null value?


empty()?  isset()?  if($var == )?  if($var == NULL)??  have a look in
the php manual for string functions, and comparison operators


I think he maybe meant testing for null values in SQL.

If this is true, there is the null keyword: is null and is not null.

select * from table_name where column_name is not null

This selects all rows from a table where the data in column column_name 
is not null. Be careful with this, as it actually tests for null and not 
an empty string, for example. If you want to test whether a value is 
null once you have assigned it to a PHP variable, you can use one of 
Justin's suggestions.

In addition, PHP has null as well.

Happy hacking.

Chris


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




RE: [PHP] syntax question

2002-09-29 Thread Smith, Benjamin

Check out this tutorial on the MySQL website:

http://www.mysql.com/articles/mysql_intro.html

It contains links to the basics of SQL and its syntax, as well as giving you a good 
grounding in MySQL specifically.

As others have stated, most of the functionality you really need should be built into 
the SQL query. It's redundant to request excessive results from the database server, 
only to filter them out with custom php routines.

-Original Message-
From: Chris Shiflett [mailto:[EMAIL PROTECTED]]
Sent: Monday, 30 September 2002 3:30 PM
To: Justin French
Cc: Jeff Bluemel; [EMAIL PROTECTED]
Subject: Re: [PHP] syntax question


Justin French wrote:

on 30/09/02 2:44 PM, Jeff Bluemel ([EMAIL PROTECTED]) wrote:
  

how to I test for a null value?


empty()?  isset()?  if($var == )?  if($var == NULL)??  have a look in
the php manual for string functions, and comparison operators


I think he maybe meant testing for null values in SQL.

If this is true, there is the null keyword: is null and is not null.

select * from table_name where column_name is not null

This selects all rows from a table where the data in column column_name 
is not null. Be careful with this, as it actually tests for null and not 
an empty string, for example. If you want to test whether a value is 
null once you have assigned it to a PHP variable, you can use one of 
Justin's suggestions.

In addition, PHP has null as well.

Happy hacking.

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




Re: [PHP] How to specify to browser to cache contents?

2002-09-29 Thread Jean-Christian Imbeault

Justin French wrote:

 If there's a noticeable difference between two browsers, and you're
 currently NOT setting any headers for caching, the blame will probably lie
 in the preference setting of the browser, not in your code.

I thought exactly the same thing before posting. So I made sure cookies 
are enabled and that the cache setting is Once per session.

The two browsers in question are N7 and IE5.5 N7 is the one that seems 
not to be caching. In my opinion IE5 often has features that make it 
do things it shouldn't just because it might be helpful to the user.

So I was thinking IE5.5 was doing some caching because *it* thought it 
should but N7 wasn't because it was respecting some HTTP header saying 
not to cache that I somehow have set by mistake ...

How can I get the entire page, HTTP headers and all so I can see if 
there are some no caching directives in the page? And which headers 
might those be? ;)

Thanks!

Jc


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




[PHP] .php to .html?

2002-09-29 Thread Jean-Christian Imbeault

I am using PHP 4.2.3 and Apache 1.3.26

When a user comes to one of my php pages it comes out has http:..ip/page.php

How can I make my pages come out as .html instead of .php?

Thanks!

Jc


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




[PHP] Re: auto_prepend: *Exactly* like include()?

2002-09-29 Thread David Robley

In article [EMAIL PROTECTED], [EMAIL PROTECTED] 
says...
 Does using the auto_prepend config option in the php.ini file act 
 exactly like and include() call.
 
 An include call will read the file off disk ... will auto.prepend do the 
 same thing or will PHP keep the file in memory for quick retrival?
 
 Jc

Whether a document is kept in memory cache or not is not something that 
php has any control over, I think; your operating system is generally what 
looks after that.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] N7: Media (Page Info Tab) contents not cached bug?

2002-09-29 Thread Jean-Christian Imbeault

When using the View|Page Info Menu item I get a nice tabbed window 
showing information for the page I just loaded. Clicking the Media tab 
shows what contents the page needed and importantly whether the contents 
are cached or not.

If I load .php pages I am developing off a local server 
(http://192.168... not accessible from the internet) I see that in the 
Media tab the Source for the gif/jpeg's on my page is listed as (not 
cached) ... but if I look in the cache folder the files are there ...

I only see this problem with my local .php pages. I do not have the 
problem with IE. I do not see this problem if I access .php files on the 
public Internet.

Does N7 have a problem caching files from private (192.168...) networks?

Or is N7 really caching the files and there is a problem with the Media 
(Page Info Tab) in that is incorrectly stating that media has not been 
cached when it has?

Is this a setting in PHP, N7, or Apache I need to change?

This is really worrying me so any comments appreciated!

Jc


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




RE: [PHP] .php to .html?

2002-09-29 Thread Peter Houchin

just save the files u create as .html make sure in your apache httpd.conf
where you reference for .php that u have html in here as well and all will
be sweet.

eg in this line

AddType application/x-httpd-php .php4 .php .htm .php3 .html


anything you put in that line will be passed through php

cheers


 -Original Message-
 From: Jean-Christian Imbeault [mailto:[EMAIL PROTECTED]]
 Sent: Monday, 30 September 2002 3:46 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] .php to .html?


 I am using PHP 4.2.3 and Apache 1.3.26

 When a user comes to one of my php pages it comes out has
 http:..ip/page.php

 How can I make my pages come out as .html instead of .php?

 Thanks!

 Jc


 --
 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: dropping mail into queue

2002-09-29 Thread Manuel Lemos

Hello,

On 09/08/2002 11:51 AM, Petre Agenbag wrote:
 Hi list
 Is is possible to change the default behaviour of the mail() function to
 send the message to the queue instead of trying to send it immediately? 
 I did do some research into this a while back, but it never really got
 to a point where I was completely satisfied with the results. I can
 recall from then that the behaviour of the mail() function was inherited
 from the way sendmail was configured on the server, but I cannot go that
 route ( ie, reconfigure sendmail to send all mail requests to the queue,
 as the server is not only a webserver, but servers my clients normal
 e-mail as well), so I'm basically asking if it is possible to override
 the sendmail behaviour when you issue the mail() function, or to even
 compose and write the message directly to the /var/spool/mqueue folder (
 that would obviously NOT use the mail() function).
 The reason for all this is that there are some clients that are
 abusing/miss-using the mail() function to query a mysql db of 20K users
 with a while() loop and then doing a mail() inside the while, this is
 causing some serious problems on my server, and I'm trying to look for
 ways to put a tab on this.So any other suggestions are also very
 welcome.

You need to set the DeliveryMode option to queue. Take a look at this 
class and in particular to the sendmail_mail.php scripth that is a 
wrapper arround the class to emulate the mail() function but in a way 
that lets you configure sendmail delivery mode directly from your 
scripts. Set the delivery_mode variable of the $message_object to 
SENDMAIL_DELIVERY_QUEUE .

http://www.phpclasses.org/mimemessage


-- 

Regards,
Manuel Lemos


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




Re: [PHP] N7: Media (Page Info Tab) contents not cached bug?

2002-09-29 Thread Chris Shiflett

I do not know the answer to your question for certain, but perhaps it 
has to do with the Cache-Control HTTP header. This header has a 
directive called no-cache which allows caching but requires that the 
cached copy be revalidated each time.

To test this, try changing the image source (on your server) and request 
the page again. If Netscape fetches the fresh resource, this might be 
it. If you see the same image as before, then there is definitely a 
problem somewhere.

Sometimes caches are used in this way to cut down on traffic without 
avoiding interaction with the origin server. Basically, the origin 
servers gets final say so to speak as to whether the cached copy is 
still valid, rather than the cache deciding on its own. This is 
extremely common in practice.

Maybe that provides a possible explanation.

Chris

Jean-Christian Imbeault wrote:

 When using the View|Page Info Menu item I get a nice tabbed window 
 showing information for the page I just loaded. Clicking the Media tab 
 shows what contents the page needed and importantly whether the 
 contents are cached or not.

 If I load .php pages I am developing off a local server 
 (http://192.168... not accessible from the internet) I see that in the 
 Media tab the Source for the gif/jpeg's on my page is listed as 
 (not cached) ... but if I look in the cache folder the files are 
 there ...

 I only see this problem with my local .php pages. I do not have the 
 problem with IE. I do not see this problem if I access .php files on 
 the public Internet.

 Does N7 have a problem caching files from private (192.168...) networks?

 Or is N7 really caching the files and there is a problem with the 
 Media (Page Info Tab) in that is incorrectly stating that media has 
 not been cached when it has?

 Is this a setting in PHP, N7, or Apache I need to change? 



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




Re: [PHP] How to specify to browser to cache contents?

2002-09-29 Thread Chris Shiflett

IE ignores the no-store directive of the Cache-Control header, and 
this is the most common reason behind behavior such as you are 
describing. Basically, because Netscape (and other browsers) adhere to 
the HTTP specification, it may appear as if they are misbehaving when it 
in fact quite the opposite.

Get rid of no-store and just use no-cache instead to see if it 
resolves the inconsistency.

Happy hacking.

Chris

Jean-Christian Imbeault wrote:

 The two browsers in question are N7 and IE5.5 N7 is the one that 
 seems not to be caching. In my opinion IE5 often has features that 
 make it do things it shouldn't just because it might be helpful to the 
 user.

 So I was thinking IE5.5 was doing some caching because *it* thought it 
 should but N7 wasn't because it was respecting some HTTP header saying 
 not to cache that I somehow have set by mistake ... 



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




Re: [PHP] syntax question

2002-09-29 Thread Jeff Bluemel

 mysql_field_name() might help... but generally I know what fields I want
to
 grab, so I don't need this...  I found this answer on
http://php.net/mysql.
 just as you could :)

I've been coding in other languages for about 6 years now, and I have looked
through a lot of the mysql stuff, and the explanations just don't make sense
for me (or the examples, I can make them work, but don't understand why they
work).  it seems there are just basic's of the language they expect that you
understand.  piece by piece I'm getting it, but I'm not happy just copying
code, and seeing something work.  I've got to know why something worked, and
feel like I understand more of the in's and out's.  I think the howto's skip
over a lot of things that have me confused.

it seems like a lot of this stuff deals more with array's, and that's
something I never learned to handle in other languages.  this may be part of
my problem...

as far as using the select queries, that's an option most times, but there
are some situations where there are too many calls to the database, and the
code isn't efficient.

here's a sample of things I made work, but don't understand...

TABLE border=3 cellspacing=2 cellpadding=2 bordercolor=#045C00
width=100%
  TR align=center
   TD align=leftDate/TD
   TDANI/TD
   TDDNIS/TD
   TDCountry/TD
   TDDestination/TD
   TDPay Phone/TD
   TDCost/TD
   TD align=rightMinutes/TD
  /TR

no - obviously here I understand what fields I'm getting out of the
database, but I'd prefer to use a syntax that would print the field names in
the top column of the table, and make my code more transportable.  with the
stuff I'm doing this would be a great help.

  ?
  mysql_data_seek ($sql, 0);
  while ($row = mysql_fetch_assoc ($sql))

now - from what I understand from the php.net doc's page this is putting
things in the array.  does that mean that in order to parse a result set I
have to turn it into an array, or can I directly access the recordset?  (all
examples point to creating an array out of it, not sure if this is
necessity, or just a better way to parse a result set)

now - my misunderstanding of this while statement throws me for a loop...  I
don't see anything in this code that moves a pointer to the next row, and
yet it seems to?

  {
  echo TR\n;
  foreach ($row as $column)
  {
  echo TD$column/TD\n;
  }
   echo /TR\n;
  }
  echo /TABLE;



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




Re: [PHP] .php to .html?

2002-09-29 Thread Jean-Christian Imbeault

Peter Houchin wrote:

 just save the files u create as .html make sure in your apache httpd.conf
 where you reference for .php that u have html in here as well and all will
 be sweet.
 
 eg in this line
 
 AddType application/x-httpd-php .php4 .php .htm .php3 .html

Super! That helps *so* much!

Jc


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




Re: [PHP] syntax question

2002-09-29 Thread Jeff Bluemel

let me be more specific...

if a field value is null how do I test for it in the result set, or the
array?

here's a real live example...  I'm working with prepaid phone cards, and if
a card has not expired yet then the field zombie_date will be null.

so - when I do the mysql_fetch_assoc ($sql) what value will the field
contain if the resulting recordset was a null?  instead of leaving that
table space blank I would like to populate it with Not Expired or
something like that.  (I have a lot of scenario's where I would like to use
that).


Chris Shiflett [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Justin French wrote:

 on 30/09/02 2:44 PM, Jeff Bluemel ([EMAIL PROTECTED]) wrote:
 
 
 how to I test for a null value?
 
 
 empty()?  isset()?  if($var == )?  if($var == NULL)??  have a look in
 the php manual for string functions, and comparison operators
 

 I think he maybe meant testing for null values in SQL.

 If this is true, there is the null keyword: is null and is not null.

 select * from table_name where column_name is not null

 This selects all rows from a table where the data in column column_name
 is not null. Be careful with this, as it actually tests for null and not
 an empty string, for example. If you want to test whether a value is
 null once you have assigned it to a PHP variable, you can use one of
 Justin's suggestions.

 In addition, PHP has null as well.

 Happy hacking.

 Chris




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




  1   2   >