[PHP] update query based on array

2002-12-09 Thread Jason Dulberg
I am displaying a list of data (from an sql query) and some of the fields in
that list are editable through a form. If the user chooses to edit one or
more of the rows of data, they must click on a checkbox to add that row to
an "update array". The problem is that when I read that array to pass to an
UPDATE sql statement, it only passes the last entry of the array.

Here's an example of the data being passed:
13 - 4 - UPDATE ranking SET category='Prep School', rank='30' WHERE pid=4
14 - 169 - UPDATE ranking SET category='Prep School', rank='30' WHERE
pid=169
15 - 166 - UPDATE ranking SET category='Prep School', rank='30' WHERE
pid=166

The above is created based on the following html code:
//the last row




So as you can see, its only reading the last row and assigning its values to
the data above as well.

Here's what I'm using for the sql query:

while(list($key,$val)=each($rankid)) {
   $upd=mysql_query("UPDATE ranking SET category='$category', rank='$rank'
WHERE pid=$val");
}

If anyone has any suggestions for fixing this problem, please let me know :)
THanks


__
Jason Dulberg
Extreme MTB
http://extreme.nas.net


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




RE: [PHP] update query based on array

2002-12-09 Thread Jason Dulberg
So you mean do something like:





Doesn't that create 2 additional arrays though?

Basically my form is just row after row of the html code above... each row
has a different ID of course. The update query should only update fields
with checked checkboxes.

Thanks for your input!

Jason


> -Original Message-
> From: Jimmy Brake [mailto:[EMAIL PROTECTED]]
> Sent: December 9, 2002 6:29 PM
> To: Jason Dulberg
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] update query based on array
>
>
> not real sure of the setup of the form but if you have mutiple groups of
> items to be updated then you should make the rank an array -- rank[pid#]
>
> you should make all the items -- that are related part of the same group
> -- by using []
>
> On Mon, 2002-12-09 at 15:06, Jason Dulberg wrote:
> > I am displaying a list of data (from an sql query) and some of
> the fields in
> > that list are editable through a form. If the user chooses to
> edit one or
> > more of the rows of data, they must click on a checkbox to add
> that row to
> > an "update array". The problem is that when I read that array
> to pass to an
> > UPDATE sql statement, it only passes the last entry of the array.
> >
> > Here's an example of the data being passed:
> > 13 - 4 - UPDATE ranking SET category='Prep School', rank='30'
> WHERE pid=4
> > 14 - 169 - UPDATE ranking SET category='Prep School', rank='30' WHERE
> > pid=169
> > 15 - 166 - UPDATE ranking SET category='Prep School', rank='30' WHERE
> > pid=166
> >
> > The above is created based on the following html code:
> > //the last row
> > 
> > 
> > 
> >
> > So as you can see, its only reading the last row and assigning
> its values to
> > the data above as well.
> >
> > Here's what I'm using for the sql query:
> >
> > while(list($key,$val)=each($rankid)) {
> >$upd=mysql_query("UPDATE ranking SET category='$category',
> rank='$rank'
> > WHERE pid=$val");
> > }
> >
> > If anyone has any suggestions for fixing this problem, please
> let me know :)
> > THanks
> >
> >
> > __
> > Jason Dulberg
> > Extreme MTB
> > http://extreme.nas.net
> --
> Jimmy Brake <[EMAIL PROTECTED]>
>


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




RE: [PHP] update query based on array

2002-12-10 Thread Jason Dulberg
Thanks Mike, that fixed the problem that I had!

Jason

> -Original Message-
> From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED]]
> Sent: December 10, 2002 6:21 AM
> To: 'Jason Dulberg'
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP] update query based on array
> 
> 
> > -----Original Message-
> > From: Jason Dulberg [mailto:[EMAIL PROTECTED]]
> > Sent: 09 December 2002 23:52
> > 
> > So you mean do something like:
> > 
> > 
> > 
> > 
> > 
> > Doesn't that create 2 additional arrays though?
> 
> Yes -- but how else are you going to get multiple values for each 
> name from
> your form to your PHP script?  Without the array subscripts on 
> both category
> and rank, you will only ever get one category and one rank passed to your
> script.
> 
> Using the above, just do:
> 
> foreach ($_POST['rankid'] as $row, $rankid):
> // in here, $rankid is the value of the current rankid[]
> // $_POST['category'][$row] is associated category[] value
> // $_POST['rank'][$row] is associated rank[] value
> endforeach;
> 
> Cheers!
> 
> Mike
> 
> -
> Mike Ford,  Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
> Email: [EMAIL PROTECTED]
> Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 
> 

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




[PHP] array insert help

2003-03-22 Thread Jason Dulberg
I need to create a form where work/home address details need to be entered.
I'd like to have these listed as 2 entries in the mysql db so I'm assuming I
need to create an array and loop through the array to do the insert.

So I have an address[1] and address[2] for example for a total of 12
address fields in each set. (6 each)

My problem is that I'm not sure how to set up the array for the fields and
how to take the input fields and insert them. Do I need a multidimensional
array for this?

ie.



How would I decode that to create an insert statement??

Any suggestions are greatly appreciated!

Jason


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



RE: [PHP] array insert help

2003-03-22 Thread Jason Dulberg
Thanks for your help...

I tried the code as you suggested however when I attempted to echo the
variables for testing but nothing showed.

for($i = 0; $i <= 1; ++$i) {
   echo "address".$_POST['address']['address'][$i];
   echo "city".$_POST['address']['city'][$i];
}

The form fields are as you suggested as well.

Thanks again!

Jason

> -Original Message-
> From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]
> Sent: March 22, 2003 4:05 PM
> To: Jason Dulberg
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] array insert help
>
>
> At 20:59 22.03.2003, Jason Dulberg said:
> [snip]
> >My problem is that I'm not sure how to set up the array for the
> fields and
> >how to take the input fields and insert them. Do I need a
> multidimensional
> >array for this?
> >
> >ie.
> >
> >
> >
> >How would I decode that to create an insert statement??
> [snip]
>
> I believe your example would work. However since you have a
> definite number
> of adresses you could add the index directly, as here:
>
> Home Address:
> 
> 
>
> Work Address:
> 
> 
>
> When the form is received you will have an array for adress that
> looks like
> this:
>
> $_REQUEST['address'] = array(
> 'address' => array(0 => 'home address', 1 => 'work address'),
> 'city' => array(0 => 'home city', 1 => 'work city'));
>
> To insert the home address you'd create an SQL statement like this:
>
> for($i = 0; $i <= $number_of_addresses; ++$i) {
> $sql = "insert into address(adress, city) values (" .
> "{$_REQUEST['address']['address'][$i]}," .
> "{$_REQUEST['address']['city'][$i]})";
> // more code
> }
>
> Hope this helps,
>
> --
>>O Ernest E. Vogelsinger
>(\)ICQ #13394035
> ^ http://www.vogelsinger.at/
>
>


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



RE: [PHP] daily availability chart array

2003-05-27 Thread Jason Dulberg
Thank you for the response. I am not quite sure how that works, can you
please give an example?

Thanks.

Jason

> -Original Message-
> From: Marek Kilimajer [mailto:[EMAIL PROTECTED]
> Sent: May 27, 2003 8:13 AM
> To: Jason Dulberg
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] daily availability chart array
>
>
> Use weekdays' numbers instead of the short format, then you need only 2
> nested loops
>
> Jason Dulberg wrote:
>
> >I need to create a daily availability chart and currently am using
> >multidimensional arrays to assign which day/timeslot is chosen.
> My problem
> >is that in doing so, I have to create 7 "foreach" statements to
> go through
> >each of the days to pick out the timeslot values.
> >
> >ie.
> >avail[mon][1] (morning)
> >avail[tues][2] (afternoon)
> >avail[wed][4] (evening)
> >avail[thurs][8] (night)
> >etc.
> >(the above data is taken from a user input form, user can choose 1 or all
> >timeslots)
> >
> >I need to loop through these values for bitwise calculation and
> comparison
> >to a mysql db field. The user can have multiple choices in the
> same day so
> >the obtained bit values would have to be added accordingly.
> >
> >Is there any way to get around using 7 loops to create the bit value?
> >
> >Any suggestions are greatly appreciated!
> >
> >Jason
> >
> >
> >
> >
>


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



[PHP] .inc location security

2001-04-24 Thread Jason Dulberg

I have about 20 virtual hosts on my server and all of them have shtml and
some php files that look to a directory /includes/ which is aliased (in the
srm.conf file) over to a main includes directory under the root dir.

