RE: [PHP] Passing variable to the next page

2002-06-04 Thread David Freeman


  Here is scenario that I am working on but  have a problem.  
  I have 10 thumbnail images on the page with information for 
  them created from database. 

  (I am pulling more info about that image from database, but 
  on this page I only display Name of Image and  Author of 
  image, the rest of the info is stored in variables.)

  I want my users to click on the thumbnail. When they do I 
  want a new window to open and I want information for that 
  particular image that they clicked (along with other info 
  that stored in variables for the same image) to be passed to 
  that new opened page.  How can I pass information about that 
  particular image to the new page?  Any ideas? 

Speaking personally, I'd only extract the data you actually need to
display - it will lower your overheads (even if just a little) and you
won't be in a situation where you have to keep data around on the
off-chance that they click the thumbnail for more info.  Then if they do
click the thumbnail get the data you need from the database.  In this
scenario about the only thing you'd need to pass your new page would be
the ID number from the database - then just do a query for what you need
on the new page.

The more images you're dealing with, and the more information you
extract per image, the more effective this will be at saving you
overheads.

CYA, Dave



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




RE: [PHP] [PLEASE HELP] Passing variable to new page.

2002-06-06 Thread David Freeman


  echo script language=\JavaScript\;
  echo function pop1() {;
  echo window.open(\info.php?prod_id=$result[0]\); };
  echo /script;

  I am calling this function in the following manner: echoimg
  onclick=\pop1();\;

OK, I tend not to put javascript inside php echo statements as it
confuses things - which variables belong to which language.  Second, as
it stands, if I understand you correctly, it won't matter which image is
clicked on, you'll always get the same prod_id.  That's a logic problem.

  ?
  $myid = $_GET['prod_id'];
  echo Product ID: $myidbr;
  ?

You don't seem to be doing anything much on this yet - except trying to
display text.

Anyway, if you're serious about solving this why not start simpler and
work up.  Create yourself some html with the javascript in it to call
your new php page.  This way you _know_ what is being passed to your
popup.  If this doesn't work then you need to fix your javascript.  If
it does work you can start putting your php back into the first one and
see where it stops working - this will likely be what you need to fix.

In future please reply to the group rather than to me personally - and
no, I'm not going to write your code for you.

CYA, Dave



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




RE: [PHP] Thumbnail pages - alot of them

2002-06-07 Thread David Freeman


  I have a mysql database table of about 7000 images (they are 
  not actually in the db, just references), as yet 
  uncategorized.  I need to put them online and allow my 
  client to browse 12-18 thumbnails per page.
  
  what would be the most efficient method to code that with 
  PHP?  any help is appreciated!

Query your database to with an appropriate 'ORDER BY' and use 'LIMIT' to
get the number you want per page.

Display them to a page from within a 'while' loop.

Process as you require.

Include page navigation to do the next set.

What have you tried?  Are you having trouble with something specific?

If you're not sure what to do then perhaps downloading something that
will do it already will work - try www.hotscripts.com or perhaps
sourceforge.net or freshmeat.net as good places to start - or even just
do a search on google - I suspect searching for 'mysql php image
browser' would get you close.

CYA, Dave



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




RE: [PHP] convertion from string to time substracting

2002-06-07 Thread David Freeman


  I got a mysql database, where two of the fields of a table 
  record times as
  CHAR(8) in the format hh:mm:ss

This is one of those situations where having your database using the
most appropriate field types would help.  When you've got it as CHAR
there's little you can do in the way of comparisons in sql.  It's
probably as good a time as any to create a new column of type 'TIME' and
then create yourself a short php script to read in all your char-based
times and write them back to the database as time-type times.

Once you've done this you can use native MySQL time and date
calculations to do all the hard work for you.

  I want to take this two times and get the difference between 
  them in seconds, for example 12:01:30 - 12:00:00 = 90 I 
  looked up at the doc in the php.net website and couldn't get 
  on how to do this... should I use the strtotime function?

If you have some particular reason why you can't convert your columns to
time then you'll need to do some work on converting time formats in php
instead - this will most likely end up being more processor intensive
for any significant iterations of the calculations involved.

  anyone has donde something like this, or knows what 
  functions could help me to do this?

Mostly just using the right field types in sql to start with and then
using the wealth of functions available to you.

CYA, Dave



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




RE: [PHP] majordomo in php?

2002-06-07 Thread David Freeman


 Anyone knows of a majordomo type mailing list made with php   

   Why would you want to do that?  If you need mailing list software 
   you'd be infinitely better off using one that already exists - if
you 
   need features that it doesn't support (eg. A web front-end for 
   majordomo) then perhaps you could conribute that (and write it in
php 
   even).

  thanks Dave, that makes sense...
  
  i was just thinking of a mailing list totally controled 
  through email... Like people if they want to subscribe, they 
  send an email with subscribe in the subject, etc...

There are some things that are best done in certain ways.  I tend to
think that php is not the most appropriate way to do this particular
job.  Mailing list software, in particular, is a fairly complex piece of
software that needs to do a lot of things well or have major
consequences (I once witnessed over 800 instances of one message in a
mailing list because an admin email address on that list had been
slightly mis-configured).

There are a number of free packages that have been around long enough to
have any serious problems ironed out.  I would tend to suggest that
you're better off going with one of those than trying to write something
new.

Of course, that presumes a desire to have a mailing list rather than a
desire to learn how to write such software.  If you do want to write
such software you'll have to decide which MTA's you want to support and
then get comfortable with how those MTA's work so you can interface your
software to them.  You'll also have to understand their security models
so you can do it without having them become a possible spam source among
other things.

CYA, Dave



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




RE: [PHP] strip_tags bug ?

2002-06-07 Thread David Freeman


  The minor problem is that it treats a not-equals sign, 
  , as an empty tag and strips it, unless it's explicitely 

...etc...

Except, of course, that when writing html you are supposed to use
entities for any valid html stuff - ie. Use gt; and $lt; for   and so
on.  As you should also use quot; if you want a  in your html.  The
fact that various browsers will let you get away with this does not make
it valid html.

The argument above it a little like saying that there's a bug in php
because it will get confused if you have  marks inside your  marks...
Eg.

$string = fred said wow to me;

By your argument this should work because php should figure out what you
mean with multiple instances of .  You have a way of making it work
that is well documented.  Ditto for html.

Of course, this doesn't stop inummerable people who, I presume, don't
know any better, from usingand other stuff instead of their
equivalent html entities.

CYA, Dave



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




RE: [PHP] dynamic pull-down menus?

2002-06-07 Thread David Freeman


  That sounds very close to what I'm trying to do.  Is it 
  necessary to reload the page every time a selection is made? 

I've found examples of the javascript side of it on www.irt.org that
helped last time I did this sort of thing.  The php/sql stuff is a
matter of figuring out what you need to extract and refining your
queries with each new menu to get the right data.

The need for page reload sorta depends on how much you want to load up
the page - the more select menus you have the more possible iterations
you get and, therefore, the more data you need to include in your page.
Beyond a certain point you may find that you're better off doing a page
reload and refreshing your select data rather than including it in the
original page.

   Do you have examples of this that work with multiple 
  pull-down menus?

Once you have a double selection it shouldn't be a big task to extend.
You may find it easier to start with by just using html/javascript and
then adding the php/sql once you know the html/javascript is working
fine - just keeps complexity down while you're working it out.

CYA, Dave



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




RE: [PHP] e-commerce example

2002-06-08 Thread David Freeman


  I'm looking for  e-commerce example (PHP+MySQL) so I don't 
  start from zero and save some time.

You could try searching for php mysql commerce on any of the
following:

www.google.com

www.freshmeat.net

www.hotscripts.com

Where you'd probably find what you're looking for.

CYA, Dave



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




RE: [PHP] Re: Date?

2002-06-09 Thread David Freeman


  Speaking of which.  I was thinking about this this morning.
  Is there a part of the Unix timestamp that tells php what 
  timezone to 
  report.

You could use the gmt-based date manipulation to do this.

  Reason why I ask, is I would like to offset the unix 
  timestamp relative 
  to where a server is to a particular user.
  So lets say the user is in Europe, and the server is in USA and the 
  script is set to display date as 'H:i T', and

Your main problem will be in identifying where the user is.  Probably
the only truly reliable way is to ask them to tell you what their time
zone is.  Pretty much every other method will result in a percentage of
inaccurate reporting - the degree of error will be dependant on the
method chosen.

CYA, Dave



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




RE: [PHP] Calendars

2002-06-10 Thread David Freeman


  I am trying to feature a calendar on a web site. I would 
  like it to display on a page and be able to change to 
  another month when this is requested and display items for 
  the general public. I want the client to be able to go into 
  the database and update the items and those items to appear 
  on the site. Is there something outthere already packaged like this?

I've got an older version online (with a tar.gz of the code I use) at
calendar.outbackqld.net.au although it's old now and the new version
(which you can view at www.isisford.qld.gov.au) isn't quite ready to be
packaged up as an archive for release yet.

If it looks like something you're interested in then let me know and I
could package up what's there - it's just not real portable in the newer
form yet.

CYA, Dave



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




RE: [PHP] the curse of the period

2002-06-11 Thread David Freeman


  The directory and file name:
  museum/trees/admin/upload2.php
  
  The directory I want to store the uploaded file is:
  museum/landmark/photos/

I've found that if you need more control over directory paths than
something fairly simple then you're often best off just declaring a set
of full paths and using them.  For example, I often use a config.php to
setup database connections and the like.  If I know I'm going to need to
access files in different directories from different parts of a site
I'll usually add something like:

$server_root = /home/www/some/web/site;
$web_root= http://www.some.server;;

Then if you need to do an include somewhere you can be sure that
something like this:

Include($server_root/museum/trees/someinclude.php);

Will work.  Equally, referring to a default images directory can be
reliable also by using $web_root.

CYA, Dave



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




RE: [PHP] GOTO command. Doest it exist?

2002-06-11 Thread David Freeman


  I do beg your pardon... But  does PHP not have GOTO command?

Why do you need one?  In my experience, going right back to BASIC over
10 years ago, it's rarely _necessary_ to have a goto.

In php I suspect you'd get similar functionlity out of either include()
for creating functions.

