[PHP] Sessions and Forms

2002-06-08 Thread Greg Macek

What is the best/recommended method of saving form data into session 
variables? Currently only have to deal with regular text input, 
checkboxes and radio buttons (no multiple selects for now). Any sample 
code someone could throw up on the list? I've only recently begun 
working with sessions, but I'm interested to see what I can do with 
them. Any sort of direction on this would be appreciated. Thanks!

- Greg


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




Re: [PHP] Sessions and Forms

2002-06-08 Thread Greg Macek

Ok, I'll have to try that on my next project. Unfortunately these forms were 
written by another developer and there too many variables to rename to make an 
array and not enough time on the project :-)  But for next time.

I've seen many examples of assigning values to session variables w/o forms on 
the list and online. Now should I look to set those values on the next page in 
the sequence of forms that the user is entering?

page1.php
?php
session_start();
*** session_register(test_var);*** // Is this ok?
?
form action=page2.php
input type=text name=test_var/input
input type=submit
/form

page2.php
?php
session_start();
*** $_SESSION[test_var] = $test_var;  *** // Or is this ok?
// or $HTTP_SESSION_VARS[test_var] = $test_var on =4.0.6
?
... (rest of page here)

Which of the two lines is more failsafe in terms of working every time?

Jason Wong wrote:
 On Saturday 08 June 2002 14:39, Greg Macek wrote:
 
What is the best/recommended method of saving form data into session
variables? Currently only have to deal with regular text input,
checkboxes and radio buttons (no multiple selects for now). Any sample
code someone could throw up on the list? I've only recently begun
working with sessions, but I'm interested to see what I can do with
them. Any sort of direction on this would be appreciated. Thanks!
 
 
 What I do is try to put all the form elements into a single array. That way 
 you'll only have a single variable to worry about.
 



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




[PHP] Sessions and Header()

2002-07-16 Thread Greg Macek

Forgive the long post here, but I'll give as much info up-front and see if 
anyone can help me out here...

I've searched the PHP docs for some help, but I am still running into a strange 
problem. Let me explain: I'm working on an internal site that stores information 
into a database, but it can be retrieved at a later date. The data initially is 
entered over many pages ( ~10 forms), so I've used sessions to store that data 
across those pages so that if they decide to move out of order, their data is 
still there. Once they're done, they can save the data, etc... we've all heard 
this story.

Now, on retrieval, I'm pulling all the information from the database and storing 
them in session variables, which all happen to be arrays. There is a lot of data 
to retrieved and put into variables. I have one PHP script perform all this and 
then re-direct the user to the start page. Unfortunately, the script isn't 
storing all the session variables, only the first 5 of 7 variable arrays.


The page looks similar to this:

?php
session_start();
require include_file.inc;
mysql_pconnect(...);
mysql_select_db(...);

$result1 = mysql_fetch_object(mysql_query(...));

$sess_var1[formVar1] = $result1-data_field;
.
session_register(sess_var1);
...// (and so on)

// and then the re-direct
Header(Location:next_page.php);
?

Unfortunately when I place the Header() call at the end of the file, it just 
sits there and doesn't re-direct. If I place it after session_start(), it will 
re-direct, but only the first five session variables are registered. Is there 
something I'm missing here or trying to do too much?

- Greg


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




Re: [PHP] Sessions and Header() - Retraction

2002-07-16 Thread Greg Macek

Well, perhaps stepping away from the problem for a few minutes actually helps 
clear the mind. Found that one of my mysql_query() statements wasn't completing 
and everything after that didn't finish. Once I fixed that, all the session 
variables work. Go fig. Let that be a lesson to me :-)



Greg Macek wrote:
 Forgive the long post here, but I'll give as much info up-front and see 
 if anyone can help me out here...
 
 I've searched the PHP docs for some help, but I am still running into a 
 strange problem. Let me explain: I'm working on an internal site that 
 stores information into a database, but it can be retrieved at a later 
 date. The data initially is entered over many pages ( ~10 forms), so 
 I've used sessions to store that data across those pages so that if they 
 decide to move out of order, their data is still there. Once they're 
 done, they can save the data, etc... we've all heard this story.
 
 Now, on retrieval, I'm pulling all the information from the database and 
 storing them in session variables, which all happen to be arrays. There 
 is a lot of data to retrieved and put into variables. I have one PHP 
 script perform all this and then re-direct the user to the start page. 
 Unfortunately, the script isn't storing all the session variables, only 
 the first 5 of 7 variable arrays.
 
 
 The page looks similar to this:
 
 ?php
 session_start();
 require include_file.inc;
 mysql_pconnect(...);
 mysql_select_db(...);
 
 $result1 = mysql_fetch_object(mysql_query(...));
 
 $sess_var1[formVar1] = $result1-data_field;
 .
 session_register(sess_var1);
 ...// (and so on)
 
 // and then the re-direct
 Header(Location:next_page.php);
 ?
 
 Unfortunately when I place the Header() call at the end of the file, it 
 just sits there and doesn't re-direct. If I place it after 
 session_start(), it will re-direct, but only the first five session 
 variables are registered. Is there something I'm missing here or trying 
 to do too much?
 
 - Greg
 
 



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