Alias /includes/ /usr/local/etc/httpd/htdocs/includes/

If I change this alias to a directory above the root dir, I can still view
all of my .inc files in a browser even if I rename them to .inc.php

These .inc files are just plain text that get included into all .shtml files
on the virtual hosts.

I tried to do the deny *.inc but doing so just made it so the browser can't
even include them. So that won't do the trick.

Is there any way that I can make these .inc files not readable by viewing
them directly in the browser and still be able to include them into
documents? Same goes for the php config stuff. If I put a config.php script
above the root, how can I get the php script to read it -- is it the same
'ol /usr/etc/httpd/ sort of thing like cgi?

My main concern is to get this stuff more secure while still allowing all of
the virtual hosts to use the files. The contents of the files isn't exactly
top secret, its just a matter of a piece of mind.

Any ideas to sort this out are greatly appreciated! Thanks.
______
Jason Dulberg
Extreme MTB
http://extreme.nas.net


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] IF in mysql query results problem

2002-01-06 Thread Jason Dulberg

I am working on a program that allows users to "bookmark" a particular item
that they view. The bookmarks are stored in the database.

I would like to use an IF statement in the mysql query so when the user logs
in and views the items, the option to bookmark the record has been removed
if they have already bookmarked it.

Here's an example query:

SELECT p.id AS player_id, p.name, p.hs, c.id AS coach_id, co.cid AS college,
IF(co.pid=31,1,0) AS is_bookmarked
FROM player p, coach c, co_bookmarks co
WHERE p.id=31 AND p.hs=c.id AND co.cid=2

When I use the above query in a search, it comes up with 3 results, 1 of
which is correct. If I GROUP BY p.id, there is only 1 result but its
incorrect. The search should only come up with 1 correct result in this
case.

+---+-++--+-+---+
| player_id | name | hs | coach_id | college | is_bookmarked |
+---+-++--+-+---+
| 31 | Paul Mantle | 24 | 24 | 2 | 0 |
| 31 | Paul Mantle | 24 | 24 | 2 | 1 |
| 31 | Paul Mantle | 24 | 24 | 2 | 0 |
+---+-++--+-+---+

+---+-++--+-+---+
| player_id | name | hs | coach_id | college | is_bookmarked |
+---+-++--+-+---+
| 31 | Paul Mantle | 24 | 24 | 2 | 0 |
+---+-++--+-+---+

The row with is_bookmarked = 1 is the only correct one. I am assuming that
for some reason, its displaying 3 results because there are 3 id's
associated with cid=2. But if I group them by the id, it takes the wrong
row:

If anyone has any suggestions as to what I'm doing wrong, please let me know
as I'm tapped out on ideas.

Thanks a TON!!

__
Jason Dulberg
Extreme MTB
http://extreme.nas.net


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] IF in mysql query results problem

2002-01-06 Thread Jason Dulberg

Thanks for your reply...

I thought about making that join however in this case, the coach data is
only needed for the player info.

Jason.
  -Original Message-
  From: Mehmet Kamil ERISEN [mailto:[EMAIL PROTECTED]]
  Sent: January 7, 2002 1:41 AM
  To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Subject: Re: [PHP] IF in mysql query results problem


  Hi Jason,

  I am not too familiar with IF statements in SQL, but one thing may be the
reason you see the incorrect results:

  You have three tables, player, coach and co_bookmarks, but you only join
player and coach.  Shouldn't you join coach with co_bookmarks.

  I hope this helps.

  erisen


  SELECT p.id AS player_id, p.name, p.hs, c.id AS coach_id, co.cid AS
college,
  IF(co.pid=31,1,0) AS is_bookmarked
  FROM player p, coach c, co_bookmarks co
  WHERE p.id=31 AND p.hs=c.id AND co.cid=2


Jason Dulberg <[EMAIL PROTECTED]> wrote:

I am working on a program that allows users to "bookmark" a particular
item
that they view. The bookmarks are stored in the database.

I would like to use an IF statement in the mysql query so when the user
logs
in and views the items, the option to bookmark the record has been
removed
if they have already bookmarked it.

Here's an example query:

SELECT p.id AS player_id, p.name, p.hs, c.id AS coach_id, co.cid AS
college,
IF(co.pid=31,1,0) AS is_bookmarked
FROM player p, coach c, co_bookmarks co
WHERE p.id=31 AND p.hs=c.id AND co.cid=2

When I use the above query in a search, it comes up with 3 results, 1 of
which is correct. If I GROUP BY p.id, there is only 1 result but its
incorrect. The search should only come up with 1 correct result in this
case.

+---+-++--+-+---+
| player_id | name | hs | coach_id | college | is_bookmarked |
+---+-++--+-+---+
| 31 | Paul Mantle | 24 | 24 | 2 | 0 |
| 31 | Paul Mantle | 24 | 24 | 2 | 1 |
| 31 | Paul Mantle | 24 | 24 | 2 | 0 |
+---+-++--+-+---+

+---+-++--+-+---+
| player_id | name | hs | coach_id | college | is_bookmarked |
+---+-++--+-+---+
| 31 | Paul Mantle | 24 | 24 | 2 | 0 |
+---+-++--+-+---+

The row with is_bookmarked = 1 is the only correct one. I am assuming
that
for some reason, its displaying 3 results because there are 3 id's
associated with cid=2. But if I group them by the id, it takes the wrong
row:

If anyone has any suggestions as to what I'm doing wrong, please let me
know
as I'm tapped out on ideas.

Thanks a TON!!

__
Jason Dulberg
Extreme MTB
http://extreme.nas.net


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



  Mehmet Erisen
  http://www.erisen.com





--
  Do You Yahoo!?
  Send FREE video emails in Yahoo! Mail.



[PHP] form submission error trapping

2002-02-17 Thread Jason Dulberg

I am working on some error trapping for several forms on my site. After
visiting a bunch of websites, I've noticed 2 common methods of displaying
error messages.

1. display an error box on a new page and force the user to hit the 
button

2. display the form again with appropriate error text and pre-filled fields.

I have part of the error on the new page working but I'm running into the
infamous no contents in the form after going .

There are some useability issues with forcing the user to hit the back
button -- some just don't want to bother.

Is there a way to display the form w/original contents and error messages
'without' having to code the entire form twice? I have about 5 forms with 50
fields or so each.

What would be the best way to go about redrawing the form with the errors
shown beside each field?

Any suggestions are greatly appreciated.

______
Jason Dulberg
Extreme MTB
http://extreme.nas.net


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




RE: [PHP] form submission error trapping

2002-02-17 Thread Jason Dulberg

Ya, it would be cool if you could how do you submit the form to itself?

Right now, I have something like 

if (!$submit) {
display form
}
else {
process
if (trim($email)=="") {
echo "error, hit back button to fix";
}
}

Thanks

Jason


> -Original Message-
> From: Steven Walker [mailto:[EMAIL PROTECTED]]
> Sent: February 17, 2002 6:18 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] form submission error trapping
> 
> 
> Jason,
> 
> I just finished one of my form pages, and I'm really happy with how it 
> turned out.
> 
> I created one php page that both displays the form and validates the 
> input. When the user hits the submit button, it submits the data to 
> itself. If anything is missing from the page, the form is reshown with 
> missing fields highlighted and the other fields filled in. If on the 
> other hand the info passes the validation test, the information is shown 
> to screen a new button (hidden form) allows the user to continue.
> 
> If you want, I can send you a link to my test site so you can check it 
> out.
> 
> Steven J. Walker
> Walker Effects
> www.walkereffects.com
> [EMAIL PROTECTED]
> 
> On Sunday, February 17, 2002, at 02:22  PM, Jason Dulberg wrote:
> 
> > I am working on some error trapping for several forms on my site. After
> > visiting a bunch of websites, I've noticed 2 common methods of 
> > displaying
> > error messages.
> >
> > 1. display an error box on a new page and force the user to hit the 
> > 
> > button
> >
> > 2. display the form again with appropriate error text and pre-filled 
> > fields.
> >
> > I have part of the error on the new page working but I'm running into 
> > the
> > infamous no contents in the form after going .
> >
> > There are some useability issues with forcing the user to hit the back
> > button -- some just don't want to bother.
> >
> > Is there a way to display the form w/original contents and error 
> > messages
> > 'without' having to code the entire form twice? I have about 5 forms 
> > with 50
> > fields or so each.
> >
> > What would be the best way to go about redrawing the form with the 
> > errors
> > shown beside each field?
> >
> > Any suggestions are greatly appreciated.
> >
> > __
> > Jason Dulberg
> > Extreme MTB
> > http://extreme.nas.net
> >
> >
> > --
> > 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] form submission error trapping

