[PHP] Evaluate PHP var in stored sql statement?

2003-01-24 Thread CF High
Hey all.

I need to find out how to get PHP to evaluate a PHP variable stored in our
MySql database.

Currently the variable is being read as a string; i.e. select * from table
where column = $myrow[0] -- instead of evaluating $myrow[0] as a variable.


The SQL statement is retrieved in the first call to dbConnect (see code
below)



dbConnect("SELECT header_id, header, sql_query FROM cat_headers WHERE
section_id = $_REQUEST[section_id] order by header");

  $set = $result;   /* Give initial result set a unique name */

  while ($myrow = mysql_fetch_row($set)) {

echo(Display the header title here);


  dbConnect($myrow[2]);  /*  $myrow[2] is the sql_query gotten
from the first dbConnect() call  */

 $set1 = $result;/* Give next result set a unique name */

while ($myrow = mysql_fetch_row($set1)) {

echo(Display category rows here);

}

  }

--
 Any leads/suggestions much appreciated..

--Noah



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




[PHP] Switch statement || How to output html without using echo() or print()

2003-01-25 Thread CF High
Hey all.

Don't know if this is possible, but here goes:

I've got a simple switch statement that carries out one of several
operations based on the switch statement variable value.

Each operation has @ 50 lines of html -- do I have to echo or print all this
html!?

I'm new to PHP so pardon my ignorance here.  I'm used to the relative ease
of Cold Fusion

Thanks for any ideas/suggestions,

--Noah

--




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




Re: [PHP] Switch statement || How to output html without using echo() or print()

2003-01-25 Thread CF High
Thanks for the informative response, Leif.

Looks like you and Johannes are on the same page -- these solutions save a
great deal of time.

Thanks,

--Noah


"Leif K-Brooks" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> No.  You can either echo/print with a heredoc (which is still
> echoing/printing, but is a lot easier) or you can exit PHP.  For example:
>  switch($somevar){
> case 'case1':
> print <<< END
> some html
> some html
> some html
> END;
> break;
> case 'case2':
> print <<< END
> some html
> some html
> some html
> END;
> break;
> }
> ?>
>
>
> Or:
>  switch($somevar){
> case 'case1':
> ?>
> some html
> some html
> some html
>  break;
> case 'case2':
> ?>
> some html
> some html
> some html
>  break;
> }
> ?>
>
> CF High wrote:
>
> >Hey all.
> >
> >Don't know if this is possible, but here goes:
> >
> >I've got a simple switch statement that carries out one of several
> >operations based on the switch statement variable value.
> >
> >Each operation has @ 50 lines of html -- do I have to echo or print all
this
> >html!?
> >
> >I'm new to PHP so pardon my ignorance here.  I'm used to the relative
ease
> >of Cold Fusion
> >
> >Thanks for any ideas/suggestions,
> >
> >--Noah
> >
> >--
> >
> >
> >
> >
> >
> >
>
> --
> The above message is encrypted with double rot13 encoding.  Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.
>
>
>



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




[PHP] Combine 3 MySql rows into one PHP output row ?

2003-01-26 Thread CF High
Hey all.

I'm a recent PHP convert (coming from Cold Fusion)..

Here's the deal:

I've got a table that contains hockey game result info; for each goal
scored I record the goal scorer ID (i.e. their Jersey Number), and assist1
and assist2 IDs if applicable.  When I output the game box score I join in
the roster and team tables (to get the team name and player names).

In Cold Fusion I was able to group a goal info set on the time of goal (each
goal returns from 1 to 3 rows depending on the number of players who
contributed to the goal); then, in Cold Fusion I could use it's output
function to display the goal info set as one row.

For example, if three players were in on a goal, the output would look
something like:

Team Name-- goal scorer name (assist1 name, assist2 name) -- Time of goal --
Goal type.

Since each goal can, and usualy does, have more than one participant, the
scoring table will be returning more than one row for each goal scored --
how can I combine these rows into one PHP output row?

If you need more info, let me know.

Thanks for any ideas,

--Noah

--




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




[PHP] Form Variables not getting passed || Apache, MySql, Win 2k Setup

2003-01-29 Thread CF High
Hey all.

This driving me nuts:

I've got Apache, MySql, and Windows 2000 running on my local machine.
In order to get passed php variables evaluated, whether via a url query
string, or through a form post, I have to use this syntax:

$_REQUEST[$my_passed_variable]

I have no such problem with our hosting company servers; i.e. I can access
query_string and form posted variables as $my_passed_variable.

What is going on here? Is there something in php.ini that needs to be
adjusted?

Any help whatsoever here is much appreciated,

--Noah

--




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




[PHP] Need to set default parameter || How to do in PHP?

2003-02-01 Thread CF High
Hey all.

In cold fusion I was able to define a default value with the  tag

When I passed the variable "test" via a form or query string, it would over
ride the parameter value.

How can I do this in PHP?  I looked in PHP manual for param, default, etc.,
but could find no equivalent.

Any ideas?

--Noah

--




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




[PHP] Single vs. Multiple DBs || Which way to go?

2003-02-08 Thread CF High
Hey all.

I'm attempting to organize a sport report site into working order.

We've got approximately 100 tables, and I'm unsure whether to break the info
up by sport (i.e. baseball, basketball, hockey, etc.) or to lump all the
tables in one db and prefix tables by their sport name (e.g. bk_scoring =
basketball scoring table).

On the surface, it would seem easier to use multiple dbs, but then again,
common tables, such as schools and coach_info would have to be duplicated in
each db.

Any ideas/suggestions much appreciated,

--Noah

--




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




[PHP] Alternating Row Colors in PHP........

2003-02-08 Thread CF High
Hey all.

I'm coming from Cold Fusion to PHP; in CF I could alternate rows with the
following:



Any ideas how to do this in PHP?

Thanks for clues,

--Noah

--




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




[PHP] Output yyyymmdd formatted date || 20030131 to FridayJanuary 31, 2003

2003-02-08 Thread CF High
Sorry for the frequent simple posts...

I've been storing my dates in mmdd format (apparently this is a bad
idea).

In any case, I need to display this date format as [day name month name day
#, year] e.g. Friday January 31, 2003.

Any ideas?

Thanks for any leads,

--Noah

--




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




[PHP] Why does this happen?

2003-02-08 Thread CF High
Hey all.

Got a problem with I'm sure a simple solution::

In this test form when I submit and insert into my db, only the last select
field get entered; i.e. in this case the day value of 25.



Year

2002


Month

12


Day

25






Why does this happen?  In Cold Fusion I'm able to refer to the three selects
as #date# and it returns 20021225 as expected.

Any ideas?

Thanks,

--Noah


--




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




Re: [PHP] Why does this happen?

2003-02-09 Thread CF High
Alright, alright, everyone, I could get away with this in Cold Fusion, but
not in PHP.

The simple example I gave is part of a more complex problem, however.

Here's the deal:

Let's say I have a form that requests the season schedule of a baseball
team, and the team in question has twenty scheduled games all on different
days.

Each form row will have three select elements for the date; i.e. date(x) for
the year, date(x+1) for the month, and date(x+2) for the day, or however
I'll need to make each date select element unique.

Then, in the insert page, I'll need to loop through each date element by
groups of three and create an array for each date set.

Similar to what I had to do in CF, but I could get away with naming each row
of select elements as date(x) for year, date(x) for month, date(x) for day,
etc.


My ideas might be a little primitive here, so feel free to chime in if
you've got a tighter solution

Thanks,

--Noah





"John W. Holmes" <[EMAIL PROTECTED]> wrote in message
000a01c2cfdd$5f9c5c40$7c02a8c0@coconut">news:000a01c2cfdd$5f9c5c40$7c02a8c0@coconut...
> > Got a problem with I'm sure a simple solution::
> >
> > In this test form when I submit and insert into my db, only the last
> > select
> > field get entered; i.e. in this case the day value of 25.
> >
> > 
> >
> > Year
> > 
> > 2002
> > 
> >
> > Month
> > 
> > 12
> > 
> >
> > Day
> > 
> > 25
> > 
> >
> > 
> >
> > 
>
> All of your form elements have the same name! What do you expect to
> happen?
>
> If you have this in PHP:
>
> $date = 1;
> $date = 2;
> $date = 3;
>
> What value do you think $date has now??
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
>
>



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




Re: [PHP] Output yyyymmdd formatted date || 20030131 to FridayJanuary 31, 2003

2003-02-09 Thread CF High
Very nice John.

I'm quickly learning the utility of MySql Date and Time objects.

I used to have to write a ten line script to format the date; now, I can use
this:

SELECT DATE_FORMAT(mydate, '%a %M %d, %Y') and I'm done.

Thanks a bunch for your help, John.

I might even write an effiicient application in this lifetime.

--Noah


"John W. Holmes" <[EMAIL PROTECTED]> wrote in message
000201c2cfd8$dcc2e180$7c02a8c0@coconut">news:000201c2cfd8$dcc2e180$7c02a8c0@coconut...
> SELECT * FROM table WHERE date BETWEEN 20030201 AND 20030201 + INTERVAL
> 7 DAY
>
> I assume '20030201' will come from PHP eventually, right, or the current
> date?
>
> For any record between now and 7 days from now:
> SELECT * FROM table WHERE date BETWEEN CURDATE() AND CURDATE() +
> INTERVAL 7 DAY
>
> For a date from PHP,
>
> $date = '20030201';
>
> SELECT * FROM table WHERE date BETWEEN $date AND $date + INTERVAL 7 DAY
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
>
> > -Original Message-
> > From: Noah [mailto:[EMAIL PROTECTED]]
> > Sent: Saturday, February 08, 2003 10:20 PM
> > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP] Output mmdd formatted date || 20030131 to
> > FridayJanuary 31, 2003
> >
> > Right.
> >
> > I've switched the date column from type INT to type DATE in our MySql
> db.
> >
> > The problem I've had with retrieving records in a certain date range
> with:
> >
> > SELECT * FROM table WHERE yourdate BETWEEN 20030201 AND 20030207
> >
> > is getting the latter part of the expression; i.e. in this case
> 20030207
> > to
> > be seven days "older" than the first part.
> >
> > This is where I need to use MySql's DATE_ADD, and other date
> manipulation
> > functions..
> >
> > Lots to learn; little time to do it.
> >
> > Thanks for feedback, John.
> >
> >
> > --Noah
> >
> >
> > - Original Message -
> > From: "John W. Holmes" <[EMAIL PROTECTED]>
> > To: "'Noah'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>
> > Sent: Saturday, February 08, 2003 3:31 PM
> > Subject: RE: [PHP] Output mmdd formatted date || 20030131 to
> > FridayJanuary 31, 2003
> >
> >
> > > > The dates are stored in a MySql db.
> > > >
> > > > I checked out the MySql DATE_FORMAT function -- pretty cool.
> > > >
> > > > However, pardon my ignorance here, how can I do date comparisons?
> > > >
> > > > For example, if I want to retrieve records from the db where the
> date
> > > is
> > > > between say, 2003-02-01 and 2003-02-07, will MySql be able to
> compare
> > > the
> > > > strings?
> > > >
> > > > I stored my dates as integer fields to do such a comparison, but
> it
> > > looks
> > > > like I need to graduate to MySql date time functions..
> > >
> > > If you've done it correctly and stored your dates in a MySQL DATE,
> > > DATETIME, or TIMESTAMP column, then you can do something like this:
> > >
> > > SELECT * FROM table WHERE yourdate BETWEEN 20030201 AND 20030207
> > >
> > > If you're storing them in an INT column, then change it over to one
> of
> > > the above.
> > >
> > > Go back to the manual and read about date_sub() and date_add() in
> MySQL
> > > for further date manipulation...
> > >
> > > ---John W. Holmes...
> > >
> > > PHP Architect - A monthly magazine for PHP Professionals. Get your
> copy
> > > today. http://www.phparch.com/
> > >
> > >
>
>
>



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