Not using goto tends to promote readability of program flow also, always
a good thing imho.

Each programming language is different and each has it's own advantage,
disadvantages and is particularly suited to certain uses.  A good
programmer works with the tools available rather than worrying over
language differences.  Just my own opinion and I don't really expect
anyone else to agree.

CYA, Dave



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




RE: [PHP] Include question

2002-06-11 Thread David Freeman


  somefile.php
  ?
  $apple = 'green';
  $pear = 'yellow';
  ?
  
  callfile.php
  ?
  include 'somefile.php';
  echo Apples are $apple and Pears are $pear; \\ which would 
  return the 
  line with green and yellow in the correct spots.
  ?
  
  But when I just do
  
  ?
  include 'somefile.php';
  ?
  
  It prints:
  $apple = 'green'; $pear = 'yellow':

Looks to me like your include file isn't being interpreted as php for
some reason.  Is the information here your exact test case or is it
different.  Certainly, as you've got it here, it would work - at least
it does for the numerous php projects I've done.

CYA, Dave

--
--
Outback Queensland Internet   
Longreach ** New Web Site Online *
Queensland
Australia W: www.outbackqld.net.au




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




RE: [PHP] Else/For loop

2002-06-12 Thread David Freeman


  Being relatively new to php, I discovered the following 
  after about 2 hours of debugging last night and was wondering why???
  
  I had the following code:
  
  if ( $num_results = 0 )
  {
   echo no records found;
  }
  else
  {
   for ($i=0; $i  $num_results; $i++)
   {
   display record set
   }
  }

  The duduction...for loops will not work inside else 
  statements. The question...why?

Your deduction is wrong, they do.  If this is the code that you're
actually using then I suspect that your problem is more in the
conditional you've got in your 'if' statement.  You aren't doing a
compare you're actually setting $num_results to 0.  A comparison is '=='
rather than just '.

--
--
Outback Queensland Internet   
Longreach ** New Web Site Online *
Queensland
Australia W: www.outbackqld.net.au


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




RE: [PHP] Querying for MAX

2002-06-12 Thread David Freeman



  What I’m trying to do here is not inside PHP nor MySQL books 
  I have. I need to query the DB to look the max result in a 
  column. That is, if I have affiliate members with ID going 
  from 1 to 10, get the query to know that the last member 
  added was 10 so I can add member 11 without using 
  auto_increment, because I need to insert old members too 
  which already have ID numbers. Is that possible?

This is really a mysql question rather than a php question and would
probably be more appropriate to a mysql list.  In any event, if you
seriously think auto_increment is not your solution here you probably
need to rethink your database design.  This is exactly what
auto_increment is for.  If someone is already in the list then you can
get their ID with a select and then do an update on their row, if
someone doesn't exist then you add them and ID auto_increments in the
process.

--
--
Outback Queensland Internet   
Longreach ** New Web Site Online *
Queensland
Australia W: www.outbackqld.net.au


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




RE: [PHP] Extracting from an Array

2002-06-12 Thread David Freeman


  I have a db field, type varchar, that is actually a 'date' 
  string formatted as dd-mm-. I used type 'varchar' (rather than 
  type 'date') since I had to accomplish other things with it.

  Now, however, I do need to extract the Year (the last four 
  digits in the array).

Ummm, are you sure it's an array?  How are you extracting the date
string from your database?  Normally you'd end up with a string when you
extract a varchar field from a database.

  I've tried to access the array $_SESSION['expiry'] but I don't know 
  how to explode this array to extract all characters

I take it you are setting this session variable from the date
information in the database?

Is the code that sets the session variable changing the format of the
database information at all?  If not then you should still have your
date in the form 'dd-mm-' shouldn't you?

  Is there a way of extracting all characters in that array?

I'm not sure you have an array to deal with unless you're talking about
the result of exploding your text string.

If you've exploded your string and are now trying to deal with the array
then, given what you've said, $array_name[2] would probably contain the
year.

Alternately, if you've got the string to work with you might find it
just as effective to do this:

$year = substr($full_date_string, -4);

This will grab the last four characters from the string which, in your
case, would be the year.

CYA, Dave


--
--
Outback Queensland Internet   
Longreach ** New Web Site Online *
Queensland
Australia W: www.outbackqld.net.au


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




RE: [PHP] possible to add a record number to a query?

2002-06-13 Thread David Freeman


  I would like to have a column returned in a query that tells 
  you which record I'm looking at?  Sort of like an 
  auto_increment?  IOW, the query results would look like:
  
  record   first   last
  
1  johndoe
2  joe blow
3  carol   fisher
  
  The table only has first and last, but I want the results to 
  add something like record to tell me which record it is.  

This is an sql question rather than php.

When you get your data include record as one of your select criteria...

Eg. Select record, first, last from my_table

CYA, Dave



--
--
Outback Queensland Internet   
Longreach ** New Web Site Online *
Queensland
Australia W: www.outbackqld.net.au


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




RE: [PHP] truncating dilema

2002-06-13 Thread David Freeman


  It has just occured to me though that if I'm to list maybe 
  100 news items with descriptions it means alot of memory 
  right because i have 100 items containing:
  date
  title
  text (could be any length)
  
  I will use substr() in my php to format the descriptions but 
  I thought I'd ask here if anyone had a *better* suggestion?

Use mysql's substring as part of your query - consult your friendly
local mysql manual for more details.

CYA, Dave


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




RE: [PHP] confused newbie on PHP and Javascript.

2002-06-13 Thread David Freeman


  I have a JavaScript function that onChange of a list box, 
  takes the value of an option and grabs data from a MySQL 
  table. My problem is how do I use the JavaScript var in my 
  sql statement?

Javascript is client-side, php is server-side.  The only way to get
something that happens in javascript to interact with something that
needs to happen on the server is to reload the page and, in doing so,
pass those variables back to the server.  The main ways you would pass
variables back to the server are either GET args in a url or POST args
from a form.

Perhaps your onChange needs to include an implied submit so that the
form data can be passed back to the server.


--
--
Outback Queensland Internet   
Longreach ** New Web Site Online *
Queensland
Australia W: www.outbackqld.net.au



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




RE: [PHP] string to array?

2002-06-13 Thread David Freeman


  I have a string something like 10.2.3
  I want to be able to use the . as a delimiter to reference 
  the elements (10, 2, and 3).

  My thought was to create an array, using . as the 
  delimiter. Is there a function that will create an array out 
  of a string, using a delimiter you specify?

$my_array = explode(., 10.2.3);

--
--
Outback Queensland Internet   
Longreach ** New Web Site Online *
Queensland
Australia W: www.outbackqld.net.au


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




RE: [PHP] Extracting Variables

2002-06-13 Thread David Freeman


  echo i = $ibr;
  for($c=1;$c=$i;$c++){
   echo team_number $team_number_$cbr;
   echo sub1_$c = $sub1_$cbr;
   echo sub2_$c = $sub2_$cbr;
   echo sub3_$c = $sub3_$cbr;
   echo sub4_$c = $sub4_$cbr;
   echo sub5_$c = $sub5_$cbr;
   }
  }

Perhaps this:

Echo sub1_$c = $sub1_$c[$c];



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




RE: [PHP] mysql_num_rows always returns 1?

2002-06-18 Thread David Freeman


   $query = select count(*) from users where 

You are asking for a count() in your query.  This will always give you
one row returned with a count.  If you really want to do this you should
probably have:

  $query = select count(*) as usercount from users where

Then you can do your tests based on the value of usercount.

Alternately, you could do something like this:

  $query = select * from user where

And then use mysql_num_rows() to see how many users you got.  In this
case, no matches will result in no rows returned.

CYA, Dave




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




RE: [PHP] insert date with a calendar

2002-06-20 Thread David Freeman


  user input, which is not always reliable, has to be in the correct
format.

What I've done for things like this is to have three separate select
form elements.  The first for selecting a day of the month.  The second
for selecting a month and the third for selecting a year.  I usually set
the year options based on the requirements - as in, if it's a mostly
current event then I set the valid options for year to be current year
minus two through to current year plus five.

CYA, Dave




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




RE: [PHP] include() question...

2002-06-20 Thread David Freeman


  Okay, let's say I want to send a user to a certain webpage...
  
  usually I would use...
  
  include(website.php);
  
  but, if i want to send a user to a website along with a 
  variable like...
  
  $temp = website.php?var=.$var;
  include($temp);
  
  ...this doesn't work.  

If you are just including the file in what's already loading then all
you need to do is make sure that $var is already set when you include
the file.  Including is logically the same as opening up the other file
and then doing a copy/paste into the current page.  It's exactly the
same as if the contents of your included file was in the file that's
doing the including.

If you are actually trying to load a new page and pass a variable to it
then you probably want to look at using header(Location:
website.php?var=$var); instead.  This will actually load a whole new
page in the browser rather than just including an extra file in a page
that's already being loaded.

CYA, Dave



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




RE: [PHP] Stumped on a function

2002-06-21 Thread David Freeman


  function cleandate($indate) {
   str_replace(-, /, $indate);
   return date(F j, Y, strtotime($indate));
   }

I suspect that you actually need something like this:

function cleandate($indate) {
  $indate = str_replace(-, /, $indate);
  return date(F j, Y, strtotime($indate));
}

Although, to be honest, you can probably get away with:

function cleandate($indate) {
  return date(F j, Y, strtotime($indate));
}

And, ultimately, you may even find that you're better off just doing the
date manipulation in mysql instead and leave it at that.

CYA, Dave



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




RE: [PHP] checkboxes

2002-06-22 Thread David Freeman


  I know this might be a bit easy for all you experts out 
  there.  I have multiple checkboxes and text areas in a form.  In the 
  confirmation email sent to the user I manage to get the text areas to
display 
  in the email. How would I get the results of the  checkboxes to to
display as well?

Here is a page I wrote to explore form processing.  It has a simple form
on it that includes each type of form element (except file upload) and
displays back all input.  It can also be used as a form target and it
will tell you what form elements were submitted.

It was written some time ago and I haven't updated it for the latest
version of PHP so it will most likely require register_globals to be on.

-8-
html
head
titleOQI - CGI Reflector/title
/head
body bgcolor=#F5F5F5 text=#00 link=#99 vlink=#6600CC