2002-02-17 Thread Jason Dulberg

RE: [PHP] form submission error trappingThanks for the code Is there a
way to keep track of what fields had the errors as its possible for people
to have like 5 errors?

Thanks again.

Jason
  -Original Message-
  From: Martin Towell [mailto:[EMAIL PROTECTED]]
  Sent: February 17, 2002 6:41 PM
  To: '[EMAIL PROTECTED]'; Steven Walker
  Cc: [EMAIL PROTECTED]
  Subject: RE: [PHP] form submission error trapping


  something like:

  
  

  
  

  

  not tested but should work - just expand on it

  Martin



  -Original Message-
  From: Jason Dulberg [mailto:[EMAIL PROTECTED]]
  Sent: Monday, February 18, 2002 10:22 AM
  To: Steven Walker
  Cc: [EMAIL PROTECTED]
  Subject: RE: [PHP] form submission error trapping



  Ya, it would be cool if you could how do you submit the form to
itself?

  Right now, I have something like

  if (!$submit) {
  display form
  }
  else {
  process
  if (trim($email)=="") {
  echo "error, hit back button to fix";
  }
  }

  Thanks

  Jason



  > -Original Message-
  > From: Steven Walker [mailto:[EMAIL PROTECTED]]
  > Sent: February 17, 2002 6:18 PM
  > To: [EMAIL PROTECTED]
  > Cc: [EMAIL PROTECTED]
  > Subject: Re: [PHP] form submission error trapping
  >
  >
  > Jason,
  >
  > I just finished one of my form pages, and I'm really happy with how it
  > turned out.
  >
  > I created one php page that both displays the form and validates the
  > input. When the user hits the submit button, it submits the data to
  > itself. If anything is missing from the page, the form is reshown with
  > missing fields highlighted and the other fields filled in. If on the
  > other hand the info passes the validation test, the information is shown
  > to screen a new button (hidden form) allows the user to continue.
  >
  > If you want, I can send you a link to my test site so you can check it
  > out.
  >
  > Steven J. Walker
  > Walker Effects
  > www.walkereffects.com
  > [EMAIL PROTECTED]
  >
  > On Sunday, February 17, 2002, at 02:22  PM, Jason Dulberg wrote:
  >
  > > I am working on some error trapping for several forms on my site.
After
  > > visiting a bunch of websites, I've noticed 2 common methods of
  > > displaying
  > > error messages.
  > >
  > > 1. display an error box on a new page and force the user to hit the
  > > 
  > > button
  > >
  > > 2. display the form again with appropriate error text and pre-filled
  > > fields.
  > >
  > > I have part of the error on the new page working but I'm running into
  > > the
  > > infamous no contents in the form after going .
  > >
  > > There are some useability issues with forcing the user to hit the back
  > > button -- some just don't want to bother.
  > >
  > > Is there a way to display the form w/original contents and error
  > > messages
  > > 'without' having to code the entire form twice? I have about 5 forms
  > > with 50
  > > fields or so each.
  > >
  > > What would be the best way to go about redrawing the form with the
  > > errors
  > > shown beside each field?
  > >
  > > Any suggestions are greatly appreciated.
  > >
  > > __
  > > Jason Dulberg
  > > Extreme MTB
  > > http://extreme.nas.net
  > >
  > >
  > > --
  > > 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] form submission error trapping

2002-02-20 Thread Jason Dulberg

Okay... I messed around with things a bit and moved the php stuff to the top
as you suggested. I have part of the validation working however if more than
1 error exists, it still only prints the 1st one.

Below are 2 example places where there would be an error... if I leave them
both blank, they should both give an error message.

$error=array();
if (strlen($username)< 3) {
$error['username']="Username must be more than 3 characters";
}
elseif (strlen($password)< 3) {
$error['password']="Password must be more than 3 characters";
}



".$error['username'];?>


".$error['password'];?>


Am I assigning errors to the array incorrectly?

Thanks for your help :)

Jason


> -Original Message-
> From: Jason G. [mailto:[EMAIL PROTECTED]]
> Sent: February 18, 2002 9:19 AM
> To: Matt; [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] form submission error trapping
>
>
> Why do not you all just put all your PHP logic, db access, etc at the TOP
> of the script.  Once you have your results and variables created, then
> start into html.
>
> This method produces MUCH cleaner scripts, and there is a very minimal
> amount of PHP interspersed within the HTML. Also, you have time to bail
> out, or redirect, etc...
>
> 
>   Connect to DB
>
>  Are we to process the form?
>  Yes:
>  Validate fields
>  Generate Error Messages
>  break;
>  No Error Messages?
>  Update the DB
>  Header("Location: bla.php?NEWID=$NEWID");
>  exit;
>
> ?>
> 
>
> Firstname: 
> 
> 
> Lastname: 
> 
> 
>
> 
>
>
>
>
> At 08:35 AM 2/18/2002 -0500, Matt wrote:
> >I think that mixing of html and php is too complex and leads to hard to
> >maintain scripts. I find it extremely difficult to understand a scripts
> >logic when it's spread out over hundreds of lines of php/html.
> >
> >I use EasyTemplates that came in Web Applications Development
> with PHP 4.0
> >by Tobias Ratschiller and Till Gerkin. It looks like the source is
> >copyrighted and you have to buy the book to get it.  But it says
> it's based
> >on FastTemplates.  The book itself is at
> >http://www.amazon.com/exec/obidos/ASIN/0735709971/
> >
> >You can see a sample of the method here
> >http://marc.theaimsgroup.com/?l=php-general&m=101371611609042&w=2
> >
> >Notice that the form action handler is the same as the original
> form. This
> >is a simple example, but it does "remember" user input as you want.
> >
> >I wrote a couple of helper functions that accept db names to build select
> >boxes and radio buttons.  They return strings of the html with
> the selected
> >value, and I just put them in a template container reserved for them (the
> >{TEMPLATE_ITEM} in the sample).
> >
> >For tables with unknown number of rows, I have one template of the main
> >page, one for the table container, and one for each row itself.
> I loop on
> >the row, using the row template and concatenate all of the rows
> of html into
> >a string.  I take that string and stick it into the table template, and
> >finally stick the table into the page template.  Very smooth,
> easy to read,
> >and no trouble with headers() since all output is done on the last
> >statement.  You have complete control over the script until then, and can
> >bail out to another page, or decide to use other templates and output
> >something else.
> >
> >As for errors, I build an array of the messages such as:
> >if (!empty($thatsThere)) {
> >$errors[] = "Don't put $thatsThere in  there";
> >}
> >if (empty($userName)) {
> >   $errors[] = "Username must be supplied";
> >}
> >
> >Then you can tell if all is okay, with if (is_array($errors)).
> If it is an
> >array, then something is wrong, so I  append the array contests into html
> >like this:
> >foreach($errors as $value) {
> >  $errorMsgs = $value . "\n";
> >}
> >and then put $errorMsgs into the page template container you've
> reserved for
> >it.
> >
> >- Original Message -
> >From: "Jason Dulberg" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >
> > > I am working on some error trapping for several forms on my
> site. After
> > > visiting a bunch of websites, I'

[PHP] save html created by loop in variable

2002-04-17 Thread Jason Dulberg

I have a WHILE loop that I am interested in storing the html that is
generated based on its results to a variable. This variable would then be
echoed later on.

Basically the html that is generated from the while loop is a bunch of table
cell definitions and some data from the database - this data is manipulated
with some IF statements in the loop.

So I'd want to store something like this:

while ($row=mysql_fetch_array($result)) {
?>

if ($variable==1) {
//store on

//store off
}
if ($variable==2) {
//store on

//store off
and so on.
}

$variable"; for each time
something needs to be displayed but it didn't display anything.

Any ideas how I could create such a thing? thanks in advance! :)



______
Jason Dulberg


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




RE: [PHP] save html created by loop in variable

2002-04-17 Thread Jason Dulberg

Thanks for your reply... I just tried it with ob_start(); and I think I'm
almost on the right track. Just one small issue. Since the records are in a
while loop, the results are printed line by line as expected. However, I
need to print something obtained from the sql query just once then the rest
to loop.

//a.agentname displays only once and h.title/h.address will be in a list
SELECT h.title, h.address, a.agentname FROM homes h, agents a WHERE
h.owner=a.id AND a.id=$aid

Basically what I'm after is displaying something like:

Agent: Fred
nice house, 123 street
ugly house, 643 road

Thanks again for your help on this.

Jason