[PHP] Sitewide Header & Footer Includes || Trouble with Relative Paths..........

2003-02-22 Thread CF High
Hey All.

Got a perhaps easy question here:

How can I create a global header and footer include to my site pages where I
don't rely on absolute paths to include and image files?

I'm having trouble including my header and footer .inc's within a
multi-level directory structure -- the relative paths to images (and to
includes within includes) are not currently accessed within the current
directory structure.

I'm assuming I'll need to prepend all image and include files with a path
variable that I set within each page, or something along those lines?

Any help much appreciated,

--Confused

--




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



Re: [PHP] Sitewide Header & Footer Includes || Trouble with Relative Paths..........

2003-02-22 Thread CF High
Hey Tom.

Thanks for the idea; however, since we're not hosting the site on our own
server, we don't have permissions for altering the php.ini file..

--Noah


"Tom Rogers" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> Sunday, February 23, 2003, 6:14:32 AM, you wrote:
> CH> Hey All.
>
> CH> Got a perhaps easy question here:
>
> CH> How can I create a global header and footer include to my site pages
where I
> CH> don't rely on absolute paths to include and image files?
>
> CH> I'm having trouble including my header and footer .inc's within a
> CH> multi-level directory structure -- the relative paths to images (and
to
> CH> includes within includes) are not currently accessed within the
current
> CH> directory structure.
>
> CH> I'm assuming I'll need to prepend all image and include files with a
path
> CH> variable that I set within each page, or something along those lines?
>
> CH> Any help much appreciated,
>
> CH> --Confused
>
> CH> --
>
> I do this at the top of my scripts
>
> ini_set ("include_path",'path/to/inc/dir:'.ini_get("include_path"));
>
> that way you just do include('file.inc') from anywhere and it will find
your
> files.
>
> --
> regards,
> Tom
>



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



Re: [PHP] Sitewide Header & Footer Includes || Trouble with Relative Paths..........

2003-02-22 Thread CF High
Hmm

Sounds like a good idea, but we've got quite a few includes in our site, not
to mention variable image paths (i.e. images/headers, images/groups, etc.)
Seems like a lot of work to create & maintain this config file + load the
references on each page.

Maybe I'm just lazy, but I wonder if there is isn't a more direct way to
modularize a site?

I'll check out your idea in any case as I haven't come up with a better
solution myself.

Thanks for the feedback,

--Noah


"Sebastian" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> What I did on my site is made a file called config.php, I then made a
> variable for all the files that need to be included, example, header,
> footer, leftnav, rightnav, etc..
>
> My config file looks like this:
>
>   $header  ="/home/public_html/includes/header.php";
>  $rightnav="/home/public_html/includes/rightnav.php";
>  $leftnav ="/home/public_html/includes/leftnav.php";
>  $footer  ="/home/public_html/includes/footer.php";
>  // and many other include variables here..
> ?>
>
> Then I simply call config.php into all my pages and when I want to include
a
> file I just do:
>
>  include("$header");
>
> // html and stuff
>
> include("$footer");
> ?>
>
> my config.php has all my site includes and it allows me to dynamically
> change anything throughout the site in a matter of seconds.
> hope this helps.
>
> Sebastian - [BBR] Gaming Clan
> http://www.BroadBandReports.com
>
> - Original Message -
> From: "CF High" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, February 22, 2003 3:14 PM
> Subject: [PHP] Sitewide Header & Footer Includes || Trouble with Relative
> Paths..
>
>
> > Hey All.
> >
> > Got a perhaps easy question here:
> >
> > How can I create a global header and footer include to my site pages
where
> I
> > don't rely on absolute paths to include and image files?
> >
> > I'm having trouble including my header and footer .inc's within a
> > multi-level directory structure -- the relative paths to images (and to
> > includes within includes) are not currently accessed within the current
> > directory structure.
> >
> > I'm assuming I'll need to prepend all image and include files with a
path
> > variable that I set within each page, or something along those lines?
> >
> > Any help much appreciated,
> >
> > --Confused
>
>



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



[PHP] Why use persistent connections? || Data driven site

2003-02-22 Thread CF High
Hey all.

We've got a site makes several queries to our MySql db in every site page.
Should we be using persistent connections, or are we better off opening and
closing connections on each query?

Thanks for any leads,

--Noah

--




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



[PHP] Efficient db connect function?

2003-02-23 Thread CF High
Hey all.

I'm currently using the following db connection function, but I'm not sure
if it's as efficient as it could be.

function dbConnect($SQL) {

global $result;

 // Connect to DB
 if (!$link = @mysql_connect($db_host, $db_user, $db_pass)) {
$result = 0;
echo mysql_errno() . ": " . mysql_error() . "\n";
 }
 else

  // Select DB
  if ([EMAIL PROTECTED]($db_name, $link)) {
$result = 0;
echo mysql_errno() . ": " . mysql_error() . "\n";
  }
  else {
// Execute query
if (!$result = @mysql_query($SQL, $link)) {
$result = 0;
echo mysql_errno() . ": " . mysql_error() . "\n";
   }
  }
}
return $result;
}

*** Is there a faster way to establish a connection & run a query, or am
I wasting my time over nothing? *

--Noah



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



[PHP] Output Numerical Month as String?

2003-02-25 Thread CF High
Hey all.

Easy question here (can't find the answer in php manual)

In Cold Fusion I'm able to format a given numerical month value, say the
third month, as #MonthAsString(3)# and it returns "March"

What's the equivalent in PHP?

Thanks for any ideas..

--Noah

--




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



[PHP] $_POST arrays not evaluated in sql statement -- why?

2003-02-25 Thread CF High
Hey all.

Got a problem with this sql statement -- php vars are evaluated (e.g. the
$date var), but not the $_POST arrays..

All of the arrays return correct values -- What am I missing here?

$sql = "INSERT into rosters (school_id, sport_id, date, jersey_id, first,
last, position, grade, town, state, country, height, weight, DOB)
VALUES
('1','1','$date','$_POST['jersey_id'][$x]','$_POST['first'][$x]','$_POST['la
st'][$x]','$_POST['position'][$x]','$_POST['grade'][$x]',

'$_POST['town'][$x]','$_POST['state'][$x]','$_POST['country'][$x]','$_POST['
height'][$x]',
   '$_POST['weight'][$x]','$DOB[$i]')";

I still have some hair left on my head..

--Noah

--




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



Re: [PHP] $_POST arrays not evaluated in sql statement -- why?

2003-02-25 Thread CF High
Hey John et. al

I tried your method John, and it works!

Re: excessive single quotes in the sql, but I tried stripping them out to no
effect.  Using curly braces in the sql statement wasn't an option I knew
about.  Thanks again for illuminating another bit of the PHP world.

--Noah