?

if ($HTTP_POST_VARS)
{
echo h1 align=\center\font face=\Arial,Helvetica\CGI
Reflector/font/h1\n;
echo centerfont face=\Arial,Helvetica\ size=2\n;
echo Here are the results of the form that you have just
submitted:\n;
echo /font/center\n;

echo centertable width=500 border=0 cellspacing=5
cellpadding=5\n;
echo tr\n;
echo th align=center width=200 bgcolor=\#D0DCE0\\n;
echo font face=\Arial,Helvetica\ size=2Form Input
Name/font\n;
echo /thth align=center width=300 bgcolor=\#D0DCE0\\n;
echo font face=\Arial,Helvetica\ size=2Form Input
Data/font\n;
echo /th\n;
echo /tr\n;
while(list($key, $val) = each($HTTP_POST_VARS))
{
echo tr\n;
echo td align=center width=200 bgcolor=\#D0DCE0\\n;
echo font face=\Arial,Helvetica\ size=2$key/font\n;
echo /tdtd align=center width=300 bgcolor=\#D0DCE0\\n;
if (is_array($val))
{
while(list($sval) = each($val))
{
echo font face=\Arial,Helvetica\
size=2$svalbr/font\n;
}
} else {
echo font face=\Arial,Helvetica\ size=2$val/font\n;
}
echo /td\n;
echo /tr\n;
}
echo /table/center\n;
} else {
echo h1 align=\center\font face=\Arial,Helvetica\CGI
Reflector/font/h1\n;
?

form name=FormExample action=?=$PHP_SELF? method=post
centertable width=500 border=0 bgcolor=D0DCE0 cellpadding=5
cellspacing=0
tr
td width=500 align=center colspan=2 bgcolor=#E5E5E5
font face=Arial,Helvetica size=3Test Form/font
/td
/trtr
th width=200 align=right bgcolor=D0D0D0
font face=Arial,Helvetica size=2Text/font
/thtd width=300 align=left
input type=text name=TextInput value=Text Input Text
size=30 maxlength=50
/td
/trtr
th width=200 align=right bgcolor=D0D0D0
font face=Arial,Helvetica size=2Select/font
/thtd width=300 align=left
select name=SelectInput
option value=1 selectedFirst Option/option
option value=2Second Option/option
option value=3Third Option/option
/select
/td
/trtr
th width=200 align=right bgcolor=D0D0D0
font face=Arial,Helvetica size=2Multi-Select/font
/thtd width=300 align=left
select name=MultiSelect[] size=3 multiple
option value=1First Option/option
option value=2Second Option/option
option value=3Third Option/option
option value=4Fourth Option/option
option value=5Fifth Option/option
/select
/td
/trtr
th width=200 align=right bgcolor=D0D0D0
font face=Arial,Helvetica size=2Check Box/font
/thtd width=300 align=leftfont face=Arial,Helvetica
size=2
input type=checkbox name=CheckBox1 value=1Check Box
1br
input type=checkbox name=CheckBox2 value=2Check Box
2
/font/td
/trtr
th width=200 align=right bgcolor=D0D0D0
font face=Arial,Helvetica size=2Radio Button/font
/thtd width=300 align=leftfont face=Arial,Helvetica
size=2
input type=radio name=RadioButton value=1Radio
Button 1br
input type=radio name=RadioButton value=2Radio
Button 2
/font/td
/trtr
th width=200 align=right bgcolor=D0D0D0
font face=Arial,Helvetica size=2Text Area/font
/thtd width=300 align=leftfont face=Arial,Helvetica
size=2
textarea name=TextArea width=30 rows=4Default
Text/textarea
/font/td
/trtr
td width=500 align=center colspan=2 bgcolor=#E5E5E5
input type=submit name=Submit value=Submit Form
input type=reset name=Reset value=Reset Form
/td
/tr
/table/center
/form

?
}
?

/body
/html
8-



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




RE: [PHP] php JavaScript

2002-06-24 Thread David Freeman

  I've tried to include a simple javascript in a .php file, 
  but couldn't get it to work.
  
  Actually not even the php code worked at all...
  
  Is there any specific configuration flag that needs to be
  set up in the Apache server so that the javascripts work
  correctly? 

Not particularly, but if you could show some sample code of what you're
doing...

FWIW, I include javascript stuff in my php all the time.

CYA, Dave




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




RE: [PHP] Testing PHP on a local machine

2002-06-24 Thread David Freeman

  I want to set up a site at home to play with php
  
  I have windows xp pro, dreamweaver MX and mysql
  
  Do I need anything to view live application data locally in 
  my browser

You'll need to install a web server that supports php and php itself.  I
did this recently on my XP Pro laptop using Apache and MySQL and PHP
with no problems.  I installed Apache from a download from
www.apache.org and used it's installer - worked fine.  Then installed
php as downloaded from www.php.net and followed the install instructions
that are included with it - also worked fine.  Then installed MySQL the
same way and it worked too.  Apache and MySQL will install as services
and run in the background all the time.  They take up under 3MB of RAM
when doing this.

CYA, Dave



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




RE: [PHP] Seperating presentation from logic

2002-06-26 Thread David Freeman


  ? // general_config.php
  
  $siteTitle
  
  $colBg = #FF;
  $colText = #FFCC99;
  $colLink = #EE;
  $colComplimentary = #CC6600;
  
  
  $fontHeading = FONT class=\heading\ face=\verdana, arial\
  size=\3\;

Wouldn't you ultimately be better off moving most of this sort of thing
into style sheets and then have the designers play with the style sheets
instead?

What I tend to do is define style classes for various functional areas
in my web sites and then my designer can figure out the design aspects
based on those constraints.  When you get down to it style sheets help
you to stay consistent in your layouts - after all, you do want all your
body text to be the same don't you?  So if you define a bodytext class
and then code that into your back-end it is always going to be that way.
If the designer then decides that they want Times New Roman instead of
Comic Sans as the body font they can change it in the style sheet and
everything else changes accordingly.

CYA, Dave




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




RE: [PHP] PHP not working on Apache at XP Pro.

2002-06-26 Thread David Freeman


  I've got Windows XP Pro OS. I installed and am running
  mySQL on that. 

  However, PHP is not getting configured with Apache on
  it. I got the latest Apache, 1.3.24 or something, not
  the Version 2. Anyway, Apache runs perfectly on it.
  However, when i put in the required PHP lines in
  httpd.conf and install PHP otherwise on the system. 
  What happens is that i get an error stating that :
  mod_c.php already exists, skipping
  
  Now when i remove that line, PHP does not work with
  Apache. If i insert that line, APACHE itself doesn't
  work at all. What is wrong with it?

I've just recently done pretty much exactly that on my XP Pro Laptop.  I
must admit that I found the install.txt text file in the php zip archive
that I downloaded from php.net to be just fine for getting it all
working.  In the end it took me something less than 20 mins to install
and test the whole thing once I had all the archives downloaded.  If you
are getting errors I'd suggest going back and reading the install.txt
again and checking that you followed the steps in it exactly - I did and
it works.  As the install file suggests, start more simply by excluding
the extra modules until you're sure the base install is working - I did
this and I suspect it helped.

CYA, Dave




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




RE: [PHP] Seperating presentation from logic

2002-06-26 Thread David Freeman


  Wouldn't you ultimately be better off moving most of this sort of
   thing
  into style sheets and then have the designers play with the style
   sheets instead?

   What if your designer wants to change from a two column 
  table to a four column table. Or change the menu from a vertical
column on 
  the left to a horizontal row on the bottom that's run by images
instead of text. 

  Actually, I think the idea behind what the previous poster 
  was saying is that:
  a) with stylesheets they don't need to touch the HTML once they've 
  finished with it (and handed it over to you for PHP work)
  b) you therefore won't need templates

Mostly my original comment above was in relation to someone's response
where they said they had defined a whole stack of variables for each
file (eg. $fontMain, $fontCopyright and so on) and my point was
specifically in relation to that.  Certainly, for layout and other
aspects a style sheet is not the whole solution but when it comes to
display elements such as fonts and colours I'd have to say that it _IS_
the solution.

CYA, Dave




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




RE: [PHP] Javascript to PHP?

2002-06-29 Thread David Freeman


  My apologies if this has been asked a thousand times. I've 
  just joined the list.

I has, but you get that...

  I can't find any information on passing JavaScript variables 
  to PHP on the same page (i.e. not through the POST information of a 
  submitted form). Is this because it's not possible?

Short answer is no.  PHP is server-side, Javascript is client-side.  You
can get variables from php to javascript when your php generates the
page to be sent to the browser but you can only get variables back from
php when you use browser to server communications (that's usually a form
- be it get or post method, or a cookie).

  To take the load off the server, I'm trying to do a bunch of string
  manipulations and loops in JavaScript and then hand that 
  info off to PHP once it's done.

You'll need to create all the javascript from you php page as it
generates and then wait for it all to be done client-side and submitted
back to the server.

CYA, Dave




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




RE: [PHP] include files or fopen

2002-06-30 Thread David Freeman


  I am trying to write a program that is very modular in 
  nature  one of the
  features I need the user to be able to do is install/uninstall or
  enable/disable the module though the interface.

I have, in the past, stored such information in a database.  In projects
that have need of such functionality I create a modules table and use
that to store what information I need - normally that's a path to the
module, the name of the config file for that module and any other
relevant bits that the project as a whole needs to know about.

Then when a page loads it can check for any appropriate modules in the
process and deal with them accordingly.

CYA, Dave




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




RE: [PHP] mySQL time = year 2038 [SOLVED]

2002-07-01 Thread David Freeman


  Yep, I was using the DATE() function in PHP to convert a 
  TIMESTAMP from a MySQL DB query. I was getting a year of 
  2038 because MySQL and PHP use different TIMESTAMP formats.

   $getmyTime = mysql_query(SELECT UNIX_TIMESTAMP(timestamp_col)
AS yournamehere FROM 
  myDBnamehere WHERE id = $whatever)
or die(Invalid query);

If you mainly need to output a date in a particular format you might
find it more effective to use mysql's date formatting capabilities.
Have a look in the manual for the section on DATE_FORMAT() which will
let you get the date out of your table in just about any format you
desire.