> -Original Message-
> From: Miguel Cruz [mailto:[EMAIL PROTECTED]]
> Sent: April 17, 2002 8:28 PM
> To: Jason Dulberg
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] save html created by loop in variable
> 
> 
> On Wed, 17 Apr 2002, Jason Dulberg wrote:
> > I have a WHILE loop that I am interested in storing the html that is
> > generated based on its results to a variable. This variable 
> would then be
> > echoed later on.
> 
> Check in the manual under Output Buffering.
> 
> miguel
> 
> 

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




[PHP] 1 session, 2 subdomains

2002-06-03 Thread Jason Dulberg

I am working on a sports website that will have a subdomain for each major
sport. There is a login panel on the main domain that routes users to the
appropriate subdomain depending on the sport that they are in. Everything
seems to be ok with cookies (cookiedomain=.domain.tld) but I can't get it to
work with sessions -- even if I pass the session id in the URL.

In the login script, I define the session then route to the appropriate
subdomain. This where the problem lies - after redirection, the session is
lost. It appears that the session is defined for the domain name that the
user signs in on - if I allow users to login on their given sport subdomain,
the session works ok, but this doesn't work the way I'd like.

Any ideas on what I'm doing wrong?

(I can post my login/session code if need be)

Thanks for any suggestions!!

______
Jason Dulberg
Extreme MTB
http://extreme.nas.net


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




RE: [PHP] 1 session, 2 subdomains

2002-06-03 Thread Jason Dulberg

The subdomain's are all on the same server and all have their docroot set to
the same directory. I'm mainly using subdomains as a way to keep the site
organized and to have different graphics based on their sport location.

So if I pass to the next subdomain, do I just use session_start() if the
person is logged in with sessions??

Thanks for your help!

Jason



> I'm guessing that your "redirection to the appropriate subdomain"
> actually refers to a different instance of the webserver
> potentially on a different machine? If so, then that's why "the
> session is lost". Sessions are maintained on a per server basis
> (am I correct here?)
>
> Even so, you can redirect to a specific page in the appropriate
> sport tld and reconstruct/restart the session (I guess to that
> point you should only have a memberid after the authentication).
>
> cheers,
> thalis
>
>
> On Mon, 3 Jun 2002, Jason Dulberg wrote:
>
> > I am working on a sports website that will have a subdomain for
> each major
> > sport. There is a login panel on the main domain that routes
> users to the
> > appropriate subdomain depending on the sport that they are in.
> Everything
> > seems to be ok with cookies (cookiedomain=.domain.tld) but I
> can't get it to
> > work with sessions -- even if I pass the session id in the URL.
> >
> > In the login script, I define the session then route to the appropriate
> > subdomain. This where the problem lies - after redirection, the
> session is
> > lost. It appears that the session is defined for the domain
> name that the
> > user signs in on - if I allow users to login on their given
> sport subdomain,
> > the session works ok, but this doesn't work the way I'd like.
> >
> > Any ideas on what I'm doing wrong?
> >
> > (I can post my login/session code if need be)
> >
> > Thanks for any suggestions!!
> >
> > __
> > Jason Dulberg
> > Extreme MTB
> > http://extreme.nas.net
> >
> >
> > --
> > 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] 1 session, 2 subdomains

2002-06-03 Thread Jason Dulberg

I am currently storing the session hash/login info (userid, session hash,
host, etc.) in the db and send it to the next domain in the redireted URL.

How would the handler work if no session info isn't being passed to the
subdomain?

Thanks!

Jason


> From: Cal Evans [mailto:[EMAIL PROTECTED]]
>
> Store your session information in a database. Assign it an ID and
> send that
> ID to the cookie or the URL in the new domain.  Then you can
> write a session
> handler that retrieves the session info form the database.
>
> =C=
>
> *
> * Cal Evans
> * Journeyman Programmer
> * Techno-Mage
> * http://www.calevans.com
> *
>
>
> -Original Message-
> From: Jason Dulberg [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 03, 2002 2:13 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] 1 session, 2 subdomains
>
>
> I am working on a sports website that will have a subdomain for each major
> sport. There is a login panel on the main domain that routes users to the
> appropriate subdomain depending on the sport that they are in. Everything
> seems to be ok with cookies (cookiedomain=.domain.tld) but I
> can't get it to
> work with sessions -- even if I pass the session id in the URL.
>
> In the login script, I define the session then route to the appropriate
> subdomain. This where the problem lies - after redirection, the session is
> lost. It appears that the session is defined for the domain name that the
> user signs in on - if I allow users to login on their given sport
> subdomain,
> the session works ok, but this doesn't work the way I'd like.
>
> Any ideas on what I'm doing wrong?
>
> (I can post my login/session code if need be)
>
> Thanks for any suggestions!!
>
> __
> Jason Dulberg
> Extreme MTB
> http://extreme.nas.net
>
>
> --
> 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] 1 session, 2 subdomains

2002-06-03 Thread Jason Dulberg

There should be session info to pass though, its just not getting through to
the subdomain from the main one.

The login script (on the main domain) for sessions looks like this:
session_register("type","user","pass","userid","user_is_logged_in","sessid")
;

then it redirects to the subdomain based on $type
$redirecturl=$config[listings_dir].$config[client_dir].$type."/index.php?s="
.$sessid;

If I don't redirect outside of the main domain, it works fine, it just
breaks once it hits the new one.

How would I find info about creating a session handler for this application?

Jason


> Actually, if you are doing this then just re-login the person
> once they get
> to the new domain. Then you have the login and the session.
>
> PHP has the capability to allow you to replace the session
> handler.  If you
> have to have them login in one domain and then use the info in another,
> building your own session handler is one way to do it. But if you have no
> session info to pass, why is it a problem?
>
> =C=
>
> *
> * Cal Evans
> * Journeyman Programmer
> * Techno-Mage
> * http://www.calevans.com
> *
>
>
> -Original Message-
> From: Jason Dulberg [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 03, 2002 3:08 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP] 1 session, 2 subdomains
>
>
> I am currently storing the session hash/login info (userid, session hash,
> host, etc.) in the db and send it to the next domain in the redireted URL.
>
> How would the handler work if no session info isn't being passed to the
> subdomain?
>
> Thanks!
>
> Jason
>
>
> > From: Cal Evans [mailto:[EMAIL PROTECTED]]
> >
> > Store your session information in a database. Assign it an ID and
> > send that
> > ID to the cookie or the URL in the new domain.  Then you can
> > write a session
> > handler that retrieves the session info form the database.
> >
> > =C=
> >
> > *
> > * Cal Evans
> > * Journeyman Programmer
> > * Techno-Mage
> > * http://www.calevans.com
> > *
> >
> >
> > -Original Message-
> > From: Jason Dulberg [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, June 03, 2002 2:13 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] 1 session, 2 subdomains
> >
> >
> > I am working on a sports website that will have a subdomain for
> each major
> > sport. There is a login panel on the main domain that routes
> users to the
> > appropriate subdomain depending on the sport that they are in.
> Everything
> > seems to be ok with cookies (cookiedomain=.domain.tld) but I
> > can't get it to
> > work with sessions -- even if I pass the session id in the URL.
> >
> > In the login script, I define the session then route to the appropriate
> > subdomain. This where the problem lies - after redirection, the
> session is
> > lost. It appears that the session is defined for the domain
> name that the
> > user signs in on - if I allow users to login on their given sport
> > subdomain,
> > the session works ok, but this doesn't work the way I'd like.
> >
> > Any ideas on what I'm doing wrong?
> >
> > (I can post my login/session code if need be)
> >
> > Thanks for any suggestions!!
> >
> > __
> > Jason Dulberg
> > Extreme MTB
> > http://extreme.nas.net
> >
> >
> > --
> > 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] get data from query before while loop

2002-03-10 Thread Jason Dulberg

I have a mysql query that I need to echo a variable from "once" before I go
into the while loop which would list the entire contents of the array. The
field shown once will not be displayed in the while looped contents. So
theoretically, something like this:

$result = mysql_query("SELECT h.title, a.agentname, a.agenturl,
IF(h.status='Sold',1,0) AS is_sold FROM homes h, agents a WHERE h.owner=a.id
AND a.id=$aid ORDER BY is_sold ASC");

if ($is_sold=="1") {
echo $agentname." ".$agenturl;
}

while ($row=mysql_fetch_array($result)) {
extract($row);
echo $title."";
}

Currently, I have everything in the while loop which prints things out more
than what I'd like. Is there a way that I can get around this problem?

Any suggestions are greatly appreciated thanks. :)

