[PHP] Printing from PHP

2003-11-06 Thread Peter Goggin
Is it possible to have a php  a script that will run on my server but let me
print to my client network printer?

What I am doing is using php to generate html for a report from a data base
which is displayed on the clients screen.  I would like to offer the client
the option of printing this report on their local printer .

If  php will not support access to a client printer is there any way of
embedding a Form Feed in the display so that if the screen report is printed
than the data will be correctly paginated?


Regards

Peter Goggin





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.532 / Virus Database: 326 - Release Date: 27/10/03

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



Re: [PHP] selecting count and then dumping to an array

2003-06-07 Thread Peter Goggin
Try

select type, count(*) from table group by type;

This should return a count for each distinct type value.

Regards


Peter Goggin
- Original Message -
From: Ryan A [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, June 08, 2003 12:13 AM
Subject: [PHP] selecting count and then dumping to an array


 Hi,

 Is there any way to get a COUNT of records (SELECT count(*) FROM main_my
 where type=$t) for 5 types using  hopefully one select statement and then
 dumping that into an array?

 The reason I am asking is running 5 selects on the DB at once is not a
very
 good idea...right?

 Thanks,
 -Ryan

 http://MrSahaf.com - The Iraqi (Dis)information ministers site (We will
 slaughter you all!)


 --
 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] Re Sessionid

2003-03-16 Thread Peter Goggin
Is the value returned by session_id (), called after session_star() always a
unique string?
The results of several trials gave me:
6f88d2d3fd7d0d47aea1e45087368adc
3cc2c1b299fcaa6f4fd107683d78a00c
115e8da118af1c5d88d6db1c1481077a
26dda220f9d64de593ce2f2de6b4bb6e
26dda220f9d64de593ce2f2de6b4bb6e

i.e. every time i started a new session I got a unique string, while the
string remained the sme within the same session.

How is this string derived?

Regards

Peter Goggin


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



Re: [PHP] Re user Identifying

2003-03-14 Thread Peter Goggin
I did not make my request for information clear. The two scenarios which I
have to cover:

1. The user registers as a customer with the site. In this case the shopping
basket and items can be attached to the customer Id. and the shopping basket
made available across sessions. The shopping basket is created when the
first item is added. It is closed when the final order is placed.  I have
already coded this and it works satisfactorily.

2. The user does not register. Instead the process is to add items to a
shopping basket, which is then converted to an order or discarded at the end
of the session. How do I identify shopping baskets belonging to different
concurrent users?  Should I include the session Id in the record, use
cookies or what?

Is the php session Id a unique ID ?

Regards