[PHP] include() from another sub-domain

2002-08-19 Thread Greg Macek

Hello,

I've searched the list and the manual and am still a bit confused.
Here's what I'd like to do. We have a bunch of internal sites that all
use the same username/password. One is already setup with a function to
authenticate this to a database. However, each login page is coming from
a different sub-domain, such as site1.mydomain.com. The login functions
resides in a PHP file on site2.mydomain.com. So it does this:

?
// This page on site1.mydomain.com

include (http://site2.mydomain.com/functions.php;);

if (loginUser($username,$password)) {
// do stuff here
// redirect
}
else { ... }

?

Right now my local script doesn't find the function I'm trying to use.
What am I missing here? Is it not possible to include a php file (and
its functions and variables) across domains? 

- Greg



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




Re: [PHP] include() from another sub-domain

2002-08-19 Thread Greg Macek

Well, that would make sense. Now is this something I need to configure
in the Apache or the PHP config file? 

On Mon, 2002-08-19 at 14:27, Rasmus Lerdorf wrote:
 If these domains are on the same physical server, include them directly
 via the full filesystem path.  If they are actually on different physical
 machines, you will need to configure those other machines to let you get
 the non-parsed PHP code through them.  Your problam right now is that the
 site2.mydomain.com machine is executing the PHP and only giving you the
 parsed result.  You need to configure Apache to not parse the file with
 PHP when requested by your script.
 
 -Rasmus
 
 On 19 Aug 2002, Greg Macek wrote:
 
  Hello,
 
  I've searched the list and the manual and am still a bit confused.
  Here's what I'd like to do. We have a bunch of internal sites that all
  use the same username/password. One is already setup with a function to
  authenticate this to a database. However, each login page is coming from
  a different sub-domain, such as site1.mydomain.com. The login functions
  resides in a PHP file on site2.mydomain.com. So it does this:
 
  ?
  // This page on site1.mydomain.com
 
  include (http://site2.mydomain.com/functions.php;);
 
  if (loginUser($username,$password)) {
  // do stuff here
  // redirect
  }
  else { ... }
 
  ?
 
  Right now my local script doesn't find the function I'm trying to use.
  What am I missing here? Is it not possible to include a php file (and
  its functions and variables) across domains?
 
  - Greg
 
 
 
  --
  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] require/include from a different directory

2003-03-29 Thread Greg Macek
Hi,

I'm having a problem hopefully can be easily answered. I'm trying to
organize parts of my site into different directories so that they're all
not in the main folder so to speak; basically breaking out by what
part of the application it is. I also have an include folder for all
my main functions and such...

/  (main directory)
/include   (global functions, includes)
/app_sect1 
/app_sect2

what I'm trying to do from /app_sect1 is include a file from the
include directory, but with little success. The line looks like this:

require ../include/inc_file.php; 

But my page just doesn't work for me now.. any ideas what I'm missing?

- Greg





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



Re: [PHP] require/include from a different directory

2003-03-29 Thread Greg Macek
It seems I have found my problem. It has to do with the files I'm trying
to include. They also include other files and the directories it's
trying to include files from aren't working. I've found a workaround for
my situation for the time being. It's not pretty, but functional. 

On Sat, 2003-03-29 at 14:19, Greg Macek wrote:
 Hi,
 
 I'm having a problem hopefully can be easily answered. I'm trying to
 organize parts of my site into different directories so that they're all
 not in the main folder so to speak; basically breaking out by what
 part of the application it is. I also have an include folder for all
 my main functions and such...
 
 /  (main directory)
 /include   (global functions, includes)
 /app_sect1 
 /app_sect2
 
 what I'm trying to do from /app_sect1 is include a file from the
 include directory, but with little success. The line looks like this:
 
 require ../include/inc_file.php; 
 
 But my page just doesn't work for me now.. any ideas what I'm missing?
 
 - Greg
 
 
 
 
 
 -- 
 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] require/include from a different directory