__
Jason Dulberg
Extreme MTB
http://extreme.nas.net


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




[PHP] populating dropdown list problems

2001-04-09 Thread Jason Dulberg

I would like to populate a dropdown list from a particular field of a bunch
of records.
Here's what I have so far on the modify page but it doesn't list stuff from
the database, all it prints is the number 1 which isn't in any of the
records.

One version of this will be on an add page and another will be on a modify
page which has the current field selected. For the add script, I'd just lose
all the selected stuff that's on there now.

print "";
$result = mysql_query("SELECT owner,agent FROM homes;");
while($a_row = mysql_fetch_array($result))
{
printf(''.$a_row[owner].'', $a_row[owner],
($owner == $a_row[owner]) ? "selected" : "", $a_row[owner]);
}
print "";

What am I doing wrong in this code? Even when I take out the selected stuff,
I still get a value of 1 in the list instead of the actual contents of the
field.

Any help is greatly appreciated!
__
Jason Dulberg
Extreme MTB
http://extreme.nas.net


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] evaluate data taken from db

2001-08-09 Thread Jason Dulberg

I have a dynamic menu on my site where data is taken from a mysql db.

$cat="select * FROM categories c WHERE c.type='Earmold'";
$cats=mysql_query($cat);
while ($row = mysql_fetch_array($cats)) {
extract($row);
echo "$name ";
}

What I would like to do is turn off the link if the link is active in the
browser. So if the url loaded in the browser is
http://www.xyz.com/product.php?cid=1&page=1 for example, the link to that
particular item is disabled in the menu.

Is something like this possible? Any help is appreciated!

Thanks.

__
Jason Dulberg
Extreme MTB
http://extreme.nas.net


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] bold current menu item

2001-08-15 Thread Jason Dulberg

I am dynamically creating a menu based on a "title" field from a database.

ie
item1
item2 etc.

Is it possible that when I'm on the "item1" page to bold the title in the
menu?

Any suggestions are appreciated.

______
Jason Dulberg
Extreme MTB
http://extreme.nas.net


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] bold current menu item

2001-08-16 Thread Jason Dulberg

The menu that's taken from the database is basically a list of links like
this

$s="select * FROM molds m, prodlookup p WHERE p.cid=$cid and p.pid=m.id
ORDER BY p.pid";
$menu=mysql_query($s);
while ($stuff = mysql_fetch_array($menu)) {
extract($stuff);
echo "".$title."";
}

So basically there could be an unlimited # of links depending on how many
products there are. I'm guessing that before I echo the link, I need to
evaluate whether $id is in the current URL. How would I go about doing that?

Thanks for your time.

__
Jason Dulberg
Extreme MTB
http://extreme.nas.net


> On Thu, 16 Aug 2001 03:50, Jason Dulberg wrote:
> > I am dynamically creating a menu based on a "title" field from a
> > database.
> >
> > ie
> > item1
> > item2 etc.
> >
> > Is it possible that when I'm on the "item1" page to bold the title in
> > the menu?
> >
> > Any suggestions are appreciated.
> >
>
> Presumably there is a corresponding filed for filename, or URL, or
> somesusch? If so, just check whether the current script name matches, and
> if so add the  tags where needed.
>
> --
> David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
> CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA
>
>If at first you don't succeed, work for Microsoft.
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] problem with $HTTP_POST_FILES

2001-08-21 Thread Jason Dulberg

I am working on an image upload script and I've tried to use the variables
from $HTTP_POST_FILES however it seems that no matter how I try to get the
variables, they are always empty -- even though they are populated when
checking phpinfo();

HTTP_POST_FILES["binFile"]
Array
( 
[name] => arrow-block.gif 
[type] => image/gif 
[tmp_name] => /var/tmp/phph60272 
[size] => 857 
) 

I got some info on it from php.net and attempt to echo as they have on their site 
however it displays nothing. 

echo $HTTP_POST_FILES['binFile']['name'].""; 

I am attempting to get size/extension of the file to determine if its a valid 
extension and within the valid filesize range. 

Is this a server issue or just my php newbie-ness? If anyone has any ideas on how I 
can get this working, please let me know.

Thanks.

__
Jason Dulberg
Extreme MTB
http://extreme.nas.net


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] RE: problem with $HTTP_POST_FILES

2001-08-22 Thread Jason Dulberg

Now I just feel like an idiot... that was the answer! I had all the other
globals registered but that one.

Thanks for your time!

Jason.



> If they're empty but phpinfo displays them you're probably inside
> a function and haven't declared HTTP_POST_FILES as global.
>
> Jason Dulberg wrote:
>
> > I am working on an image upload script and I've tried to use
> the variables
> > from $HTTP_POST_FILES however it seems that no matter how I try
> to get the
> > variables, they are always empty -- even though they are populated when
> > checking phpinfo();
> >
> > HTTP_POST_FILES["binFile"]
> > Array
> > (
> > [name] => arrow-block.gif
> > [type] => image/gif
> > [tmp_name] => /var/tmp/phph60272
> > [size] => 857
> > )
> >
> > I got some info on it from php.net and attempt to echo as they
> have on their site however it displays nothing.
> >
> > echo $HTTP_POST_FILES['binFile']['name']."";
> >
> > I am attempting to get size/extension of the file to determine
> if its a valid extension and within the valid filesize range.
> >
> > Is this a server issue or just my php newbie-ness? If anyone
> has any ideas on how I can get this working, please let me know.
> >
> > Thanks.
> >
> > __
> > Jason Dulberg
> > Extreme MTB
> > http://extreme.nas.net
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] dumping a session

2001-09-12 Thread Jason Dulberg

If an admin deletes a user's session while they are online, is it possible
to show that user a message saying that their session has been revoked? I
can seem to think of a way to determine if the user logged out or if the
agent kicked them out.

Thanks in advance and please excuse my "newbieness".

______
Jason Dulberg
Extreme MTB
http://extreme.nas.net


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] select based on time/date

2001-09-24 Thread Jason Dulberg

I am using sessions on my site and have noticed that people often don't
click the "logout" button -- something which I need them to do in order to
clear their session from the db and update some site stats. In the sessions
table, I have a field $timein (in format F j, Y, g:i a) that gets added when
the user logs in and a $timeout field that gets added when they hit
"logout".

Basically, what I've been thinking of doing is using cron to run a php
script every hour or so that will search the table for sessions with no
$timeout field and $timein is more than X number of minutes old.

My problem is that since I'm using the F j, Y, g:i a date/time format, how
would I make the mysql select? Do I have to explode the $timein field?

Any suggestions are appreciated.
__
Jason Dulberg
Extreme MTB
http://extreme.nas.net


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] select based on time/date

2001-09-25 Thread Jason Dulberg

I had a look at the DATE_FORMAT info on the mysql doc page and its a bit
easier to understand than the CONCATS.

Would I want to use the CURTIME() function since I would want to select
sessions based on the hour? How would I go about combining CURTIME with the
rest of my query?

Theoretically, here is what I understand, please let me know whether or not
I am correct:

select * from sessions where (CURTIME() - EXTRACT(MINUTE FROM $timein) >=
60);
//where 60 is the lifespan of the session

Thanks for your suggestions and time!

__
Jason Dulberg
Extreme MTB
http://extreme.nas.net



> And, as someone recently pointed out in response to a similar suggestion
> I made, there is a mysql DATE_FORMAT function that will do the same thing
> without the CONCATS.

> >
> > -Original Message-
> > From: Jason Dulberg [mailto:[EMAIL PROTECTED]]
> > Sent: martedì 25 settembre 2001 5.47
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] select based on time/date
> >
> >
> > I am using sessions on my site and have noticed that people often don't
> > click the "logout" button -- something which I need them to do in order
> > to clear their session from the db and update some site stats. In the
> > sessions table, I have a field $timein (in format F j, Y, g:i a) that
> > gets added when the user logs in and a $timeout field that gets added
> > when they hit "logout".
> >
> > Basically, what I've been thinking of doing is using cron to run a php
> > script every hour or so that will search the table for sessions with no
> > $timeout field and $timein is more than X number of minutes old.
> >
> > My problem is that since I'm using the F j, Y, g:i a date/time format,
> > how would I make the mysql select? Do I have to explode the $timein
> > field?
> >
> > Any suggestions are appreciated.
> > __
> > Jason Dulberg
> > Extreme MTB
> > http://extreme.nas.net
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] select based on time/date

2001-09-25 Thread Jason Dulberg

I tried basically what you have but I got an error:

$sql="select * from logged_in where time_in + interval 1 hour <= now()";
$result = mysql_query($sql);