"John W. Holmes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> >
> ('1','1','$date','$_POST['jersey_id'][$x]','$_POST['first'][$x]','$_POST
> ['
>
> Let's just be smart and think about this for a second. Look at all of
> the single quotes you've got. How do you expect PHP to be able to tell
> what's a variable and what's text? Do you mean $_POST or
> $_POST['jersey_id'] or $_POST['jersey_id'][$x] as the variable? PHP
> can't read your mind.
>
> Anyway, if you're going to use this method, put braces around your
> variable, so PHP knows what you are sending it.
>
> ('1','1','$date','{$_POST['jersey_id'][$x]}','{$_POST['first'][$x]}'
>
> or this method
>
> ('1','1','$date','$_POST[jersey_id][$x]','$_POST[first][$x]'
>
> PHP will be greedy, I think, and assume you mean $_POST[jersey_id][$x]
> as the variable.
>
> Or this method
>
> ('1','1','$date','".$_POST['jersey_id'][$x]."','".$_POST['first'][$x]."'
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
>
>



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



[PHP] Switch Statement || Case with multiple values?

2003-03-02 Thread CF High
Hey all.

In Cold Fusion I was able to do the following:




Do Stuff




Note the comma delimited set of values for the case.  Is there a way to do
this in php?( i.e. if any of the comma delimited case values match the
switch expression, proceed with the specified case instructions)

It's kind of cumbersome breaking out 5 cases when in CF I can combine them
into one

Let me know.

--Noah



--




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



[PHP] Run db query with db query?

2003-03-03 Thread CF High
Hey all.

Got a problem here:

1) I have a page that queries our db for info

2) Based on the # of rows returned I loop through to create a set of
formfields for each customer

3) Within this loop I run another query to retrieve option elements for
a particular category

The problem is that the inner query is overwriting the result resource for
the outer query. So:

while ($q = mysql_fetch_row($result)) {

build form tables for each client and run inner query

html stuff

/* Calls db query to populate particular option category */
write_select_options($tables,$form_fields,$where_clause);

}

What's the conventional method for running queries within queries?

Any leads most appreciated,

--Noah

--




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



[PHP] Re: Run db query with db query?

2003-03-03 Thread CF High
Exactly.

I'm using $result for both queries.  That's how I discovered the problem:
the inner query is over-writing the outer query $result set.

Unfortunately my existing db_connect function does not account for multiple
queries.

I just pass the query as a param -- db_connect($sql).  $result is returned
for each query, but this only works with single queries; not nested queries.

In any case, it doesn't seem terribly efficient to run a query within a
query, since the inner query only needs to be run once at the top of the
page.

Problem now is:

How to populate the write_select_options($tables,$form_fields,$where_clause)
function; when it returns no variable -- it just echoes out the option
values.

Looks like I need to modify the function to return a var rather than echoing
some output.

Most likely just talking to the empty universe at this point ;--)

Cheers to all php junkies...

--Noah


"Monty" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> What is the code for the inner query? Hard to advise you based on the
small
> bit of code you posted.
>
> Are you using the same $result var for both queries? If so, that's why.
Just
> run two separate queries stored in to different result vars. I do this all
> the time with no problems.
>
>
> > From: [EMAIL PROTECTED] (Cf High)
> > Newsgroups: php.general
> > Date: Mon, 3 Mar 2003 16:45:52 -0800
> > To: [EMAIL PROTECTED]
> > Subject: Run db query with db query?
> >
> > Hey all.
> >
> > Got a problem here:
> >
> > 1) I have a page that queries our db for info
> >
> > 2) Based on the # of rows returned I loop through to create a set of
> > formfields for each customer
> >
> > 3) Within this loop I run another query to retrieve option elements for
> > a particular category
> >
> > The problem is that the inner query is overwriting the result resource
for
> > the outer query. So:
> >
> > while ($q = mysql_fetch_row($result)) {
> >
> > build form tables for each client and run inner query
> >
> > html stuff
> >
> > /* Calls db query to populate particular option category */
> > write_select_options($tables,$form_fields,$where_clause);
> >
> > }
> >
> > What's the conventional method for running queries within queries?
> >
> > Any leads most appreciated,
> >
> > --Noah
> >
> > --
> >
> >
> >
>



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



[PHP] Populate var with function output string?

2003-03-03 Thread CF High
Hey all.

Is it possible to populate a var with an output string generated by a
function? So:

***
function write_string(count) {

for ($x = 0; $x < $count; $x++) {

 echo " Row $x";

}

}

$my_string = write_string(5);

echo $my_string;
***

I need $count option elements stored in $my_string. How to make this happen.

Thanks for any ideas,

--Noah


--




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



[PHP] Yarrrrgggghhhhh || Simplest php question in existence........

2003-03-03 Thread CF High
Hey all.

Basic question here:

How can I refer to a query result set as $result['field_name'] rather than
$result[0]?

So, I'm looking for  -- just can't seem to
get the right syntax.

-- clueless



--




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



[PHP] md5 encrypt problem

2003-03-10 Thread CF High
Hey all.

Having a wee bit o' trouble with a simple md5 script:

  for ($x=1 ; $x <62 ; $x++) {

  $mypass = "sports" . $x;
  $mypass = md5($mypass);

  dbConnect("UPDATE user_login SET password = '$mypass' WHERE school_id
= $x");

  }

For some reason, when I attempt to login with my md5'd user supplied
password I get no match.  Bizarre, haven't had this problem
before...

Any help always appreciated

--Noah

--




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



[PHP] Performance and Function Calls

2003-03-15 Thread CF High
Hey all.

Quick question:

If I have a function that, say, prints out the months in a year, and I call
that function within a 10 cycle loop, which of the following is faster:

1) Have function months() return months as a string; set var
string_months = months() outside of the loop; then echo string_months within
the loop

-- OR

2) Just call months() for each iteration through the loop

I'm not sure how PHP interprets option number 1.

Guidance for the clueless much appreciated...

--Noah

--




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



[PHP] PHP Processing Order || Function Calls

2003-03-18 Thread CF High
Hey all.

I was under the impression that PHP processes all php code first before
handing HTML processing over to the browser.

It seems that if you call an external function that, say, queries your db
for data and spits out populated formfields, the function is processed
somehow simultaneously with staright HTML. The result in this case is that
my submit button appears above the formfields! Here's a quick example:

*** global_functions.php 
"; }
return $string;

} ?>

*** print_form.php 


$display_form = make_form($sql);
?>






*** Result 

Submit button on top
Formfields are below submit button



Any info much appreciated.  I'd like to avoid having to pop the submit
button in based on the number of records returned, or other workaround.

Thanks in advance,

--Noah





--




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



Re: [PHP] PHP Processing Order || Function Calls

2003-03-18 Thread CF High
Thanks for the tip Erik.

Looks like I'll need to test live on this one -- I've got a win2k/Apache/PHP
setup locally -- output buffering apparently does not work in this
configuration...

I'll look into it on our host company's Linux servers,

--Noah


"Erik Price" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
>
> CF High wrote:
> > Hey all.
> >
> > I was under the impression that PHP processes all php code first before
> > handing HTML processing over to the browser.
>
> http://www.php.net/manual/en/ref.outcontrol.php
>
>
>
> Erik
>



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



[PHP] Detailed error message?

2003-03-21 Thread CF High
Hey all.

I'm having a difficult time adjusting my php.ini file to display detailed
error messages in my local testing environment.

For example, when a query returns an error, I do not get the line # where
the error occurred or really any info other than:

"Query not executed. Unknown column 'Array' in 'where clause'"

How can I get a full error report; i.e. file where error occurred; the line
number, etc.

Thanks for any help,

--Noah

--




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



Re: [PHP] Detailed error message?

2003-03-21 Thread CF High
Thanks Darren.

I'll look into it, when I get a spare moment,

--Noah


"Darren Young" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I use the set_error_handler and have a local function that dumps that
> stuff. I then redirect all of that to a log file on disk so the user
> doesn't have to see it.
>
> Check http://www.php.net/manual/en/function.set-error-handler.php
>
> There's a whole section in the manual that deals with error handling in
> some detail.
>
> > -Original Message-
> > From: CF High [mailto:[EMAIL PROTECTED]
> > Sent: Friday, March 21, 2003 12:46 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Detailed error message?
> >
> >
> > Hey all.
> >
> > I'm having a difficult time adjusting my php.ini file to
> > display detailed error messages in my local testing environment.
> >
> > For example, when a query returns an error, I do not get the
> > line # where the error occurred or really any info other than:
> >
> > "Query not executed. Unknown column 'Array' in 'where clause'"
> >
> > How can I get a full error report; i.e. file where error
> > occurred; the line number, etc.
> >
> > Thanks for any help,
> >
> > --Noah
> >
> > --
> >
> >
> >
> >
> > --
> > 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] Code Design || Functions vs. Switch Statements

2003-03-21 Thread CF High
Hey all.

I'm looking for guidance from any PHP Gurus, or gurus in the making re:
whether to use a function based design or a switch statement based design
for a multi-sport data driven sport report.

Alright, here's the deal:

Last year I developed a data driven hockey report for a friend -- the site
has done rather well.  Based on the success of his site, I thought I'd
launch a spec sport report and see what happens (that's where I'm at now).

Over the past few weeks I've been converting the single sport hockey report
over to a multi-sport interface.  In doing so, I realized that many of the
hard coded templates I developed in Cold Fusion could be converted to PHP
functions; thus saving time for common sport development (i.e. baseball and
softball have the same stats, so no need to replicate hard coded templates,
just call function(s) to do the work).

Due to my relative beginner developer status, I'm coming from a position of
ignorance -- I don't  know for sure what the best way to proceed actually
is.  The functions I've created work, but I can't shake the notion that
there is a better way to proceed -- and I'm sure if you've got any
programming experience under your belt, you've already got a few ideas in
mind.