CYA, Dave




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




RE: [PHP] FW: Help please!

2002-07-02 Thread David Freeman


  id 3 from the database. What I really want is to state width 
  is 100 and height is 100 for example so I do not have to downlaod the
entire
  picture and specify the width and height as part of the image:
   
   Do not want 
   img src=getdata.php?id=3 width=100 height=100
  
   WHat I want
   img src=getdata.php?id=3width=100height=100
  
   WHich will be a lot quicker on the client side.

This won't really change speed on the client side at all - the image is
the size that the image is.  Changing it's display size won't change the
file size.

Having said that, if you're looking to set a standard width and height
for an image loading in a particular location then you could probably
just do this:

  img src=getdata.php?id=3 width=100 height=100

...which should do what you want.  If you actually want the real width
and height of the image then you're probably going to have to do some
pre-processing to work out the width and height first and then include
them in the image tag.

CYA, Dave



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




RE: [PHP] Button can't see form!

2002-07-05 Thread David Freeman


  The problem I have is with a page I build dynamically. The 
  whole page is encased in form/form tags. In between these tags
there 
  are sections echoed as a result of a databasse query. Each of these 
  sections is a form.

  form name=addproduct
  
  table
  !-- loop round result set creating a form for each row --
  form name=detail
dynamic content
  /form
  form
dynamic content
  /form
  form
dynamic content
  /form
  /table

[etc]

To the best of my knowledge you can't nest forms like this.  Even if you
can I'd suggest it's bad practice as you'll all too easily run into
problems and complexity issues (eg. Having to specifically name each
form etc).  I'd suggest finding a different way to achieve what you want
(more forms most likely).

CYA, Dave




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




RE: [PHP] Best String to Array Solution

2002-07-11 Thread David Freeman


  Greetings, this may be simple, but it's late and my brain 
  needs a hand.
  
  I have a string such as first,second,third,fourth
  
  I need a way to take each one of the items separated by the 
  comma to be an item in an array.

Check out explode() and I think you'll find what you need.

CYA, Dave




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




RE: [PHP] PHP/MySQL -- Date/Time Confusion

2002-07-12 Thread David Freeman


  Which method is the best way to store date/time in MySQL and 
  then which PHP
  command is the best to use to convert that date to something 
  useful?

Get comfortable with MySQL's date functionality and you'll find that you
don't often need to do the date comparisons and manipulation in php at
all.