If it will help, here's the table structure -- looks like my structure is
bit different from what I orignally posted:

CREATE TABLE logged_in (
   id tinyint(4) DEFAULT '0' NOT NULL auto_increment,
   session varchar(100) DEFAULT '0' NOT NULL,
   time_in varchar(50) NOT NULL,
   KEY id (id)
);

Thanks again.

__
Jason Dulberg
Extreme MTB
http://extreme.nas.net


> The problem with this is curtime returns a number in HHMMSS
> format and your
> extract
> returns MM so you get HHMMSS - MM which is always going to be greater than
> 60
> unless you are running your script in the first minute of the day (ie
> 37 - 49).
>
> Try this instead:
>
> select * from sessions where $timein + interval 1 hour <= now();

- Original Message -
From: "Jason Dulberg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, September 25, 2001 2:35 PM
Subject: RE: [PHP] select based on time/date

> > I had a look at the DATE_FORMAT info on the mysql doc page and its a bit
> > easier to understand than the CONCATS.
> >
> > Would I want to use the CURTIME() function since I would want to select
> > sessions based on the hour? How would I go about combining CURTIME with
> the
> > rest of my query?
> >
> > Theoretically, here is what I understand, please let me know whether or
> not
> > I am correct:
> >
> > select * from sessions where (CURTIME() - EXTRACT(MINUTE FROM
> $timein) >=
> > 60);
> > //where 60 is the lifespan of the session


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] select based on time/date

2001-09-25 Thread Jason Dulberg

I plugged your query in and it didn't result in an error - however, it came
up with no results even though there should be.

This one should have come up but didn't:
INSERT INTO logged_in VALUES ( '5', 'b406e68a7cde49534a14f5fd8848006e',
'September 24, 2001, 3:27 pm', '');
-- the fields correspond to the table structure quoted below

Thanks again!
__
Jason Dulberg
Extreme MTB
http://extreme.nas.net


> -Original Message-
> From: Jack Dempsey [mailto:[EMAIL PROTECTED]]
> Sent: September 25, 2001 7:07 PM
> To: 'Jason Dulberg'; 'Sheridan Saint-Michel'; [EMAIL PROTECTED]
> Subject: RE: [PHP] select based on time/date
>
>
> select * from logged_in where date_add(time_in,interval 1 hour) <= now()
>
> -jack
>
> -Original Message-
> From: Jason Dulberg [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 25, 2001 6:08 PM
> To: Sheridan Saint-Michel; [EMAIL PROTECTED]
> Subject: RE: [PHP] select based on time/date
>
> I tried basically what you have but I got an error:
>
> $sql="select * from logged_in where time_in + interval 1 hour <= now()";
> $result = mysql_query($sql);
>
> If it will help, here's the table structure -- looks like my structure
> is
> bit different from what I orignally posted:
>
> CREATE TABLE logged_in (
>id tinyint(4) DEFAULT '0' NOT NULL auto_increment,
>session varchar(100) DEFAULT '0' NOT NULL,
>time_in varchar(50) NOT NULL,
>KEY id (id)
> );


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] select based on time/date

2001-09-26 Thread Jason Dulberg

You were right! I changed it to a timestamp (14) and the selection is
working great now.

Only problem is that when I logout which UPDATE's the table to clear the
$session field, the $time_in timestamp gets updated because of the NOW()
function. I need that date to stay the same when someone logs out.

current logout.php:
$out = "UPDATE logged_in SET session='' WHERE (logged_in.userid='$aid') AND
(logged_in.session='$sessid')";

Is there a way to only allow the NOW() to work when a row is added to the
table? Or perhaps another way

Thank you again for your time. I've learned alot from this.

__
Jason Dulberg
Extreme MTB
http://extreme.nas.net

> -Original Message-
> From: Sheridan Saint-Michel [mailto:[EMAIL PROTECTED]]
> Sent: September 26, 2001 9:38 AM
> To: Jason Dulberg; [EMAIL PROTECTED]
> Subject: Re: [PHP] select based on time/date
>
>
> The reason my query didn't work is you have time_in as a varchar.
> Change it to a datetime field or timestamp field and it should work.
>
> I would suggest making it a timestamp field.  That way whenever
> you update the row (probably update the session field with a new
> session) MySQL will automatically set time_in to Now().  This will
> avoid a lot of headache for you  =)
>
> Sheridan Saint-Michel
> Website Administrator
> FoxJet, an ITW Company
> www.foxjet.com
>
>
> - Original Message -
> From: "Jason Dulberg" <[EMAIL PROTECTED]>
> To: "Sheridan Saint-Michel" <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> Sent: Tuesday, September 25, 2001 5:08 PM
> Subject: RE: [PHP] select based on time/date
>
>
> > I tried basically what you have but I got an error:
> >
> > $sql="select * from logged_in where time_in + interval 1 hour <= now()";
> > $result = mysql_query($sql);
> >
> > If it will help, here's the table structure -- looks like my
> structure is
> > bit different from what I orignally posted:
> >
> > CREATE TABLE logged_in (
> >id tinyint(4) DEFAULT '0' NOT NULL auto_increment,
> >session varchar(100) DEFAULT '0' NOT NULL,
> >time_in varchar(50) NOT NULL,
> >KEY id (id)
> > );
> >
> > Thanks again.
> >
> > __
> > Jason Dulberg
> > Extreme MTB
> > http://extreme.nas.net


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] select based on time/date

2001-09-26 Thread Jason Dulberg

Awesome... Its all working perfectly now! Makes perfect sense why the update
is like that.

thanks again!

__
Jason Dulberg
Extreme MTB
http://extreme.nas.net



> -Original Message-
> From: Sheridan Saint-Michel [mailto:[EMAIL PROTECTED]]
> Sent: September 26, 2001 1:59 PM
> To: Jason Dulberg; [EMAIL PROTECTED]
> Subject: Re: [PHP] select based on time/date
>
>
> Timestamp only sets itself to Now() if it isn't explicitly set (or set to
> NULL).  So try this:
>
> $out = "UPDATE logged_in SET session='',time_in=time_in WHERE
> (logged_in.userid='$aid') AND (logged_in.session='$sessid')";
>
> Sheridan Saint-Michel
> Website Administrator
> FoxJet, an ITW Company
> www.foxjet.com
>
>
> - Original Message -
> From: "Jason Dulberg" <[EMAIL PROTECTED]>
> To: "Sheridan Saint-Michel" <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> Sent: Wednesday, September 26, 2001 12:44 PM
> Subject: RE: [PHP] select based on time/date
>
>
> > You were right! I changed it to a timestamp (14) and the selection is
> > working great now.
> >
> > Only problem is that when I logout which UPDATE's the table to clear the
> > $session field, the $time_in timestamp gets updated because of the NOW()
> > function. I need that date to stay the same when someone logs out.
> >
> > current logout.php:
> > $out = "UPDATE logged_in SET session='' WHERE (logged_in.userid='$aid')
> AND
> > (logged_in.session='$sessid')";
> >
> > Is there a way to only allow the NOW() to work when a row is
> added to the
> > table? Or perhaps another way
> >
> > Thank you again for your time. I've learned alot from this.
> >
> > __
> > Jason Dulberg
> > Extreme MTB
> > http://extreme.nas.net


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] mysql query for current id-1

2001-10-01 Thread Jason Dulberg

This is kindof a weird question so bear with me as I try to explain.

I have a session table that gets updated when a user logs in/out. If they
don't logout, some info is left unchanged. I have a cron script that takes
care of the stray sessions so that's all good. In the sessions table,
there's a field "self_logout" which is Y when they logout properly and N if
the cron script removes their session.

What I'd like to do is when the user logs in next time, a search will be
made to look at that users last login session info. If they didn't log out
properly, a notice will appear.

So theoretically, I need to search for something like:

"users current id -1" or their last time of visit.

Here is the sql query that I have so far. But I think that I need to remove
the "self_logout='N'" because that doesn't show the actual last result;
rather it shows the last result where they didn't properly logout.

$sql="select id,agent,host, DATE_FORMAT(time_in, '%M %d, %Y, %l:%i') AS
unixdate from logged_in WHERE (self_logout='N') AND (userid='$current_user')
ORDER BY id DESC LIMIT 1,1";

Here is my trimmed down table structure:

CREATE TABLE logged_in (
id tinyint(4) DEFAULT '0' NOT NULL auto_increment,
session varchar(100) DEFAULT '0' NOT NULL,
time_in timestamp(14),
time_out varchar(50) DEFAULT '-' NOT NULL,
self_logout char(1) DEFAULT 'N' NOT NULL,
KEY id (id)
);