2003-03-29 Thread Greg Macek
I've considered that route, but an issue I have with that is I do most
of my development work on a machine that a different directory structure
than the production server (currently a Cobalt RaQ4), so the paths are
different. Accommodating both would be a time consuming project for me. 

On Sat, 2003-03-29 at 14:47, Jason Paschal wrote:
 try using an absolute path.
 
 
 
 
 
 
 From: Greg Macek [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: [PHP] require/include from a different directory
 Date: 29 Mar 2003 14:19:41 -0600
 
 Hi,
 
 I'm having a problem hopefully can be easily answered. I'm trying to
 organize parts of my site into different directories so that they're all
 not in the main folder so to speak; basically breaking out by what
 part of the application it is. I also have an include folder for all
 my main functions and such...
 
 /  (main directory)
 /include   (global functions, includes)
 /app_sect1
 /app_sect2
 
 what I'm trying to do from /app_sect1 is include a file from the
 include directory, but with little success. The line looks like this:
 
 require ../include/inc_file.php;
 
 But my page just doesn't work for me now.. any ideas what I'm missing?
 
 - Greg
 
 
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 _
 Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
 http://join.msn.com/?page=features/junkmail



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



Re: [PHP] How to do Date Calculation

2002-10-10 Thread Greg Macek

You could also check out this class someone wrote called Date_calc. It's
a nice frontend to all sorts of date calculations you may run across.
It's helping me quite a bit for my projects.

http://www.phpinsider.com/php/code/Date_Calc/

On Thu, 2002-10-10 at 06:04, Noodle Snacks wrote:
 
 Jason Wong [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  On Thursday 10 October 2002 18:37, Jack wrote:
   Dear all
   I'm trying to make a script which will show the month before current
 month!
   Is there anyway i can do this?
  
   Example :
  
   CurrentPervious
  
   OctoberSeptember
 
  date(F, strtotime(last month));
 To find more about PHP's date/time functions go here:
 
 http://www.php.net/manual/en/ref.datetime.php
 
 in particular look at:
 
 date() -- Format a local time/date
 mktime() -- Get UNIX timestamp for a date
 time() -- Return current UNIX timestamp
 strtotime() --  Parse about any English textual datetime description into a
 UNIX timestamp
 
 
 --
 JJ Harrison
 [EMAIL PROTECTED]
 
 
 
 -- 
 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] Upload images to server other than web server?

2002-10-29 Thread Greg Macek
This topic may have been covered before, but I couldn't find any info on
it. 

We have a Cobalt RaQ4 that serves up all our intranet sites, a couple of
which will have forms for uploading files that are related to records
stored in a DB. I'm not planning on storing the files in the DB, don't
worry. :) However, the files themselves will not be stored on the RaQ,
but a different file server on the network which has substantial space
for files.

What is the best way to go about this? Have the file uploaded to a temp.
location on the RaQ and FTP it to its final destination? Or is there a
way to automatically redirect the file? I've considered NFS for this,
but I'm unsure if the RaQ has tools for mounting NFS shares.
Ideas/comments welcome. Thanks.

- Greg



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




Re: [PHP] Re: Upload images to server other than web server?

2002-10-29 Thread Greg Macek
I will give the search a try tomorrow morning. But I can give direct
access to the filesystem for one folder on the RaQ if needed as a
temporary holding place. In my head it seems to be the best option I
have. I'll see what my search results come up with tomorrow. 

On Tue, 2002-10-29 at 23:38, Jason Young wrote:
 Does it have direct access to this filesystem?
 Or maybe FTP access? I've seen a lot of talk about automatic FTP 
 transfers on the list, maybe you can filter the topics and grab 
 something from there?
 
 Just a few cents to throw in :)
 -Jason
 
 Greg Macek wrote:
 
  This topic may have been covered before, but I couldn't find any info on
  it.
 
  We have a Cobalt RaQ4 that serves up all our intranet sites, a couple of
  which will have forms for uploading files that are related to records
  stored in a DB. I'm not planning on storing the files in the DB, don't
  worry. :) However, the files themselves will not be stored on the RaQ,
  but a different file server on the network which has substantial space
  for files.
 
  What is the best way to go about this? Have the file uploaded to a temp.
  location on the RaQ and FTP it to its final destination? Or is there a
  way to automatically redirect the file? I've considered NFS for this,
  but I'm unsure if the RaQ has tools for mounting NFS shares.
  Ideas/comments welcome. Thanks.
 
  - Greg
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
-- 
Greg Macek | Senior IT Manager
Marketing Resources, Inc.
630.530.0100

[EMAIL PROTECTED] | http://www.mrichi.com



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