The question:  if you were to undertake this project, would you develop
functions (not objects -- I'm not there yet), to create templates for
submitting game results, or would you break it down into switch statements
with include files, or none of the above?

Any advice greatly appreciated,

Give a holler if you need more details

--Noah



--




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



[PHP] Trouble with fopen() || Win2k Machine

2003-06-06 Thread CF High
Hey all.

Quick question here that's driving me up the wall:

Using fopen(), I'm easily able to open files for reading; however, when I
attempt to open files for writing using fopen($file_path, "W+"), an error
occurs.

I'm able to use fopen($file_path, "a+"), but I need to be able to overwrite
files; not write to the end of the file.

Again, I'm testing on windows here..

Any suggestions greatly appreciated,

--Noah



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



[PHP] Re: Trouble with fopen() || Win2k Machine

2003-06-06 Thread CF High
Thanks for the suggestion.

Still no luck though with the file path on windows; e.g. file path is
http://192.168.1.2/dev_files/drop_down.js

So, when I open the file for writing: $fw = fopen($file_path, "wb") an error
results ("can't open file")

Looks like I need to escape out of slashes within the file path on windows.

In any case, thanks for the idea -- it's a step in the right direction,

--Noah


"Ptker" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> If the file is binary, try fopen($file_path, "wb");
> "Cf High" <[EMAIL PROTECTED]> ~{P4HkO{O"PBNE~}
> :[EMAIL PROTECTED]
> > Hey all.
> >
> > Quick question here that's driving me up the wall:
> >
> > Using fopen(), I'm easily able to open files for reading; however, when
I
> > attempt to open files for writing using fopen($file_path, "W+"), an
error
> > occurs.
> >
> > I'm able to use fopen($file_path, "a+"), but I need to be able to
> overwrite
> > files; not write to the end of the file.
> >
> > Again, I'm testing on windows here..
> >
> > Any suggestions greatly appreciated,
> >
> > --Noah
> >
> >
>
>



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



Re: [PHP] Re: Trouble with fopen() || Win2k Machine

2003-06-06 Thread CF High
Ah, well that's a useful bit of info ;--)

Didn't run across that in php.net's description of fopen()

Thanks, Jason -- I'll switch to relative paths..

--Noah



"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Saturday 07 June 2003 03:25, CF High wrote:
>
> > Still no luck though with the file path on windows; e.g. file path is
> > http://192.168.1.2/dev_files/drop_down.js
> >
> > So, when I open the file for writing: $fw = fopen($file_path, "wb") an
> > error results ("can't open file")
> >
>
> You can't open an HTTP stream for writing!
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> --
> /*
> APL is a natural extension of assembler language programming;
> ...and is best for educational purposes.
> -- A. Perlis
> */
>



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



[PHP] strip_tags() Quandry....

2003-05-27 Thread CF High
Hey all.

I've got a chunk of HTML text I'd like to format for insertion into our
mySql db.

Let's say $html_string equals the following:


1
Bardo, Jesse
S
A
Andover, MA


To setup this chunk of text for insertion I first use
strip_tags($html_string); that results in:

1
Bardo, Jesse
S
A
Andover, MA

I then use str_replace(",","",$html_string) to create a space delimited
string.

Here's where I believe the problem occurs.  There are apparently numerous
blank spaces within the string.  I've tried replacing the blank spaces, or
whatever is separating the data to no avail.

I've tried a number of aimless efforts to get the string properly formatted,
but no luck -- any suggestions?

Thanks for helping me over this hurdle...

--Noah



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



Re: [PHP] strip_tags() Quandry....

2003-05-29 Thread CF High
Hey Justin.

Sorry for the late reply -- got totally wrapped up in utilizing that highly
useful bit of reg exp code.

Thanks for the heads up; it certainly solved the problem.

Unfortunately, or fortunately, new problems have arisen -- time to dive into
learning some reg exp syntax

Thanks again,

--Noah



"Justin French" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> on 28/05/03 2:56 PM, CF High ([EMAIL PROTECTED]) wrote:
>
>
> > I've got a chunk of HTML text I'd like to format for insertion into our
> > mySql db.
> >
> > Let's say $html_string equals the following:
> >
> > 
> > 1
> > Bardo, Jesse
> > S
> > A
> > Andover, MA
> > 
> >
> > To setup this chunk of text for insertion I first use
> > strip_tags($html_string); that results in:
> >
> > 1
> > Bardo, Jesse
> > S
> > A
> > Andover, MA
> >
> > I then use str_replace(",","",$html_string) to create a space delimited
> > string.
>
> exactly... for starters, there might be tabs (\t), newlines (\n, \r,
\n\r),
> plus multiple spaces ("  ").
>
> this is DEFINITELY a quick hack, adapted from code on
> au.php.net/preg-replace... someone with more regular expression knowledge
> can probably get this down to 1 or 2 lines, with a perfomance gain as well
> :)
>
> 
> $html = "
> 1
> Bardo, Jesse
> S
> A
> Andover, MA
> ";
>
> $html = preg_replace ("'<[\/\!]*?[^<>]*?>'si", ' ', $html);
> $html = preg_replace ("'([\r\n])[\s]+'", ' ', $html);
> $html = preg_replace ("([\s]+)", ' ', $html);
> $html = trim($html);
>
> echo ""; print_r($html); echo "";
>
> ?>
>
> You'll need to test it thoroughly, and make sure it's ok on larger blocks
of
> text, like whatever your target source is, to make sure it doesn't bog
> anything down.
>
>
>
> Justin
>



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



[PHP] Generating Static Pages || Preserve PHP Code?

2003-06-10 Thread CF High
Hey all.

Interesting problem here, at least for me ;--):

How to generate php pages using fopen() without having php code evaluated in
the written pages?

For example, if build_pages.php runs a db query and, based on the result
set, produces a test page using fopen(), how to avoid having php code
getting evaluated?

Here's an example snippet:

*
 // Set read & write paths
 $write_path = "C:\\apache\\htdocs\\client_site\\files\\";
 $write_path = $write_path . "example_page.php";
 $read_path = $doc_path . "build_pages.php";

 // Read file to variable & close
 $fr = fopen($read_path, "r") or die("An error occurred while opening
$read_path");
 $text = "";
 while (!feof($fr)){ $text .= fread($fr, 10); }
 fclose($fr);

 // Create example page
 $fw = fopen($write_path, "wb") or die("An error occurred while opening
$write_path");

 // Write data to example page
$make_page = fwrite($fw, $text);

 fclose($fw);
*

Give a holler for more info -- I know the question is a little vague -- I'm
still figuring out how to implement this solution..

--Noah





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



[PHP] addslashes() || Why the multiple slashes?

2003-09-09 Thread CF High
Hey All.

Simple ?

why does PHP add 3 slashes to the following var:

$apostrophe = "I've got an apostrophe";

$slashed = addslashes($apostrophe);

echo $slashed;

Result: I\\\'ve got an apostrophe.

What's up with that -- why not just add a single backslash?

--Noah

--

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



[PHP] count() & numerical arrays....

2003-09-09 Thread CF High
Hey all.

Another simple, yet baffling for me, question:

I have a comma delimited list of numbers; e.g. $num_list = "1,2,3,4"

I split the number list to array -- $num_list_array = split("," $num_list)

I then count the number of elements -- $count = count($num_list_array);

I do not get 4 for $count, rather 1!

I can't stand coming up with cludgy workarounds just to count the number of
elements in a numerical list.

Any ideas?

--Noah

--

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



[PHP] Web server file perms || More than I can chew.....

2003-09-19 Thread CF High
Hey all.

Got a problem with a site builder app I've spent three months developing.

On my local machine (win2k pro, apache), no problems -- everything works
just as designed.

Today I began testing on the live server; i.e. my client's hosting company
(linux, apache 1.3.27, php 4.3.1)  -- that's when the trouble started.

The site builder app builds static pages based on changes made by users in
our online administration center.  When I test out creating a new site
section; i.e. triggering my make_file function(writes page content to new
file) I receive the following error:


  Warning: fopen(/local_server_path/file_to_create.php) [function.fopen]:
failed to create stream: Permission denied

I've attempted to chmod(777) my testing directory via ftp client, which
appears to work; however, when I fileperms($file_in_test_dir), I get
chmod(644), so clearly I'm not the owner.

Pardon my ignorance here, but I as yet know little about dir/file perms.
Should I contact the host and have them give me sufficient permissions?

Any help so much appreciated as I am completely handcuffed at the moment.

Thanks,

--Noah

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



Re: [PHP] Web server file perms || More than I can chew.....

2003-09-19 Thread CF High
Thanks for the informative post, Lowell & Marek.

Our host suggested chmod-ing necessary directories via ftp.  Completely
defeats the purpose of my app which is supposed to allow the client to
maintain the site themselves; not have me mess around with directory/file
perms -- ugggh

In any case, I'm more than a little frustrated that the app works like a
dream locally; now, I have to hack around to get it working live.  I'm not a
huge fan of the latest version of php now either.  I was able to open
external files (e.g. http://somesite.com/index.php) with fopen(); no such
luck in this realease.  Getting a freaking "php_hostconnect: connect failed"
error message now.

My mood is down the tubes at present -- waiting for some divine inspiration
as my efforts to slog it out have me stewing..

--Noah


"Lowell Allen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > On my local machine (win2k pro, apache), no problems -- everything works
> > just as designed.
> >
> > Today I began testing on the live server; i.e. my client's hosting
company
> > (linux, apache 1.3.27, php 4.3.1)  -- that's when the trouble started.
> >
> > The site builder app builds static pages based on changes made by users
in
> > our online administration center.  When I test out creating a new site
> > section; i.e. triggering my make_file function(writes page content to
new
> > file) I receive the following error:
> >
> > Warning: fopen(/local_server_path/file_to_create.php) [function.fopen]:
> > failed to create stream: Permission denied
> >
> > I've attempted to chmod(777) my testing directory via ftp client, which
> > appears to work; however, when I fileperms($file_in_test_dir), I get
> > chmod(644), so clearly I'm not the owner.
> >
> > Pardon my ignorance here, but I as yet know little about dir/file perms.
> > Should I contact the host and have them give me sufficient permissions?
>
> If you create a subdirectory of the root level public HTML directory, then
> PHP can create files there, but not in the root level directory. If you
> change permissions to 777, PHP can create files there, but it's not a good
> idea to have the permissions that wide-open.
>
> You might be able to get your commercial host to change who PHP is running
> as from "nobody" to your login identity, then PHP could write to the root
> level directory, but you might not be able to -- my main host says they're
> changing policy for security reasons to not allow that.
>
> You could put the static files in a subdirectory where PHP will have
> permission to create files. But this might require lots of reworking links
> depending on your site design, and thus not be a viable option.
>
> You could set up a PHP script to be executed by a crontab as a CGI. Done
> this way, PHP can write to the root level directory. This is what I did
> recently for a similar problem. The content management system provides a
> link for updating static HTML pages. That link (script) writes info to the
> database, flagging an update request. Every 5 minutes, a crontab calls the
> PHP CGI script that actually does the update. The script checks the
database
> flag and does the updates if they've been requested (flagged).
>
> Bottom line -- discuss the problem with your commercial host and see what
> they suggest.
>
> --
> Lowell Allen

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



[PHP] fopen() || Execute read file as php page; not plain text

2003-09-19 Thread CF High
Any ideas here?

was able to use an absolute reference on my local machine to execute read
file contents; e.g. fopen('http://www.mysite.com/index.php', 'a'), but on
the host webserver no such luck.  Administrator said I can only use relative
paths.  Problem is, when I use a relative path, I just get plain text; i.e.
the read file doesn't get executed as php.

eval()'s not an option either, as the read file(s) has apostrophes, quotes
top-to-bottom.

Basically, I just need the file-to-be-read to have the queries within it run
as if it were run in the web browser.

All clues appreciated as I'm at my wits end here -- can't find didly on this
subject on the net.

--Noah

--

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



Re: [PHP] fopen() || Execute read file as php page; not plain text

2003-09-19 Thread CF High
Hey Jay.

Yes, the file is php code.

Um, why not use include()?  I'm ashamed, and very pleased, to admit that
I had no idea I could set a var = to an include file!

Well, one learns something new each day, often with much head banging ;--)

Thanks for clueing me in.

--Noah


"Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
[snip]
was able to use an absolute reference on my local machine to execute
read
file contents; e.g. fopen('http://www.mysite.com/index.php', 'a'), but
on
the host webserver no such luck.  Administrator said I can only use
relative
paths.  Problem is, when I use a relative path, I just get plain text;
i.e.
the read file doesn't get executed as php.

eval()'s not an option either, as the read file(s) has apostrophes,
quotes
top-to-bottom.

Basically, I just need the file-to-be-read to have the queries within it
run
as if it were run in the web browser.

All clues appreciated as I'm at my wits end here -- can't find didly on
this
subject on the net.
[/snip]

Is the file PHP code? If so, why not include()?

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



Re: [PHP] fopen() || Execute read file as php page; not plain text

2003-09-19 Thread CF High
Hm..

Looks like I was deluding myself.  The only data returned by setting a var =
include $include_path, is 0 or 1.  I'm looking for a few hundred lines of
evaluated text.  Back to the drawing board.  Christ, this is a pain in
the.

--Noah


"Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
[snip]
was able to use an absolute reference on my local machine to execute
read
file contents; e.g. fopen('http://www.mysite.com/index.php', 'a'), but
on
the host webserver no such luck.  Administrator said I can only use
relative
paths.  Problem is, when I use a relative path, I just get plain text;
i.e.
the read file doesn't get executed as php.

eval()'s not an option either, as the read file(s) has apostrophes,
quotes
top-to-bottom.

Basically, I just need the file-to-be-read to have the queries within it
run
as if it were run in the web browser.

All clues appreciated as I'm at my wits end here -- can't find didly on
this
subject on the net.
[/snip]

Is the file PHP code? If so, why not include()?


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



Re: [PHP] fopen() || Execute read file as php page; not plain text

2003-09-19 Thread CF High
Because I need to write $include_path content to file; not display it in the
browser...

--Noah


"Andu" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Fri, 19 Sep 2003 17:05:47 -0700
> "CF High" <[EMAIL PROTECTED]> wrote:
>
> > Hm..
> >
> > Looks like I was deluding myself.  The only data returned by setting a
var =
> > include $include_path, is 0 or 1.  I'm looking for a few hundred lines
of
> > evaluated text.  Back to the drawing board.  Christ, this is a pain in
> > the.
>
> Why do you need to set the $var, why not just include $include_path
when/where
> you need it in your script.
>
> >
> > --Noah
> >
> >
> > "Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > [snip]
> > was able to use an absolute reference on my local machine to execute
> > read
> > file contents; e.g. fopen('http://www.mysite.com/index.php', 'a'), but
> > on
> > the host webserver no such luck.  Administrator said I can only use
> > relative
> > paths.  Problem is, when I use a relative path, I just get plain text;
> > i.e.
> > the read file doesn't get executed as php.
> >
> > eval()'s not an option either, as the read file(s) has apostrophes,
> > quotes
> > top-to-bottom.
> >
> > Basically, I just need the file-to-be-read to have the queries within it
> > run
> > as if it were run in the web browser.
> >
> > All clues appreciated as I'm at my wits end here -- can't find didly on
> > this
> > subject on the net.
> > [/snip]
> >
> > Is the file PHP code? If so, why not include()?
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
>
>
> 
> Regards, Andu Novac

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



Re: [PHP] fopen() || Execute read file as php page; not plain text

2003-09-19 Thread CF High
Could you explain what you mean by:

"Then you're not INCLUDEing it inline to the source"

--Noah

"Roger B.A. Klorese" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > Because I need to write $include_path content to file; not
> > display it in the
> > browser...
>
> Then you're not INCLUDEing it inline to the source, are you?

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



Re: [PHP] fopen() || Execute read file as php page; not plain text

2003-09-19 Thread CF High
Re: "So you want to read from a file and write back to it? I don't
understand what you're trying to accomplish, execute a script and write the
result to file?"

Yes, the read file is a nested set of queries that populates a js pop up
menu, the site navigational structure.  That's why I need the read file to
be executed.

Got help from a PHP guru -- he suggested shell access

--Noah


"Andu" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Fri, 19 Sep 2003 18:20:01 -0700
> "CF High" <[EMAIL PROTECTED]> wrote:
>
> > Because I need to write $include_path content to file; not display it in
the
> > browser...
>
> So you want to read from a file and write back to it? I don't understand
what
> you're trying to accomplish, execute a script and write the result to
file?
>
> >
> > --Noah
> >
> >
> > "Andu" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > On Fri, 19 Sep 2003 17:05:47 -0700
> > > "CF High" <[EMAIL PROTECTED]> wrote:
> > >
> > > > Hm..
> > > >
> > > > Looks like I was deluding myself.  The only data returned by setting
a
> > var =
> > > > include $include_path, is 0 or 1.  I'm looking for a few hundred
lines
> > of
> > > > evaluated text.  Back to the drawing board.  Christ, this is a pain
in
> > > > the.
> > >
> > > Why do you need to set the $var, why not just include $include_path
> > when/where
> > > you need it in your script.
> > >
> > > >
> > > > --Noah
> > > >
> > > >
> > > > "Jay Blanchard" <[EMAIL PROTECTED]> wrote in
message
> > > > news:[EMAIL PROTECTED]
> > > > [snip]
> > > > was able to use an absolute reference on my local machine to execute
> > > > read
> > > > file contents; e.g. fopen('http://www.mysite.com/index.php', 'a'),
but
> > > > on
> > > > the host webserver no such luck.  Administrator said I can only use
> > > > relative
> > > > paths.  Problem is, when I use a relative path, I just get plain
text;
> > > > i.e.
> > > > the read file doesn't get executed as php.
> > > >
> > > > eval()'s not an option either, as the read file(s) has apostrophes,
> > > > quotes
> > > > top-to-bottom.
> > > >
> > > > Basically, I just need the file-to-be-read to have the queries
within it
> > > > run
> > > > as if it were run in the web browser.
> > > >
> > > > All clues appreciated as I'm at my wits end here -- can't find didly
on
> > > > this
> > > > subject on the net.
> > > > [/snip]
> > > >
> > > > Is the file PHP code? If so, why not include()?
> > > >
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > > >
> > > >
> > >
> > >
> > > 
> > > Regards, Andu Novac
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
>
>
> 
> Regards, Andu Novac

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



[PHP] session_start() || shell access problem......

2003-09-20 Thread CF High
Hey all.

I'm running a script from the command-line php interpreter as follows:
(thanks to D. Souza for lead)

$text = `usr/local/bin/php /path/to/my/php/page.php`;

within the read file I want to enable sessions, so I session_start() at the
top of the page:




Regardless of how I mess around with placement of session_start(), I get a
"Headers already sent".

Why? Nothing has been output to the browser within the read file!
Furthermore, if I create a test page with just:



Still receive "Headers already sent".

My eyes are completely fried -- anyone feel like saving my vision?

--Noah

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



Re: [PHP] session_start() || shell access problem......

2003-09-20 Thread CF High
Hey Robert.

Indeed, hard to find the problem.

I don't believe it's a whitespace issue, or even a "Headers sent issue",
despite the fact that I'm receiving that error.

Check it out:

test.php contains just one line: 

test1.php, the file to be executed, contains just one line:


There are no line breaks, spaces, etc.

Still get "Headers already sent".

Pretty strange, right?

Correct me if I'm wrong, but I think the problem may be related to the fact
that when files are executed from the command line, php now looks for
include_paths, session_paths, etc. relative to the server root; not the site
root.

I can think of no other reason why include paths, starting sessions, and so
on, return errors from the command line but ork perfectly fine when run in a
browser.

Feel free to clue me in -- I know didly about shell access issues.

--Noah


"Robert Cummings" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Sat, 2003-09-20 at 15:46, CF High wrote:
> > Hey all.
> >
> > I'm running a script from the command-line php interpreter as follows:
> > (thanks to D. Souza for lead)
> >
> > $text = `usr/local/bin/php /path/to/my/php/page.php`;
> >
> > within the read file I want to enable sessions, so I session_start() at
the
> > top of the page:
> >
> >  > session_start();
> > ?>
> >  > code to execute here...
> > ?>
> >
> > Regardless of how I mess around with placement of session_start(), I get
a
> > "Headers already sent".
> >
> > Why? Nothing has been output to the browser within the read file!
> > Furthermore, if I create a test page with just:
> >
> > 
> >
> > Still receive "Headers already sent".
> >
> > My eyes are completely fried -- anyone feel like saving my vision?
>
> This often is difficult to detect when there's is implicit output
> outside of the  script and see if there is any whitespace or newlines preceding the tag.
>
> HTH,
> Rob.
> --
> ..
> | InterJinn Application Framework - http://www.interjinn.com |
> ::
> | An application and templating framework for PHP. Boasting  |
> | a powerful, scalable system for accessing system services  |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for   |
> | creating re-usable components quickly and easily.  |
> `'

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



Re: [PHP] session_start() || shell access problem......

2003-09-21 Thread CF High
H,

Well, is there a way to pass params to file_to_be_executed in command line?

For example:



Somehow I need $my_param to be passed to page.php (the file to be processed
in command line).

Any ideas?

--Noah



"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Sessions don't work on command line and that is how you run your script
> - from command line.
>
> CF High wrote:
> > Hey Robert.
> >
> > Indeed, hard to find the problem.
> >
> > I don't believe it's a whitespace issue, or even a "Headers sent issue",
> > despite the fact that I'm receiving that error.
> >
> > Check it out:
> >
> > test.php contains just one line:  > /path/to/my/php/test1.php`;?>
> >
> > test1.php, the file to be executed, contains just one line:
> > 
> >
> > There are no line breaks, spaces, etc.
> >
> > Still get "Headers already sent".
> >
> > Pretty strange, right?
> >
> > Correct me if I'm wrong, but I think the problem may be related to the
fact
> > that when files are executed from the command line, php now looks for
> > include_paths, session_paths, etc. relative to the server root; not the
site
> > root.
> >
> > I can think of no other reason why include paths, starting sessions, and
so
> > on, return errors from the command line but ork perfectly fine when run
in a
> > browser.
> >
> > Feel free to clue me in -- I know didly about shell access issues.
> >
> > --Noah
> >
> >
> > "Robert Cummings" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >
> >>On Sat, 2003-09-20 at 15:46, CF High wrote:
> >>
> >>>Hey all.
> >>>
> >>>I'm running a script from the command-line php interpreter as follows:
> >>>(thanks to D. Souza for lead)
> >>>
> >>>$text = `usr/local/bin/php /path/to/my/php/page.php`;
> >>>
> >>>within the read file I want to enable sessions, so I session_start() at
> >
> > the
> >
> >>>top of the page:
> >>>
> >>> >>>session_start();
> >>>?>
> >>> >>>code to execute here...
> >>>?>
> >>>
> >>>Regardless of how I mess around with placement of session_start(), I
get
> >
> > a
> >
> >>>"Headers already sent".
> >>>
> >>>Why? Nothing has been output to the browser within the read file!
> >>>Furthermore, if I create a test page with just:
> >>>
> >>>
> >>>
> >>>Still receive "Headers already sent".
> >>>
> >>>My eyes are completely fried -- anyone feel like saving my vision?
> >>
> >>This often is difficult to detect when there's is implicit output
> >>outside of the  >>script and see if there is any whitespace or newlines preceding the tag.
> >>
> >>HTH,
> >>Rob.
> >>--
> >>..
> >>| InterJinn Application Framework - http://www.interjinn.com |
> >>::
> >>| An application and templating framework for PHP. Boasting  |
> >>| a powerful, scalable system for accessing system services  |
> >>| such as forms, properties, sessions, and caches. InterJinn |
> >>| also provides an extremely flexible architecture for   |
> >>| creating re-usable components quickly and easily.  |
> >>`'
> >
> >

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



Re: [PHP] session_start() || shell access problem......

2003-09-21 Thread CF High
Thank the heavens above

Actually, thank "Ben", a poster from php.net manual.

Looks like environment variables are not passed to file when it is executed
from the command line.

A workaround is:

$inc_path = $_SERVER['DOCUMENT_ROOT'] . '/';
$remaddr = getenv("DOCUMENT_ROOT");
putenv("DOCUMENT_ROOT=$inc_path");

That does the trick for what I need done now; namely, being able to include
files within my command line executed files.

Still, there must be a way to pass params to command line executed
files..

--Noah



"Cf High" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> H,
>
> Well, is there a way to pass params to file_to_be_executed in command
line?
>
> For example:
>
>  $my_param = 'my_include_path';
> $text = `usr/local/bin/php /path/to/my/php/page.php`;
> ?>
>
> Somehow I need $my_param to be passed to page.php (the file to be
processed
> in command line).
>
> Any ideas?
>
> --Noah
>
>
>
> "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Sessions don't work on command line and that is how you run your script
> > - from command line.
> >
> > CF High wrote:
> > > Hey Robert.
> > >
> > > Indeed, hard to find the problem.
> > >
> > > I don't believe it's a whitespace issue, or even a "Headers sent
issue",
> > > despite the fact that I'm receiving that error.
> > >
> > > Check it out:
> > >
> > > test.php contains just one line:  > > /path/to/my/php/test1.php`;?>
> > >
> > > test1.php, the file to be executed, contains just one line:
> > > 
> > >
> > > There are no line breaks, spaces, etc.
> > >
> > > Still get "Headers already sent".
> > >
> > > Pretty strange, right?
> > >
> > > Correct me if I'm wrong, but I think the problem may be related to the
> fact
> > > that when files are executed from the command line, php now looks for
> > > include_paths, session_paths, etc. relative to the server root; not
the
> site
> > > root.
> > >
> > > I can think of no other reason why include paths, starting sessions,
and
> so
> > > on, return errors from the command line but ork perfectly fine when
run
> in a
> > > browser.
> > >
> > > Feel free to clue me in -- I know didly about shell access issues.
> > >
> > > --Noah
> > >
> > >
> > > "Robert Cummings" <[EMAIL PROTECTED]> wrote in message
> > > news:[EMAIL PROTECTED]
> > >
> > >>On Sat, 2003-09-20 at 15:46, CF High wrote:
> > >>
> > >>>Hey all.
> > >>>
> > >>>I'm running a script from the command-line php interpreter as
follows:
> > >>>(thanks to D. Souza for lead)
> > >>>
> > >>>$text = `usr/local/bin/php /path/to/my/php/page.php`;
> > >>>
> > >>>within the read file I want to enable sessions, so I session_start()
at
> > >
> > > the
> > >
> > >>>top of the page:
> > >>>
> > >>> > >>>session_start();
> > >>>?>
> > >>> > >>>code to execute here...
> > >>>?>
> > >>>
> > >>>Regardless of how I mess around with placement of session_start(), I
> get
> > >
> > > a
> > >
> > >>>"Headers already sent".
> > >>>
> > >>>Why? Nothing has been output to the browser within the read file!
> > >>>Furthermore, if I create a test page with just:
> > >>>
> > >>>
> > >>>
> > >>>Still receive "Headers already sent".
> > >>>
> > >>>My eyes are completely fried -- anyone feel like saving my vision?
> > >>
> > >>This often is difficult to detect when there's is implicit output
> > >>outside of the  > >>script and see if there is any whitespace or newlines preceding the
tag.
> > >>
> > >>HTH,
> > >>Rob.
> > >>--
> > >>..
> > >>| InterJinn Application Framework - http://www.interjinn.com |
> > >>::
> > >>| An application and templating framework for PHP. Boasting  |
> > >>| a powerful, scalable system for accessing system services  |
> > >>| such as forms, properties, sessions, and caches. InterJinn |
> > >>| also provides an extremely flexible architecture for   |
> > >>| creating re-usable components quickly and easily.  |
> > >>`'
> > >
> > >

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



Re: Re[2]: [PHP] session_start() || shell access problem......

2003-09-21 Thread CF High
Finally!

Thanks Tom & Rasmus for pointing me in the right direction.

God, two days of bleary eyed searching -- enough is enough.  Thank you guys
for helping out a newbie.

--Noah


"Tom Rogers" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> Monday, September 22, 2003, 2:13:57 AM, you wrote:
> CH> H,
>
> CH> Well, is there a way to pass params to file_to_be_executed in command
line?
>
> CH> For example:
>
> CH>  CH> $my_param = 'my_include_path';
> CH> $text = `usr/local/bin/php /path/to/my/php/page.php`;
> ?>>
>
> CH> Somehow I need $my_param to be passed to page.php (the file to be
processed
> CH> in command line).
>
> CH> Any ideas?
>
> CH> --Noah
>
>
>
> CH> "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
> CH> news:[EMAIL PROTECTED]
> >> Sessions don't work on command line and that is how you run your script
> >> - from command line.
> >>
> >> CF High wrote:
> >> > Hey Robert.
> >> >
> >> > Indeed, hard to find the problem.
> >> >
> >> > I don't believe it's a whitespace issue, or even a "Headers sent
issue",
> >> > despite the fact that I'm receiving that error.
> >> >
> >> > Check it out:
> >> >
> >> > test.php contains just one line:  >> > /path/to/my/php/test1.php`;?>
> >> >
> >> > test1.php, the file to be executed, contains just one line:
> >> > 
> >> >
> >> > There are no line breaks, spaces, etc.
> >> >
> >> > Still get "Headers already sent".
> >> >
> >> > Pretty strange, right?
> >> >
> >> > Correct me if I'm wrong, but I think the problem may be related to
the
> CH> fact
> >> > that when files are executed from the command line, php now looks for
> >> > include_paths, session_paths, etc. relative to the server root; not
the
> CH> site
> >> > root.
> >> >
> >> > I can think of no other reason why include paths, starting sessions,
and
> CH> so
> >> > on, return errors from the command line but ork perfectly fine when
run
> CH> in a
> >> > browser.
> >> >
> >> > Feel free to clue me in -- I know didly about shell access issues.
> >> >
> >> > --Noah
> >> >
> >> >
> >> > "Robert Cummings" <[EMAIL PROTECTED]> wrote in message
> >> > news:[EMAIL PROTECTED]
> >> >
> >> >>On Sat, 2003-09-20 at 15:46, CF High wrote:
> >> >>
> >> >>>Hey all.
> >> >>>
> >> >>>I'm running a script from the command-line php interpreter as
follows:
> >> >>>(thanks to D. Souza for lead)
> >> >>>
> >> >>>$text = `usr/local/bin/php /path/to/my/php/page.php`;
> >> >>>
> >> >>>within the read file I want to enable sessions, so I session_start()
at
> >> >
> >> > the
> >> >
> >> >>>top of the page:
> >> >>>
> >> >>> >> >>>session_start();
> >> >>>?>
> >> >>> >> >>>code to execute here...
> >> >>>?>
> >> >>>
> >> >>>Regardless of how I mess around with placement of session_start(), I
> CH> get
> >> >
> >> > a
> >> >
> >> >>>"Headers already sent".
> >> >>>
> >> >>>Why? Nothing has been output to the browser within the read file!
> >> >>>Furthermore, if I create a test page with just:
> >> >>>
> >> >>>
> >> >>>
> >> >>>Still receive "Headers already sent".
> >> >>>
> >> >>>My eyes are completely fried -- anyone feel like saving my vision?
> >> >>
> >> >>This often is difficult to detect when there's is implicit output
> >> >>outside of the  >> >>script and see if there is any whitespace or newlines preceding the
tag.
> >> >>
> >> >>HTH,
> >> >>Rob.
> >> >>--
> >> >>..
> >> >>| InterJinn Application Framework - http://www.interjinn.com |
> >> >>::
> >> >>| An application and templating framework for PHP. Boasting  |
> >> >>| a powerful, scalable system for accessing system services  |
> >> >>| such as forms, properties, sessions, and caches. InterJinn |
> >> >>| also provides an extremely flexible architecture for   |
> >> >>| creating re-usable components quickly and easily.  |
> >> >>`'
> >> >
> >> >
>
>
> Try this
>
>  $args = '"hello world"';
> $text = `/usr/bin/php /usr/local/apache/htdocs/in.php $args`;
> echo $text;
> ?>
>
> in.php contains:
>
>  echo '';
> phpinfo(32);
> echo '';
> echo $_SERVER['argv'][1];
> ?>
>
> That should do what you want if I understand the problem :)
>
> --
> regards,
> Tom

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



[PHP] IE6 Session Problem

2003-11-28 Thread CF High
Hey all.

Hope this will help someone hours of useless searching.

Looks like out-of-the-box winXP machines running IE6 have session cookies
automatically disabled!

Ug, 24 hours slogging through newsgroups to stumble across this solution
myself.

If you have a login based site & rely on session(s), IE6 users will not be
able to log in unless they do the following:

1) Internet Options >> Privacy >> Advanced

2) Check the "Always Allow Session Cookies" checkbox

HTH,

--Noah


--

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



[PHP] Session Expiration Problem....

2003-12-03 Thread CF High
Hey all.

Our hosting company sets session vars to expire every 15 minutes.

I've setup an Admin Center for users to enter various types of information,
some of which, for example entering a basketball team roster, can take
slower users upwards of 25 minutes or more.

The result?  Admin user spends 25 minutes entering data; clicks the submit
button; then is redirected to the login page because their session
expired! -- all form data is lost -- not good

Is there a way to extend the php session timeout for particular pages?
Alternatively, is there a way, other than using cookies, to store user data
from page-to-page?

Thanks for any leads,

--Noah



--

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



Re: [PHP] Session Expiration Problem....

2003-12-04 Thread CF High
Hey Lowell.

H, no, not a particularly elegeant solution, but it must work for you.

I'm experimenting with >> ini_set('session.gc_maxlifetime', 4320);

Don't know if this will extend the session timeout; i.e. garbage collection
routine, I'm still testing it.

A total drag that our host limits session timeouts to just 15 minutes!

Must be a workaround for this...

--Noah



"Lowell Allen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > Our hosting company sets session vars to expire every 15 minutes.
> >
> > I've setup an Admin Center for users to enter various types of
information,
> > some of which, for example entering a basketball team roster, can take
> > slower users upwards of 25 minutes or more.
> >
> > The result?  Admin user spends 25 minutes entering data; clicks the
submit
> > button; then is redirected to the login page because their session
> > expired! -- all form data is lost -- not good
> >
> > Is there a way to extend the php session timeout for particular pages?
> > Alternatively, is there a way, other than using cookies, to store user
data
> > from page-to-page?
> >
> > Thanks for any leads,
>
> Yeah, I get occasional complaints about this problem -- although I don't
> have to contend with sessions expiring every 15 minutes! I've found that
> it's usually possible to use the browser back button to return to the form
> with all values still in place (Windows 98-IE6 being an exception), then
> open a new window to log in again, then return to the form window to
submit.
> Those instructions can accompany your "not logged in" message. Admittedly
an
> inelegant solution, but it's better than losing the form data.
>
> In my situation, I've considered rewriting the PHP script that's receiving
> the form post so that if the session has expired it will re-display a
> simplified version of the form (without showing protected content) with
the
> posted data, and provide a link to open a login form in a new (small)
> window.
>
> HTH
>
> --
> Lowell Allen

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



[PHP] Object Oriented Programming Book(s)?

2003-12-26 Thread CF High
Hey all.

I've got the O'Reilly "Programming PHP" & "PHP Cookbook" PHP books --
excellent PHP Resources -- however, the OOP sections are rather short.

I'm hoping to get my hands on a relatively in-depth OOP book.

It doesn't look like there are any PHP specific OOP books out there yet, so
any OOP books that will help a developing PHP programmer are much
appreciated

TIA & Happy Holidays,

--Noah



--

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



[PHP] md5() with rand() || Strange results, need help....

2004-05-13 Thread CF High
Hey all.

I'm running an online sport report that is member protected; i.e. users need
to login to gain site access.

When a new user signs up, I set their username to their email address &
generate a temporary password for them using rand() & md5():

$username = strip_illegals($_POST['email']);
$plain_pass = rand();
$password = md5($plain_pass);

I then insert their login info into our member's table.

Unexpectedly, when users attempt to login no matching record is found.

Their login submits two post fields (username & password):

$username = trim(strtolower($_POST['username']));
$password = trim(strtolower($_POST['password'));
$password = md5($password);

The username matches, but the password does not -- I've echoed the md5'd
submitted password & maddenlingly, it doesn't match.

I've had no problem using md5() before and am completely dumbfounded as to
why this is not working.

If anyone has any clues as to what might be happening; i.e. why the md5'd
submitted plain text password does not match the stored md5'd password,
please, please let me know.

The email complaints are piling up and I'm getting nowhere.

--Noah



--

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



Re: [PHP] md5() with rand() || Strange results, need help....

2004-05-13 Thread CF High
Their receiving the $plain_pass

$plain_pass is md5'd on login submit, so we should get md5($plain_pass ) =
db stored md5'd($plain_pass ).

Makes no sense at all.

Got a couple hundred emails in my inbox from users not able to login -- I'm
basically screwed ;--(

--Noah



"Curt Zirzow" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> * Thus wrote CF High ([EMAIL PROTECTED]):
> >
> > $username = strip_illegals($_POST['email']);
> > $plain_pass = rand();
> > $password = md5($plain_pass);
> >
> > I then insert their login info into our member's table.
> >
> > Unexpectedly, when users attempt to login no matching record is found.
>
> Are you sending them the $plain_pass or $password?
>
> > Their login submits two post fields (username & password):
> >
> > $username = trim(strtolower($_POST['username']));
> > $password = trim(strtolower($_POST['password'));
> > $password = md5($password);
> >
> > The username matches, but the password does not -- I've echoed the md5'd
> > submitted password & maddenlingly, it doesn't match.
>
> Other wise I'm reading this to say your system is evaluating
>
>   md5('foo') != md5('foo')
>
> as being true.
>
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] md5() with rand() || Strange results, need help....

2004-05-13 Thread CF High
password field is char (32)

Strange that the usernames are all properly set to the submitted email
address, but the password is not properly updated.

Correct me if I'm wrong here, but

$plain_pass = rand(); /* plain pass should be a random # */
md5($plain_pass); /* plain pass is a random # here and not another call to
rand() */

I went ahead and created a test user account for myself -- no problem at
all.  Received the login email, and logged in fine with the generated test
user username & password.

Perhaps it's a browser issue -- I am completely clueless at this point &
these hockey fanatics are filling up my admin inbox.

--Noah


"John W. Holmes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> CF High wrote:
>
> > If anyone has any clues as to what might be happening; i.e. why the
md5'd
> > submitted plain text password does not match the stored md5'd password,
> > please, please let me know.
>
> md5() results in a 32 character string. What kind of field are you
> storing it in?
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals – www.phparch.com

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



Re: [PHP] md5() with rand() || Strange results, need help....

2004-05-13 Thread CF High
Re: the browser track, it looks like all adversely affected users; i.e.
those who can no longer log in, have a browser of I.E. 6.0.

I know that in many cases I.E. 6.0 has session and cookie vars disabled by
default.

Is it possible, a long, long shot, that rand() behaves differently in I.E.
6.0 -- I know PHP is server side, but I'm looking for any clues

--Noah


"John W. Holmes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> CF High wrote:
>
> > If anyone has any clues as to what might be happening; i.e. why the
md5'd
> > submitted plain text password does not match the stored md5'd password,
> > please, please let me know.
>
> md5() results in a 32 character string. What kind of field are you
> storing it in?
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals – www.phparch.com

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



Re: [PHP] md5() with rand() || Strange results, need help....

2004-05-14 Thread CF High
It doesn't appear to be cookie settings either, nor auto-fill in.

I do not have auto-complete running; when I log in under an affected users
account, the stored md5($plain_password) does not match the submitted
md5($plain_password).

Could it be perhaps that md5() works differently with integers vs. a text
string?

God knows at this point,

--Noah

"Travis Low" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Besides checking the browser cookie settings, have one of the affected
users
> turn off the auto-fill form feature, then tell the browser to forget all
saved
> form information.  Let us know what happens.
>
> cheers,
>
> Travis
>
> CF High wrote:
> > Re: the browser track, it looks like all adversely affected users; i.e.
> > those who can no longer log in, have a browser of I.E. 6.0.
> >
> > I know that in many cases I.E. 6.0 has session and cookie vars disabled
by
> > default.
> >
> > Is it possible, a long, long shot, that rand() behaves differently in
I.E.
> > 6.0 -- I know PHP is server side, but I'm looking for any clues
> >
> > --Noah
> >
> >
> > "John W. Holmes" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >
> >>CF High wrote:
> >>
> >>
> >>>If anyone has any clues as to what might be happening; i.e. why the
> >
> > md5'd
> >
> >>>submitted plain text password does not match the stored md5'd password,
> >>>please, please let me know.
> >>
> >>md5() results in a 32 character string. What kind of field are you
> >>storing it in?
> >>
> >>--
> >>---John Holmes...
> >>
> >>Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
> >>
> >>php|architect: The Magazine for PHP Professionals – www.phparch.com
> >
> >
>
> --
> Travis Low
> <mailto:[EMAIL PROTECTED]>
> <http://www.dawnstar.com>

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



[PHP] Zlib Compression || Implementation || Bandwidth Savings?

2004-02-02 Thread CF High
Hey all.

Having a good problem -- our hockey report site has jumped from 10
gigs/month to 30+ gigs/month & growing.

We're getting killed in bandwidth fees at the moment; barring switching to
another host, will utilizing ZLIB compression significantly reduce
bandwidth?

Also, in terms of ZLIB settings, I've ini_set() zlib compression to ON.

Additionally, do I need to ob_start() (& flush) page output?

I am uncertain how to implement the following:

example.php



Thanks for any advice,

--Noah

--

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



[PHP] Re: Zlib Compression || Implementation || Bandwidth Savings?

2004-02-02 Thread CF High
H

Looks like the majority of sent bandwidth is html, not image files >> ratio
is at least 10:1 html to images.

With that in mind, setting zlib compression to ON seems the way to go.

Question is, how to implement compression?

Is it enough to just ini_set() zlib compression to ON? i.e. will all content
be automatically be compressed, or do I need to ob_start() & ob_end_clean()
at the start and end of each page?

TIA for any clues -- I'm obviously confused about compression
techniques.

--Noah



"Rush" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "Cf High" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Having a good problem -- our hockey report site has jumped from 10
> > gigs/month to 30+ gigs/month & growing.
> >
> > We're getting killed in bandwidth fees at the moment; barring switching
to
> > another host, will utilizing ZLIB compression significantly reduce
> > bandwidth?
>
> well it depends what uses most of your bandwith. If it is for images, then
> compression will not help much since images are allready compressed. In
that
> case, you may save much more if you can put images in some directory and
> tell apache to allow cacheing for that directory.
>
> On the other hand if your bandwith goes mainly on thransfer of html source
> for the pages then compression can shave up to 80% of your bandwith usage.
>
> rush
> --
> http://www.templatetamer.com/

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



[PHP] Re: Zlib Compression || Implementation || Bandwidth Savings?

2004-02-03 Thread CF High
Hey all.

No such luck re: just using ini_set() to compress pages

Rush's link is HIGHLY useful -- thanks Rush!

http://www.phpbuilder.com/columns/argerich20010125.php3?page=2

Works without a hitch in IE 5+ and NN 4.7+ with PHP 4.2.3

--Noah


"Ammar Ibrahim" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> if this works for you, could you please post your story in the group. this
> is very interesting if you could save 50% of your bandwidth just by
turning
> the zlib flag :)
>
> good Luck,
> Ammar
>
> "Cf High" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hey all.
> >
> > Having a good problem -- our hockey report site has jumped from 10
> > gigs/month to 30+ gigs/month & growing.
> >
> > We're getting killed in bandwidth fees at the moment; barring switching
to
> > another host, will utilizing ZLIB compression significantly reduce
> > bandwidth?
> >
> > Also, in terms of ZLIB settings, I've ini_set() zlib compression to ON.
> >
> > Additionally, do I need to ob_start() (& flush) page output?
> >
> > I am uncertain how to implement the following:
> >
> > example.php
> >
> >  > session_start();
> >
> > ini_set("zlib.output_compression","ON");
> > ini_set("zlib.output_compression_level",4);
> >
> > ob_start();
> >
> > $page_contents = fopen(** read file contents to variable **);
> >
> > ob_end_flush();
> > ?>
> >
> > Thanks for any advice,
> >
> > --Noah
> >
> > --

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



[PHP] Re: Zlib Compression || Implementation || Bandwidth Savings?

2004-02-03 Thread CF High
My lord, this rocks!

Our pages load at least twice as fast now, and bandwidth will likely be
reduced by at least a factor of 2.

I would strongly recommend utilizing zlib compression functions to anyone
looking to speed page delivery & reduce bandwidth!

--Noah



"Rush" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "Ammar Ibrahim" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > if this works for you, could you please post your story in the group.
this
> > is very interesting if you could save 50% of your bandwidth just by
> turning
> > the zlib flag :)
>
> if you check amount of data that gets transfered from
> http://www.moj-posao.net/ (once that images are cached, which is usually
> imediately after the first page is loaded) you will see that amount
> transfered is is in region of 10k, while the html source of the page is
> about 50k. You do the math :) It is also has a great effect on page
loading
> time for dial-up users.
>
> rush
> --
> http://www.templatetamer.com/

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



[PHP] Re: Search Engines || Dynamic Content || Apache Mod_Rewrite....

2004-02-23 Thread CF High
Hey all.

I've got a PHP-MySql database driven site setup in a shared hosting
environment that does NOT support apache mod_rewrite.

Is there a workaround for getting dynamic pages (e.g.
index.php?display=contact) indexed in major search engines without using
mod_rewrite?

Any clues very much appreciated.

TIA,

--Noah


--

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



[PHP] Re: PHP || MySql Directory Tree Problem......

2004-03-05 Thread CF High
Hey all.

I've developed a site builder application that allows my clients to build/maintain 
their sites without my having to deal with tedious web design tasks.

The current version has some problems, however.

To resolve these issues I've switched over to an MVC (Model-View-Controller) 
structured site.

Great results so far except for one problem: the site directory structure.

Currently I have all page ids & titles stored in my "site_tree" table.

The site_tree table has the following structure:

prime_id (int auto_increment)
parent_id (int)
layout (int)
secure (int)
pop_menu (char 1)
title (var char 200) 

Here's some example to data to clarify the purpose of this table:

  prime_id parent_id layout secure pop_menu title 
  2  0  2  0  Y  Resources  
  3  0  1  0  Y  Memberships  
  4  2 3  0  N  Children and Youth 
  5  0  3  0  N  Events  
  6  2 1  0  N Adult Education 


Rows 3 & 5; i.e. Children and Youth & Adult Education, correspond to the parent 
category, Resources, whose prime_id is 2.

So, each child category's parent_id is the prime_id of the parent category and each 
child can be a parent to many children.

One use of this structure is to auto build the javascript popup menu for the site 
navigation (the pop_menu flag is used for this purpose).

The problem I'm having is retrieving data from, for example, the products table:

  prime_id page_id copy product_type 
  1 4  Test 1  
  2 6 Test1 1  


The products table page_id equals the prime_id of the site_tree table.  

When I query for product data based on the product category; i.e. Resources, which has 
a prime_id of 2, there is no matching record in the products table (since the products 
table only contains specific items, not category data).

So, what can I do to join the site_tree table with the products table and other 
similarly structured tables?

Please email for further details -- there's likely stuff I'm leaving out.

TIA for ny clues re: site tree models.

--Noah
 



-- 
 


[PHP] Re: PHP || Create File (not upload) with ftp()?

2004-03-12 Thread CF High
Hey all.

I've been having ownership issues when writing files with fwrite(); i.e.
file owner is "nobody" while ftp'd files are owned by the site owner.

In order to streamline file management, I'd like to be able to write files
on our webhost server using PHP's ftp functions; not using fwrite() and the
like.

So, for example, let's say I have the following data to be written to file:

$test = "I'm test data";

How would I use ftp() functions to write $test to file on the webserver?

Any help much appreciated.

--Noah

--

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



[PHP] PHP 4.2.3 || Can't unset $_SESSION!

2004-03-28 Thread CF High
Hey all.

Strange problem here.

I'm running on apache 1.3.26 & php 4.2.3.

In a test page, test1.php, I set $_SESSION['checker'] = 1;

In another test page, test2.php, I unset($_SESSION['checker']);

When I print_r($_SESSION) in test1.php, $_SESSION['checker'] is still set &
still equals 1!

I've tried session_unregister($checker),
session_unregister($_SESSION['checker']), unset($checker), etc. -- none of
them unset this particular session var.  Very strange behavior.
Interestingly, I can set $_SESSION['checker'] = 0 (instead of 1) in
test2.php & that works fine when I print_r($_SESSION) in test1.php.

Any clues as to why this might be happening?

FYI, register globals is set to ON.

Let me know if you need further details.

TIA,

--Noah



--

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