Did that make any sense? To sum it all up, I just want to remind people to
click "logout" if they forgot the last time.

Thanks for any suggestions!!

__
Jason Dulberg
Extreme MTB
http://extreme.nas.net


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] mysql query for current id-1

2001-10-01 Thread Jason Dulberg

Thank you for your lightning fast response!!

I tried your query but it appears to be coming up with the current id rather
than the users last login.

__
Jason Dulberg
Extreme MTB
http://extreme.nas.net



> -Original Message-
> From: Maxim Maletsky (PHPBeginner.com)
> [mailto:[EMAIL PROTECTED]]
> Sent: October 2, 2001 12:14 AM
> To: 'Jason Dulberg'; [EMAIL PROTECTED]
> Subject: RE: [PHP] mysql query for current id-1
>
>
>
>
> What about this:
>
> $sql="select id,agent,host, DATE_FORMAT(time_in, '%M %d, %Y, %l:%i') AS
> unixdate from logged_in WHERE userid='$current_user' ORDER BY id DESC
> LIMIT 1";
>
>
> I think this should work for your case.
>
> Maxim Maletsky
> www.PHPBeginner.com
>
>
>
> -Original Message-
> From: Jason Dulberg [mailto:[EMAIL PROTECTED]]
> Sent: martedì 2 ottobre 2001 6.04
> To: [EMAIL PROTECTED]
> Subject: [PHP] mysql query for current id-1
>
>
> This is kindof a weird question so bear with me as I try to explain.
>
> I have a session table that gets updated when a user logs in/out. If
> they don't logout, some info is left unchanged. I have a cron script
> that takes care of the stray sessions so that's all good. In the
> sessions table, there's a field "self_logout" which is Y when they
> logout properly and N if the cron script removes their session.
>
> What I'd like to do is when the user logs in next time, a search will be
> made to look at that users last login session info. If they didn't log
> out properly, a notice will appear.
>
> So theoretically, I need to search for something like:
>
> "users current id -1" or their last time of visit.
>
> Here is the sql query that I have so far. But I think that I need to
> remove the "self_logout='N'" because that doesn't show the actual last
> result; rather it shows the last result where they didn't properly
> logout.
>
> $sql="select id,agent,host, DATE_FORMAT(time_in, '%M %d, %Y, %l:%i') AS
> unixdate from logged_in WHERE (self_logout='N') AND
> (userid='$current_user') ORDER BY id DESC LIMIT 1,1";
>
> Here is my trimmed down table structure:
>
> CREATE TABLE logged_in (
> id tinyint(4) DEFAULT '0' NOT NULL auto_increment,
> session varchar(100) DEFAULT '0' NOT NULL,
> time_in timestamp(14),
> time_out varchar(50) DEFAULT '-' NOT NULL,
> self_logout char(1) DEFAULT 'N' NOT NULL,
> KEY id (id)
> );
>
> Did that make any sense? To sum it all up, I just want to remind people
> to click "logout" if they forgot the last time.
>
> Thanks for any suggestions!!
>
> __
> Jason Dulberg
> Extreme MTB
> http://extreme.nas.net
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED] To
> contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] mysql query for current id-1

2001-10-01 Thread Jason Dulberg

Awesome... Works perfectly!!

Thanks for your help!

__
Jason Dulberg
Extreme MTB
http://extreme.nas.net

> -Original Message-
> From: Maxim Maletsky (PHPBeginner.com)
> [mailto:[EMAIL PROTECTED]]
> Sent: October 2, 2001 1:03 AM
> To: 'Jason Dulberg'; [EMAIL PROTECTED]
> Subject: RE: [PHP] mysql query for current id-1
>
>
>
> ... DESC LIMIT 1,1
>
> As you wrote yourself.
>
> Sorry, haven't taken in consideration ;-)
>
>
> Maxim Maletsky
> www.PHPBeginner.com
>
>
>
> -Original Message-
> From: Jason Dulberg [mailto:[EMAIL PROTECTED]]
> Sent: martedì 2 ottobre 2001 6.59
> To: Maxim Maletsky (PHPBeginner.com); [EMAIL PROTECTED]
> Subject: RE: [PHP] mysql query for current id-1
>
>
> Thank you for your lightning fast response!!
>
> I tried your query but it appears to be coming up with the current id
> rather than the users last login.
>
> __
> Jason Dulberg
> Extreme MTB
> http://extreme.nas.net
>
>
>
> > -Original Message-
> > From: Maxim Maletsky (PHPBeginner.com)
> > [mailto:[EMAIL PROTECTED]]
> > Sent: October 2, 2001 12:14 AM
> > To: 'Jason Dulberg'; [EMAIL PROTECTED]
> > Subject: RE: [PHP] mysql query for current id-1
> >
> >
> >
> >
> > What about this:
> >
> > $sql="select id,agent,host, DATE_FORMAT(time_in, '%M %d, %Y, %l:%i')
> > AS unixdate from logged_in WHERE userid='$current_user' ORDER BY id
> > DESC LIMIT 1";
> >
> >
> > I think this should work for your case.
> >
> > Maxim Maletsky
> > www.PHPBeginner.com
> >
> >
> >


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] php in css not working with IF's

2001-10-03 Thread Jason Dulberg

I have a common css file that is being used across several virtual hosts.
Basically, what I am trying to do is use the same css file even though
several text colors/sizes need to be changed depending on what site/platform
its being used on.

I have my sql query (retrieves $site_style) in the file that includes the
css file and a bunch of IF statements inside the css file itself. The only
problem is that the css is not being generated properly.

For some reason, the IF statements are not being processed correctly/at all.
I can echo the variables through the index.php and the variables are set to
global. Its just that styles.php seems to almost bypass the IF and use the
1st set of variables even though it shouldn't be.

Here's an example from the css (styles.php) - there are about 5 IF
statements in there but here's the basic idea of them all:



.standard {
font-family:verdana, arial;
font-size: pt;
color:;
}

The call from site style 10


If I go to a $site_style 10, it still uses the variables defined within the
example IF statement even though it clearly shouldn't. If I type in the URL
to styles.php from a $site_style 10, it shows the wrong tags.

Is it a problem with my IF statements or is something else going over my
head?

Thanks again for any help - I've been trying to figure this out for days to
no avail...

______
Jason Dulberg
Extreme MTB
http://extreme.nas.net


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] php in css not working with IF's

2001-10-03 Thread Jason Dulberg

Thank you for your response. I changed my the code to the method that you
suggested. Unfortunately, it still doesn't use the IF's properly.

For instance, if I open a $site_style 10, the IF statement for that is the
following:

elseif (($BROWSER_PLATFORM == "Win") && ($site_style=="10")) {
$pc8=8;
$pc9=9;
$pc10=10;
$pc12=12;
$pc13=13;
$pc14=14;
$text="#D1BAC6";
$link="#F8CC92";
$heading="#B38B9F";
}

It still reads the first IF statement as I have in the original message
shown below.


Thanks again.

Jason.



> > if (($BROWSER_PLATFORM == "Win") && (($site_style!=="10") ||
>
> Any other problems aside, this is not how you do 'Not Equal'.
>
>   $site_style!="10"
>
> is correct syntax.
>
> > ($site_style!=="9"))) {
> > $pc8=8;
> > $pc9=9;
> > $pc10=10;
> > $pc12=12;
> > $pc13=13;
> > $pc14=14;
> > $text="#ff";
> > $heading="#2E4471";
> > }
> > ?>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] php in css not working with IF's

2001-10-03 Thread Jason Dulberg

Theoretically, either/or I'm assuming. If A isn't 10 or A isn't 9...

So I'm assumuming that my IF's are way off base?

This is definitely something that'll be helpful for my other work as well.

Thanks

__
Jason Dulberg
Extreme MTB
http://extreme.nas.net

> -Original Message-
> From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
> Sent: October 4, 2001 12:41 AM
> To: Jason Dulberg
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] php in css not working with IF's
> 
> 
> > if (($BROWSER_PLATFORM == "Win") && (($site_style!=="10") ||
> > ($site_style!=="9"))) {
> 
> Common logic mistake.
> 
>   if ( A != 10 or A != 9 )
> 
> Which value of A would make that logic false?
> 
> -Rasmus
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] php in css not working with IF's

2001-10-03 Thread Jason Dulberg

Thanks for sticking with me here and for your examples!!

So basically, I need to use AND instead of OR.

if (($site_style!=="10") && ($site_style!=="9") && ($site_style!=="8")) {
}