MySQL lets you store date/time stuff as date, time or timestamp formats
(off-hand, haven't referred to the manual here) that will store the data
for you.  You can manipulate this date information in your sql query
using things like DATE_FORMAT() and the like.  Check the MySQL manual
for all of those (chapter 6 or 7 I think it is).

If you're mostly doing data extraction based on date criteria then
you'll find it works best as sql queries basically.

CYA, Dave




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




RE: [PHP] mysql LIMIT

2002-07-14 Thread David Freeman


  can I use limit to show the 2nd record on without knowing 
  how many more records there might be?
  
  also, what happens if I set the limit in a mysql statement 
  (LIMIT 5,10), but there are only 3 results? 7 results?

My answer would tend to be that you should try it for yourself and
see...

But anyway, without having tried it myself recently, the first question
is that you could use LIMIT (2, 1) and you'd probably get what you're
trying for.  As for the second question, you'll only get what records
there are.  If your limit excludes all possible results then you'll get
no result (ie. If you use LIMIT(5, 10) and you've only got 3 records,
then you won't get anything back at all.  If you've got 7 records then
you'll get the last 3 of them).  But in all honesty, you could have
worked this out for yourself fairly quickly with some simple testing of
your own.

CYA, Dave




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




RE: [PHP] retrieving random data from mysql database

2002-07-14 Thread David Freeman


  can you teach me how to retrieve random data from my 
  database? like for example...i have a list of names on my 
  database and i'd like to retrieve only one name at a 
  time..randomly. how do i go about this?

This is really a database question rather than a php question and you
haven't said which database you're using so it's hard to give a
definitive answer.  In MySQL you'd do something like this:

Select * from some_table where some_condition order by RAND() limit 1;

That would select one random row out of all rows that meet
some_condition.

CYA, Dave




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




RE: [PHP] retrieving random data from mysql database

2002-07-15 Thread David Freeman


  When you say, 
  Order by RAND()
  I would think the Order by  construct expects a column name.
  In your case, it gets a decimal value.
  How does Order by treat decimal values?
  Oh, I just checked the manual:
  In MySQL Version 3.23, you can, however, do: SELECT * FROM 
  table_name ORDER BY RAND() 
  I still don't understand how does Order by work with a 
  decimal value!!!

I don't pretend to have all the answer.  I just know that I had reason
to work this one out for myself a while back and when I consulted the
MySQL manual it gave sample code on what to do in MySQL to achieve this
result.  I accepted that fact and used it.  I haven't needed any deeper
information on this one so I haven't looked.

I suspect if you really want to know how it works then you'll have to
ask this question again on a MySQL-specific list - and perhaps even a
MySQL developers list.

CYA, Dave




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




RE: [PHP] Inclusion error

2002-07-16 Thread David Freeman


   Failed opening '/var/www/html/BOOKS/newbooks.php' for inclusion
   (include_path='.:/php/includes:/usr/share/php') in Unknown 
  on line 0
   
   I am getting the following error, when the file 
  newbooks.php is invoked.
   The first lines in this entire file starts with the ?php 
  tag, followed by
   4 lines of comments. What could be the problem here.

At a guess I'd say you've got something in your code that looks
something like this:

Include(some/path/newbooks.php);

You'll need to check the 'some/path' bit to see if that is where the
file 'newbooks.php' is actually stored. Making another guess based on
the above I'd also check that 'BOOKS' is the right directory name,
particularly keeping in mind that 'BOOKS' is a completely different
directory to 'Books' and to 'books' on a unix system.

CYA, Dave




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




RE: [PHP] redirecting after login

2002-07-23 Thread David Freeman

  what doesn't work is after they login to Page 1, the 
  redirect sends them to 
  Page 2 and right back to Page 1 because the global session 
  isn't staying 
  registered.

Are you putting session_start() at the top of each page where you want
to be able to use the session stuff you've set?

CYA, Dave




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




RE: [PHP] datetime field - still a newbie

2002-07-24 Thread David Freeman

  I have a datetime field in one of my mysql tables...when 
  displaying some of
  my records I want to display the date in the aforementioned 
  datetime field,
  but if the date is today I want to display today instead.  
  If the date is
  yesterday I want it to display that  so I how do I 
  compare the date in
  my record to todays date? Thanks

First up, extract your date as part of your query in a standard format -
if you're looking to do date manipulations you're probably going to be
benefit from extracting it as a unix timestamp.

Once you've got your date information, along with whatever else you're
extracting, you can then process it in php.

You'll most likely have some sort of while() loop to increment through
your query data.

While you're incrementing through you can do an test the date
information against today and yesterday.  Have a read of the php
manual for date() and mktime() as you'll almost certainly need to use
these two functions.

Basically what you'll need to do is test to see if the date information
from your database query is the same as your date information based on
working out what today or yesterday are when expressed in the same
format as the date information from your database.

The rest is pretty much display stuff - substitute date information for
appropriate words as required.

Hope that heads you in the right direction.

CYA, Dave




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




RE: [PHP] Paying Job...

2002-07-25 Thread David Freeman


  Do you charge by the page, script or by the hour (that would 
  be nice).

We do this sort of thing in, basically, one of three ways...

1.  Client gives us a budget and we give them a clear idea of what that
budget will get them.

2.  Client gives us a good idea of what they want to achieve and we
provide a quote to get them there.

3.  Client gives us all the content they have and we go to it and write
an invoice for our work when we are done.

Number 3 is pretty rare.  For 1 and 2 we always get approvals on the
work as we go and we always work to the budget that we've got (either
from their end or from our quoute).  Documenting what is covered within
the quote is important so that you have a way to increase the invoice if
the client comes back asking for added features that were not originally
included.

We've found that most clients like the idea of a fixed fee so they know
what they are up for.  The key to doing this is to make sure that you
don't end up losing out by not making clear what that money will buy.

CYA, Dave




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




Re: [PHP] date problem

2002-04-28 Thread David Freeman

On 28 Apr 2002 at 14:48, Nick Wilson wrote:

 I have a field in MySQL db like this: date TIMESTAMP, 
 and it looks pretty regular like this: 20020428011911

If you've got the data in your database then do the date/time 
conversions as part of your sql query - it's more efficient.

Something like this would work:

$qid = db_query(SELECT DATE_FORMAT(TimeStamp, '%e %b %y') AS 
DispDate FROM sometable);

That will extract your timestamp as DD MMM  from memory - have a 
look at the MySQL manual under the chapter on selects and date/time 
formatting and you'll get the complete list of '%x' options you can 
use.

CYA, Dave


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




Re: [PHP] Weird/inconsistent behaviour when sending an empty file? (WAMP, Apache2, PHP 4.2.0)

2002-04-28 Thread David Freeman

On 28 Apr 2002 at 17:54, Moritz Schallaboeck wrote:

 it might very well be an ignorant oversight, but I can't explain the following 
 behaviour. Consider a file containing -only- this code:
 
 -snip-
 ?
 
 ?
 -snip-

[etc]

Just a personal opinion here... if you're sending output to a browser 
that is not formatted as a valid web page then you can't rely on what 
will work, or not work, for any given browser.  IE in particular is 
very good at fixing broken html as it loads a page and this can 
hide otherwise serious problems with html.

If you're going to output something to a browser then you _really_ 
should make sure it's valid html.  At the very least that would mean 
including:

html
head/head
body/body
/html

in a page.  What you do after that is up to you.  At least if you 
include that much you'll get a valid web page and pretty much every 
browser will no what to do with it.

CYA, Dave


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




Re: [PHP] failed query results

2002-04-28 Thread David Freeman

On 28 Apr 2002 at 13:48, baldey_uk wrote:

 $customer_id_check=(SELECT id FROM $customer_table WHERE firstname =
 '$firstname'  lastname = '$lastname'  email = '$email');
   $result1=mysql_query($customer_id_check);
   if (!$result1) {
  print theres no such customer!;
   }

if (isset($result1)  !empty($result1)  mysql_num_rows($result1) 
== 0)
{
  print no customer;
}



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





Re: [PHP] Auto refresh when data changed in Mysql

2002-04-28 Thread David Freeman

On 28 Apr 2002 at 20:32, Simonk wrote:

 I have added the code, but it turn out :
 
 Warning: Cannot add header information - headers already sent by (output
 started at C:\Inetpub\php\hospital_equipment.php:5) in
 C:\Inetpub\php\hospital_equipment.php on line 6

[etc]

 Here is my full HTML code:
 
 html
 head
 titleEquipments' Detail/title
 head

[etc]

 header (Expires: Mon, 1 Jan 1990 05:00:00 GMT);// Date in the past
 header (Last-Modified:  . gmdate(D, d M Y H:i:s) .  GMT);
   // always modified
 header (Cache-Control: no-cache, must-revalidate);  // HTTP/1.1
 header (Pragma: no-cache);

Put this stuff up above your html and it will most likely work.  
You must put header stuff before any other output including white 
space (tabs, spaces, new lines etc).

CYA, Dave



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




RE: [PHP] Re: NameVirtualHost breaks PHP

2002-04-28 Thread David Freeman

On 28 Apr 2002 at 16:11, Greg Blakely wrote:

  Can you indicate Apache settings regarding php and virtualhosts?
 
 In the main server configuration area, I have:

[etc]

 ### and then, under the VirtualHost area, I have:
 
 VirtualHost *
 Port 80
 AddType application/x-httpd-php .php4 .php3 .phtml .php
 AddType application/x-httpd-php-source .phps
 ServerAdmin [EMAIL PROTECTED]   
 DocumentRoot /home/tcrc/www/forum
 ServerName forum.tcrconline.com
 ErrorLog /home/tcrc/logs/error_log
 CustomLog /home/tcrc/logs/access_log combined
 /VirtualHost

get rid of the AddType lines in your virtual host definition.  You 
don't need them.  Settings in your main config area will be inherited 
by your virtual host config.

When you change this stuff, don't forget to restart apache for the 
changes to take effect.

CYA, Dave


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




Re: [PHP] GET question

2002-04-28 Thread David Freeman

On 28 Apr 2002 at 23:30, Evan wrote:

 I pass parameters via querystring in this way:
 page.php?ID=5ID=6ID=23
 
 In $_GET[ID] I get only the value 23 

Unless you set ID as an array, which you haven't, you'll only keep 
the last value.  The simple answer is to have something like:

page.php?ID1=5ID2=6ID=23

although there's quite a few other solutions depending on what it is 
you're trying to do.

 Is there a way to make things working to have a sequence of values separated
 by commas?

Probably, but it's probably more effective to let us know what you're 
trying to do.  There's probably better ways to achieve the end result 
you're after.

CYA, Dave


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




Re: [PHP] Supplied argument is not a valid MySQL result resource

2002-04-28 Thread David Freeman

On 28 Apr 2002 at 15:14, Dan McCullough wrote:

  What does that error mean?
 
 $result = mysql_query('select * from aannh_towns;'); 
 echo 'info stored'; 
 while ($query_data = mysql_fetch_array($result)) {
  echo , $query_data['town'], , $query_data['town_id'], ; } 
 ? 

Means you stuffed up your sql query.  If you've copied it down right 
then I'd say you need to ditch the ';' from your query.

CYA, Dave


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




Re: [PHP] redirection

2002-04-28 Thread David Freeman

On 28 Apr 2002 at 19:11, Norman Zhang wrote:

 I want to set up a check that the page cannot be exacted by calling from
 another page. E.g., members.php can only be excited if it called by
 login.php.

If your login page does some sort of authentication and then either 
sets a cookie or a session variable or something you can check for 
that instead.  If there's no valid login (cookie, session, whatever) 
then redirect back to the login page.

CYA, Dave



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




Re: [PHP] append line to text file HELP !!!

2002-04-28 Thread David Freeman

On 29 Apr 2002 at 0:26, Rodrigo wrote:

 Ok guys, this is the code and under it you can see what I get when I try
 to submit the form. 
  
  
 ?php
 $file_pointer=file('emails.txt','a') || exit;
 $string_to_write = ($newmail).\n;
 $s=fopen($file_pointer,$string_to_write);
 $s=fclose($fp);
 ?
  
  
 Warning: Supplied argument is not a valid File-Handle resource in
 /home/restricted/home/h4ck3r/public_html/write.php on line 4
 
 Warning: Supplied argument is not a valid File-Handle resource in
 /home/restricted/home/h4ck3r/public_html/write.php on line 6 
 

I haven't actually checked your code on my development box and I 
haven't done file i/o for a while so this does not address any syntax 
errors that might exist, but...

What is the operating system?  Do you have sufficient permissions to 
be writing files in that directory?  What permissions are set on the 
file you're trying to append to?

If you can't work with files in that directory because of directory 
permissions then it won't work.  If the file has permissions that 
prevents the web server process from accessing it then you also won't 
be able to get it working.

CYA, Dave


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




Re: [PHP] lookin for a Menuing System...

2002-04-28 Thread David Freeman

On 29 Apr 2002 at 15:11, Dan wrote:

 what I need is a menuing system..

 Much like this JavaScript one... except I need it in PHP...
 http://www.dynamicdrive.com/dynamicindex1/navigate1.htm

Umm, you want to have to reload a whole page just to expand a 
navigation menu?  Not real good use of resources I'd suggest, to say 
nothing of irritating people browsing your site.  PHP is server-side, 
every time you do something it has to go back to the server to 
generate more html.

Do it in JavaScript, it works and it's client side so it will be 
faster.

CYA, Dave



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




RE: [PHP] lookin for a Menuing System...

2002-04-28 Thread David Freeman

On 29 Apr 2002 at 14:05, Martin Towell wrote:

 javascript should be easy enough to convert to php - thier language
 constructs are basically the same.

Sure, but that doesn't mean it's appropriate.  A menu system done in 
php will have the advantage of being, from the browsers point of 
view, plain html mostly.  The disadvantage is that every change to 
that menu will have to be done server-side, meaning a page reload 
even if that's the only content that changes on the page.

A menu system done in javascript won't require a reload but will, as 
Miguel points out, potentially break on systems where javascript is 
unavailable for whatever reason.

In the end you should always be coding pages to degrade 'gracefully'. 
 Even if you use a javascript navigation system there should still be 
a working menu system if javascript is not available.

CYA, Dave



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




Re: [PHP] lookin for a Menuing System...

2002-04-28 Thread David Freeman

On 28 Apr 2002 at 23:03, Miguel Cruz wrote:

  Do it in JavaScript, it works and it's client side so it will be 
  faster.
 
 But take care - using JavaScript for site navigation is tricky business. 
 Some people don't use it, some people can't use it (not supported by their 
 browsers / hardware / corporate policy), and search engines certainly 
 won't follow those links.

True.  In the end you've got to take that sort of thing into account 
and code pages that will degrade gracefully when using features that 
may not be available in all browsers.

CYA, Dave



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




Re: [PHP] lookin for a Menuing System...

2002-04-28 Thread David Freeman

On 29 Apr 2002 at 0:46, michael kimsal wrote:

 Can someone point me to hardware that is still in active use that can't 
 handle javascript?

Hardware?  No.

 Similarly, can someone point me to a company that specifically disables
 javascript as 'corporate policy'?  Back in 96-97, the 'no javascript' 

Hmmm, not specifically.  Although, I can think of at least one large 
organisation with a WAN that would have thousands of computers that 
specifically _ADDS_ their own javascript-based navigation to the top 
of every single page in the browser.  This particular behaviour will 
break any javascript mouse-over that doesn't specifically name, and 
use by name, mouse-overs.

The point in a network the size of the Internet you just don't know.  
A good web programmer is going to take into account that some people 
will deliberately disable javascript.  For those people you get a 
choice.  Either ignore them or take them into account.  It's your 
decision.  Just because everyone else does it is not enough reason.

Few web designers take the blind into account when designing but that 
doesn't mean it's right.  In fact, here in Australia the Sydney 
Olympics web site was the subject of (winning if I recall) legal 
action over it's inaccessibility to the blind.

There are ways to make sure your wonderful web design will still work 
if javascript isn't present.  There are design rules that will leave 
your website mostly navigable to people using text-based browsers.  
There are ways to degrade capabilities gracefully, and ways to 
disable badly.

An example of badly is to basically tell someone to bugger off 
because they don't have 'xxx' (where 'xxx' is whatever technology you 
want to use, be it javascript, java, flash, etc, etc).  If they can 
figure out you don't have it and give you a message about it then 
they can insert something that leaves the site functional - even if 
not as nice an experience.

 IMO, it's now like targetting only websafe colors because some people 
 might only browse in 256 colors.  If they do that, about 80% of the 
 web's content will look like crap anyway, and they won't specifically 
 think my stuff looks all that much worse than anyone else's.

Depends on your audience.  I fair percentage of computer owners never 
adjust their screen resolution from whatever it was delivered at.  If 
the store left it at 800x600x256 then they will never change it even 
if it's capable of more.  I know of at least one organisation that 
was running 17 monitors at 640x480x256 because that's how they were 
set up when delivered!  Weren't they surprised when we changed it for 
them...

CYA, Dave


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




Re: [PHP] parsing mail files

2002-04-29 Thread David Freeman

On 29 Apr 2002 at 8:24, Michael George wrote:

 I am looking for some sample code that will parse a file in Unix mbox format.

How much control do you have over the system the mbox lives on?  You 
might find it easier to do at least some of the pre-processing as a 
shell script before feeding it to php.  There are a number of command 
line tools in linux that let you manipulate an mbox - including 
stepping through each message, for example.

CYA, Dave



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




Re: [PHP] MS SQL problem

2002-04-29 Thread David Freeman