Peter Goggin
- Original Message -
From: -{ Rene Brehmer }- [EMAIL PROTECTED]
To: Peter Goggin [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, March 14, 2003 4:13 AM
Subject: Re: [PHP] Re user Identifying


 On Thu, 13 Mar 2003 19:55:04 +1100, Peter Goggin wrote about [PHP] Re
 user Identifying what the universal translator turned into this:

 My site uses shopping baskets to record what the user wants to but. These
 records are stored in a database against the user.   This requires the
user
 to register and log onto the site. Is it possible to avoid this by the
use
 of cookies or some other method?

 To retain a users identity, when the users ain't on your site, you've got
 no way around cookies.

 Be aware that the cookie should only (for security reasons) contain the
 user's ID, not his/her login or password.

 When the user returns to the site, you'll need to look for the cookie, and
 then compare the userID to the database, and provide auto-login by
 retrieving login and password from the database.

 I don't use cookies myself, so can't help beyond that.

 Rene

 --
 Rene Brehmer

 This message was written on 100% recycled spam.

 Come see! My brand new site is now online!
 http://www.metalbunny.net



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



[PHP] Re user Identifying

2003-03-13 Thread Peter Goggin
My site uses shopping baskets to record what the user wants to but. These
records are stored in a database against the user.   This requires the user
to register and log onto the site. Is it possible to avoid this by the use
of cookies or some other method?

Is it  possible to use both methods in parallel. so that the user can choose
either method. i.e. choose to register as a customer, or use the default id
(perhaps via the cookie) and enter customer information at the time of
placing the order?


Any advice on the best way of doing this would be greatly appreciated.
Regards

Peter Goggin


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



[PHP] Date fields

2002-12-28 Thread Peter Goggin

I have a form with several date fields. I want to be able to set these by
selecting from a calendar display.  Does anyone know of any php function or
code which would let me do this?

Regards

Peter Goggin


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




Re: [PHP] REPLY NEEDED

2002-11-21 Thread Peter Goggin
Where has this crap come from?
Regards

Peter Goggin
- Original Message - 
From: MICHAEL OSHODI [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, November 20, 2002 5:51 PM
Subject: [PHP] REPLY NEEDED



 ASSISTANCE

WE ARE MEMBERS OF A SPECIAL COMMITTEE FOR BUDGET AND
PLANNING OF THE NIGERIA NATIONAL PETROLEUM CORPORATION
 (NNPC)IN WEST AFRICA. THIS COMMITTEE IS PRINCIPALLY CONCERNED
WITH CONTRACT AWARDS AND APPROVAL. WITH OUR POSITIONS,
WE HAVE SUCCESSFULLY SECURED FOR OURSELVES THE SUM OF
THIRTHY ONE MILLION, FIVE HUNDRED THOUSAND UNITED
STATES DOLLARS (US$31.5M). THIS AMOUNT WAS CAREFULLY
MANIPULATED BY OVER-INVOICING OF AN OLD CONTRACT.

BASED ON INFORMATION GATHERED ABOUT YOU, WE BELIEVE
YOU WOULD BE IN A POSITION TO HELP US IN TRANSFERING
THIS FUND (US$31.5M) INTO A SAFE ACCOUNT. IT HAS BEEN
AGREED THAT THE OWNER OF THE ACCOUNT WILL BE
COMPENSATED WITH 30% OF THE REMITTED FUNDS, WHILE WE
KEEP 60% AS THE INITIATORS AND 10% WILL BE SET ASIDE
TO OFFSET EXPENSES AND PAY THE NECESSARY TAXES.WE
INTEND TO USE PART OF OUR OWN SHARE TO IMPORT FROM
YOUR COUNTRY AGRICULTURAL AND CONSTRUCTION MACHINERY.
THIS IS BECAUSE THE PRESENT GOVERNMENT OF MY COUNTRY
IS EMPHASISING ON PROVIDING FOOD AND HOUSING FOR ALL
ITS CITIZENS BEFORE THE NEXT ELECTION. HENCE,
AGRICULTURAL AND CONSTRUCTION EQUIPMENT ARE IN HIGH
DEMAND OVER HERE. WE SHALL ALSO NEED YOUR ASSISTANCE
IN THIS REGARD ON A COMMISSION TO BE AGREED UPON WHEN
WE FINALLY MEET.

ALL MODALITIES OF THIS TRANSACTION HAVE BEEN CAREFULLY
WORKED OUT AND ONCE STARTED WILL NOT TAKE MORE THAN
SEVEN (7) WORKING DAYS, WITH YOUR FULL SUPPORT. THIS
TRANSACTION IS 100% RISK FREE.

MOREOVER, WE SHALL NEED THE FOLLOWING FROM YOU TO 
ENABLE US BEGIN THE TRANSACTION FORMALLY. THEY ARE; 
YOUR FULL NAME AND ADDRESS OR YOUR COMPANY NAME, 
ADDRESS AND TELEPHONE/FAX NUMBERS, YOUR BANKERS 
NAME AND ADDRESS, YOUR ACCOUNT NUMBER AND NAME. 
THIS INFORMATION WILL BE USED ALONGSIDE OTHER VITAL
 DOCUMENTS OVER HERE IN PREPARING THE NECESSARY 
APPLICATION FOR PAYMENT TO THE CONCERNED QUARTERS 
WHERE PAYMENT APPROVALS WOULD BE SECURED IN FAVOUR
 OF YOUR COMPANY FOR THE PAYMENT OF OUR FUND(US$31.5M)
 INTO YOUR NOMINATED ACCOUNT FOR US ALL. BY OUR APPLICATION, 
IT WILL BE ASSUMED THAT THIS SUM IS BEING REQUESTED AS 
PAYMENT, WHICH IS LONG-OUTSTANDING, FOR A CONTRACT, 
WE SHALL CLAIM WITH OUR POSITION, YOU OR YOUR COMPANY
 EXECUTED FOR (NNPC) SOMETIME IN 1997. HENCE, WE SHALL 
FOLLOW ALL THE LEGAL OFFICIAL PROTOCOLS USUALLY 
OBSERVED BY FOREIGN CONTRACTORS WHENEVER THEY 
ARE DEMANDING PAYMENT FOR CONTRACTS EXECUTED 
FOR THE GOVERNMENT OF MY COUNTRY.

FURTHERMORE, IMMEDIATELY THE FINAL APPROVAL IS GRANTED, 
THE FUND WILL BE TRANSFERRED INTO YOUR ACCOUNT WITHIN 72
HOURS, BY WHICH TIME MY PARTNERS AND I WILL BE IN YOUR COUNTRY 
FOR THE FINAL DISBURSEMENT IN THE RATIO ALREADY SPELT OUT TO YOU.

 PLEASE, YOU SHOULD ENDEAVOUR TO GIVE US AN ACCOUNT 
WHICH YOU HAVE ABSOLUTE CONTROL OVER. THIS IS VERY 
IMPORTANT BECAUSE WE WOULD NOT WANT A SITUATION 
WHEN THE MONEY IS IN THE ACCOUNT, YOU NOW TELL US 
YOU WOULD NEED TO BE AUTHORISED BY ANOTHER PERSON 
BEFORE WE CAN HAVE OUR OWN SHARE.

YOU WILL NOT BE REQUIRED TO TRAVEL OUT OF YOUR COUNTRY, 
ME AND MY PARTNERS, WE TRAVEL DOWN TO YOUR COUNTRY 
FOR THE DISBURSEMENT OF THE FUND, AFTER THE FINAL TRANSACTION. 
WE WILL ALSO DISCUSS ABOUT OIL BUSINEES IN MY COUNTRY 
WHEN WE COME DOWN OVER THERE. BECAUSE WE WOULD 
LIKE TO ESTABLISH A JOINT BUSINESS WITH YOU. THAT IS 
WE WILL USE YOUR NAME TO REGISTER AND  
INCORPORATE AN OIL COMPANY IN MY COUNTRY. 

BESIDES, ON THE COMPLETION OF THIS TRANSFER, 
ALL DOCUMENTS USED FOR THE PURPOSE WILL BE 
WITHDRAWN FROM THE QUARTERS THEY ARE SUBMITTED 
BY OUR CONTACTS IN THESE OFFICES AND DESTROYED, 
THEREAFTER. SO, THERE WILL NOT BE ANY PROBLEM 
ARISING FROM THIS TRANSACTION NOW OR IN THE FUTURE.
IF THIS PROPOSAL SATISFIES YOU, PLEASE REACH US ONLY
BY EMAIL FOR MORE INFORMATION. 

PLEASE, TREAT AS URGENT AND VERY IMPORTANT.

YOURS FAITHFULLY,

CHIEF MICHAEL OSHODI




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




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




[PHP] PHP Generated web pages

2002-10-03 Thread Peter Goggin

I want to transfer from a web page to a transient page to display a message
and carry out some database updates and then transfer back to the original
page after a pause of 5 seconds.  Is this possible using php?

Regards

Peter Goggin


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




[PHP] Web Site

2002-08-21 Thread Peter Goggin


I am setting up a web site which will be hosted on my own equipmet at home,
located in Melbourne, Australia
I would like some general advice on two questions.

1. What sort of permanent interconnect should I look at (Cable is not
available in my area).  Is DSL suitable? Are there any good providers in the
area?

2. I need to set up credit card payments. Has anyone any experience with
PayPal? Are there any other providers I should consider.


I don't know if this is the correct list for the questions, but if not
perhaps someone could point me to where I can get some advice.


Regards

Peter Goggin


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




[PHP] Linked drop down selection lists and dynamically generated links

2002-07-06 Thread Peter Goggin

I have two related tables. The first has about 12 records, each of which is
related to about 12 records in the second table.  I want to have two
interconnectedt dropdown list fields. The fisrt is used to select from the
first table and when the value has been selected, use it to determine the
contents of the second drop down list.  Once the second field has been
selected I want to use this data to otain the name of the form to be used to
display data selected using the two fields.

Obviously I can do this by having interrelated pages where the value from
the first fields is carried to the second page and used to populate the
second drop down list. I can then presumably dynamically generate the link
to the required page and pass over what paraeters are needed.

Is there any way of doing this so within a single page?

Can this be done using only PHP or do I need to use Javascripts?
Where would I be able to find examples of code which does this sort of
processing?

Any adivice would be gratefully received.
Regards


Peter Goggin

Regards

Peter Goggin


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




[PHP] Passing more than one variable with alink

2002-07-02 Thread Peter Goggin

I need to pass more than one variable with a link.

I cannot see the syntax listed anywhere.

I am using :
printf (a href=\catalogueitemslist.php?catitempage=%s;?catrange=%s\IMG
SRC=\/jpg/buttons/nextset.jpg\ HEIGHT=25
BORDER=0/aLEFT,$catitempage,$catrange);


Obviously the separators between the two variablesare incorrect.   i.e. I
have: ?catitempage=%s;?catrange=%s

Can anyone tell me what it should be or where I can find a reference to
these sort of syntax problems.


Regards

Peter Goggin


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




Re: [PHP] mysql_select_db problem

2002-06-03 Thread Peter Goggin

I use the following code for connection and selecting databases:
  $link =
mysql_pconnect(localhost,$_SESSION['dbauser'],$_SESSION['dbapassword'])
or die(Could not connect);
print Connected successfullyP;
 mysql_select_db(stamps) or die(Could not select database);

This works.
Regards

Peter Goggin
- Original Message -
From: PossumPal [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, June 03, 2002 4:40 AM
Subject: [PHP] mysql_select_db problem


Hi,

I'm a newbie, so please have mercy on my silliness...

I've checked my formats, and can't seem to understand why I can connect to
the db, but not select the db that I want to use.  The following code always
returns the Couldn't select database error.

If I use the mysql monitor, I can select the database directly without any
problems.

Could someone point out what I'm missing?
?
$db_name=mydb;
$table_name=my_table;
$connection = @mysql_connect(localhost, user, password) or die
(Couldn't connect.);
$db = @mysql_select_db($db_name) or die (Couldn't select database);
?


Regards,

Carol






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




Re: [PHP] Apache, html, php and global variables

2002-06-02 Thread Peter Goggin

I certainly read your reply and tried it with the session_start as the first
line of the php secion. I have since remove the HTML etc.   The script
appears to work with out error .

I was able to set session vars etc and the script completed with out error
and the session vars could be printed out at the end of the script.

I then called another php script from my menu frame and was not able to find
the _session vars which showed as blanks. I put the session_start() as first
line of php block but this still did not make it possible to read the
session vars.

Do I need to use names sessions or what?  Is there some setting that is
required in the php.ini or apache to make this work?


As I stated at the beigining of the e-mail saga what i want to be able to do
is to set global variables which will be available to any php script. In
particular i want to ensure that each user has an individual connection to
data abse and that this is maintained through out the session. I have set
the connection up to use the mysql_pconnect function, but I still need to
reconnect in every script which uses the database.  I therefore need to be
able to caryy the username/password from onepage to the next.

Is the start_session and session variables the corect way to do this or is
there a better way?

Regards

Peter Goggin
- Original Message -
From: John Holmes [EMAIL PROTECTED]
To: 'Peter Goggin' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Sunday, June 02, 2002 3:31 PM
Subject: RE: [PHP] Apache, html, php and global variables


 Did you read my reply at all? Call session_start() before any output to
 the browser.

 ---John Holmes...

  -Original Message-
  From: Peter Goggin [mailto:[EMAIL PROTECTED]]
  Sent: Sunday, June 02, 2002 1:20 AM
  To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Subject: Re: [PHP] Apache, html, php and global variables
 
  My script is:
  html
  body
  ?php
  session_start();
  printf(P loggin on as );
  printf (Puser name: );
  printf ($HTTP_POST_VARS['User']);
  printf (PPassword: );printf ($HTTP_POST_VARS['Password']);
  printf (P);
 
 
  /* Connecting, selecting database */
  $link = mysql_pconnect(localhost, $HTTP_POST_VARS['User'],
  $HTTP_POST_VARS['Password'])
  or die(Could not connect);
  print Connected successfullyP;
  printf (BR);
  print Setting Global variablesBR;
  $_SESSION_VARS[dbauser]=($HTTP_POST_VARS['User']);
  $_SESSION_VARS[dbapassword]=($HTTP_POST_VARS['Password']);
  printf ($_SESSION_VARS[dbauser]);
  printf (BR);
  printf ($_SESSION_VARS[dbapassword],BR);
  ?
  P
  /body
  /html
The errors I get are:
  Warning: Cannot send session cookie - headers already sent by (output
  started at c:\usr\www\my-domain\databaselogin.php:3) in
  c:\usr\www\my-domain\databaselogin.php on line 4
 
  Warning: Cannot send session cache limiter - headers already sent
 (output
  started at c:\usr\www\my-domain\databaselogin.php:3) in
  c:\usr\www\my-domain\databaselogin.php on line 4
 
  loggin on as
 
  user name: stampuser
 
  Password: vantwest
 
  Connected successfully
 
 
  Obviously I have something not configured correctly, or I am calling
 the
  function in the wrong place.  Any advice on how to overcome this would
 be
  very useful.
 
 
  Regards
 
 
  Peter Goggin
 
  - Original Message -
  From: John Holmes [EMAIL PROTECTED]
  To: 'Peter Goggin' [EMAIL PROTECTED]; php-
  [EMAIL PROTECTED]
  Sent: Sunday, June 02, 2002 12:09 AM
  Subject: RE: [PHP] Apache, html, php and global variables
 
 
   Sessions use cookies, which use headers, which have to be sent
 before
   any output. html is output. So, put session_start() before that.
  
   ?
   Session_start();
  
   ...
  
   ?
   html
   body
   ...
  
   Where are you putting dbauser and dbapassword into the session?
  
   Your sessions still aren't going to work because the
 session.save_path
   isn't set correctly in your PHP.ini. Set it to a directory on your
   computer that the web server has access to write to.
  
   ---John Holmes...
  
-Original Message-
From: Peter Goggin [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 01, 2002 9:54 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] Apache, html, php and global variables
   
I am not clear what you mean by this. I have set session_start()
 on in
   the
php script that logs onto the database initially.  i then call a
 test
   php
script from a button on the menu frame. This is the output it
 gives:
   
Test php variables
   
Warning: Cannot send session cookie - headers already sent by
 (output
started at c:\usr\www\my-domain\maintenance.php:4) in
c:\usr\www\my-domain\maintenance.php on line 5
   
Warning: Cannot send session cache limiter - headers already sent
   (output
started at c:\usr\www\my-domain\maintenance.php:4) in
c:\usr\www\my-domain\maintenance.php on line 5
   
Warning: open(/tmp

Re: [PHP] Apache, html, php and global variables

2002-06-01 Thread Peter Goggin

I am not clear what you mean by this. I have set session_start() on in the
php script that logs onto the database initially.  i then call a test php
script from a button on the menu frame. This is the output it gives:

Test php variables

Warning: Cannot send session cookie - headers already sent by (output
started at c:\usr\www\my-domain\maintenance.php:4) in
c:\usr\www\my-domain\maintenance.php on line 5

Warning: Cannot send session cache limiter - headers already sent (output
started at c:\usr\www\my-domain\maintenance.php:4) in
c:\usr\www\my-domain\maintenance.php on line 5

Warning: open(/tmp\sess_593732809e269f91e78e7406d4a22808, O_RDWR) failed: No
such file or directory (2) in c:\usr\www\my-domain\maintenance.php on line 5
Test of global variables
DBA USER:
DBA Password;
Warning: open(/tmp\sess_593732809e269f91e78e7406d4a22808, O_RDWR) failed: No
such file or directory (2) in Unknown on line 0

Warning: Failed to write session data (files). Please verify that the
current setting of session.save_path is correct (/tmp) in Unknown on line 0


The script is:
HTML
BODY
Test php variablesBR
?php
session_start();
printf (Test of global variablesBR);
printf (DBA USER: ,$_SESSION_VARS[dbauser],BR);
printf (BR);
printf (DBA Password; ,$_SESSION_VARS[dbapassword],BR);
?
/BODY
/HTML

Is there a problem with how I am using sessiot_start, or is there a php
config problem?

Regards

Peter Goggin

- Original Message -
From: John Holmes [EMAIL PROTECTED]
To: 'Peter Goggin' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Saturday, June 01, 2002 2:04 PM
Subject: RE: [PHP] Apache, html, php and global variables


 You still have to connect to a database every time a script is run,
 whether it's loaded in a frame or run by itself. If you start a session
 and save the username and password in it, then you can use that login
 and password on every other page that you call session_start() on.

 ---John Holmes...

  -Original Message-
  From: Peter Goggin [mailto:[EMAIL PROTECTED]]
  Sent: Friday, May 31, 2002 11:12 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] Apache, html, php and global variables
 
  I am not certain how this helps me, since it appears the data is only
  carried to pages called directly from where it is set.  The page where
 the
  user logs onto the database does not link to other pages. This is done
  from
  the top frame of the form. The top frame of the inital page contains
 the
  menu, one option of which is to log onto the data base to start a
 session.
  The user will then select another page from the top form.
 
  This new page is displayed in the bottom frame of the intial page, and
  there
  may be futher links within this page on the bottom fram.Generally
 however
  main navigation is from the top frame which remains in place through
 out.
  What I wabt to do is to have the login information available at all
 times
  once the user is logged in, nomattar how the current page is called.
 
  Is this possible?
 
  If so how is this done?
 
 
  - Original Message -
  From: Stuart Dallas [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Saturday, June 01, 2002 11:56 AM
  Subject: Re: [PHP] Apache, html, php and global variables
 
 
   On Saturday, June 1, 2002 at 2:42:40 AM, you wrote:
Is there any way of caryying the login information from one web
 page
  to
  the
next in global variables so that the username and password entered
 in
  the
login screen is available to all other web pages in the site or do
 I
  have to
ask the user to re-enter this information at every screen?
  
   Sessions: http://www.php.net/session
  
   --
   Stuart
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php


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




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




Re: [PHP] Apache, html, php and global variables

2002-06-01 Thread Peter Goggin

My script is:
html
body
?php
session_start();
printf(P loggin on as );
printf (Puser name: );
printf ($HTTP_POST_VARS['User']);
printf (PPassword: );printf ($HTTP_POST_VARS['Password']);
printf (P);


/* Connecting, selecting database */
$link = mysql_pconnect(localhost, $HTTP_POST_VARS['User'],
$HTTP_POST_VARS['Password'])
or die(Could not connect);
print Connected successfullyP;
printf (BR);
print Setting Global variablesBR;
$_SESSION_VARS[dbauser]=($HTTP_POST_VARS['User']);
$_SESSION_VARS[dbapassword]=($HTTP_POST_VARS['Password']);
printf ($_SESSION_VARS[dbauser]);
printf (BR);
printf ($_SESSION_VARS[dbapassword],BR);
?
P
/body
/html
  The errors I get are:
Warning: Cannot send session cookie - headers already sent by (output
started at c:\usr\www\my-domain\databaselogin.php:3) in
c:\usr\www\my-domain\databaselogin.php on line 4

Warning: Cannot send session cache limiter - headers already sent (output
started at c:\usr\www\my-domain\databaselogin.php:3) in
c:\usr\www\my-domain\databaselogin.php on line 4

loggin on as

user name: stampuser

Password: vantwest

Connected successfully


Obviously I have something not configured correctly, or I am calling the
function in the wrong place.  Any advice on how to overcome this would be
very useful.


Regards


Peter Goggin

- Original Message -
From: John Holmes [EMAIL PROTECTED]
To: 'Peter Goggin' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Sunday, June 02, 2002 12:09 AM
Subject: RE: [PHP] Apache, html, php and global variables


 Sessions use cookies, which use headers, which have to be sent before
 any output. html is output. So, put session_start() before that.

 ?
 Session_start();

 ...

 ?
 html
 body
 ...

 Where are you putting dbauser and dbapassword into the session?

 Your sessions still aren't going to work because the session.save_path
 isn't set correctly in your PHP.ini. Set it to a directory on your
 computer that the web server has access to write to.

 ---John Holmes...

  -Original Message-
  From: Peter Goggin [mailto:[EMAIL PROTECTED]]
  Sent: Saturday, June 01, 2002 9:54 AM
  To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Subject: Re: [PHP] Apache, html, php and global variables
 
  I am not clear what you mean by this. I have set session_start() on in
 the
  php script that logs onto the database initially.  i then call a test
 php
  script from a button on the menu frame. This is the output it gives:
 
  Test php variables
 
  Warning: Cannot send session cookie - headers already sent by (output
  started at c:\usr\www\my-domain\maintenance.php:4) in
  c:\usr\www\my-domain\maintenance.php on line 5
 
  Warning: Cannot send session cache limiter - headers already sent
 (output
  started at c:\usr\www\my-domain\maintenance.php:4) in
  c:\usr\www\my-domain\maintenance.php on line 5
 
  Warning: open(/tmp\sess_593732809e269f91e78e7406d4a22808, O_RDWR)
 failed:
  No
  such file or directory (2) in c:\usr\www\my-domain\maintenance.php on
 line
  5
  Test of global variables
  DBA USER:
  DBA Password;
  Warning: open(/tmp\sess_593732809e269f91e78e7406d4a22808, O_RDWR)
 failed:
  No
  such file or directory (2) in Unknown on line 0
 
  Warning: Failed to write session data (files). Please verify that the
  current setting of session.save_path is correct (/tmp) in Unknown on
 line
  0
 
 
  The script is:
  HTML
  BODY
  Test php variablesBR
  ?php
  session_start();
  printf (Test of global variablesBR);
  printf (DBA USER: ,$_SESSION_VARS[dbauser],BR);
  printf (BR);
  printf (DBA Password; ,$_SESSION_VARS[dbapassword],BR);
  ?
  /BODY
  /HTML
 
  Is there a problem with how I am using sessiot_start, or is there a
 php
  config problem?
 
  Regards
 
  Peter Goggin
 
  - Original Message -
  From: John Holmes [EMAIL PROTECTED]
  To: 'Peter Goggin' [EMAIL PROTECTED]; php-
  [EMAIL PROTECTED]
  Sent: Saturday, June 01, 2002 2:04 PM
  Subject: RE: [PHP] Apache, html, php and global variables
 
 
   You still have to connect to a database every time a script is run,
   whether it's loaded in a frame or run by itself. If you start a
 session
   and save the username and password in it, then you can use that
 login
   and password on every other page that you call session_start() on.
  
   ---John Holmes...
  
-Original Message-
From: Peter Goggin [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 31, 2002 11:12 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Apache, html, php and global variables
   
I am not certain how this helps me, since it appears the data is
 only
carried to pages called directly from where it is set.  The page
 where
   the
user logs onto the database does not link to other pages. This is
 done
from
the top frame of the form. The top frame of the inital page
 contains
   the
menu, one option of which is to log onto the data base to start a
   session.
The user will then select another page

[PHP] Apache, html, php and global variables

2002-05-31 Thread Peter Goggin

I do not know whether this is a question for this list, but if not perhaps
someone can tell me where to raise it.

I am designing a web site which has a number of  pages. One of these
provides the facility for the user to log onto a mysql database.  Other web
pages allow the user to query and update different tables in the database.

I used the mysql_pconnect function in the login page and assumed that the
connection would automatically be available to all other pages in the site
as they are invoked, but find that I have to include it in every page that
access the data base.

Is there any way of caryying the login information from one web page to the
next in global variables so that the username and password entered in the
login screen is available to all other web pages in the site or do I have to
ask the user to re-enter this information at every screen?


Regards

Peter Goggin



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




Re: [PHP] Apache, html, php and global variables

2002-05-31 Thread Peter Goggin

I am not certain how this helps me, since it appears the data is only
carried to pages called directly from where it is set.  The page where the
user logs onto the database does not link to other pages. This is done from
the top frame of the form. The top frame of the inital page contains the
menu, one option of which is to log onto the data base to start a session.
The user will then select another page from the top form.

This new page is displayed in the bottom frame of the intial page, and there
may be futher links within this page on the bottom fram.Generally however
main navigation is from the top frame which remains in place through out.
What I wabt to do is to have the login information available at all times
once the user is logged in, nomattar how the current page is called.

Is this possible?

If so how is this done?


- Original Message -
From: Stuart Dallas [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, June 01, 2002 11:56 AM
Subject: Re: [PHP] Apache, html, php and global variables


 On Saturday, June 1, 2002 at 2:42:40 AM, you wrote:
  Is there any way of caryying the login information from one web page to
the
  next in global variables so that the username and password entered in
the
  login screen is available to all other web pages in the site or do I
have to
  ask the user to re-enter this information at every screen?

 Sessions: http://www.php.net/session

 --
 Stuart


 --
 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