elseif ($site_style=="10") {
}

hrm... it didn't work.

Sorry for being such a dope about this :(

Jason



> Ok, you are clearly not following along here...  ;)
> 
> You have (let $site_style = A for brevity):
> 
> if( A!=10 OR A!=9 OR A!=8 )
> 
> When A=10 this becomes:
> 
> if( 10!=10 OR 10!=9 OR 10!=8 )
>  falsetrue true
> 
> if( false OR true OR true ) is the same as if (true)
> 
> Seriously, try drawing the Venn diagram for your expression.
> 
> Or try substituting common english.
> 
> if Jason is not 21 or Jason is not 20 or Jason is no 19 let him into the
> cool club.
> 
> Say Jason is 21, is he allowed in?  Sure he is, because one of the
> conditions for getting into the cool club is that Jason is not 20.  It
> doesn't matter that one of the other conditions says to not let Jason in.
> If the people writing the rules wanted to force all the conditions to
> apply they would have written:
> 
> if Jason is not 21 AND Jason is not 20 AND Jason is not 19, let him into
> the cool club.
> 
> -Rasmus
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] php in css not working with IF's

2001-10-03 Thread Jason Dulberg

Should I stick with

if (($site_style!="10") && ($site_style!="9") && ($site_style!="8"))

or

if($site_style != ('10' or '9' or '8'))

So here's what I've gathered from the various messages and my current
methods:

- index.php selects $site_style from the db
- header.php is included by index.php (header.php has the css src for
styles.php in it)
- styles.php has the IF's
- I need to put  to pass the variables
from the script to the css file
(if possible, I need to get around this as headers are being included with
the css src already in them)
- do not need to use require() in styles.php

Thanks to everyone for all the suggestions!! :)

Jason


> -Original Message-
> From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
> Sent: October 4, 2001 2:09 AM
> To: Maxim Maletsky (PHPBeginner.com)
> Cc: 'Jason Dulberg'; [EMAIL PROTECTED]
> Subject: RE: [PHP] php in css not working with IF's
>
>
> > Ok. Wll show you with an example:
> >
> > if (($site_style!=="10") && ($site_style!=="9") && ($site_style!=="8"))
> > { }
> >
> > elseif ($site_style=="10") {
> > }
> >
> >
> > Should simply be
> >
> >  if($site_style != ('10' or '9' or '8')) {}
>
> Stop confusing the lad.  That obviously won't work.
>
> -Rasmus
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] php in css not working with IF's

2001-10-04 Thread Jason Dulberg

$site_style ranges from 1 - 11

$site_style 1 - 7,11 use the same css style.
$site_style 8,9 use the same css 
$site_stylye 10 uses different css from them all.

Thanks for your time.

Jason

> -Original Message-
> From: David Robley [mailto:[EMAIL PROTECTED]]
> Sent: October 4, 2001 2:48 AM
> To: Jason Dulberg; Rasmus Lerdorf
> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: [PHP] php in css not working with IF's
> 
> 
> On Thu,  4 Oct 2001 16:04, Jason Dulberg wrote:
> > Should I stick with
> >
> > if (($site_style!="10") && ($site_style!="9") && ($site_style!="8"))
> >
> > or
> >
> > if($site_style != ('10' or '9' or '8'))
> 
> As has been pointed out, that latter won't work. What is the range of 
> possible values for $site_style? If it is 10 or less, then you could 
> simply rephrase the test to
> 
> if($site_style < 8)
> 
> or alternatively, if the range is 0 to more than 10
> 
> if( $site_style < 8 || $site_style > 10 )
> 
> 
> 
> -- 
> David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
> CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  
> 
>"Ici nous voyons le tour Eiffel!" Tom parried.
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] php in css not working with IF's

2001-10-04 Thread Jason Dulberg

I just want to thank everyone who helped me get the css stuff to work. All
of the IF statements are now working properly --- I've certainly learned a
lot from all the messages.

thanks again...
Maxim Maletsky
Rasmus Lerdorf

and all others who responded to my message!

__
Jason Dulberg
Extreme MTB
http://extreme.nas.net


> I have a common css file that is being used across several virtual
> hosts. Basically, what I am trying to do is use the same css file even
> though several text colors/sizes need to be changed depending on what
> site/platform its being used on.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] framing search results

2001-02-05 Thread Jason Dulberg

I'd like to create a script that will frame search results made by various
databases. I will be hardcoding these links into an HTML page. Since there
will be alot of these links and I will be using the script across several
virtual hosts, I can't have the links built by a db as they link to offsite
stuff.

My problem so far is that if I try to link to a search result (which is
obviously built by a database), I get a bunch of errors because the &, =, ?
etc. fields are dropped. So basically, I need to escape the ?,&'s etc. in
the url. I can do this in perl (cgi::escape) but I'm not quite sure how to
do it in php. Couldn't get it to work properly in perl so I'm crossing over
to PHP to see if its doable.

Here's what I got from a code example from zend.com. Basically, I just need
to add the %3A etc onto $url.




 


Now one thing that I noticed is that often when the url is encoded and I try the link, 
I get a 404 error. What am I doing wrong?

So the links that I hardcode into the html is something like 
xyz.com/frame.php?page=searchresults.php or something like that.

I'm really new to php so sorry if this is kinda vague. If there's a better way of 
doing what I'm trying to above, please let me know!

Thanks in advance for your help!
__
Jason Dulberg
Extreme MTB
http://extreme.nas.net


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] framing search results

2001-02-06 Thread Jason Dulberg

Thanks for your help on this!

Because the links that are on the HTML pages won't be determined by myself
(and won't be encoded), I need to encode them when they are read by the
script. All that I do is put the call to the php script onto the link. So
what I tried to do is plugged the code below

urlencode($url) right into the frame call itself.



But of course that doesn't work because I'm still running into the 404
error.

Can I encode the $url taken in from the browser then decode it in the
output? Since I can't store the links in the script or in a database, the
url won't be encoded.

It works just fine if I link to ...

frame.php?x=frame&url=http%3A%2F%2Fwww.mls.ca%2Fbin%2Furllink.exe%3Freq%3Dre
altor%26x_aid%3D1%26x_bid%3d0

but not

frame.php?x=frame&url=http://www.mls.ca/bin/urllink.exe?req=realtor&x_aid=11
111&x_bid=0

Is there any way around this?

Thanks again for your input!

__
Jason Dulberg
Extreme MTB
http://extreme.nas.net


> You can encode URLs with urlencode() and decode them by using
> urldecode()...
>
> try read here:
>
> www.php.net/urlencode
> www.php.net/urldecode
>
>
> ### my way:
> ### you pass $url:
>
> $url = www.maxim.cx/get.php?this=variables&as=many&as=you&what=want
> echo "";
>
>
> ### and you catch it with:
>
> 
tch($x){ 
> case "frame": 
> ?>
>   
>marginheight="0" scrolling="NO" noresize>
>
>  break; 
> } 
> ?>
> 
> 
> 
> Cheers,
> Maxim Maletsky
> 
> 
> 
> 
> 
> -Original Message-
> From: Jason Dulberg [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 06, 2001 3:09 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] framing search results
> 
> 
> I'd like to create a script that will frame search results made by various
> databases. I will be hardcoding these links into an HTML page. Since there
> will be alot of these links and I will be using the script across several
> virtual hosts, I can't have the links built by a db as they link 
> to offsite
> stuff.
> 
> My problem so far is that if I try to link to a search result (which is
> obviously built by a database), I get a bunch of errors because 
> the &, =, ?
> etc. fields are dropped. So basically, I need to escape the ?,&'s etc. in
> the url. I can do this in perl (cgi::escape) but I'm not quite sure how to
> do it in php. Couldn't get it to work properly in perl so I'm 
> crossing over
> to PHP to see if its doable.
> 
> Here's what I got from a code example from zend.com. Basically, I 
> just need
> to add the %3A etc onto $url.
> 
>  switch($x){ 
> case "frame": 
> ?>
>   
>marginheight="0" scrolling="NO" noresize>
>
>  break; 
> } 
> ?>
> 
> Now one thing that I noticed is that often when the url is 
> encoded and I try
> the link, I get a 404 error. What am I doing wrong?
> 
> So the links that I hardcode into the html is something like
> xyz.com/frame.php?page=searchresults.php or something like that.
> 
> I'm really new to php so sorry if this is kinda vague. If there's a better
> way of doing what I'm trying to above, please let me know!
> 
> Thanks in advance for your help!
> __
> Jason Dulberg
> Extreme MTB
> http://extreme.nas.net
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]