On 29 Apr 2002 at 14:14, Joshua E Minnie wrote:

 if(user_exists($dbname,users,user,$user)  0) {

echo the variables to make sure they are what they should be.

 function user_exists($dbname, $table, $field, $value) {

echo the variables to make sure they are what they should be.

   $query = SELECT $field FROM $table WHERE $field = '$value';

echo your select to make sure it looks like it should.

   $rows = mssql_num_rows($result);

echo the result to make sure it looks like it should.

Doing the above will probably find your problem for you.

CYA, Dave



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




Re: [PHP] Cannot add header information

2002-04-29 Thread David Freeman

On 29 Apr 2002 at 13:02, Bo Pritchard wrote:

G'day Bo

 I know without the accompanying code there's no way to help me...But without
 having to get real specific what does the following message tell me is
 wrong?

 Warning: Cannot add header information - headers already sent by (output
 started at /home/omnidevi/omnidevices-www/s-cart/form.phtml:4) in
 /home/omnidevi/omnidevices-www/s-cart/shop-head.phtml on line 44

You can only send header information once at the start of a page.  If 
you do anything that sends header information it _has_ to happen 
before any other output - this includes white space (tabs, spaces, 
etc) and any html output.

A reasonable rule of thumb is to do all your header stuff right at 
the top of your php file.

CYA, Dave



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




Re: [PHP] create textfile if not existing?

2002-04-29 Thread David Freeman

On 29 Apr 2002 at 22:49, Hawk wrote:

 lets say I have 30 lines of text and I want to store it in a folder called
 txt with the filename $name.txt and, if $name.txt exists, create a
 $name1.txt or similiar?

What is it that you are trying to achieve?  It sounds like you're 
trying to store temporary data and there's better ways to go about 
that.

CYA, Dave



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




RE: [PHP] Defining PHP varibles from URL

2002-05-05 Thread David Freeman


-Original Message-
script language=php
$file = ;
//the above is defined from the url
include $file;
/script
It could be what I was typing in the url bar.
file.php?file=foobar.inc
-Original Message-

Hmm, so you define $file in your url as foobar.inc and then, in the
page itself you take change $file to be .

At least, that's how I'd read it.  I'd suggest, it's not an overly good
idea to include a file like this as someone else has already mentioned.

In any event, your fix would have to be something like this:

script language=php

If (!isset($file) || empty($file))
{
  $file = some file;
}
Include $file ;

/script

That way you're only going to over-write the contents of $file if it's
already either unset or empty.

CYA, Dave



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




RE: [PHP] Who's having a good hosting experience these days?

2002-05-05 Thread David Freeman


  My hosting service which WAS cool about 2 years ago has 
  grown into a bloated mess of zero logic.

Fast, Reliable, Cheap, Feature-Rich

Now pick any three.

In the end I guess you get what you pay for.  If you can only afford a
lower price host then you only get lower value.

CYA, Dave


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




RE: Re[2]: [PHP] HTML to mysql - from msql to html

2002-05-05 Thread David Freeman


  now i am having problems with spaces
  
  text is:
  ---
  bla bla bla  foo
  ---
  
  and shows:
  ---
  bla bla bla foo
  ---

Plain old HTML ignores white space.  You do understand this?  To include
what you want you'll need to substitute spaces for non-breaking spaces
(nbsp;) but I wouldn't advise it.  I'd be suggesting that if your
content requires such things that you reconsider how you are doing your
content.

CYA, Dave



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




RE: [PHP] Please, can you help me?

2002-05-05 Thread David Freeman


  I have a big problem and cannot find the answer anywhere, so 
  please, help me if you can. When I use fwrite() function on 
  webserver, it sometimes happens, that more then one user 
  accesses the file and the result is, that the file is 
  corrupted or truncated.

I suspect that flock() would be of use, consult the php manual for it's
use.

CYA, Dave



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




RE: [PHP] Tailing a log file {!?}

2002-05-05 Thread David Freeman


  Is there a tail util for NT/W2K?

Almost certainly there will be a tool that will read the end of files.
The problem will be in what you want to look at.  If you want to look at
log files on NT/2K then, AFAIK, they aren't actually vanilla text files
so a tail util won't do the job.  I'm not actually sitting near an NT/2K
box at the moment so I can't check that for certain.

CYA, Dave



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




RE: [PHP] Defining PHP varibles from URL

2002-05-06 Thread David Freeman


-Original Message-
I don't mean to be a pain but could someone send me a working example?
-Original Message-

This was replied to already by me and others.  Didn't you read the
replies?

In any event, here's what I wrote last time...


-Original Message-
script language=php
$file = ;
//the above is defined from the url
include $file;
/script
It could be what I was typing in the url bar. file.php?file=foobar.inc
-Original Message-

Hmm, so you define $file in your url as foobar.inc and then, in the
page itself you take change $file to be .

At least, that's how I'd read it.  I'd suggest, it's not an overly good
idea to include a file like this as someone else has already mentioned.

In any event, your fix would have to be something like this:

script language=php

If (!isset($file) || empty($file))
{
  $file = some file;
}
Include $file ;

/script

That way you're only going to over-write the contents of $file if it's
already either unset or empty.

CYA, Dave


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




RE: [PHP] Formatting Information in header? Gridlines in Excel

2002-05-06 Thread David Freeman


  -Original Message-
  Can someone tell me where to find the various options for 
  the Header function as it relates to M$ Excel?
  -Original Message-

As far as I know, you can't.  Headers are for html/http information not
for any particular helper application.  If you want to have control
over the configuration of Excel you'll have to learn to output your data
as a valid Excel spreadsheet with the relevant formatting information
included - this would obviously involve knowing a fair bit about the
data structure and format of .xls files.

CYA, Dave



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




RE: [PHP] Sorting, sort of

2002-05-06 Thread David Freeman


  -Original Message-
  I have about 50 records with the following fields:
  'gen', 'year', 'color', 'name', 'email', 'location', 'misc', 
  'pic1', 'pi c2', 'pic3', 'pic4'
  -Original Message-

If you're going to be changing your database, you might also consider
what to do with 'picX'.  As it stands you've got a max of four pics, but
what if you later decide on a max of 5 or reducing it to 3?

I'd actually separate them out to their own table and just have an ID
reference that points them to your user data and the 'picX' data as the
second field.

The you can use a join to get all the information and you aren't limited
by your database structure to any set number of 'pic' records.

...and now that I'm completely off-topic I think I'll finish here.

CYA, Dave



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




RE: [PHP] File upload problem

2002-05-06 Thread David Freeman


  -Original Message-
  D'oh!  You're right, I went back and checked php.ini and 
  found upload_max_filesize but it's already set to 200M, I'm 
  assuming that means 200 MegaBytes.  So I don't think that's 
  the problem.  I don't have the hidden tag set in the page 
  code so that shouldn't be a factor either, right? I'm a real 
  rooky at php programming.
  -Original Message-

  INPUT TYPE=hidden name=MAX_FILE_SIZE value=2048000

You actually _need_ that hidden tag set AFAIK.

CYA, Dave



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




RE: [PHP] Redirect after submit

2002-05-06 Thread David Freeman


  -Original Message-
  I have a page that contains multi If ElseIf statements.  I 
  want to redirect right after a user submits gets a message 
  (echo Entry Added to Database. \n; )  would you like to 
  add another. then prompts for an alert.  Would you like 
  another ???  and redirects to a page based on selection.
  -Original Message-

The moment you output anything to your page you can't do an automated
redirect using the header() function.

If you need to output something and then do a redirect automatically
then you're going to have to start fiddling quite a bit.  The first
thing that springs to mind would be inserting a meta refresh in your
head but this won't help if you have a conditional redirect.  The
second would be to do it in javascript where your alert box determines
what url to go to and you use that javascript to do the navigation
(perhaps by simulating a form submission).

CYA, Dave



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




RE: [PHP] File upload problem

2002-05-07 Thread David Freeman


  -Original Message-
  I'm curious, I keep seeing people say that that tag is 
  /necessary/, but I've never had to use it in the upload forms 
  that I've built and they work just fine in Opera, NN  IE. 

Good question.  To be honest it's been a while since I looked, I built a
file upload function as part of a standard set of functions that I
include in projects and then stopped worrying about it.  As a result
it's been a some time since I looked at that sort of thing.  I recall
including it for a reason but don't exactly recall the reason.

  AFAICT from the manual that tag is only to advise the 
  browser to limit the size of the file being uploaded, 
  nothing to suggest that the absence of the 
  tag would prevent uploading.

I guess that anything that causes this sort of thing to happen on the
browser is going to help.  I know I'd be fairly unimpressed if I sat
waiting for a 2MB file to upload only to find that the limit is 1.5MB or
some such.  At least if a client-side limit is given the browser can do
something about it.

Not that I actually recall testing that either - I've so far only used
file upload capabilities on intranet projects where I have fully
switched 100MB and the like.

CYA, Dave



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




RE: [PHP] Error messages

2002-05-07 Thread David Freeman

  really nice error message. I put it below. Is this a PHP 
  function/mode/config option or where these things written by 
  the people who maintain PHP on that site?

  MySQL Error : Connection Error
  Error Number: 1045 Access denied for user: 'icon@localhost' 
[etc]

A little of both I would guess.  The site designers would have used the
error reporting functions available to derive the information displayed
and then incorporated that design into the actual pages you see
displayed.  You wouldn't expect to get a page with that information
without having coded it first.

Having said that, I'd be a little careful of providing that much
information in an error message on a production (and publicly available)
web site purely because it may provide enough information for someone to
attack or compromise the site.

CYA, Dave



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




RE: [PHP] Self Destruct code

2002-05-07 Thread David Freeman


  basically I will be left at their mercy; if they don't pay, 

  So, is there any way I can inconspicuously code in some 
  boo-boo's that are time related etc.

I'd suggest that you have a legal or business practices issue rather
than a technical one.  Do you have a signed contract or work agreement?
What are the terms and conditions laid out in it?  If you don't have one
then perhaps you should look at having one.  At a minimum I'd be
suggesting that such terms and conditions need to address the issues of
copyright over the work produced, significant way points or
development stages, completion deadlines and payment schedules.

If you deliberately sabotage the work you have done you might end up in
a poor legal position yourself (leaving aside personal feelings of being
able to get back at someone for a moment).

If you don't have such things in place then perhaps suggesting a part
payment or some other alternative will work.

Ultimately, there are no real technical solutions to anything but
technical problems and I don't think the situation you're describing
falls into that category.

CYA, Dave


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




RE: [PHP] File upload problem

2002-05-07 Thread David Freeman

  -Original Message-
  Hmm, after a bit of testing I find that the MAX_FILE_SIZE 
  tag is useless to say the least (probably because no browsers support
it?)

That's somewhat of a shame I guess but I can hardly claim to be
surprised - especially as I've just spent much of my time in the last
couple of days wrestling with browser rendering compatibility issues for
a client's web site - from which my only significant conclusion was that
Netscape sucks.

  1) you still have to wait for the whole 5MB to be uploaded
  2) php sees the MAX_FILE_SIZE setting is exceeded then 
  discards the file

An opportunity to do something lost - although I guess you might be able
to do some javascripting to achieve the same.  But then, that wouldn't
require you to have the hidden field either.

CYA, Dave



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




RE: [PHP] Genus who came up with Self Destruct Code Copy Pro tection

2002-05-09 Thread David Freeman


  I was talking in general. The BBS was simply an example to 
  make things clearer. I am *not* developing a BB system! 
  If you want you can think of a immaginary tool that makes 
  a website load twice as fast, need the half web 
  space and makes the website look nicer, of course at lower 

OK, if you're producing something with a significant commercial value
then spring for the dollars to pay for zend encoder and use it.  Seems
like some people want it both ways - my code is different and unique and
has commercial value in and of itself but I'm not prepared to spend real
dollars to protect it, I want free code to do that.

I suspect that many people in this situation have an overly high opinion
of their code and, in reality, there are open source or free
alternatives that do much the same (albeit elegant and easily
customisable or whatever) and, as such, not worth spending the money on
zend.

CYA, Dave



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




RE: [PHP] problems with form/form

2002-05-09 Thread David Freeman


  a table with several contents, and I have a form on every 
  row, the problem is that the form is to big, so the tab le 
  looks ugly, I tried with everything I could come up with, 

The form/form tags imply a break which adds space vertically.  It's
contrary to doing good html and will most likely cause errors in an html
validator but about the only way I've found to get around it is to bury
your form/form somewhere that the implied break won't do anything.
If you're using a table then between the table and tr or between
/tr and /table is a pretty good place.

CYA, Dave



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




RE: [PHP] Genus who came up with Self Destruct Code Copy Pro tection

2002-05-09 Thread David Freeman


  Obviously most coders are in the middle ground.
  They are not writing the killer app of all time
  but is of significant value.  I don't know what
  people on here are charging but I can't add $2880
  a year to my overhead for the zend encoder.  Plus
  add $1875 per cpu for the zend accelerator for
  each project.

My personal opinion is that your code is either worth protecting or
it's not.  If it's worth protecting then that protection comes at a
price.  Sorry, commercial reality time here.  If you are going to
operate on a commercial basis then you have commercial decisions to
make.  This is one of them.

  So you're bidding for a project and the guy asks,
  Let me get this straight, you're charging me more
  then everyone else and I won't be able to edit the
  code?  I think you would simply pricing yourself
  out of the market.

If that's what you're going to do then yes.  Ask yourself what people
like ISC (the people who do bind and sendmail do to make a living -
after all they have seriously commercial quality products available for
free) or people like RedHat (who give away their linux distro for nix if
you want to download it, or pay a small fee to whatever company
downloads it and sells CD-R burns of the iso's).  People can, and do,
make money giving away their code.

When you figure out how they are doing it, and the philosophy behind it,
then maybe that will ease these fears.

I can pretty much guarantee that if you come up with a killer app in
php that no matter how protected it is you will not be the only one with
a version of killer app for long.  Someone else will come along and
write something similar - if that person does it open source then
there's also a fair chance it will end up being better than your product
due to shear weight of numbers contributing to it.

In the end all this, and more, are your decisions.  Of course, if you
choose not to do this commercially then it's a whole different setup
with different goals and so on.

For the record, I pretty much release what I do to anyone who wants it.
Not that my efforts are of a standard that they are worth all that much
per se - they are often fairly specific to the project at hand and not
overly portable (in their released format).

I do have one intranet application under development for my own business
that may well end up with a strong commercial basis but it will never be
a single product but part of a much larger package my business is
currently planning.  Even then, the code associated with that project
may end up open sourced in some way.

Let's face it, there's even a move to replicate the zend encoder in open
source.

As has already been said, there also has to be a level of trust between
you and your client(s) if you are going to do business with them.  If
your clients see you as overly paranoid about your work they may end up
not wanting to deal with you anyway.

If you're that paranoid about losing control of your work offer it on a
complete solution basis - either you host it on a machine that they
have no back end access to or you provide the hardware as well as the
software and have it locked out in such a way that the code is not
easily stolen.  Although, even here you'll sooner or later be
compromised I would think.

CYA, Dave



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




RE: [PHP] problems with form/form

2002-05-10 Thread David Freeman


  I've only just picked up on this thread, but why not put 
  each form inside a td element?
  
  i.e.
  table
   tr
   tdform ... /form/td
   tdform ... /form/td
   /tr
  /table

A closing /form includes an implied p so if you keep it inside your
td/td you'll end up with extra space in your cell.  If your table
has no different backgrounds or whatever then this probably won't matter
all that much but if you're using colours or images as backgrounds in
your table cells then it may will stuff up your nice layout.

CYA, Dave



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




RE: [PHP] Genus who came up with Self Destruct Code Copy Pro tection

2002-05-10 Thread David Freeman


  So I should buy a commerical product from zend to
  protect my code but since my code will be reversed
  engineered anyways then what's the point of buying
  from zend?

That's your choice.  It's also my point.  If you can't be 100% secure
then perhaps you should be looking at what you're trying to do.

Some observable facts:

1.  Some companies remain, from what I can tell, highly successful and
can give away their source code for free.

2.  Some companies remain, from what I can tell, highly successful
without giving away any of their source.

3.  Some companies fail, even if they are giving away their source.

4.  Some companies fail, even if they don't give away their source.

The conclusion I draw from that is that protecting or giving away your
source is not a single make or break decision for a company.  Rather,
there are a myriad of decisions involved, of which the status of any
source code is but one.  Protect it, don't protect it, by itself it
doesn't mean squat.  In association with other things it might.

For example, if you aren't prepared to pursue, in the courts as
necessary, your closed source proprietary code then sooner or later
someone will figure that out and take it for their own use.  Do you
think Microsoft would be as successful if it wasn't as agresive about
protecting it's intellectual property?

Speaking only for myself, I believe the effort involved to be not worth
it, so I have no current intention of trying to protect, encode,
conceal, booby trap or whatever any of my code.

What you do is your business.  You'd probably do well to understand the
implications first - what are you protecting?  Why?  How far will you go
to protect it?  Will you take legal action?  Etc etc etc

CYA, Dave



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




RE: [PHP] Layout Help

2002-05-10 Thread David Freeman


  Anyway, I have a stack of 76 playlists I need to consolidate and 
  display. These are from radio shows, so each playlist has 
  the date, the name of the radio show, and anywhere from 20 - 27
tracks, 
  artists, and albums on them.

It's really more an sql question than a php question but...

Have a table that contains dates and names of shows.

Have another table that contains artists.

Have another table that contains songs.

Have another table that contains tracks.

Each of these also has an ID in addition to the other data in the table.

Have a linking table that contains artist ID's and song ID's.  This
lets you, for example, look up all songs for a particular artists or,
potentially, all artists for a song.

Have another linking table that contains song ID's and album ID's.  This
lets you relate songs to albums and, through the previous table,
artists.  This way, though, you can have compilation albums with
multiple artists on a single album.

Last of all create another linking table with song ID's and show ID's.
This gets you songs for a show but, through the other linking tables you
get information on everything else.

For any additional information just store it in the relevant table (ie.
If you want to keep track of song lengths then it would go in the songs
table, if you wanted artist bios that would be in the artist table and
so on).

You'll obviously need to be doing a fair number of joins in your queries
but it will give you a more versatile structure.

Then write your php for the interface (oh, the easy bit, and finally
some mention of php, does that make this message on-topic now?)

CYA, Dave



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




RE: [PHP] Alternating table rows...

2002-05-10 Thread David Freeman


  I've been asked if I can alternate the colors of the 
  rows to make the report more legible.

What I usually do is something like this:

if ($colour == blue) $colour = red else $colour = blue;

Then the bit where you actually output display you use $colour to set
display attributes and away you go.

CYA, Dave



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




RE: [PHP] randomize?

2002-05-10 Thread David Freeman


  I have a group table with 16 items, and I want them to be 
  randomly put in 4 different groups, with 4 in each group, 
  I've seen the $rand(x,x) thing, but is there any way to 
  limit to 4 in each group without 47839 rows of code? :P

Wouldn't you just randomise all 16 items and take them on at a time to
fill your table?

CYA, Dave



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




RE: [PHP] Best way for date/time

2002-05-11 Thread David Freeman



  Okay so I've then got
  
  2002-05-08
  and whats then the best way to manipulate it regarding
  plus 3 days or plus 4 weeks ?

Do it in your sql query - check out the date manipulation stuff in the
sql manual - it's quite comprehensive and tells you what you need to
know.

CYA, Dave



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




RE: [PHP] MySQL and RH 7.2

2002-05-11 Thread David Freeman


  I tried locate and find and both come up empty for mysqladmin.
  Am I missing something stupid here?

How did you install it?  Did you build from source or use rpm's?  If you
installed from rpm's which ones did you install?  From memory there's
about four rpm's that you'll need to have everything.  Mysqladmin, again
from memory, is in one of the '-client' rpm's.

CYA, Dave



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




RE: [PHP] random order

2002-05-12 Thread David Freeman


  hmm it got a little more complicated now,
  i have a table with: id title question answer1 answer2 
  answer3 answer4. how can i use all of those in a php page 
  but only randomize the answers?

You have multiple questions with the same answers?  Then split your
table into two tables and put all your answers in one and your questions
in the other.  Then include another table that contains question and
answer id equivalents.

CYA, Dave



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




RE: [PHP] random order

2002-05-12 Thread David Freeman


  I have a mysql databse with 4 rows, and each row (row1, 
  row2, row3, and row4) 
  contains a sentence. now i want these sentences to appear in 
  random order:

I've always found mysql's RAND() function to be of use.  Specifically:

SELECT * FROM MyTable WHERE Some='Condition' ORDER BY RAND() LIMIT 4

CYA, Dave



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




RE: [PHP] Generate inline image

2002-05-12 Thread David Freeman


  How do I generate gif inline images using PHP's image 
  functions using GD libs.  Everything I have seen so far 
  requires a header before generating the image.  But I want 
  the image embedded into a table with other texts.  Thank you 
  for the help.

Write the php to generate the image as a separate file.  Then call that
file from an image tag.

Eg. img src=generate_image.php

CYA, Dave



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




RE: [PHP] template logic problem

2002-05-13 Thread David Freeman


  My problem is that for one page in the site I need to 
  display a image in the navigation bar that is referenced 
  from a database.  The database query happens in the included 
  file which is below the navigation in the html - This means 
  i cant reference the image file name because the query hasnt 
  happened.

I suspect that in the end any tricks you play will be just that -
tricks.  If you require certain information to properly render a
particular part of the page then you should really generate that
information before you render that part of the page.  Perhaps using a
function to extract the image you need as part of your navigation will
work.

  Or  can I use some tricky javascript?

I don't really know enough javascript to give a full answer but it's you
might get away with having some sort of place-holder image (single pixel
transparent gif perhaps) set up and then use an event of some sort to
change it to the image you really wanted (not sure if an onload() type
function would work here or if you'd have to do something else though).

Check some javascript resources to look into that - I like www.irt.org
myself for that sort of thing.

CYA, Dave



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




RE: [PHP] PHP file Opening Problem

2002-05-13 Thread David Freeman


  Whenever I try to open any PHP page
  on my browser i.e. IE then it displays
  Windows message box for saving the file on the disk
  or opening the code in any editor.
  I mean PHP file is not executed successfully and 
  I am unable to figure out the problem.

What is the web server?  What operating system is the web server running
on?  Is php installed?  Has it been configured?  What does the source of
a php page that doesn't work look like?

Basically, insufficient information for a meaningful answer.

CYA, Dave



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




RE: [PHP] Newbie challenge to brainiacs

2002-05-14 Thread David Freeman


  Here is a sample of my weblog that reads into an array from a file ie

  I want to try to find the hour that has the most hits
  The day of the week that has the most hits
  and the max and ave  no of hits of these.

I haven't given it a whole lot of thought but I'd be tempted to dump the
whole thing into an appropriately structured sql database and then use
SELECT's to extract the information you want.  It'll likely end up
faster and less processor intensive than doing it in php by itself I
suspect.

CYA, Dave



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




RE: [PHP] Where's the error?

2002-05-14 Thread David Freeman


  Thanks heaps for your help I really appreciate it.  I have 
  made the changes you suggested but now I only get a blank screen.

These are more general hints on ways to solve the problem yourself.

  function getmydate($hit)
   {
  $single = explode ( ,$hit);
  return $single[3].$single[4];
  }

What happens if you feed this function a designated string that you
explicitly provide. ie. Define $string to be a line of data you'd like
get date info on and then call the function.  If you get the right thing
you know your function is doing what you expected.

  $filename = (combined_log);
  
  //fopen ($filename, r);
  
  $fcontents = file($filename);
   $limit = 1;
  for ($i = 0; $i = $limit; $i++)
  {
  $line = $fcontents[i];

Try echo'ing $line to make sure you actually had something happen.

  if (!empty($line))
  {
  $currentdate = getmydate($line);
  echo $currentdate;
  }
  }

Work up to the whole solution if you find things not working like you'd
expect.

CYA, Dave



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




RE: [PHP] Sessions Without Cookies or SID Passing...

2002-05-14 Thread David Freeman


  You're missing one method - using the user's IP address
  It's not a guaranteed fool-proof method, but if you don't 
  want to use cookies or the URL, then this sorta works.

Unless there's a firewall using NAT or a proxy cache involved.  I know
for a fact that our internal network only ever reports the address of
our firewall.  We run an Internet kiosk of sorts so if two or three
people hit your site from inside our firewall they will all look like
the same person.

We're not alone in doing this sort of thing.

CYA, Dave



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




RE: [PHP] Cool PHP Tricks/Features ?

2002-05-15 Thread David Freeman


It's quite some time since I dealt directly with modems and packets
moving over networks per se so some of this may well prove wrong - feel
free to point it out if I am someone.

  3. But surely, ASDL, cable, the backbone and decent 
  intranets must all do hardware compression, don't they?  Or 
  are they secretly not very keen on decreasing network traffic?

Perhaps there's an element of confusion in technologies.  A modem is an
analogue device.  It converts a digital signal into an analogue one to
transfer it over a phone line as audio.  As such, it is capable of being
compressed due to the nature of the signal (being audio and all).  A
digital network link (which includes ISDN, ADSL and the backbone link
stuff) is just that - a digital link.  No conversion to analogue takes
place.  On a digital link you're moving packets of data.  I doubt
there's much scope of a packet of data that would typically be under 1k
in size (going purely from memory here and quite happy to be told
otherwise).

Different technologies involve different concepts basically.

CYA, Dave



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




RE: [PHP] Date and time functions

2002-05-16 Thread David Freeman


  I am on the East Coast of Australia.

I'm in central Queensland...

  Do you know if by default if the date/time display will 
  display only East coast Australia time, or will display  
  from the user's time zone? eg Will USA users see the 
  Australian time or their own time? Would this cause a issue 
  with timestamping an order when it comes to writing to a 
  mySQL database?

I presume we're talking about php date/time stuff here?  In that case,
php gets it's date/time from the server it is running on.  If your
server is on the east coast of Australia then you'll have local time for
east coast of Aust.

One way to deal with this would be to take everything back to GMT/UTC/Z
and use that instead.  Then all you need to do is add an appropriate
adjustment to get local time where ever the browser is - of course, you
may not easily be able to figure that out so it's not necessarily a
perfect solution.

In the end, the solution will depend on your requirements.  What are you
using a timestamp for?  If it's purely as a reference point in database
queries (i.e. all changes in the past two days, or 10 mins) then it
probably doesn't matter all that much.  Your database will be updated
from your server and your server has a consistent internal time.

If your application is date dependant in an absolute way then it becomes
a little harder I guess.  Although, you'd also ask yourself how relevant
it becomes to someone in a vastly different time zone - i.e. if you're
doing a local event calendar (which just happens to be one of the things
I'm doing right now) then the fact that an event might be happening
right now instead of this time tomorrow (from the perspective of someone
on the other side of the world and their time zone) is largely
immaterial - they aren't going to get there anyway.

Perhaps the simplest approach to that is to include a time/date
reference.  If you're going to include date information let the browser
know the context.  So, you advertise the next 'xxx' event will be at 3PM
17 May and tell them that it's 10:30AM on 17 May right now.  Leave any
relevant math up to them.

  Can someone suggest a script that may give me the option to 
  offer both  time zones to the user?

You could probably do something in javascript (being client-side it
knows the time in the browsers' location) to work out equivalencies and
conversions if you like.

CYA, Dave



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




RE: [PHP] Q:Anybody using PHP directly on Mac-OSX???

2002-05-17 Thread David Freeman


  So, anybody out there have PHP installed on their local home 
  desktop Mac OSX box able to test by a quick preview in 
  browser from say an app like BBedit?

I went to:

http://www.google.com/

I entered the following into their dinky little search box:

mac osx apache mysql php installer

I got a total of 333 matches.  The first one is an article on
www.faqts.com about how to install php/mysql/apache on Mac OSX, the
thire is a pre-built binary for MySQL.

Google also asked if I actually meant to search for:

mac os x apache mysql php installer

So I clicked on that link and it resulted in 3600 matches.  The first
page of which included more matches which look relevant.

So, yes, it's possible.

A little research, and I feel I must stress the _LITTLE_ part, would
have you your answer.

CYA, Dave



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




RE: [PHP] Confused about which function to use with forms/database

2002-05-17 Thread David Freeman


  I've read the documentation but am still confused about what 
  to use when.
  
  When passing data from forms to database, which do I use?
  When retrieving data from database to display in forms, 
  which do I use?

Kinda depends on what you're using the data for really.  If you don't
care about preserving formatting or any sort or keeping any html tags
that are included then strip the lot out before you drop it into your
database.  If you want to keep it all then you'll need to be more
selective.

As a general rule, though, you'll need to 'escape' anything that your
database won't like - this is typically the ' and  chars.  Addslashes()
will do that for you.  Anything else you want to do depends on what you
need the data for.

When you suck the data back out you'll obviously need to stripslashes()
to get rid of the 'escape' chars you added above.  Then you'll also need
to do any other processing required - for example, converting \n to br
if you're just displaying data on a page (nl2br()).  If you're actually
sucking that data back out to go into a textarea in a form or something
then you won't do that.

Unless you're particularly careful it's probably worth stripping out all
html tags anyway as they offer the potential to have someone include
scripting.  When displaying to a html page you probably also want to
convert special chars to html entities using htmlspecialchars().

I may have missed some stuff here, didn't bother looking at a manual
while writing this but I hope you'll get the idea.

CYA, Dave



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




RE: [PHP] Confused about which function to use with forms/database

2002-05-17 Thread David Freeman


   When you suck the data back out you'll obviously need to 
   stripslashes() to get rid of the 'escape' chars you added above.
  
  Nope, because the escape characters don't actually get added to the 
  database.

  When the database's command interpreter sees it, it removes 
  the escape character (\) before inserting the string into 
  the database. So it's back to its original form then. When 
  you retrieve it, you'll just get:

Ah, fair enough.  Obviously, I've never actually tested that particular
behaviour.  I'll keep this in mind for future reference though.

CYA, Dave



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




RE: [PHP] random order by id

2002-05-18 Thread David Freeman


  i have a db and a table with id and questions
  now i want these questions to be listed in a random order, 
  is there a way to format my SQL query or do i need some PHP 
  work to?

It's best achieved in sql:

SELECT ID, Question FROM Questions WHERE Some = Condition ORDER BY
RAND() LIMIT 10

Will get you up to ten randomised questions based on your 'where'
condition.

CYA, Dave



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




  1   2   >