RE: [PHP] php/mysql report builder

2002-11-26 Thread Miles Thompson
It's not the same as simply generating a report in PDF. He's looking for a 
band-type of report writer with groupoing levels,  automatic totals, 
subtotals,  sub reports, drag anddrop fields, right click formatting 
options, etc. One of the great leaps backwards with PHP, or any of the 
scripting language, has been reversion to the hand-coding of reports.

On the other hand, the output device is a browser, so one cannot get too 
fancy - hence generate a PDF. After looking at the PDF library that's not a 
task I'd gladly undertake.

Cheers - Miles

At 09:08 PM 11/26/2002 -0500, John W. Holmes wrote:
> sorry for posting this mysql question again. im searching for a report
> builder for mysql specifically for creating reports for
> invoice/receipt..etc.
> just like crystal reports and oracle report builder. or  is there any
> suggestion to do it  in PHP .

Get any of the hundreds of PDF classes out there and create your reports
with those...

---John Holmes...



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



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




Re: [PHP] **** Converting dynamic webpages into static HTML pages

2002-11-27 Thread Miles Thompson
I'll have to pseudo code this, but following on from Matt's suggestion of a 
standalone php script to generate the necessary files, let the database do 
the work.

allproducts.php

select whatever fields are necessary from the database as 
parameters for catalog.php

work down the result set from the above query
create file for output naming it for the product number, 
e.g $prd_num.'html
execute catalog.php, (which you already have) passing it 
necessary params,
directing output to file handle for $prd_num.'html'
close the file
loop

create file index.php (or whatever)
write necessary header and initial content
work down the result set from the query a second time
write the description, embed image, product number as URL 
pointing to $prd_num.html
loop

If allproducts.php was to create one huge file of products, then abandon 
the second loop, just keep writing to the first file. (Or if using Matt's 
code, use ">>" instead of ">".)

Caveat - watch out for a table which may accidentally surround the whole of 
the output - this would bring NS 4.x to its knees.

HTH - Miles Thompson

At 02:57 PM 11/27/2002 -0500, Matt Vos wrote:
I'm not sure...
I always echo... I don't really like embedded code... gets confusing when
one part of the page is one thing and another is another.
At the very least you coudl try it, I know its farily easy to build a script
which will rip through the script to fix it to make it all php friendly.

The other alternative is to have a script require() the php file, just set
your variables in the script, then require('catalog.php');
All code will be executed as if it were part of the script.

Matt
- Original Message -
From: Ron Stagg <[EMAIL PROTECTED]>
To: Matt Vos <[EMAIL PROTECTED]>
Sent: Wednesday, November 27, 2002 2:49 PM
Subject: RE: [PHP]  Converting dynamic webpages into static HTML pages


I like your direction.

When running PHP as a static binary, how does it handle text (HTML code)
that falls outsize of the  tags.  Is the text ignored or
outputted?

Ron

-Original Message-
From: Matt Vos [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 27, 2002 12:42 PM
To: Ron Stagg; [EMAIL PROTECTED]
Subject: Re: [PHP]  Converting dynamic webpages into static HTML
pages

Compile php as a static binary (CGI execution mode?) and add something
liek
the following to your code at the top:

#!/usr/local/bin/php
$arg_count = 1;
while ($arg_count < count($argv))
{
$argument = $argv[$arg_count];
$arg_split = split("=",$argument);
$variable = trim($arg_split[0]);
$value = trim($arg_split[1]);

if ($variable != "" && $value != "") $$variable = $value;

$arg_count = $arg_count + 1;
}

Make catalog.php executable, then run it as such:
(assuming product_type and product_seq are the vars you use)
./catalog.php product_type=1 product_seq=2 > products.html

Matt

- Original Message -
From: Ron Stagg <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, November 27, 2002 2:18 PM
Subject: [PHP]  Converting dynamic webpages into static HTML pages


I have an interesting challenge.  I have built an online product catalog
that is driven entirely by the contents of the product database (MySQL).
The entire catalog is implemented in a single PHP script (catalog.php).
The dynamic nature of this implementation allows the catalog script to
generate hundreds of product description pages.

Now, my client has requested that I give him the ability to generate a
static version of the catalog so that he can burn it onto a CD for
distribution at trade shows.  He wants the CD to be a snapshot of the
catalog.  Furthermore, he wants to be able to generate this "snapshot"
frequently so that pricing info on the CD will be current.  To
accommodate this, the process for generating the snapshot must be easy
and intuitive.

My plan of attack is to generate static HTML files by running the
catalog script once for each product in the database. Here is my
quandary; instead of echoing the output to a buffer for Apache to send
off to the client, I need the script to output to a file.  I do not want
to write a second version of catalog.php that writes everything to file.
There must be an easier way to do this.  Is there a way I can access the
output buffer that Apache sends to the client?

Any other ideas?

Thanks,

Ron




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



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




Re: [PHP] Streaming audio

2002-11-27 Thread Miles Thompson
This may seem terribly naive, but what server streams the audio, Apache 
with an additional module? Or a special audio server?

If the former, it would seem quite straightforward I would assume (which is 
how I get myself into trouble and have such *interesting* assignments), 
Apache would issue the file, using appropriate headers.

For the second, why not do a redirect to the audio server, passing the 
necessary parameters?

Not knowing the first thing about how this works, why not?

Miles Thompson

At 12:55 PM 11/27/2002 -0800, Mako Shark wrote:
Does anyone know how to do streaming audio with PHP?
No clue if this is even possible. I've checked around
a bit, looked at some script sites, but nothing seems
to give a clue. I *think* it might be possible to set
something like this up, but I'm not sure.

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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



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




Re: [PHP] Security question with PHP on Unix / Linux.

2003-02-04 Thread Miles Thompson
Ananth,

For starters, you are probably on the wrong list - the PHP developers list 
is probably where you should be asking this question.

Second, PHP runs through the web server, so the user is the same user the 
web server, usually "nobody", although that depends on the how the web 
server is installed. No one is encouraged to all access to the underlying 
system through the web server, although the exec() function allows 
execution of some commands.

I can't help you much more than that, and I believe the other list will be 
more fruitful.

Regards - Miles Thompson


At 07:54 AM 2/4/2003 -0700, Ananth Kesari wrote:
Hi,

I mailed this earlier, but got no response. Maybe it went unnoticed.
So, resending it again. Please read below.

Your help in this is appreciated.

Thanks,
Ananth.


Hi,

I am working on porting PHP onto NetWare.

I am newbie to Unix / Linux systems and at this point of time, I am
trying to understand the way security is implemented for PHP on Unix /
Linux. I mean, how are the different users distinguished from Unix /
Linux. Do they get to login into the Unix / Linux system? Do they have
separate data space for each user? What is the API that is used to login
to Unix / Linux. User may enter his username and password on the
browser, but how do they get translated onto the Unix / Linux box?

Since I am a newbie, I may have misunderstood some concepts here. Can
someone help me in understanding this correctly? Also, can you point me
to any documentation on PHP security on Unix systems. I want some
in-depth technical stuff upto what calls are made etc.

Your help in this is appreciated.

Thanks,
Ananth.


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



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




RE: [PHP] tracking bulk email

2003-02-04 Thread Miles Thompson
Do the database updates, it's what db's are for!Q
M.

At 09:40 AM 2/4/2003 -0500, Leonard Burton wrote:

What about making the log a .txt file and not a database?  Wouldnt that be
quicker?

Leonard.

-Original Message-
From: Lowell Allen [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 04, 2003 7:27 AM
To: PHP
Subject: Re: [PHP] tracking bulk email


> From: "Kevin Stone" <[EMAIL PROTECTED]>
>
> - Original Message -
> From: "Lowell Allen" <[EMAIL PROTECTED]>
>
>> I've added an email feature to a content management system that will send
>> plain text email to about 1400 contact addresses. Each contact is sent a
>> separate email with the contact name and address in the "To:" header. It
>> works fine to small test lists, but hasn't been tested with a large list.
>>
>> Although I think list posts should only pose one question, I have two:
>>
>> (1) My client is nervous about the script failing mid-list and not being
>> able to determine which contacts were sent mail. I need to build this
>> check into the content management system. I could write a flag to the
>> database every time mail() returns true, but that would mean 1400
database
>> updates! If I instead append to a variable each time through the mail()
>> loop, I'll lose the record if the script times out. Can anyone suggest
how
>> to record the position in a loop if a time out or failure occurs?
>
>> (2) In order to avoid the script timing out, I'm counting the number of
>> mail() attempts and calling set_time_limit(30) every 50 attempts to
>> provide another 30 seconds of script execution time.

[snip]

> In response to your first question.  File stores are something a computer
> does very very fast (might want to add some error catching to this)..
>
> $i=0
> while() {
> count_index($i)
> $i++;
> }
>
> function count_index ($i) {
> $fp = fopen('count.txt', 'w');
> fwrite($fp, $i);
> fclose($fp);
> }

Thanks, Kevin. I've put a counter in place within my mail loop. It seems to
slow the process, but perhaps not too much. And thanks to Mark McCulligh for
describing a system for sending about 1500 messages that's called with a
cron tab and writes to a db after each mail. And thanks to Chris Hayes for
pointing to relevant list archives. My system seems to be working, but it's
so slow that I'm going to look at using a cron tab and saving everything to
a database for easier reference in case of failure mid-list.

--
Lowell Allen


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



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



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




Re: [PHP] Headers bust ?

2003-02-15 Thread Miles Thompson

Malcom,

Do your logic test before your input form. When you think of how a script 
is processed, on the server, then you'll see that the logic portion must 
precede any display portion.

Juli Meloni has a good example of this structure in her custom error 
message example. You'll find it at www.thickbook.com

Scripting often requires us to invert what we would see as the "normal" 
flow of eventsl

Cheers - Miles Thompson

At 09:01 AM 2/15/2003 -0500, Malcolm wrote:

Hello,

 I've been fooling with this for a few days now.
I'm getting a hearders already sent error.
I know it means I've got output before the header but
I can't figure how else to do this.

The error messages;

(output started at c:\foxy\www\project_db\switchtest.php:2) in 
c:\foxy\www\project_db\switchtest.php on line 11

The script;



echo " This script uses a predefined list of names to switch";
echo"
Input mal, jim or joe 
 Your Name:


";
switch ($dog) {
   case mal:
header("location =../aamaillist/ml_menu.php");
   break;
   case jim:
echo "";
   print "
If you were jim you could have a private page here.";
echo "";
   break;
   case joe:
echo ""; print "Hello Joe";
echo "";
   break;
   default:
   print "You must be a stranger.";
}
?>

 How can I redirect without output before the header ?

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


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




Re: [PHP] Inserting records in a particular way in MySQL

2003-02-16 Thread Miles Thompson

Phillip,

It doesn't matter, obviously you're not using the autoincrement ID for a 
foreign key. All this does is identify a record.

If you did a SELECT and found a missing sequence number, what's to say that 
value would not be inserted by another user before your INSERT? If you have 
not set up the table with a MyISAM, MySQL will eventually use the missing 
numbers.

These are only identifying tags, with no intrinsic meaning.

Miles


At 09:37 AM 2/16/2003 -0800, Phillip S. Baker wrote:
Greetings all,

I have some PHP code that is inserting records into a DB.
Most of this is auto increment.

However I know there is allot of breaks in the sequencing.

I am wondering if there is some way to write the SQL code to search 
through the existing records in the DB and to find where the next 
available ID is instead of just inserting the next sequence.

So for example if the ID's are.

20453
20454
20458
20459

It would let me know that 20455 is available for use and use the ID number 
instead of using 20460
Thanks all.


Phillip



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


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




RE: [PHP] Inserting records in a particular way in MySQL

2003-02-16 Thread Miles Thompson

If you are not using them as foreign keys, how does it matter? They are 
simply identifiers for a particular record. If you need to know the number 
of records a select count(*) does that quickly enough, gaps are irrelevant.

Miles


At 03:38 PM 2/16/2003 -0500, Willie G wrote:
Miles,

I never use auto increment.  Not because of gaps, but in case I need to
reload the table.  They do have meaning if they are foreign keys to another
table.

- Larry


-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 16, 2003 1:14 PM
To: Phillip S. Baker; PHP Email List
Subject: Re: [PHP] Inserting records in a particular way in MySQL



Phillip,

It doesn't matter, obviously you're not using the autoincrement ID for a
foreign key. All this does is identify a record.

If you did a SELECT and found a missing sequence number, what's to say that
value would not be inserted by another user before your INSERT? If you have
not set up the table with a MyISAM, MySQL will eventually use the missing
numbers.

These are only identifying tags, with no intrinsic meaning.

Miles


At 09:37 AM 2/16/2003 -0800, Phillip S. Baker wrote:
>Greetings all,
>
>I have some PHP code that is inserting records into a DB.
>Most of this is auto increment.
>
>However I know there is allot of breaks in the sequencing.
>
>I am wondering if there is some way to write the SQL code to search
>through the existing records in the DB and to find where the next
>available ID is instead of just inserting the next sequence.
>
>So for example if the ID's are.
>
>20453
>20454
>20458
>20459
>
>It would let me know that 20455 is available for use and use the ID number
>instead of using 20460
>Thanks all.
>
>
>Phillip
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


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



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




Re: [PHP] List tables

2003-03-15 Thread Miles Thompson
As noted earlier, in the manual 
and please don't cross post.
Miles
At 05:37 PM 3/26/2003 +, shaun wrote:
Hi,

i would like to list all of the tables and field names in my database

e.g.

table 1
  field 1
  field 2
  field 3
table 2
  field 1
  field 2
  field 3
table 3
  field 1
  field 2
  field 3
etc
is there a simple way to do this?

thanks for your help



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


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


Re: [PHP] PHP on one box, Apache on another?

2003-07-01 Thread Miles Thompson
Your intention is a little foggy.
PHP is server side, it works through the web server, thus Apache parses the 
scripts, so no, it can't.

If you mean scripts on one box, database on another, no problem.

Miles Thompson

At 09:20 AM 7/1/2003 -0500, Jay Blanchard wrote:
I don't know the details of this request (like why., but as soon as I
know I'll tell you) but can Apache live on one box with all PHP requests
being handled on another box?
Jay

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


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


Re: [PHP] file pointer

2003-07-01 Thread Miles Thompson
Start by checking the file functions in the manual - there are some 
interesting options for foen().
Miles
At 10:59 AM 7/1/2003 -0500, Kyle Babich wrote:
How would I set the file pointer to the very end of the last line of the
file?
ex. ahkjhff
asdjfhlkajf
sdfhaksljdh
kasjdhkjlfh
asdjfhklajs
askjdhjfdjf//here
Thanks,
--
Kyle
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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


Re: [PHP] how to modify in the db

2003-07-06 Thread Miles Thompson
Start with a good tutorial on PHP and MySQL - there are scads of them 
around, and Julie Meloni has some excellent examples at www.thickbook.com.

At 04:41 PM 7/6/2003 -0300, Kevin Fradkin wrote:
hi...
i have this secuence to insert data to my db
mysql_query
("INSERT INTO my_table(
 number,name,surname
)
 values ('$number','$name','$surname'
)");
i want to ask what do i have to do if i want to modify instead of insert
when this data already exists...
 for example.. i have in my_table
number name surname
1jhon smith
and i want to change the name...jhon --> john
Use a SELECT query to find if it exists (mysql_numrows() - check sp.)
then issue an UPDATE query to change it, making certain you have a unique 
key to identify the record.
otherwise, use your INSERT query.

This stuff isn't magic - you have to do a bit of work to get the desired 
results.


and if that not exist create it...
number name surname
0  mary   duke
1  charles emmerson
and add john's one.. ( to check if i can use only modify to add )

thnx!..



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


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


Re: [PHP] qry not running??

2003-07-07 Thread Miles Thompson
Micah,

Echo your SELECT statement to make certain it reads the way it should.
Test for number of rows returned, or an error - $result probably contains 
nothing, that is it's not pointing to an array.

Miles

At 01:23 PM 7/7/2003 -0600, Micah Montoy wrote:
Anyone see what is wrong with this?

//get category info
$result = mssql_query("SELECT cat_id, cat_name FROM category WHERE cat_id =
'$cat_name'");
$catID = mssql_result($result,0,"cat_id");  //line 32
$catName = mssql_result($result,0,"cat_name");  //line 33
I'm getting the error:

Warning: mssql_result(): Bad row offset (0) in
c:\inetpub\wwwroot\webpage10\example\u_images\act_load_imgs.php on line 32
Warning: mssql_result(): Bad row offset (0) in
c:\inetpub\wwwroot\webpage10\example\u_images\act_load_imgs.php on line 33
thanks



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


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


Re: [PHP] php arrays into flash

2003-07-07 Thread Miles Thompson
Jim,

The key words are "implode" on the PHP side and "split" on the Flash side. 
Here's an example:

The data is returned from PHP like so, after doing the connect, select, 
etc. to produce an array of 7 dates for back issues ... no claim that this 
is optimal code.

if( $result && mysql_num_rows( $result ) >= 1 )
{
while( $row = mysql_fetch_array( $result ) )
{
 $arrdates[] = $row[ dtStory ];
}
$issuedates = implode( ",", $arrdates );
 } 

echo "issuedates=".$issuedates;

and in Flash, as part of the LoadVars  varGetDates.onLoad = function( 
success) callback is handled like so ...

_root.arrIssueDates = issuedates.split( "," );
_root.dtDate = _root.arrIssueDates[0];
for (i=0; i < arrIssueDates.length; i++)
{
   //load  combo-display and data same in this case
   cboIssueDates.addItem(arrIssueDates[i],arrIssueDates[i]);
}
At 06:29 PM 7/7/2003 -0500, Jim McNeely wrote:
I know a lot more about php than about flash (which is probably sad) but 
does anyone know how to take info in an array and pass it into an array in 
flash? I think they have arrays, but the only thing I can seem to find in 
flash to get info from php is the loadvariable actionscript step. I looked 
around via google and I couldn't find anything within a reasonable time 
that seemed to answer this question.

TIA

Jim McNeely
Envision Data
[EMAIL PROTECTED]
http://www.envisiondata.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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


Re: [PHP] PHP, MySQL and Flash

2003-07-09 Thread Miles Thompson
Randy,

Flash is so damned graphically oriented, but the graphic bits aren't 
necessarily connected to bits of data ...

I'm just talking off the top of my head here  w/o knowing any specifics 
of your requirements.

Assuming you have n cars, then two tracks would have to be created, each 
with n track elements. I guess these would be an array of movie clips.

Then a set of "car" movie clips would be created, each car loaded with the 
information necessary, at a minimum, to uniquely identify it.

These get loaded on to one track, each car superimposed over a track element.

Then the cars can be dragged to the appropriate places on the "tracks".

When everything is positioned just so, then clicking "Update" would process 
each track array, updating the database with the car and track-position data.

So, having blabbered on, I'm not much wiser. but this is much like a puzzle 
game isn't it? How do the Flash games store their state?

It would also be nice to be able to shove a car in between two other cars.

So, if this model works, the bottom layer (scene?) has to be able to 
identify what overlies it.

Try posting this on FlashCoders.

Cheers - Miles

At 07:30 AM 7/9/2003 -0500, Rankin, Randy wrote:
Does anyone know of any articles on integrating PHP, MySQL and Flash to
perform a drag and drop routine for updating a db?
Specifically, I have a client who is _INSISTING_ that I integrate a drag and
drop feature into his railcar storage application. He wants to be able to
view two railcar storage tracks, Track A and Track B, then drag and drop
cars from Track A to Track B ( or Track B to Track A ). Once he positions (
orders ) all the cars properly on each track, I need to update a MySQL db to
reflect the changes.
I have already developed the above feature so that he can do this
'textually', but he is _determined_ that he must have the graphic 'drag and
drop' feature.
There may be another method ( Javascript ? ) to accomplish the same effect.
I am certainly open to any advice and/or opinions. Any pointers would be
_greatly_ appreciated.
Thanks,

Randy Rankin


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


Re: [PHP] MySQL Results - display issue :S

2003-07-09 Thread Miles Thompson
Brenton,

The short answer: loops, counters and test

Across -  your content   and so forth 
When to stop - a cell counter tested with mod operator
Alternating colour - a row counter tested with mod operator
That should get you pointed in the right direction. (If this is for a 
school project that might be too much info; what does your prof want?)

HTH - Miles Thompson

At 10:45 AM 7/10/2003 +0930, Brenton Dobell wrote:
I know im probibly getting irritating to most of you :P but i thought i may
ask another thing that is on my mind!
I have a sql query bringing back 200 rows for arguments sake, From this i
would like an answer to 2 issues i have.
1) I know how to display it row after row going down :P duh of course :P,
but i have seen sites where it goes across then down across then down ect
ect like X -> X then next row ect. How is this done??
2) How can i alternate the colours for each row?? row 1 eg light blue and
the 2nd row dark blue then back to light blue ect ect.
Thanks in advance

Brenton Dobell

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


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


RE: [PHP] I'm really getting annoyed with PHP

2003-07-23 Thread Miles Thompson
Yes!
And where do we find the  tags ?
Cheers - Miles
At 09:55 PM 7/23/2003 +0200, Petre Agenbag wrote:
If you want to "use PHP", then you must use the headers() function. BUT,
with the header function, you MUST make sure that there will be absolutely
NO output to the page before the header() function is called, not even a
space...
Otherwise, you can simply use a meta refresh...
-Original Message-
From: Beauford.2005 [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 24, 2003 9:41 PM
To: PHP
Subject: [PHP] I'm really getting annoyed with PHP
Yes, I'm still screwing around with this stupid redirection thing, and
either I'm just a total idiot or there are some serious problems with
PHP. I have now tried to do it another way and - yes - you guessed it.
It does not work.
I mean really, it can not be this hard to redirect a user to another
page. If it is, then I must look into using something else as I just
can't be wasting days and days on one minor detail that should take 30
seconds to complete.
If anyone has some concrete suggestion on how to get this to work It
would be greatly appreciated. In the mean time I have given up on it as
I am just totally pissed off at it.
TIA



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


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


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


Re: [PHP] PHP Webpage like MySql- need to be able to see all fields and edit

2003-07-24 Thread Miles Thompson
Matt,

Juli Meloni has a tutorial on this at her web site. I think it's called 
something like "Custom Error Messages" and if I remember the fields are 
pulled from a database, and there are code examples of how it operates if 
fields are not completed, information fails a simple parsing test, etc.

Have a look at:
http://www.thickbook.com
It'll be worth your time.

Miles

At 12:41 PM 7/24/2003 -0300, Matt Hedges wrote:
Hello.  I am building a webpage for a sorority- http://www.olemissaoii.com .

I built a basic php script where they add the sisters and their names, grad.
date, and email.  Is there anyway to build a page that shows all the fields
where someone could go in and edit/add what they need?  What I basically
want is a webpage that works like MyCC SQL Database.  The only thing I've
been able to figure out is a basic update page, but using that they have to
type in everything again- so for example if they want to change the email
address, they'd have to retype the names and grad. date.  So I'd like a
script that shows all the rows and columns and allows someone to go in and
change whatever field they want.
Any help greatly appreciated,
Hedges


--
___
| Matt Hedges
| http://hedgesinnovations.com
|


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


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


Re: [PHP] html and php in the same document

2003-07-24 Thread Miles Thompson
At 04:09 PM 7/24/2003 +, Curt Zirzow wrote:
* Thus wrote Curt Zirzow ([EMAIL PROTECTED]):
> * Thus wrote Bill Pilgrim ([EMAIL PROTECTED]):
> > If php and html are to be included in the same document, does the 
document extension always have to be .php  ?  Are there ways to include 
php into an html document without changing the extension?
>
> Apache, IIS, Other?
>
> If apache:
>
> AddType application/x-httpd-php .php .html
> add this ^

Btw, thats in your system http.conf, and if you have permissions to
do that.
And every .html page is parsed by PHP.
He will still have to turn PHP on and off within the page.
Unless he *really* wants to hide usage of PHP, I don't see the point of 
doing this.

Miles Thompson

PS Curt - Like the sig.




Curt
--
"I used to think I was indecisive, but now I'm not so sure."


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


Re: [PHP] Re: Parse error not understood

2003-08-06 Thread Miles Thompson
Yes, I'm top posting, pls forgive.

This is a situation where an editor which has built-in brace matching 
really helps - if in the midst of "looking" one remembers to use it.

Another tip, although it probably wouldn't help here: Save the code with a 
.phps extension and look at it in the browser.

Cheers - Miles

At 02:59 PM 8/6/2003 +0200, Chris Blake wrote:
Holy schmoley...something so small.I must get off this green tea,
all this good health stuff is causing havoc in my brain...
Thanks Fokkema, and Johnfor pointing out an obvious error...

Regards

On Wed, 2003-08-06 at 14:48, Fokkema, I.F.A.C. (HKG) wrote:
> > //If "Delete User" is selected--
> > if ( $_REQUEST['useroption'] == 'delete')
< snip -- liked the Ford quote > 

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


Re: [PHP] AOL Email client

2003-08-08 Thread Miles Thompson
At 07:57 PM 8/7/2003 -0500, php list wrote:
I am using php mail and setting all my $headers info to show From:, To:,
etc.
It work perfectly on my computer. I use MS Outlook.
I am doing this for a client who received his email via his aol account.
When he receives the email, the email comes in with "Unknown Sender".
Is there issues with this? Do I need to so something different for AOL email
to receive this information properly?
Thanks.
Mark Roberts, Roberts Computing Systems
Webmaster Services $29.50/mo


Others know a lot more about email than me, and I don't know if this your 
system is Windows or *x, but quite likely the mail is sent with the 
identity of the web server.

We had this problem using the mail() function at Experthost, as we could 
not track the bounces, they went back to sendmail's "nobody" account, and 
the ones we originated could not be identified.

This isn't an answer, more a musing on what could be happening.

Cheers - Miles

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


RE: [PHP] dev style guide

2003-08-09 Thread Miles Thompson
At 11:27 AM 8/6/2003 -0500, Jay Blanchard wrote:
[snip]
Just a remark but isn't it pointless to use Hungariannotation in a
language that is by default typeless???
[/snip]
We use it becuase we have a group of programmers, so the notation makes
it easier for one in the group to understand the intention of another in
the group. The notation also helps to clear up any casting issues that
may arise. http://us2.php.net/language.types.type-juggling
And it helps when you get back up to speed when you revisit a project after 
a few months.
Use of Hungarian notation has been a bit of a religious issue; use what 
works and use it consistently.

Of course, if you come from the Flash world, it's likely a postfix (ugly 
word!) rather than prefix.

Cheers - Miles 

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


Re: [PHP] Flash Actionscript List or Forum

2003-08-11 Thread Miles Thompson
Some v. active lists here:
http://chattyfig.figleaf.com
This is moderately active, but munges code examples, so is less useful:
<[EMAIL PROTECTED]>
And the forums at Macromedia, of course.

HTH - Miles Thompson

At 03:08 AM 8/8/2003 -0400, Joe Harman wrote:
Hello all,

I've been doing PHP for a little while now... I am starting learn Action
Script now... and having trouble with global variables and functions...
does anyone know where I find a good list or forum for action script?
Joe Harman

http://www.HarmanMedia.com

I used to think I was indecisive, but now I'm not so sure. - Joe Harman,
2003


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


Re: [PHP] does PHP have a equivalent to the C++ #ifndef #define?

2003-08-14 Thread Miles Thompson
Not quite, but have a look at the function handling functions:
http://www.php.net/manual/en/ref.funchand.php
particularly
http://www.php.net/manual/en/function.function-exists.php
May not be what you want, but might get you close.

Miles

At 10:42 AM 8/10/2003 -0400, Dan Anderson wrote:
I'm coding a really large web page in PHP.  One of the problems I run
into is I'll create a function in file inc.function.something.php and it
will need a function included in inc.function.somethingelse.php.  If I
require() somethingelse.php in something.php and it's already been
required in main.php, I get an error about the function being defined
twice.
Is there an equivalent to the C++:

#ifndef some_header_file_h
#define some_header_file_h
// insert code that shouldn't be repeated here

#endif // some_header_file_h

Thanks in advance,

Dan Anderson

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


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


Re: [PHP] Stop neurotic posting

2003-08-14 Thread Miles Thompson
At 02:54 AM 8/6/2003 -0400, andu wrote:


if more people would read the manual or know how to find commonly
asked and solved quetions this list would probaly drop in 20% (very
rough estimate) of posts.  Getting that information to the people
who arn't reading the manual is a difficult task, cause if they
arn't reading the manual, why would they even bother with reading
the information on how to find the answer.
Now noisyness from the 'helpers'...  I have noticed at times that a
question is answered the same way like 10 times by 10 different
people; this I consider more noisy than a RTFM post.
Agreed again.



be. Is it too difficult to not answer the post at all if you disagree
with  the content?
Now, I kinda wondered at first if I should not respond to this
cause it's rather in a disagreement tone :)
Nevermind the tone, you have a point. My post was about people who 
chronically answer with an attitude (half of their posts have to do with 
the manual). As far as I can tell you always take the time to help, I'm 
surprised you picked on this.
People are sometimes lazy or simply they just don't know what to look for, 
to look up a function you must know the name of it, what's the big deal to 
reply with a function name as opposed to RTFM, you do it anyway. I'll tell 
you what the difference is, you are bored to death for hearing the same 
question for the millionth time and feel vindictive. You're shooting the 
messenger though. If you are at the point where you can't deal with 
newbies it's understandable (been there, done that), but it's not their fault.


I understand the RTFM attitude, because in many cases the tone of the 
question shows that the manual HAS NOT been read. Or that some basic 
thought was put into what is being attempted. I also think a lot of people 
are coming to PHP without programming or database experience. They have 
either heard that PHP is "cool", or have gotten dumped into it by starting 
to use a packaged applcation, like Community Calendar. Consider how many 
requests have we had on the list for a "Visual Editor" for PHP.

If you are going to use MySQL, it is reasonable to expect that the person 
does some command line work with MySQL, finds out how common commands work, 
becomes familiar with MySQL's searchable on-line manual, etc.

It logically follows that the next step is to become familiar with the 
MySQL portion of the PHP manual, and by extension how arrays work in PHP.

There are also debugging procedures to follow: display the error message, 
echo the problem statement, simplify, divide and conquer, etc.

THEN come to this list, and you know what the question is and how to ask 
it. (And can be corrected, as I was once with a basic syntax error when a 
while loop wasn't working - something about a misplaced ";")

Problems then become a lot easier to solve - and let's face it, most of 
them are pretty simple; we've tended to create a too-complex environment.

I'll shut up now.

Miles

PS Maybe we should refer everyone to Steve Litt's www.troubleshooters.com 
for a read through on his troubleshooting process. /mt

 

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


Re: [PHP] Sum a column of values from a MySQL query

2003-08-14 Thread Miles Thompson
From bitter experience I'll suggest that it's a REALLY GOOD idea to store 
invoice totals, subtotals, etc. in either the invoice header record. If not 
rounding errors, or some small change in logic, can come back and bite you 
- accountants get *really* upset when that 3000.00 invoice becomes 3000.01 
or 2999.99.

Know what else? THEY'LL NEVER LET YOU FORGET.

Don't call it denormalization - call it history.

Cheers - Miles

At 03:53 PM 8/5/2003 +0800, Jason Wong wrote:
On Tuesday 05 August 2003 15:43, Ben C. wrote:
> Yes, I know.  However, the while() loop should generate all the invoice in
> a list.
As has been pointed out the query only results in a single row. So how would
the while-loop "generate all the invoice[s]"? It's only ever given a single
row to play with.
And has also been pointed out, could you state clearly:

- what exactly you're trying to do
- what your database schema is
- what you tried that didn't work, and *how* it didn't work
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
I appoint you ambassador to Fantasy Island!!!
*/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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


Re: [PHP] How to connect to DB

2003-08-17 Thread Miles Thompson
Take out the "@" so you can see what error is returned.

Echo your defines to confirm that you are getting what you expect.

Double check that you have the browser set to refresh on every call to a page.

Clear your cache.

Use the header() function to add code at the top of the page to force a 
refresh.

HTH - Miles

At 04:42 PM 8/16/2003 +0530, murugesan wrote:
Hello all,
I have some existing php pages already. Now I want to change the DB
to point to another DB.
I have changed the include_path in php.ini file to point to /home/config
Also I changed the constant db_name defined in a file in
/home/config/con.php to point to new DB.
[snip]
<
include "con.php"
@mysql_pconnect(db_host,db_user,db_pass);
mysql_select_db (db_name) or die ("could not select db");
<<
<
//contents of con.php

<<
Also I restarted the apache.
But it is still accessing the old DB.
What are all the changes that I have to make. other than these changes.
Regards,
Murugesan.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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


Re: [PHP] Discussion: do you consider null a value or strictly a type?

2003-08-17 Thread Miles Thompson
At 03:20 PM 8/17/2003 -0400, Robert Cummings wrote:
There has been a recent thread on the internals list as to the meaning
and usage of the "null" datatype. Zeev claims, perhaps rightly so, the
following:
Zeev wrote:
>
> null is not a value, was never meant to be a value, and won't be a
> value
Interestingly though, the PHP documentation at

http://www.php.net/manual/en/language.types.null.php

indicates the following:

The special NULL value represents that a variable has no value. NULL
is the only possible value of type NULL.
Which is obviously contradictory since it claims to be a variable having
no value and yet also claims it is a special value. Also the following
snippet from:
http://www.php.net/manual/en/language.operators.assignment.php

seems to also indicate that null is a value -- namely:

The basic assignment operator is "=". Your first inclination might
be to think of this as "equal to". Don't. It really means that the
the left operand gets set to the value of the expression on the
rights (that is, "gets set to").
The above reference might not be obvious, but since you can assign the
null constant, then it says the "left operand gets set to the value
of..." seemingly indicating that null is a value.
Now the point of the discussion is not to indicate who is right or who
is wrong -- that would appear to be a ridiculous argument. I am more
interested in finding out the practices and experience of PHP
developers. I'd like to know how many people treat null as a value, and
how many do not. For instance to you ever assign default values of null
to instance variables, or local variable, or array entries? I know in
practice that I have, and find it quite convenient to represent a
default value.
Cheers,
Rob.
--
Year's ago I was told that NULL means "Don't know", and to take it a little 
further, one could argue that it represents the state of a variable, rather 
than its contents. Once a concrete value has been assigned, even if it is a 
space or a zero, the state of the variable is no longer NULL.

I also think, in discussing NULLs, that we hit a limit of language - we 
have to refer to this "not knowness" as something. Thus a variable set to 
NULL is not like an empty bucket, more like a bucket with potential, but if 
you examine it reveals not " " 's, or 0's, but a benign vacuum.

This is not a value, but it is a convenient shorthand to refer to it as such.

Now, shall we discuss imaginary numbers?

Cheers  - Miles

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


Re: [PHP] webeditor

2003-03-29 Thread Miles Thompson
http://www.editworkspro.com/index.php

I've not used it, and it requires IE - but the demo was impressive.
Miles
At 11:21 AM 3/28/2003 -0800, Daniel Guerrier wrote:
Does anyone know of an open source webeditor that I
can use to enter information into a text area field.
I have a custom CMS and I would like to add webeditor
functionality to the textarea fields
__
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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


Re: [PHP] Looking functions for deal with special characters

2003-03-29 Thread Miles Thompson
Just off the top of my head ...
Install Spanish language  suport on the Windows machine
What CodePage are you using?
Check the Microsoft KB.
Thinking about it a bit more, a plain ascii file may not handle Spanish 
because (if I remember correctly) it's single byte and represents only char 
0 - 127 - what I know as high-ascii goes from 128 - 254 - happy faces and 
the like, and yes, characters with unlauts and acute or grave accents.

If you look at the .csv with a plain text editor, what do you see?

No answer - but I hope this helped.

Miles Thompson

At 10:16 AM 3/28/2003 -0600, [EMAIL PROTECTED] wrote:
Hi, I am getting data from a database, containing special characteres (in
spanish).  After that, I want to write down this data to an ascii file
(.csv).  When this file is open with excel, the resulting data on cell
(strings) does not keep the same special characteres instead of that appear
strange characters.  Here I want to show the same characters as stored on
the database.
I am using fput ($fp,"string") to write data to the csv file.

Does somebody deal with this ? please let me know.

Ignacio Estrada F.



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


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


Re: [PHP] Test tables existance

2003-03-30 Thread Miles Thompson
Come on, check the mysql section of the PHP manual ... this took about 20 sec
http://www.php.net/manual/en/function.mysql-list-tables.php
At 11:34 PM 3/30/2003 +0300, Antti wrote:
How do I test if a mysql table exists or not? Is there a function for 
this? I didn't find a good one.

-antti

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


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


Re: [PHP] chill out

2003-04-03 Thread Miles Thompson
I mostly lurk -- my level of participation depends on what I'm working on.

I do have these observations:

1. Far too many people don't try to help themselves first, i.e., by doing 
some creative searching /reading of (primarily) the manual.

2. A serious question usually gets prompt and helpful responses.

3. The same thing usually applies to questions that could be resolved by 
checking the docs.

4. There are some really sterling and knowledgeable individuals whose 
participation is more than generous. (I won't name them, but if you check 
the frequency of posts and quality of answers they're pretty easy to pick 
out - John Holmes & Jason Wong come to mind immediately.)

5. Moderately off topic issues are usually handled with some discretion.

6. The level of language is civilized, not much profanity, etc.

7. There are occasional spats - someone pushing a particular class, or 
won't let go of the bone, but they're rare.

8. Rasmus L. watches the list!

9. It's open to exchanges like this, which would never get past a moderator.

10. Overall, people are really responsive.

Cheers - Miles Thompson

At 01:14 PM 4/3/2003 +1000, [EMAIL PROTECTED] wrote:
We subscribe to a few email lists on various languages.

This list would have to be the worst for anyone learning
- the amount of sarcasm and flaming that goes on is huge.
Just try and remember - everyone has to learn,
if you feel a question is off topic or stupid - ignore it,
theres no need to make the poster feel like an idiot.
We all know your smarter than the rest of us ;-)

Steve



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


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


Re: [PHP] chill out

2003-04-03 Thread Miles Thompson
Jason ...

A fellow proofreader!! Well done!

Miles


> We all know your smarter than the rest of us ;-)

I hope you don't think I'm making you stupid, but I think you mean "you're".

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
 

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


Re: [PHP] Individual member pages

2003-04-04 Thread Miles Thompson
Relatively easy-ish. . But you'll have to study PHP a bit more.

This is a situation where sessions work really well - read up on them in 
the manual. Authenticate the user by means of a login page, which 
establishes the session. Then put something like the following at the top 
of each page.


session_register( "origin" );
$origin=$PHP_SELF;
if( $HTTP_SERVER_VARS[ "PHP_AUTH_USER" ] !="lancelot" && $HTTP_SERVER_VARS[ 
"PHP_AUTH_PW" ] !="grail" ) { if( !session_is_registered( "member_id" ) ) { 
header("Location: user_logon2.php\n"); } }

All the above was one long strinb in the source, at the very top of the 
page, ahead of EVERYTHING else. You can ignore the bit about "lancelot" and 
"grail", that was built-in so that htdig could index the pages. The key bit 
is this:

if( !session_is_registered( "member_id" )  // note the " ! " which negates 
the test

If the user is not authenticated, i.e. the member_id does not exist, the 
user is redirected to the user_logn2.php, otherwise the rerest of the page 
loads.

Why is this one line at the very top of each member page? Because the 
header() is function is called and there can be no output at all before 
that function.

How you authenticate is up to you, but there's a good start, if I remember 
correctly, at http://www.thickbook.com, or Devshed, Webmonkey, etc. There 
are a couple of good articles/tutorials on session at those sites as well.

HTH - Miles Thompson

At 11:16 AM 4/4/2003 +0100, Andrew wrote:
How could I have individual pages for each member who registers?
(ie) Pages only that member can see.
Would this be easy(ish) to do or should I study PHP a little more first?

Andrew



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


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


Re: [PHP] Fw: What Visual PHP Edit ?

2003-06-03 Thread Miles Thompson
The "editor" topic has been beat to death, please check the archive.

However, PHP is code, all code, there's no "visual" component. All a visual 
editor would give you is a prettier interface; be more concerned about an 
editor that lets YOU write quickly and efficiently, whether it be vim, 
emacs, UltraEdit, EditPlus, Jedit, Notepad, Pico, Joe or something fancier 
like HTMLKit or BlueFish. (PHPEdit seems to be reported as still buggy.)

Cheers - Miles

PS I KNOW someone's favourite, absolute best editor has been left out. Pls 
forgive.

At 12:01 PM 6/3/2003 +0700, agus wrote:
hi everyone,
i want to know what the good software for PHP Editor Programing, like 
Visual Age For Java, or Visual .NET from Microsoft...


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


RE: [PHP] Best PHP books

2003-06-10 Thread Miles Thompson
Addressing only the issue of  the complete function reference, you can do 
no better than the annotated online manual.

When I first started using PHP there was a dearth of books; I diligently 
dloaded the manual and printed it out, only to find the online version much 
more convenient. That was on a dialup connection, too.

Addressing examples, etc., there are an awful lot of good tutorials out 
there for PHP, once a couple of those are worked through you pretty well 
have what you need.

HTH - Miles Thompson

At 12:49 PM 6/10/2003 -0500, Jay Blanchard wrote:
[snip]
Does anyone have any recommendations for a good PHP book?
I tried the "Learn PHP in 24 hours" book, but it was incredibly light on
details. I'm looking for a book that has at least a complete function
reference and is geared towards the intermediate to advanced level
programmer.
[/snip]
I like O'Reilly's PHP Cookbook.

Jay

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


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


Re: [PHP] nl2br

2003-06-11 Thread Miles Thompson
At 04:15 PM 6/11/2003 -0400, Edward Peloke wrote:
Ok,
I am trying to create a very basic page where we can all easily work on a
document.  I just have a huge textarea that inserts the text into a longtext
field in the mysql db.  I use nl2br to keep the formatting.  Of course, when
the document is viewed in the textarea, all of the  are there.  THe
problem is, everytime I update the text in the textarea, another set of 's are put in so with every edit, the lines get farther and farther
apart...why?
Thanks,
Eddie
This is a bit of a timing issue - when are you calling nl2br()?

We limited our users to using IE, and have wrap turned ON for the text area.

Articles are written in WordPerfect, then selected and copied to the 
Windows clipboard, then pasted into the textarea in a stories editing page. 
This resulted in a lot of "\r\n" cobinations that had to be filtered out, 
as either the paste operation or the action of copying to the clipboard 
entered one at the end of every line.

We wanted to preserve the ones following periods, exclamation marks and the 
like.

We did not need double lines between paragraphs, as the text is displayed 
to the consumer through a Flash movie.  It  adds a space between paragraphs 
whether we want it or not.

Therefore, on every update or insert to the database I check, using the 
following code. It looks like a lot but is nearly instantaneous.

 code starts ---
// have to clean up the extraneous CR/LF combos
$trupara= ".\r\n"; // period+CR+LF
$dblquotpara= '"'."\r\n"; // double quote+CR+LF
$sglquotpara= "'"."\r\n"; // single quote+CR+LF
$questnpara = "?\r\n"; // question+CR+LF
$exclampara = "!\r\n"; // exclamation+CR+LF
$colonpara  = ":\r\n"; // exclamation+CR+LF
$dudspc = ". \r\n"; // period+spc+CR+LF
$flspara= "\r\n"; //CR+LF
$truflag= "***"; //something unique
$txtBody = str_replace ( $trupara, $truflag, $txtBody);
$txtBody = str_replace ( $dblquotpara, "$$$", $txtBody);
$txtBody = str_replace ( $sglquotpara, "%%%", $txtBody);
$txtBody = str_replace ( $questnpara, "+++", $txtBody);
$txtBody = str_replace ( $exclampara, "!!!", $txtBody);
$txtBody = str_replace ( $colonpara, ":::", $txtBody);
$txtBody = str_replace ( $dudspc, "###", $txtBody);
$txtBody = str_replace ( $flspara, " ", $txtBody);
$txtBody = str_replace ( $truflag, ".\n\n", $txtBody);  ///double 
quote
$txtBody = str_replace ( "$$$", '"\n', $txtBody);   ///single 
quote
$txtBody = str_replace ( "%%%", "'\n", 
$txtBody);   ///question mark
$txtBody = str_replace ( "+++", '?\n', 
$txtBody);   ///exclamation mark
$txtBody = str_replace ( "!!!", '!\n', $txtBody);   ///colon
$txtBody = str_replace ( ":::", ':\n', $txtBody);   ///dudspace
$txtBody = str_replace ( "###", '.\n\n', $txtBody);

$txtBody = str_replace ( "\n ", "\n", $txtBody);
--code ends ---
The final one cleans up the text so that there is no leading space on the 
following line.

If we need extra spaces, etc., then  or  tags are used. (Flash is 
weird - if we wanted to split a headline in two we had to use the first 
form, the second caused output to choke. Auugh!)

When the story is called back for editing, stripslashes() is called against 
the text fields.

When the story is fed for display in the movie, the text is filtered using 
stripslashes, and nothing else.

When the story is fed for printing, the text body is processed this way,
$stext =  $row[ txtBody ] ;
$stext = stripslashes( $row[ txtBody ] );
$stext = ereg_replace("(\r\n|\n|\r)", "", $stext);
The last line was cribbed from the comments for the nl2br() section of the 
manual. $row[txtBody] is what's returned from the database.

Although it was only 3 wk ago, I know I played with nl2br() but it gave me 
more grief than I wanted, the above works for  us.

Hope this helps - Miles Thompson
(Apologies to the ereg_replace() experts who would have done the above on 
one line.)



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


Re: [PHP] slash trouble when editing text

2003-06-11 Thread Miles Thompson
Check out stripslashes().
MT
At 04:16 PM 6/11/2003 -0400, Matt Palermo wrote:
I wrote a small script that creates a link to all the .php and .txt files 
in a given directory.  When one of these links is clicked, it brings up 
another window with the files contents inserted into a text area.  From 
there the user can edit the text file then click a submit button to make 
the changes.  The problem is whenever the file contains quotes, when the 
file gets edited it puts a slash in front of every quote.  Like this.

// original .txt file
"these are quotes"
Then when the submit buttons is clicked, the file looks like this:

// edited .txt file
\"these are quotes\"
If submit is pressed again, then it will look like this:

// twice edited file
\\"these are quotes\\"
Does anyone know how I can avoid this from happening?  Thanks.

Matt


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


Re: [PHP] nl2br

2003-06-11 Thread Miles Thompson
Leif,

The users I'm talking about here are two internal people, not the subscribers.

Budget was tight, and rather than wrangling text from both Netscape and IE, 
we just made a decision. I don't remember the quirk exactly, I think it was 
the way wrapping was handled in the textarea in NN.

Subscribers? They can use whatever they like, as long as they get Flash 
Player 6 functionality. If you take issue with that, sorry, but this is 
supposed to be a money-making operation and subscribers were finding it far 
too easy to forward .pdf's by email.

We have it documented, thanks to a temp, that one company purchased a 
single subscription and forwarded it to 15 others. That's a loss of $3,00 
/mo, $3,600 /yr.; a lot of groceries.

Now they are starting to read it on line, through Flash, and if they print 
it out and distribute it, at least it's more hassle. Unfortunately PC's 
aren't a secure environment.

Side note: We surveyed subscribers in late Winter - over 95% read the 
.pdf's onscreen. That made the decision to deliver the news via Flash much 
easier.

Cheers - Miles

PS Std. browser I use is Mozilla - faster & sharper. (Except when I have to 
edit a news story!) /mt



At 05:50 PM 6/11/2003 -0400, Leif K-Brooks wrote:
That's plain wrong.  This is the /world wide/ web, not the IE users' 
club.  Either stop that BS or keep off of the internet!

Miles Thompson wrote:

We limited our users to using IE


--
The above message is encrypted with double rot13 encoding.  Any 
unauthorized attempt to decrypt it will be prosecuted to the full extent 
of the law.



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


Re: [PHP] slow mail()

2003-06-13 Thread Miles Thompson
Are you sending these in a loop?

Write out something as each mail is sent, the email address is useful, plus 
an OK or FAIL depending on what mail() returned.

Also, don't enclose this in a table as on some browsers nothing will 
display until the closing table tag is received.

You might also investigate flush() (I think) .

HTH -Miles Thompson

At 03:19 PM 6/13/2003 +0200, you wrote:
Hi all,

Sending multiple emails using PHP - as BCC or multiple mail() commands -
takes quite long; usually over 50 seconds for 10 addresses.
While sending these messages the browser won't show anything else but a
blank page, which is not a very exciting internetexperience for people using
my mailing-application.
I've been using exactly the same code on some other boxes without any
extreme delays.
The box is running Sendmail 8.12.9, PHP 4.3.1 on FreeBSD 4.8.

Any help greatly appreciated!

The maillog says:

 Jun 12 19:25:20 pippi sendmail[95211]: h5CHPKZu095211: from=nobody,
size=56, class=0, nrcpts=1,
msgid=<[EMAIL PROTECTED]>, [EMAIL PROTECTED]
 Jun 12 19:25:30 pippi sendmail[95212]: h5CHPP6h095212:
from=<[EMAIL PROTECTED]>, size=293, class=0, nrcpts=1,
msgid=<[EMAIL PROTECTED]>, proto=ESMTP, daemon=MTA,
relay=localhost [127.0.0.1]
 Jun 12 19:25:30 pippi sendmail[95212]: h5CHPP6h095212: to=<[EMAIL PROTECTED]>,
delay=00:00:00, mailer=esmtp, pri=30289, stat=queued
 Jun 12 19:25:30 pippi sendmail[95211]: h5CHPKZu095211: [EMAIL PROTECTED],
ctladdr=nobody (65534/65534), delay=00:00:10, xdelay=00:00:10, mailer=relay,
pri=30052, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent
(h5CHPP6h095212 Message accepted for delivery)


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


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


Re: [PHP] WARNING: FW: Virus Found in message "[PHP-DB] Re Now how about Roman Numerals?"

2003-06-16 Thread Miles Thompson
Marios,

Hard to say - bugbear is making the rounds, and it's a pernicious little 
beastie.

It not only uses an existing address list, it has a built-in SMTP mailer 
and synthesizes not only "To:" addresses, but also "From:" addresses.

Last week I had mail addressed to me ([EMAIL PROTECTED]) from 
someone's system, the return address was "[EMAIL PROTECTED]". 
Rather cute, especially as the reply bounced!

Norton's popping up that bugbear warning about 7x each day right now. I'm 
using Eudora with the "Use Microsoft viewer" option switched off - thus 
nothing happens and NAV is quarantining them.

Not to say that wasn't from Hugh, but given that was last week's 
discussion, and I would expect him to be pretty vigilant, I'd say it's 
highly unlikely.

Miles

At 04:13 PM 6/16/2003 +0100, Marios Adamantopoulos wrote:


-Original Message-
From: Hugh Bothwell [mailto:[EMAIL PROTECTED]
Sent: 16 June 2003 14:50
Norton AntiVirus found a virus in an attachment from Hugh Bothwell.

Attachment:  besturingssystemen.xls.exe
Virus name: [EMAIL PROTECTED]
Action taken:  Clean failed : Quarantine succeeded :
File status:  Infected
"Richard Hutchins" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Here's a rundown of what the script is doing based on your input:
>
> If you pass in the number 155, here are the calculations:
>$m = $nu


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


Re: [PHP] WARNING: FW: Virus Found in message "[PHP-DB] Re Now how about Roman Numerals?"

2003-06-16 Thread Miles Thompson
At 01:45 AM 6/17/2003 +0800, Jason Wong wrote:
On Tuesday 17 June 2003 01:29, Miles Thompson wrote:

> Hard to say - bugbear is making the rounds, and it's a pernicious little
> beastie.
>
> It not only uses an existing address list, it has a built-in SMTP mailer
> and synthesizes not only "To:" addresses, but also "From:" addresses.
> Norton's popping up that bugbear warning about 7x each day right now. I'm
> using Eudora with the "Use Microsoft viewer" option switched off - thus
> nothing happens and NAV is quarantining them.
It just amazes me how dumb these commercial products can be. It's not that
hard for it to recognise that:
a) warnings should never be sent to a mailing list
b) some viruses use a 'random' from address and thus no warning should be 
sent
to the 'sender'

--
Jason,

It doesn't send anything to the mailing list; I'm talking about warnings 
popping up on my system. Nor did it send a warning to the sender. After all 
that would be counterproductive for a virus. 

Maybe we should saw this off now - I replied chiefly because I thought it 
v. unlikely that Hugh would have  sent a buggy email to the list.

Cheers - Miles



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


[PHP] Security conundrum ....

2003-06-22 Thread Miles Thompson
This does have to do with PHP, but bear with me.

We're using a Flash movie, which calls various PHP scripts to authenticate 
users & retrieve news articles, to display a daily business digest. As 
Flash's printing capabilities are pathetic, we use JavaScript to popup a 
chromeless window in which runs print_news.php. (This is a small window, 
with selection, resizing, etc. all disabled, and which calls the print 
dialog on load; all that is really visible is its "Close" button.)

It won't be too long before some bright spark realizes that our site could 
be visited and the URL for print_news.php fed in; that person would then 
have free access - not good.

What I planned to do is add authentication to print_news.php, by passing 
the user's ckval  (obtained when first authenticated by user_logon.php) 
back to the browser in a session var. That does not work, as Flash 
apparently gobbles the cookie.

The apparent alternative is to call an intermediate script from Flash, 
passing the ckval, and having that script set the session and then redirect 
to print_news.php, using the header( Location: ... ). The problem is that 
opens in the same window, and I need a new one.

I obviously can't pass ckval in the URL, and I don't have any way, that I 
know of, to fake a  POST.

Suggestions or nudges in the right direction will be appreciated.

Regards - Miles Thompson

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


Re: [PHP] Security conundrum ....

2003-06-24 Thread Miles Thompson
Justin,

Tks for your reply -- you're partially correct in how it works, and thus 
far I've not used session id's. Cool.

Login is built into the Flash movie and calls a PHP script to authenticate, 
which returns appropriate success/fail data to the movie. Everything is 
buried in the Flash movie to solve a serious pass-around problem we had 
when using PDF's. If the Flash .swf file gets passed, then the login is the 
first thing encountered. Passwords shared you say? we limit logins to a 
fixed number per week.

I thought of sessions, but when I tried to set them in the authentication 
script called from the .swf, the .swf gobbled them, they did not go to the 
browser.

What I've done is call a script which opens a window, passing it the ckval 
and issue date to display. It's only function is to start a session and 
call a second window, which actually displays the story. That window closes 
its parent. (Too much JavaScript for my liking.)

This scheme is only working on a test site now. If you want to, check out
http://www.allnovascotia.com/test_flash/feed_print_story.php , which a 
person might do if they figured they will get the news for free, a rude 
message appears. (Which will be changed for production, as we would rather 
encourage, not discourage, potential subscribers.)

To see how this scheme works legally, have a look at
http://www.allnovascotia.com/test_flash/index.php?pgget=1
and login using "flasher" in all the boxes.
So it's not a PHP solution, I'm popping up an intermediate window and 
closing it, which is ugly - flicker. And I've not  been able to figure out 
a way to have that intermediate window open at a small size -- everything 
in JS seems to operate on children.

Regards - Miles Thompson

At 01:30 PM 6/23/2003 +1000, you wrote:
Ok, I'm trying to get a grip on what happens here:

1. i visit your site, see a flash movie, which enables me to log-in

2. after i log in, I see a link called "news"

3. I click on it, which pops open a HTML window through javascript, with a
URL like example.com/print_news.php
[At this point, the news page should only be available to authenticated
users, but it isn't -- right?]
The answer appears to be sessions.  When you log in, you should be able to
pass a session ID back to the flash movie, along with the user's ckval
(whatever that is), and add a session variable like 'logged_in' to the
session.
When the flash movie uses javascript to pop open the news window, you should
be able to pass the session id as a GET variable in the URL, eg:
example.com/print_news.php?PHPSESSID=x

print_news.php needs to have this at the top:



...
Your news
...



...
Sorry, you must be logged in baby!
...


You don't NEED cookies to have session work... it can be done with URLs.

Justin

on 23/06/03 5:18 AM, Miles Thompson ([EMAIL PROTECTED]) wrote:

> This does have to do with PHP, but bear with me.
>
> We're using a Flash movie, which calls various PHP scripts to authenticate
> users & retrieve news articles, to display a daily business digest. As
> Flash's printing capabilities are pathetic, we use JavaScript to popup a
> chromeless window in which runs print_news.php. (This is a small window,
> with selection, resizing, etc. all disabled, and which calls the print
> dialog on load; all that is really visible is its "Close" button.)
>
> It won't be too long before some bright spark realizes that our site could
> be visited and the URL for print_news.php fed in; that person would then
> have free access - not good.
>
> What I planned to do is add authentication to print_news.php, by passing
> the user's ckval  (obtained when first authenticated by user_logon.php)
> back to the browser in a session var. That does not work, as Flash
> apparently gobbles the cookie.
>
> The apparent alternative is to call an intermediate script from Flash,
> passing the ckval, and having that script set the session and then redirect
> to print_news.php, using the header( Location: ... ). The problem is that
> opens in the same window, and I need a new one.
>
> I obviously can't pass ckval in the URL, and I don't have any way, that I
> know of, to fake a  POST.
>
> Suggestions or nudges in the right direction will be appreciated.
>
> Regards - Miles Thompson
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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


Re: [PHP] weird switch behaviour

2003-06-26 Thread Miles Thompson
Try cleaning it up ...
switch( trim( strtoupper( $type ) ) );
I had this happen to me - the $type echoed OK, but would not get caught in 
the "case". The above fixed it.

Miles Thompson

At 02:18 PM 6/18/2003 +0100, cg wrote:
I am testing a var in a switch statement,
switch($type)
{
case "HIRE":
statements;
break;
etc
default:
echo "In Default";
break;
}
I can echo $type directly above the switch statement, confirm it contains
the string "HIRE", but the switch takes the default every time!!
what is going on??

thanks



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


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


RE: [PHP] Re: Seraching for good Hotel & room booking program.....

2003-06-27 Thread Miles Thompson
Don't flame me, this doesn't have a PHP back end, I suspect it's Flash 
Communications server at the back end, as there seems to be a constant data 
stream for virtually every change made on the form. But everyone should 
have a look at the Broadmoor's Reservation system, and play with it a bit ...

https://www.enteryourinformation.com/broadmoor/onescreen.cfm?CFID=3537567&CFTOKEN=93131017

The question is: Will an effortless exhange be something we look forward to 
in PHP 5?  Or am I missing something already that could be done with 
sockets in PHP?

Regards - Miles

At 07:13 AM 6/27/2003 -0500, Jay Blanchard wrote:
[snip]
Sorry, i try again...
> Hello,
> i am serching for a good program (PHP) that i can use for
> a hotel and apartments booking and billing system.
>
> do you know some?  thank you very much in advance,
>
> Giulio
>
[/snip]
Google is your friend ...

http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=hotel+reservation
+system+PHP
HTH

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


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


RE: [PHP] php-general as REPLY TO

2003-06-30 Thread Miles Thompson
If snipping everything is v. rude, then I  apologize.

Please, everyone, get a grip -- how difficult is it to right click and 
select "Reply to All"? And if one has to cut and paste the "php-general ... 
" form cc: to to:, does it take that much time?

More likely, if you start typing "php-" it autocompletes.

Sorry for jumping in, and wasting bandwidth, but this is a petty matter.

More importantly, this is a pretty high quality list, with good questions, 
solid answers, and, most of the time, consideration shown for others.

Regards - Miles Thompson

At 05:59 PM 6/30/2003 -0500, Daryl Meese wrote:

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


Re: [PHP] pdf to html

2002-07-25 Thread Miles Thompson

Why not just display the pdf's in the browser? The only caveat is that IE 
has to be properly patched if 5.5, and there is the minor inconvenience of 
users having to install the Acrobat Reader. Most people have already done 
that, so it's practically a non-issue.

The manual shows how to feed a pdf stored on disk to a browser. I'd imagine 
extracting and displaying a PDF from a database would be similar to doing 
the same thing for a .jpg.

Miles Thompson

At 10:03 AM 7/25/2002 -0500, Tyler Longren wrote:
>Hi,
>
>I've been searching around for ways to convert pdf to html.  I haven't
>had much luck.
>
>I have a client that has a bunch of pdf's stored in a mysql table.
>They don't want their users to have to download the pdf file, they want
>the pdf to be displayed in the web browser all the time.  Google has
>something that allows them to convert pdf to html, so, is it possible
>for me to do the same?
>
>These pdf's are graphic intensive...there's not much plain text.
>
>Thanks everyone,
>Tyler
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php



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




Re: [PHP] mailing list managers

2002-08-13 Thread Miles Thompson

Justin,

Have a look at PostMyMail, although it's designed to work with PostNuke. 
Have no idea if it can run stanadalone.

I also wrote a clunky one in Python - it grabbed the addresses from a 
database and sent each individually. Python has a very nice SMTP module. By 
"clunky" I mean it didn't have an interface, I edited the source for the 
script every time I sent a mail. No problem, as it was a "proof of concept".

Mightn't there be something at Hotscripts?

HTH - Miles Thompson

At 01:09 AM 8/14/2002 +1000, Justin French wrote:
>Hi all,
>
>Just a quick note to see if anyone has any experience with mailing list
>managers.
>
>I've currently got a DB of subscribers, and basic PHP scripts are not going
>to be a good long-term solution.
>
>I was hoping that maybe there's an opensource or commercial product out
>there that I can install in my doc root (ie, PHP + MySQL support) which will
>handle this in a more effective manner (ie, space the mailout across an hour
>or so, etc etc).
>
>Or alternatively, somebody might recommend a service such as sparklist.com
>(but cheaper, since they're targeting a list with greater numbers @ a
>minimum of $50/month).
>
>TIA,
>
>Justin French
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php



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




Re: [PHP] include & require directive

2002-08-13 Thread Miles Thompson

Huy,

Use Editplus, or something similar, not Notepad. Costs $45 and makes your 
work *much* easier.

Miles


At 08:41 AM 8/13/2002 -0700, Huy wrote:
>Thanks,
>
>I thought I checked that already. Obviously, I use notepad in Win2000 to
>edit the files, and save them as Unicode file, which Notepad put some
>characters at the beginning of the file. Only when I use another editor was
>I able to see those strange characters. After deleting them, the require
>statement works fine. Again, thanks for the help. :)
>
>"James Green" <[EMAIL PROTECTED]> wrote in message
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > On Tue, 2002-08-13 at 02:55, Huy wrote:
> > > But I do...
> > >
> > > If I left out the require statement all is well.. or I copy the
>whole
> > > content of the included file.. it works fine. The problem is the require
> > > statement.
> >
> > Check the file for whitespace, anything outside ?>.. > spaces/blank lines above your first  >
> > James.
> >
> >
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php



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




[PHP] Shared Hosting and Security Qualms ...

2002-08-15 Thread Miles Thompson

This is somewhat off-topic, but has to do with shared hosting. All of my 
experience with Linux has been on boxes where I've pretty well had the only 
account. I'm now working on a shared system which provides SSH access. The 
idea is to host a client's site on  this system, but after a few hours of 
exploring here's why I'm having second thoughts.

I can move up the directory tree and see all the other users directories, 
the contents thereof, and individual files, such as 
"/use/home/other_user/today.html". Permissions are such that I was not able 
to edit or copy them. (I tried.) The contents of etc/passwd could be listed.

mysqlshow listed all the databases on the system; with the mysql console I 
was able to examine the structure and contents of any of them, with a 
couple I went further and added a table, inserted records, and dropped the 
table. I could also insert records (which I subsequently deleted) into 
existing tables.

Call me naive, but is this normal, or should I bail on this arrangement 
before going any further? It's a BSD system.

Comments and opinions are solicited.

Regards - Miles Thompson



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




Re: [PHP] Shared Hosting and Security Qualms ...

2002-08-15 Thread Miles Thompson

I am, the provider has been instructed to close the account. I am still 
wondering if this is typical for a shared environment. I'm now looking at a 
virtual server solution.

Cheers - Miles

At 11:48 PM 8/15/2002 +1000, Justin French wrote:
>I'd be running away :)
>
>Justin French
>
>
>on 15/08/02 10:36 PM, Miles Thompson ([EMAIL PROTECTED]) wrote:
>
> > This is somewhat off-topic, but has to do with shared hosting. All of my
> > experience with Linux has been on boxes where I've pretty well had the only
> > account. I'm now working on a shared system which provides SSH access. The
> > idea is to host a client's site on  this system, but after a few hours of
> > exploring here's why I'm having second thoughts.
> >
> > I can move up the directory tree and see all the other users directories,
> > the contents thereof, and individual files, such as
> > "/use/home/other_user/today.html". Permissions are such that I was not able
> > to edit or copy them. (I tried.) The contents of etc/passwd could be 
> listed.
> >
> > mysqlshow listed all the databases on the system; with the mysql console I
> > was able to examine the structure and contents of any of them, with a
> > couple I went further and added a table, inserted records, and dropped the
> > table. I could also insert records (which I subsequently deleted) into
> > existing tables.
> >
> > Call me naive, but is this normal, or should I bail on this arrangement
> > before going any further? It's a BSD system.
> >
> > Comments and opinions are solicited.
> >
> > Regards - Miles Thompson
> >
> >



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




Re: [PHP] help with making appropriate indexes.

2002-08-15 Thread Miles Thompson

General rule of thumb - create indexes on any fields which will be used in 
the conditional part of a select statement, whether where or join. Since 
you are working with tables, you can save yourself a lot of typing by 
dropping the "table_" from the table names. After all, that's what they 
are. (You can do this unless you've gone too far with your system.)

Miles Thompson

At 02:15 PM 8/14/2002 +0200, lallous wrote:
>give this query:
>
>   SELECT
> table_routing.id  AS   routeid,
> table_pricing.units   AS   price,
> table_routing.providerAS   providerid,
> table_country.nameAS   countryname,
> table_country.id  AS   countrycode
>   FROM
> table_pricing,
> table_routing,
> table_country
>   WHERE
> table_country.id = table_routing.country
>AND
> table_routing.country = table_pricing.country
>AND
> table_routing.provider = table_pricing.provider
>AND
> table_country.enabled = 1
>   ORDER BY routeid
>
>what keys / indexes should I create on whatever tables to make this query
>efficient?
>I don't know if this query can be re-written even with JOINs and stuff.
>
>Please advise,
>
>If you've got an online doc. about that it will help too.
>
>
>Elias
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php



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




Re: [PHP] Error

2002-08-15 Thread Miles Thompson

Havn't the foggiest idea what it means, but what has usually happened is 
that I missed a ";" on an earlier line.
MT

At 09:54 PM 8/15/2002 +0200, Christian Ista wrote:
>Hello,
>
>Could you tell me the signification of this error :
>
>Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in
>d:\inetpub\wwwroot\TEST\test3\act_language_fr.php on line 20
>
>
>Bye
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php



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




RE: [PHP] Error

2002-08-15 Thread Miles Thompson

Have you tried saving the pages with a .phps extension and looking at them 
in a browser? That usually uncovers syntactical errors quite quickly.
Miles

At 10:08 PM 8/15/2002 +0200, Christian Ista wrote:
> > Havn't the foggiest idea what it means, but what has usually happened
>is
> > that I missed a ";" on an earlier line.
>
>
>That's happen when I include a page. But the strange this, I include the
>same page earlier and without any problem.
>
>The content of this page is a lot of variable (string), like that (a
>small part) :
>
>$var_login_nom  = 'Last name';
>$var_login_prenom   = 'First name';
>$var_login_email= 'Email';
>$var_login_password1= 'Password (6 char.
>min.)';
>$var_login_password2= 'Password
>(verification)';
>$var_login_creer_compte = 'Create a new
>account';
>
>Bye
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php



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




Re: [PHP] PHP and Transactions with InnoDB

2002-08-29 Thread Miles Thompson

I've not worked with InnoDb, but given that the web is a stateless space 
and all kinds of things can happen, I'd be very reluctant to lock a record 
until the very moment I'm updating it. In other words, when I have my batch 
of updates and inserts ready to go, then I'd begin by transaction, execute 
them, and do a commit or a rollback.

Cdn$ .02   - Miles Thompson

At 04:59 PM 8/29/2002 +0200, Geranium wrote:
>I could use some practical tips on doing transactions with InnoDB
>tables in MySQL.
>
>I want to grab and lock a record and do a whole load of related stuff,
>then make sure everything is updated in a consistent way, something
>like this skeleton:
>
>BEGIN
>
>SELECT * from blah WHERE something=n FOR UPDATE //Grab and lock a record
>
>SELECT * from t1, t2 where a=1 ...
>
>INSERT blah...
>
>UPDATE something else...
>
>if ($allok)
>COMMIT
>else
>ROLLBACK
>
>I don't quite get what I need to do to make sure these are all regarded
>as part of the same transaction. Does the transation apply to all
>queries made between the begin and commit (I assume so)? What happens
>when I have another process doing the same thing at the same time?
>Do I need to keep the result value I get from the begin query and
>somehow use it for the commit at the end so MySQL knows they are two
>ends of the same transaction? Or does MySQL somehow track that for me -
>i.e. can there only be one transaction in progress per connection?
>
>I'm finding the MySQL docs are extremely dry and somewhat short on
>examples...
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php



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




Re: [PHP] question

2002-09-11 Thread Miles Thompson

Julie Meloni to the rescue again - http://www.thickbookcom, you'll find a 
tutorial on custom error messages.
In fact, after working on that you may rethink your approach.

Miles Thompson

At 04:31 PM 9/11/2002 +0300, Meltem Demirkus wrote:
>Hi,
>I am working on a process which turn to the previous page when the user
>enter something wrong in the form on a page .But I also want to warn the
>user with an error message on this page ...I know using heder : location but
>I couldn't  add the message ...
>can anybody help me ? How can I add this message to the page..
>thanks alot
>
>metos
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


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




[PHP] Import & Stamp PDF's

2002-09-20 Thread Miles Thompson

Each evening I distribute a newsletter to approx 500 subscribers, and I 
want to stamp each copy I send with the name, email address and subscriber 
number of the recipient. I've not done any programmatic PDF manipulation, 
but could this be done using PDFlib? I receive the newsletter as a PDF from 
the publisher, it's not generated on my system. I envision it running as 
follows:

Have fetched all this information from the database, while processing the 
result set ..
Open a copy of todays_news.pdf
Write the desired information to a certain block/watermark
Save it

Create the mail message & attach PDF
Send it

Delete the copy
Repeat


Regards - Miles Thompson


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




Re: [PHP] Adding to a MySql Database

2002-09-24 Thread Miles Thompson


Marek's a bit more elegant, but I'm wondering when twelve of us press the 
button and the database is hit bang, bang, bang. Mightn't a MySQL 
autoincrement field be better, and let MySQL do the work?

mt

At 07:32 PM 9/24/2002 +0200, Marek Kilimajer wrote:
>Or better UPDATE table SET col = col +1
>
>Jay Blanchard wrote:
>
>>[snip]
>>I have a field on a MySql database that is started with a 0, and I want
>>to add 1 to this field every time a button is pressed on a form. So it
>>should add one every time, like if there is 5 and you press it one time
>>it would have 6.
>>[/snip]
>>
>>1. SELECT for the current value
>>2. add 1 to the current value
>>3. UPDATE the new value
>>
>>HTH!
>>
>>Jay
>>
>>"I ain't gonna write your code for ya' or fix your computer neither"
>>
>>*
>>* Texas PHP Developers Conf  Spring 2003*
>>* T Bar M Resort & Conference Center*
>>* New Braunfels, Texas  *
>>* Contact [EMAIL PROTECTED]   *
>>*   *
>>* Want to present a paper or workshop? Contact now! *
>>*
>>
>>
>>
>>
>>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


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




Re: [PHP] MyPHPNuke1.8.8-1 *** Nuked ***

2002-09-25 Thread Miles Thompson

Some themes are not as fully worked out as they should be. At the MySQL 
console, use this to reset the them to PostnukeSilver.

mysql> update nuke_module_vars set pn_value = 's:14:"PostNukeSilver";' 
where pn_id = '9'

The "s" denotes a string
The "14" is the length of the theme name
Make certain the name you use matches the case used in the directory 
holding the theme.
The closing ";" must be included.

I also tried clicking and swearing, but the system would not respond. 

Hope this helps - Miles Thompson

At 03:58 AM 9/25/2002 +0100, James Redfern wrote:
>I used Update System on my E-smith server to install
>dmc-mitel-myphpnuke-1.8.8.-1.noarch.rpm without errors.  Looked good
>but I thought I'd change the theme, so after having read the manual
>for 30 minutes, logged in as "God" and selected a yellow one.  It
>started to load and then stopped with just a header.  And that's as
>far as I got.
>
>Now I have no access to the interface or admin as there are no working
>links on the page.  No amount of clicking, refreshing or swearing at
>it seems to work.
>
>Any ideas?
>
>I even tried to uninstall it but RPM reports an error and says it
>isn't installed.
>
>It seems I'm damned if I do and damned if I don't!
>
>JR.
>
>--
>James Redfern [The Redfern Organization]
>PGP Auto-responder <mailto:[EMAIL PROTECTED]?subject=0xCB81E8E8>
>Fingerprint: 6809 FE89 4CEF E76F C6DF  04BF 46DC 58B9 CB81 E8E8
>
>...You always suppress momentary anger at something you deeply and 
>permanently hate"--Robert M. Persig
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


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




Re: [PHP] How to test if a number is negative

2002-09-25 Thread Miles Thompson

$x = -1;
if ($x < 0 ){
 echo "Negative";
else
 echo "Positive";
}

Or am I missing something?

Miles

At 07:02 PM 9/25/2002 -0700, Mike Dunlop wrote:
>I've look through all the numerican functions but can't readily see a way 
>to test for a negative number e.g -7
>
>Any ideas on how to do this?
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


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




Re: [PHP] How to test if a number is negative

2002-09-25 Thread Miles Thompson

Or, as my teenage son, who is smarter than me, suggests ...

 1 / $x + abs( $x )

which yields 1/0 if $x is neg.  (He didn't go into trapping for the error 
... sigh.)

Miles

At 11:07 PM 9/25/2002 -0300, Miles Thompson wrote:
>$x = -1;
>if ($x < 0 ){
> echo "Negative";
>else
> echo "Positive";
>}
>
>Or am I missing something?
>
>Miles
>
>At 07:02 PM 9/25/2002 -0700, Mike Dunlop wrote:
>>I've look through all the numerican functions but can't readily see a way 
>>to test for a negative number e.g -7
>>
>>Any ideas on how to do this?
>>
>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


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




RE: [PHP] what do you think?

2002-09-27 Thread Miles Thompson


Fully concur.

mt

At 01:26 PM 9/27/2002 +0100, Ford, Mike   [LSS] wrote:
> > -Original Message-
> > From: Arminas [mailto:[EMAIL PROTECTED]]
> > Sent: 27 September 2002 11:38
> >
> > about http://smanager.web1000.com/
>
>I think the page needs a drastic proof-read and grammar check -- I have 
>trouble understanding what some of it is even trying to say.  And I 
>haven't a clue what "ASSAY TO INTEGRATE MANAGEMENT" is supposed to mean!
>
>It looks like a nice product, but I wouldn't even evaluate it after 
>looking at this because I'd be worried about having to spend too much time 
>trying to decipher it's output.
>
>Cheers!
>
>Mike
>
>-
>Mike Ford,  Electronic Information Services Adviser,
>Learning Support Services, Learning & Information Services,
>JG125, James Graham Building, Leeds Metropolitan University,
>Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
>Email: [EMAIL PROTECTED]
>Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


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




Re: [PHP] Distance Script Available?

2002-10-04 Thread Miles Thompson

 From concept to reality?
mt

At 02:51 PM 10/4/2002 +0200, Maxim Maletsky wrote:
>Distance of what?
>
>
>On Fri, 4 Oct 2002 07:21:53 -0500
>"RoyW" <[EMAIL PROTECTED]> wrote:
>
> > There has to be somewhere you can pick up a script or function that will
> > calculate distance?
> >
> > :-)
> >
> > Roy
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>--
>Maxim Maletsky
>[EMAIL PROTECTED]
>
>www.PHPBeginner.com  // where PHP Begins
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


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




Re: [PHP] Getting Newest

2002-11-07 Thread Miles Thompson
Lighten up! Participation here is voluntary.

Maxim gave you a good answer, as you provided no information about the 
table structure. I'd be wondering why you are using three tables, but 
that's probably another discussion. Based on what he gave you, and a little 
study you should be able to figure it out, otherwise query each table in 
turn & pick the most recent according to whatever criteria you use.

Have an index on the field which determines "most recent", check the max() 
function and side effects it may have on query speed.

Cheers - Miles Thompson

PS Why do you have three tables - is your data fully normalized?

At 03:19 PM 11/7/2002 -0500, Stephen wrote:
Did you not read what I asked? I have three tables, I need to get the newest
from whichever table has the newest piece of content.


- Original Message -
From: "Maxim Maletsky" <[EMAIL PROTECTED]>
To: "Stephen" <[EMAIL PROTECTED]>
Cc: "PHP List" <[EMAIL PROTECTED]>
Sent: Thursday, November 07, 2002 12:46 PM
Subject: Re: [PHP] Getting Newest


>
> SELECT * FROM table ORDER BY date DESC
>
>
> --
> Maxim Maletsky
> [EMAIL PROTECTED]
>
>
>
> "Stephen" <[EMAIL PROTECTED]> wrote... :
>
> > Sorry, I'm using MySQL.
> >
> >
> > - Original Message -
> > From: "Marco Tabini" <[EMAIL PROTECTED]>
> > To: "Stephen" <[EMAIL PROTECTED]>
> > Cc: "PHP List" <[EMAIL PROTECTED]>
> > Sent: Wednesday, November 06, 2002 4:00 PM
> > Subject: Re: [PHP] Getting Newest
> >
> >
> > > That depends on what DBMS you are using. Which one is it?
> > >
> > >
> > > Marco
> > > --
> > > 
> > > php|architect - The magazine for PHP Professionals
> > > The first monthly worldwide  magazine dedicated to PHP programmer
> > >
> > > Come visit us at http://www.phparch.com!
> > >
> > >
> >
> >
>
> --
--
> > 
> >
> >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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



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




Re: [PHP] Exim sendmail faults

2002-07-04 Thread Miles Thompson

Liam,

Unfortunately I discarded the earlier messages, so I don't know what your 
error is.
Do you have a fixed IP or do you have something like the Mpowered service 
where you're behind sympatico's NAT server?

Can you use exim to send mail from the console? Is sympatcio allowing this?

You may have to configure exim to use sympatico's SMTP server. (It's been 
so long since I've done that I forget how, and it was a real trial and 
error approach.)

This probably isn't much help - Miles Thompson

PS You may want to post this on the nslug.ca list; some mail guru's read 
it. /mt

At 01:58 PM 7/4/2002 -0400, Liam Gibbs wrote:
>Chris Hewitt wrote:
> > I was going to ask you whether a normal user on your computer could send
> > mail (OK, root counts). As the answer is no, it is not a problem with
> > your php setup.
> >
> > sympatico.ca has several MX entries, the first of which is
> > smtp26.bellglobal.com and I can ping that from here. I also get a
> > response by telnetting to port 25. I conclude that I could send email to
> > that address (whether the user would be accepted I don't know).
> >
> > As you presently cannot from your computer, I guess its an Exim
> > configuration issue (which I know nothing about), but have you
> > configured it up for your computer, domain etc.?
>
>Ok, perhaps I should explain the server set up a bit more...
>This will end up being off topic for PHP I think but perhaps
>there is someone who may be able to help me (I will also post
>this information on the Exim mailing list I just discovered).
>
>sympatico.ca is a large internet provider which I have an
>ADSL connection through. Any sympatico.ca servers don't belong
>to me but to the provider.
>
>Off this ADSL connection is a BSD box which does my firewalling,
>etc. Behind that box is the web server which is called
>www.cell.dhs.org (cell.dhs.org being my domain). On this
>server is a Debian Linux box which runs Apache with PHP,
>the Exim mail server, etc.
>
>So, any idea what I could be missing from my configuration
>that would let me ping addresses nslookup them but not
>send mail to them?
>
>Any other questions/information needed?
>
>thx for the help!
>
> > Liam Gibbs wrote:
> >
> > >
> > >Ok, fair enough.
> > >
> > >Here are the full errors I get when I try to mail "[EMAIL PROTECTED]"
> > >(BTW, I'm doing it as root but I get the same errors no matter who
> > >I'm logged in as or if I do it through PHP):
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php



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




Re: [PHP] Exim sendmail faults

2002-07-04 Thread Miles Thompson

Liam,

Is "anydomain.ca" in exim's configuration file? Where did that come from?

And, you probably know much more about this than I do, but did you try 
those little validation exercises in exim's setup guide? I assume exim 
let's you send mail to yourself on the same box.

This ain't much help - Miles

At 02:21 PM 7/4/2002 -0400, Liam Gibbs wrote:
>Miles Thompson wrote:
> > Unfortunately I discarded the earlier messages, so I don't know what your
> > error is.
>
>When I try to send an email I get:
>unrouteable mail domain "anydomain.ca"
>
>I can resend you the full error messages if you want.
>
> > Do you have a fixed IP or do you have something like the Mpowered service
> > where you're behind sympatico's NAT server?
>
>I have a fixed IP address. My BSD box is using NAT to port forward
>to the web server which sits behind it.
>
> > Can you use exim to send mail from the console? Is sympatcio allowing this?
>
>Sympatico allows it but I can't do it (I used to have another
>box that did this but it got hacked and pretty much destroyed...)





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




[PHP] Re: [PHP-DB] PHP dBASE connectivity

2002-07-04 Thread Miles Thompson

1. Please don't cross post.
2. Which line is #23?
3. Have you tested to ensure that you have a valid handle? ($db_num)
4. Have you tried adding error code to see the result of dbase_create(), 
dbase_open()
5. I seem to remember reading in the docs, a long time ago (2 yr) that the 
dbase functions were not really reliable and were intended mostly to 
extract info for export to another database. I could not be 100% wrong on 
that, and I've not worked with the dbase functions in PHP.

After this reply, please keep this focused on the php-db list.

Regards - Miles Thompson

At 12:14 PM 7/4/2002 +0100, labhras sammin wrote:
>Hi I need to use PHP (ver 4 windows) to add a record to a dBase iv database.
>
>I can  create, open, read and close a database but when I try to add a
>record I always get  the following error:
>Warning: unexpected error in C:\php\phpstuff\addTest1.php on line 23
>
>Here is the code [shortened] that I use to create the database table, open
>the table, create the record and add the record- the database table has one
>field a 10 char string:
>
>$dbname = "test1.dbf";
>$dbflag = 2;
>$def = array( array("name", "C",  10));
>dbase_create($dbname, $def));
>$db_num = dbase_open($dbname, $dbflag);
>$new_record['name'] = 'xx';
>dbase_add_record ($db_num, $new_record);
>
>any help, advice or code samples would be very appreciated
>thanks
>Labhras
>
>
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php



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




Re: [PHP] Re: Working under Apache 1.3 but not Under IIS (Problem Resolved But its too Slow)...

2002-07-09 Thread Miles Thompson

Index your database on the name and password fields and issue this query

Select count(*) where name = '$namevar' and password = '$passvar'

If count > 0 you have a hit, proceed with rest of authentication, else send 
appropriate error msg.
Whatever you do, DON'T make sequential searches through a database. They 
are agonizingly slow.

Regards - Miles Thompson

PS cs.mun.ca is different, where are you located?

At 04:31 PM 7/9/2002 -02-30, you wrote:
>I got it fixed by changing the Max Execution Time in the
>php.ini file...  However, this is ridiculously slow...   Does
>anyone else have any idea how I can run through a 4 MB+
>Database checking 2 fields Without having to wait longer
>than 30 seconds...  If it was a simple text file it would
>have been easy using different search strategies (possibly
>even Hashing Keys...)
>
>Please give me some suggesstions...
>
>Kondwani...
>"Kondwani Spike Mkandawire" <[EMAIL PROTECTED]> wrote in message
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > The function shown below only functions with my
> > Apache on WinNT...  I have tried it on my local
> > Server (thats the one running the Apache and
> > it works perfectly)...  I am trying to step through
> > a moderately large database (4MB)...  However when
> > I tried the example on the Server for my Work
> > Place it returned an error stating that the Script
> > took longer than 30 seconds to execute hence
> > failed...  When I search for a name at the top of
> > the Database it immeadiately Spits out Found!...
> > The server on which this fails is an IIS WebServer, I am
> > not quite sure what version it is...  I am kind of
> > at a loss whether its to do with the scripts efficiency
> > or the Servers Settings...  Why is it possible to
> > execute the Script easily on my local host...
> >
> > Here is the location...
> >
> > http://www.coop.mun.ca/verification.php
> >
> > Try and Type in any Name...  As it should simply
> > Step through the Database not find it and Respit the Page...
> > However this does not happn...
> >
> > Please Help...
> >
> > if (function_exists(odbc_fetch_array))
> >   return;
> >
> > function odbc_fetch_array($result, $rownumber=-1) {
> >   if (PHP_VERSION > "4.1") {
> > if ($rownumber < 0) {
> >   odbc_fetch_into($result, &$rs);
> > } else {
> >   odbc_fetch_into($result, &$rs, $rownumber);
> > }
> >   } else {
> > odbc_fetch_into($result, $rownumber, &$rs);
> >   }
> >   foreach ($rs as $key => $value) {
> > $rs_assoc[odbc_field_name($result, $key+1)] = $value;
> >   }
> >   return $rs_assoc;
> > }
> >
> >
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php



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




Re: [PHP] mysql question

2002-07-11 Thread Miles Thompson

Yes, though I'd probably add parentheses to make it clearer.

select * from table where ((start_shot <= $current_shot) and (end_shot >=
$current_shot))

Though that's probably not necessary. Make certain you have your less 
than's and greater thans set the right way, I've often sat slack-mouthed 
wondering why I had no data, simply because I was using "<" when it should 
have been ">".

Cheers - Miles Thompson

At 12:06 PM 7/11/2002 -0400, Alexander Ross wrote:
>I realize this isn't a php question, but I figured that someone here knows
>of a good mysql newsgroup and in the mean time someone here probaby knows
>the answer to my question.
>
>Can I set up a query like this:
>
>select * from table where start_shot <= $current_shot and end_shot >=
>$current_shot
>
>note everything will be of type INT
>
>Thanks ya'll
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php



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




Re: [PHP] Searching a Paradox Table with my PHP Script..

2002-07-11 Thread Miles Thompson


Why are you building the array? Why not let SQL do the work?

Select col1, col2, col3, ... coln from target_table where 
field_holding_target_value = '$target_value_i_want'

If you have no records returned, then no match, otherwise you have one or 
more matches. In the second case you can proceed with your processing. I've 
also noted Chris Hewitt's suggestions re number of connections, etc.; 
that's worth checking as well.

See below as well ...

Cheers - Miles Thompson

At 04:00 PM 7/11/2002 -02-30, Kondwani Spike Mkandawire wrote:
>Hallo folks:  (Sorry for a repost on the same topic just
>that my first one never got through)...
>
>I have a bit of an issue with Paradox Table Searching...
>I have a fairly large table (4MB+), here is the problem:
>
>When I run a search for an element in the Table on
>my localhost which is running Apache and php 4.1,
>I have no issues with speed...  However when I run it
>on the Server at my work place, which is running IIS
>Server (I am not sure which version), and the same
>PHP version on my Workstation it takes ages to execute...
>
>I have gotten suggestions and have revised my Script
>over and over using odbc_exec() with SQL commands
>SELECT myColumn FROM myTable, I have used
>a COUNT SQL command suggested on this forum,
>My general algorithm is as follows...
>
>1)  I create an Array using odbc_fetch_array this Array
>  contains one column from the Table I am searching...

How are you populating the array?

>2)  Keep trying to matchup each element in the array
>  against the validation element being checked...
>  returning found within a sequential loop...
>  and eventually "Not Found"...

Are you hitting the database each time through the loop, or stepping 
through the result set?
How many elements in the array?

>3)  I suppose the sequential loop is whats killing me,
>   but the table is not ordered hence I am forced to
>   do a sequential search..  Does anyone else have
>   an idea for a quicker and much more efficient
>   algorithm...

What reasons are there for not ordering the table? Indexes speed things up 
dramatically, for both the users on the LAN and those accessing via the 
'Net. Use indexes, they're your friend!


>Once again the issue of Speed is a non-factor on
>my local machine running Apache but it does become a
>factor when I run it on our Server, which is running an
>IIS Server...
>
>Thanks in advance...
>
>Kondwani



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




Re: [PHP] One more thing... e-mails format

2002-07-12 Thread Miles Thompson

Cesar ...
You've touched a nerve ...

For a start, because the list requires it.

Second, because we have no idea what kind of client the members are using.

Third, plain text is all that is needed to communicate the ideas and 
concepts necessary to this list.

Fourth, plain text renders blocks of code, indentation, etc. cleanly and 
consistently.

Fifth, "rich" email or HTML email is a crock promoted by Microsoft, and 
results in unnecessarily bloated messages.

Sixth, the "features" of HTML email are often employed to the detriment of 
clear and concise writing.

And I could probably come up with more, but those are just off the top of 
my head. I don't know if you were around when W95 first came out, but 
Outlook offered, and it still does, to make Word the default email editor. 
For about 6 mos life on mailing lists was hell until people were trained to 
turn that off. Can you imagine reading an HTML formatted message in 
Pegasus, mutt or pine?

Cheers - Miles Thompson


At 02:45 AM 7/12/2002 -0300, César Aracena wrote:
>ItÂ’s me againÂ… and not PHP related. Why is it that every piece of mail I
>send to the list comes back as a *rich text” or sometime even “plain
>text”, when my M$ Outlook is set to send HTML messages? I think it would
>make sense if *EVERYBODY* e-mail where received like mine because of
>serverÂ’s settings, but some people letters appear as they intend to be.
>Any thoughts? Thanks,
>
>Cesar Aracena <mailto:[EMAIL PROTECTED]>
>CE / MCSE+I
>Neuquen, Argentina
>+54.299.6356688
>+54.299.4466621
>



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




RE: [PHP] postnuke / geekware?

2002-07-18 Thread Miles Thompson

At 08:16 PM 7/18/2002 -0400, John Holmes wrote:
> > hi,
> >
> > anyone have an opinion on postnuke versus geekware for a php-based
>CMS?
> >
> > cheers,
> > jaxon
>
>No...I kind of prefer GeekLog... geeklog.sourceforge.net
>
>---John Holmes...
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

John,

Reasons why? I've been looking at a number of them; PostNuke seems to have 
the most aggressive development effort, including modules, blocks and themes.

Miles Thompson



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




[PHP] Re: [PHP-DB] Fatal error: Call to undefined function: pg_connect() in .....

2002-07-18 Thread Miles Thompson

Is PostgreSQL started with the -i switch? (I think that's the one; it 
exposes it to tcp/ip connections.)  Check your PGSQL docs to be certain.

Have you run a page with phpinfo? Is PostgreSQL support compiled into your 
installation of PHP? This is a file consisting of
, named phpinfo.php. Again, I'm doing this from memory but 
I'm pretty certain of the function name.

If you have a yes to those questions, then we can start on the rest. Check 
to see if there is a pg_error function you can call if the connection 
fails. Keep error reporting at a high level so we can see what they are.

Regards - Miles Thompson

At 06:37 PM 7/18/2002 -0700, Vincent wrote:
>Hi, I'm a newbie here. I don't know what went wrong.
>I've tried searching for solutions and can't find any.
>How come pg_connect() isn't defined? Should I include
>any header files or something in php?
>
>Here's my code:
>
>connect to database
>"; } else print "Connected"; ?>
>I've tried installing Apache's rpm and Php's rpm. I'm
>running on RedHat Linux 7.3. apache_1.3.23-11.i386.rpm
>and php-4.1.2-7.rpm. Then, it still gives me the error
>message. So, I tried the gz version using
>apache_1.3.26.tar.gz and php-4.2.1.tar.gz. Nothing
>works. I've tried looking into the php.ini files,
>adding extension to pgsql.so.
>
>Have any of you encountered this problem before?
>
>__
>Do You Yahoo!?
>Yahoo! Autos - Get free new car price quotes
>http://autos.yahoo.com
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php



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




Re: [PHP] dynamical balancing text in two colums

2003-08-27 Thread Miles Thompson
We tried something like this in the spring. If the paragraphs are uniform 
in length you can get columns roughly balanced - but never with a high 
degree of certainty.

We also knew our subscribers would be printing out the copy, and that's 
where we gave up on two column layout, as we had no control over the sheet 
size, font size, etc. If an article extended over two pages, you had to 
read the first colum to the bottom, turn the page and keep reading to the 
end of the column, then flip back and start reading the second column.

I suppose one could get closer, but look at the desktop publishing programs 
- apart from FrameMaker, you have to flow and place text by hand. To do it 
we'd be counting lines, adjusting for heads and bylines, and hoping, 
hoping, hoping it would not look too disgraceful.

So we bailed out - the subscriber could read it online, with a decent line 
lenght in a Flash movie, or accept "typewriter like" printout extending 
across the page. What made that decision easier was a survey which 
indicated that over 90% of subscribers read it on line and did not print it.

Cheers - Miles Thompson

At 07:10 PM 8/26/2003 +0200, Dynamical.biz wrote:
Hi, I've been dealing withs this question:

I've never seen dynamical balanced text in two colums in a web so this the
challenge.
html formated text is stored in a database, conetion and placed into a
variable i.e.:
$text = "http://www.lamundial.net/img/labordeta.jpg"; align=left
border=0>efe.Zaragoza. El parlamentario.Some more text
tranquilo simplenente trabajando."; ... some more paragrphs just like
newspaper articles.
the first idea is this:
1. count the total characters in $text string so we can guess juts the half
2. getting into $tx1 variable the fisrt half
3. count the total characters in $tx1 till the fisrt "" STARTING from
the END to the BEGUINING of $tx1
4. getting into $col1 the fist part
5. getting into $col2 the rest
6. render the text in a table
//CODE
1. $half = floor(strlen($texto)/2);
2. $tx1 = substr($text,0,$half);
3. $first_P = strrpos($tx1,"");
4. $col1 = substr($text,0,$first_P);
5. $col2 = substr($text,$first_P);
6.

  


  

PROBLEMS
easy to know the middle point of a string but we have html code so easy to
break it badly, something like:
 so this is
why the  idea.
If there is a large paragrph in the middle of the whole text the columns the
two columns are not so nice balanced, this is why I ask the people writing
articles for my web trying to avoid long ones. They use HTMLAREA
http://www.interactivetools.com/products/htmlarea/ from Interactive tools so
the html is not done by hand.
anyway just in case there is no way to correctly balance the text I let the
writer the "1 colum / 2 colums" as an option so the traditional 1 colum (no
colums) is always available. they can display the final render os the
article as they save it when writing so the decide.
this is working at most of the articles in
http://www.lamundial.net
i.e.:
http://www.lamundial.net/home.php?pg=article&idart=124
http://www.lamundial.net/home.php?pg=article&idart=121
http://www.lamundial.net/home.php?pg=article&idart=118
the text balancing is working quite nice

any other idea?
thanks


aniceto lópez
DYNAMICAL.BIZ
web development
host services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Linux Issues

2003-09-07 Thread Miles Thompson
You're way off topic for the PHP list, and if you are asking this kind of 
question you are probably going to need a lot of support.

If you were in Maritime Canada I'd suggest you post these questions to 
NSLUG; if not, post to a Linux Users Group near you. Google for your 
region/country. I'd also recommend buying a boxed version as you appear to 
be having trouble with your ISO images.

If you insist on dloading, get Knoppix as it will run from the CD, then you 
can go from there. Verify the MD5 checksum's against what you downloaded.

Regards - Miles Thompson



At 09:36 AM 9/7/2003 -0500, you wrote:
Another question if you will...

When downloading Linux ISOs or whatever, which do I need? What is the
difference between i386, PPC, and all those other exactly? How do I know
which I need?
Thanks,
Stephen Craton
- Original Message -
From: "Stephen Craton" <[EMAIL PROTECTED]>
To: "andu" <[EMAIL PROTECTED]>
Cc: "PHP List" <[EMAIL PROTECTED]>
Sent: Sunday, September 07, 2003 8:35 AM
Subject: Re: [PHP] Linux Issues
> Well, I'm wanting one with a really nice GUI and great functionality. I'll
> check into Debian and Slackware later today after church. Any other good
> recomendations?
>
> Thanks,
> Stephen Craton
> - Original Message -
> From: "andu" <[EMAIL PROTECTED]>
> Cc: "PHP List" <[EMAIL PROTECTED]>
> Sent: Saturday, September 06, 2003 11:02 PM
> Subject: Re: [PHP] Linux Issues
>
>
> > On Sat, 6 Sep 2003 22:41:29 -0500
> > "Stephen Craton" <[EMAIL PROTECTED]> wrote:
> >
> > > Thanks for the replies.
> > >
> > > I've tried both 8.1 and 9.1 versions of Mandrake Linux with no luck (I
> > > bought the 8.1 CDs a while back)
> > >
> > > I've also tried making a floppy disk but still no luck with 8.1. In
9.1,
> I
> > > can't get the autorun screen to make the floppy disk.
> >
> > Try another distro, I recommend Slackware or Debian. Another option is
to
> get one
> > of the distros which run from the cd with the option to copy it to hard
> drive like
> > Knoppix, they have more advanced auto-configuration software.
> >
> > >
> > > Thanks,
> > > Stephen Craton
> > >
> > > - Original Message -
> > > From: "Dan Anderson" <[EMAIL PROTECTED]>
> > > To: "Stephen Craton" <[EMAIL PROTECTED]>
> > > Cc: "PHP List" <[EMAIL PROTECTED]>
> > > Sent: Saturday, September 06, 2003 10:09 PM
> > > Subject: Re: [PHP] Linux Issues
> > >
> > >
> > > > Oh also make sure you are using /9.1/ and NOT /9.2 RC1/!
> > > >
> > > > -Dan
> > > >
> > > > On Sat, 2003-09-06 at 22:51, Stephen Craton wrote:
> > > > > Hello,
> > > > >
> > > > > This isn't really a PHP issue but I have no where else to go to
get
> help
> > > really. Hopefully someone here can still help me.
> > > > >
> > > > > I am running Windows XP and have decided to install Mandrake Linux
> on
> > > top of it just for the heck of it. So, Friday I downloaded the latest
> ISO
> > > files from an FTP server and today I put in the burnt CDs and it takes
> me to
> > > the boot screen for it. I push enter (as it says to enter the setup)
and
> it
> > > takes me to a blank screen and just sits there, doing nothing except
> > > flashing the Caps Lock and Scroll Lock lights on my keyboard.
> > > > >
> > > > > I went to the online manual for Mandrake and it said to add the
text
> > > "noauto" which I did for the boot sequence. Same error. Any ideas
what's
> > > going on and how to fix it?
> > > > >
> > > > > Thanks,
> > > > > Stephen Craton
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > > >
> > > >
> > > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > >
> >
> >
> > 
> > Regards, Andu Novac
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] 'while' not picking up on first DB record

2003-09-17 Thread Miles Thompson
Please don't cross-post.
See below - M.
At 10:17 AM 9/17/2003 -0400, Roger Spears wrote:
Hello,

Can anyone from the lists please tell me why this bit of code is not 
picking up on the first record in the database?  If the 'id' I'm looking 
for is '1' it doesn't populate the _SESSION variables.  Any 'id' greater 
then '1' will populate the _SESSION variables.

$q = "SELECT * FROM employee";
$r = mysql_query($q);
You're picking up first line here, but doing nothing with it.

$row = mysql_fetch_array($r);
So delete it or comment it out.


while ($row = mysql_fetch_array($r))
 {
   if ($employee == $row["id"])
   {
   $_SESSION['dear'] = $row["last_name"];
   $_SESSION['to_email'] = $row["email"];
   }
 }
Thanks,
Roger
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Slow searches in large database

2003-10-13 Thread Miles Thompson
Start by checking the MySQL docs to find out if indexes are used with "IN" 
and "LIKE" especially as the latter is using wildcards. I suspect not.

Given that you are essentially performing a  sequential read of the 
database and checking on all these fields your performance is remarkably good.

Soltuion? Use indexes wherever possible and refine you query. Do you have 
to search on all those fields, is there any way of deriving a subset?

Alternately, investigate MySQL full-text search and see if you can put that 
to work for you.

I also recommend posting this question on the MySQL list as it's really a 
db, not a PHP question.

Cheers - Miles Thompson

At 11:54 PM 10/13/2003 +0100, Adrian Teasdale wrote:
Hi there

Wondering if someone could help or give some advice.

We have a mysql database that has approximately 20,000 records and has a
total size of 125mb  There are approximately 25 fields that we need to
search each time that someone performs a search.  We have installed
TurckMMCache onto the server which speeded up the searching, but it
still takes around 15 seconds for the results to be displayed.
An example of one of our search strings is:

select docs.* from docs where 1 and CY IN ('GB')  and (TI like
'%searchstring%' or PD like '%searchstring%' or ND like '%searchstring%'
or DR like '%searchstring%' or DS like '%searchstring%' or DD like
'%searchstring%' or DT like '%searchstring%' or RN like '%searchstring%'
or HD like '%searchstring%' or TD like '%searchstring%' or NC like
'%searchstring%' or PR like '%searchstring%' or RP like '%searchstring%'
or AA like '%searchstring%' or TY like '%searchstring%' or AC like
'%searchstring%' or PC like '%searchstring%' or RC like '%searchstring%'
or RG like '%searchstring%' or AU like '%searchstring%' or TW like
'%searchstring%' or CO like '%searchstring%' or AB like '%searchstring%'
or TX like '%searchstring%')
Basically, is there anything that anyone can immediately suggest that we
need to do to speed things up?
Thanks

Ade

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


Re: [PHP] (ANNOUNCE) New PHP mailing list *searchable* archives

2003-10-21 Thread Miles Thompson
V. nice.
All the more importnat ot NOT HIJAC threads.
Miles
At 10:07 AM 10/21/2003 -0400, Marco Tabini wrote:
Hello Everyone--

I wanted to let you know about a new initiative that php|architect has 
launched: the Searchable PHP Mailing List Archive, which can be found at 
http://phparch.com/mailinglists.

This is a fully searchable archive of the PHP mailing lists with an 
attempt to build proper threading, keyword highlight, automatic quoted 
text indentation and a few other features.

It's still a bit experimental, and some features don't work as best as 
they could. However, it should be fairly functional, and the full-text 
search engine can be helpful if you're looking for fast answers to 
problems that are often asked on the mailing lists. It's there for 
everyone to try, and please feel free to drop me a note if you think 
something doesn't quite work the way it should or if you have ideas about 
possible enhancement. At the present time, one of the things we're working 
on is filtering the messages trough SpamAssassin and allowing for the 
possibility to exclude messages marked as spam from the search results.

We built our archive because we found it difficult to find a good search 
resource dedicated only to the PHP mailing lists. I hope it will help you, 
as well.

Cheers,

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


Re: [PHP] training material on PHP + MySQL + IIS + Windows 2000

2003-11-07 Thread Miles Thompson
At 11:41 PM 11/7/2003 +0800, Denis L. Menezes wrote:
Hello friends,

Does anyone have a training course that can be bought or licensed for
training PHP and WAMP?
Thanks
Denis
Denis,

That's not an easily answered question; each is a major product. Would you 
want a gloss, or in depth approach?

There are certainly lots of training courses for Windows, and probably for IIS.

I believe the MySQL web site has training courses listed, but this would 
also depend on how much database theory you want to absorb. (Some is needed 
so that you design effective data structures.)

And as for PHP, how much programming knowledge do you have? If the answer 
is "Some", then there are lots of online tutorials and examples which give 
you enough to get started. Otherwise, a basic programming course would be a 
good first step - even one of the quickie or Dummies books. Something that 
doesn't require a web server would be a good idea, say "Python in 24 
Hours", if such a title exists.

Regards - Miles Thompson

PS You may want to familiarize yourself with Linux and Apache, as that's 
how the majority of web sites are hosted. You would also save yourself a 
bundle in licensing fees. 

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


Re: [PHP] Is a while loop the most efficient way to send out multiple emails?

2003-12-30 Thread Miles Thompson
At 05:37 PM 12/30/2003 +0900, Dave G wrote:
PHP Gurus,
I currently run a few newsletters that go out to small groups of
50 to 100 people. I use a while loop to send out the emails. I chose a
while loop as opposed to just taking all the emails and putting them in
the CC field because I wanted to personalize each email with a greeting
that included the recipients name and other personalized information. It
looks like:
while ($member = mysql_fetch_array($sqlQueryResult)
{
$content = "Hi, {$member[name]}. Your email address is
{$member[email]}";
mail ($member[email], $subject, $content)
}
When I execute my script, it takes a little time to go through
about 50 people. I'm not sure exactly, but maybe ten seconds, possibly
as high as twenty.
Soon I will be creating a script to send out an email to 500
people, with the possibility that it will grow to 1000. I'm concerned
that the while loop will take ten times as long, and not only be a drain
on the server, but also run the risk of my browser timing out waiting
for a response to confirm all mails were sent.
So my question is, is there a way more efficient than while
loops to send out multiple emails with personalized information? Is it
the mail() command that takes time, or the mysql_fetch_array(), or both?
Any suggestions would be greatly appreciated.
--
Yoroshiku!
Dave G
[EMAIL PROTECTED]


Dave,

This goes out to 900 people every night, I just bought myself some time by 
adding this at the bottom of the while loop:
// give ourselves more time
set_time_limit( 20 );

I also echo the recipient's email & an OK/Fail, depending on what mail() 
returns, to the browser so that I can see the progress.

HTH - Miles

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


[PHP] Classified Ads scripts with session authentication

2004-01-13 Thread Miles Thompson
I have googled, and there are scores of them.

We have our own database (MySQL) which we use to authenticate subscribers 
for out news site; does anyone know of a classified ads script that uses a 
session (or a cookie) to maintain authentication info? If so, we could 
provide our own front end and use the rest.

I know this is a long shot - thanks for having a look.

Regards - Miles Thompson

PS What we want to do is enable subscribers to place ads for free, but have 
them available for anyone to look at. /mt

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


Re: [PHP] mysql question

2004-01-15 Thread Miles Thompson
Christian,

A red flag is flying.

Usually, when people start talking about how the number of tables will 
multiply in an application, there is a problem with the design of data 
structures. If that's the case, now is the time to fix it.

Miles

At 05:35 PM 1/15/2004 +, Christian Calloway wrote:
Hey,

Sorry to post a mysql question here, but I wanted an answer from a PHP
perspective. I am currently working on a database (for work) which contains
40 tables, and will continue to expand. The reason for expansion of tables
is to obscure to get into, but the relationships all do make sence. I have
never worked on anything over like 50 tables, and I was wondering if I
should expect a performance hit, when say, I have 100 tables, 200 tables,
etc. Would it be wiser to break up the logical sections into there own
databases? Wouldn't that cause a bigger hit (to performance) with multiple
tables from multiple databases being opened on every user query? Thanks in
advance
Christian

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


[PHP] Combining results - is there better way?

2004-01-16 Thread Miles Thompson
This code works, but are there alternate, more efficient ways of doing it. 
A count of subscribers, by classification, has to be provided, where the 
classification definitions are in one table (class) with this structure:

   nClassKey - unique, numeric, autoincrement
   Classification - text ,name of the classification
   ClassDesc - text, description of the classification
and a nClassKey value is stored in each subscriber record.

As the version of MySQL used by my ISP lacks UNION capability, I'm fetching 
the necessary data with two SELECTS. The first retrieves nClassKey and 
Classification from the class table, and the results are put in an array, 
$arClass, where the $key is nClassKey and $value is Classification. Pretty 
straightforward, resulting in [1]=>Development, [2]=>Retailing ... 
[13]=>Agriculture.

For the count of classifications I used the following SELECT:

   select nClassKey, count(nClassKey) as classcount from subscriber group 
by nClassKey

and stick it in the array $arCount with this code:

   while ($myrow = mysql_fetch_array($result)) {
$arCount[$myrow["nClassKey"]] = $myrow["classcount"];
   }
All of this works. Note that $arCount can be a sparse array; there may be 
instances of nClassKey missing from the subscriber table simply because no 
one happens to fall in the "aerospace" category, for example.

To generate a listing for display, I am using the following code to 
traverse the $arClass array, searching in the $arCount for a matching key, 
leaving out all the HTML stuff:

   foreach($arClass as $key => $value){
  print( $value .  ":  ");
  if (array_key_exists($key, $arCount)){
 print( $arCount[$key] );
  } else {
print( 0 );
  }
   } // foreach
My question is if there is a faster, cleaner way to do this? I did try 
array_search, but as it looks for any matching value anywhere in the target 
array the results it returned were not reliable.

Regards - Miles Thompson

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


Re: [PHP] Combining results - is there better way?

2004-01-16 Thread Miles Thompson
John,
Perfect. Don't know where my head was.
Miles
At 10:29 AM 1/16/2004 -0500, John W. Holmes wrote:
Miles Thompson wrote:
   } // foreach
My question is if there is a faster, cleaner way to do this? I did try 
array_search, but as it looks for any matching value anywhere in the 
target array the results it returned were not reliable.
If I'm understanding you correctly, I think this'll work:

SELECT c.nClassKey, c.Classification, COUNT(s.nClassKey) FROM 
classifications c LEFT JOIN subscribers s ON c.nClassKey = s.nClassKey 
GROUP BY c.nClassKey

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


Re: [PHP] mysql question

2004-01-16 Thread Miles Thompson
Christian,

I did a bit of digging in the MySQL docs to try and find the limits on 
number of fields in a table, etc. Didn't have much luck. I would not worry 
about thousands, or even hundreds of thousands of rows in a table for two 
reasons. First MySQL is becoming a heavier-duty database, and second, when 
the proper indexes are used it is blindingly fast at retrievals. Apparently 
the database engine also handles a large number of tables quite well.

When tables will be multiplying like bunnies, as you posit here, I foresee 
major code headaches.

I've thought about following type of design but have never implemented it. 
Might it work in your situation? Maybe this is what you are already doing, 
and I've just  relabelled it. If so, please accept my apologies.

Have standard tables for the basic stuff.: company, with co_key, address 
fields etc; products with prod_key, co_key, prod_name, etc.

Have two other tables, let's call them prod_descriptors and prod_data. 
We're violating one of Codd's principles here because the prod_data table 
has meaningless field names, just f1, f2, f3, f4 ... fn. How you sort out 
which data types to use is your business.

Prod_descriptors contains the meta information which makes prod_data 
useful. Its fields, at a minimum, would be prod_key, prod_characteristic, 
prod_data_field. For a given prod_key "M56H" there would be a record for 
each product characteristic which you have to track, and the field used in 
prod_data.

This may be a somewhat extreme example, as it is highly likely that there 
are a common characteristics for all products, so things would not have to 
be totally generalized. This design is also somewhat wasteful of disk 
space, but MySQL does a remarkable job, internally, of conserving space so 
it is used efficiently. The thorny issue of which data types to use in what 
columns hasn't been addressed either.

The crunch is whether or not you can ask questions of these tables and 
fetch the data you need.





At 12:52 PM 1/16/2004 +, Christian Calloway wrote:
Well let me try and describe a simplified version of what I am doing. I work
for a group of analysts, and they analyse technical products. Each products
has about 300+ fields associated with it, and each product is vastly
different from the other. Let's say the product "foo" has a table "fields"
associated with it, which describes each field in foo (its name,
description, type[float,boolean,text], order) and another table called
"data_foo" which is 300+ fields in length. Each record in "data_foo"
represents the technical specfiications of a single company/manufacturer. So
if there are 200+ companies, there will be at least one data_foo record
associated with it (in reality there is a one to many association between a
company and the number of technical specifications they have defined).There
are many different applications designed around the tables "foo" and
"data_foo", and course the relationships are slightly more involved, but I
digress. Each new product specification requires that I create a new table
to hold that data, and with new product specifications being created every
month, you see that the N number of tables will increase. If I store that
data in the "fields" table or create a table that has 1-many relationship
with it, I endup with thousands and thousands of records (Remember, each
product has 300+ fields associated with it, and each company has at least on
product specfication, and the N number of products continues to increase).
Any ideas?
"Miles Thompson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Christian,
>
> A red flag is flying.
>
> Usually, when people start talking about how the number of tables will
> multiply in an application, there is a problem with the design of data
> structures. If that's the case, now is the time to fix it.
>
> Miles
>
> At 05:35 PM 1/15/2004 +, Christian Calloway wrote:
> >Hey,
> >
> >Sorry to post a mysql question here, but I wanted an answer from a PHP
> >perspective. I am currently working on a database (for work) which
contains
> >40 tables, and will continue to expand. The reason for expansion of
tables
> >is to obscure to get into, but the relationships all do make sence. I
have
> >never worked on anything over like 50 tables, and I was wondering if I
> >should expect a performance hit, when say, I have 100 tables, 200 tables,
> >etc. Would it be wiser to break up the logical sections into there own
> >databases? Wouldn't that cause a bigger hit (to performance) with
multiple
> >tables from multiple databases being opened on every user query? Thanks
in
> >advance
> >
> >Christian
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Flash-PHP Socket Connection

2004-01-20 Thread Miles Thompson
Use xmlReceiver to trigger the back end PHP script. Have that script 
generate XML which you parse in Flash. Plain text will work, but a single 
quotation mark in the text sends you off to never never land. Here's an 
example:

xmlReceiver.load( "http://"; + host + "feed_xml_article.php");

I know it's not a socket, but it's plenty fast.

Regards - Miles Thompson

PS What good would a socket to PHP do, anyway? (I probably just revealed my 
ignorance!) /mt

At 11:03 PM 1/20/2004 +0100, Eric Bolikowski wrote:
Hey Ben

I know it may sound nuts, but I really want to make a socket connection
between a Flash and a PHP file.
Normally I would simply read in a text file/read XML/send data with GET or
POST, but I'm looking for a socket connections of following reasons:
1) I want a fast connection
2) I'm looking at this as a challenge, because it doesn't seem like anyone
else has done this before
Eric

"Ben Ramsey" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> What I mean is: you shouldn't need to use sockets to read in a file from
> Flash unless you're trying to do something more complicated, but from
> the way it sounds, you just want to pull data from MySQL with a PHP
> script and output it to Flash.  The PHP script could just echo plain
> text and Flash can read that in just fine without needing to connect via
> a socket.
> -Ben
>
> Ben Ramsey wrote:
>
> > Flash has the ability to read in text files, so you could use PHP to
> > output data in the correct format and use Flash to read the PHP script
> > like it reads a text file.  We did this in ASP once upon a time.
> >
> > Here's a tutorial about reading text files into Flash:
> > http://www.virtual-fx.net/tutorials/html/loadtextfile.htm
> >
> > Also, from what I understand, Flash now has a great XML parser, so you
> > could use PHP to generate XML and Flash could read in the XML as
> > variables.  You might want to look into that, but I think it's only
> > available in the newest version.
> >
> > -Ben
> >
> >
> > Eric Bolikowski wrote:
> >
> >> Hi everybody
> >>
> >> I'm working on a site that will be based on Flash, PHP and MySQL. PHP
> >> will
> >> work as a middleware for Flash and MySQL.
> >>
> >> My problem is communication between Flash and PHP.
> >> I'm really out looking for using the socket functions in PHP and Flash
to
> >> make fast connection.
> >>
> >> I have googled for almost an hour now, and I can't seem to find any
> >> interesting. The only info I find, is about sending data between Flash
> >> and
> >> PHP with HTTP GET or HTTP POST.
> >>
> >> So if anybody has some general information on this or a link to a
> >> tutorial
> >> on the subject, I would like to get those resources.
> >>
> >> Thanks a lot
> >>
> >> Eric
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] looking for a PHP editor

2001-01-10 Thread Miles Thompson

Editors are like hammers - once you get used to one, well that's what you 
use because you know how it behaves. For a Windows environment I'll endorse 
jeremy's recommendation of Ultraedit -- my hammer of choice. It offers some 
neat features: tons of macros and word files for various languages, 
multiple windows into same document, an easily used column mode that just 
great for picking a list of fields from one file and inserting into another.

Need hex? Click on the "H" button on the toolbar.

Need wordwrapping? There's a wrap button, and wraps can be soft or hard.

Need to change formatting between DOS and Unix/MAC? Click of a button.

For Linx, etc.? I don't have a hammer yet. I feel obligated to use VIM, but 
I cut my teeth on WordStar for CP/M so Joe is comfortable, but I'm leaning 
towards Jed. I find VIM very arcane, but if it's your hammer of choice, go 
for it.

And if you have the horsepower, in the Linux GUI there's Bluefish -- looks 
quite nice.

Finally, don't forget AMAYA, but you won't find and PHP add-ons.

Now, can we pick one and get back to work?

Cheers - Miles

PS I really liked yesterday's comment that " Real Programmers cat 
/dev/audio > myprog and hiss machine code into the mic". Kewl!! //mt

At 08:35 AM 01/10/2001 -0500, defender of the protocol wrote:
>the specialized editors for php are bs, you don't need an IDE to script 
>your web page or anything else for that matter
>
>http://www.ultraedit.com
>
>go get a copy of UltraEdit, download the wordfile for php syntax so it 
>highlights properly, and you're set
>
>http://www.ultraedit.com/downloads/additional.html
>
>i'm sure someone on this list has said this before
>
>- jeremy
>
>At 07:49 PM 1/9/2001, you wrote:
>
>> > I went to their homepage, and couldn't find a link to download
>> > the actual program, just some example stuff, and it says "coming
>> > soon"... Is it out there somewhere and I'm just retarded, or are
>> > you mob on a beta list or something???
>>
>>www.codecharge.com/download
>>
>>Their homepage is sort of hidden because it's still in beta.
>>Like in the version i downloaded the generated code gave a lot of PHP errors.
>>I understand they are working on it every day, sometimes it works, sometimes
>>not.
>>
>>Also my trial period was only 1 day due to some error.
>>
>>
>>Chris
>>
>>
>>
>>
>>--  C.Hayes  Droevendaal 35  6708 PB Wageningen  the Netherlands  --
>>
>>
>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]




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




RE: [PHP] Calling a Windows Com object or an Extended Fetch?

2001-01-10 Thread Miles Thompson


Looks like we still have the famous MSFT definition of cross-platform:
Windows, Windows 9x, Windows NT (and now Windows 2000).

So, is this the clinching argument for CORBA, rather than COM?
And I doubt the vaunted COM+ solves the problem.

Miles

At 09:42 AM 01/10/2001 -0600, Paulson, Joseph V. \"Jay\" wrote:
>Well the next problem I have found is that php has to be running on a
>windows machine for the com objects to actually work and well we are running
>it on a Unix box.  So we can't use the com objects.  Thanks for all the help
>thought!
>Jay
>
>-Original Message-
>From: bard [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, January 09, 2001 5:37 PM
>To: Miles Thompson
>Cc: Paulson, Joseph V. "Jay"; [EMAIL PROTECTED]
>Subject: Re: [PHP] Calling a Windows Com object or an Extended Fetch?
>
>
>Or you could just look at the phpbuilder.com column on using COM objects in
>php, or you could RTFM at the php.net site. just type in php.net/com and see
>what happens.
>
>We use php and com here a lot, and while the implementation lacks a few
>features of the asp/vb implementation it's handy when migrating from NT/ASP
>to NT/PHP.
>
>
>On Tue, 9 Jan 2001, Miles Thompson wrote:
>
> > I don't know, but I was glancing through an article on PHP in the current
> > issue of Dr. Dobb's Journal last week. At the very end I *think* there was
>
> > an example of calling a COM object. It was a VbScript <-> PHP comparision.
>
> > Have a look, might help.
> >
> > Miles
> >
> > (Yes, I've been known to make notes while in the newsstand.)
> >
> > At 10:01 AM 01/09/2001 -0600, Paulson, Joseph V. \"Jay\" wrote:
> > >Hello everyone--
> > >I was wondering if PHP can call Windows COM objects in memory?  If PHP
>can
> > >do this does anyone know how to do it or can you point me in the
>direction
> > >were I can pissibly figure it out.  Also, does anyone know if PHP can
>call
> > >an Extended Fetch?
> > >Thanks,
> > >Jay Paulson
> > >
> > >--
> > >PHP General Mailing List (http://www.php.net/)
> > >To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >For additional commands, e-mail: [EMAIL PROTECTED]
> > >To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
> >




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




RE: [PHP] looking for a PHP editor

2001-01-10 Thread Miles Thompson

Cynic,

I've never used version control -- other than saving as draft1, draft2, 
draft3 -- and there have been days I've wanted draft2.5. Is this something 
integral to the editor, or would a tool like CVS work?

Versioning would be *good*.

Miles

At 07:26 PM 01/10/2001 +0100, Cynic wrote:
>agreed, 4.5.2 still contains pretty old bugs.
>UltraEdit is bugfree (at least I haven't encountered any), has
>project management capabilities (but cannot make use of a
>version control system, AFAIK).
>
>At 18:59 10.1. 2001, Boget, Chris wrote the following:
>--
> >> > >Personally, my team and I use HomeSite 4.5.x from Allaire.
> >> > You did not mention the price (compared to HoTMetaL at $70).
> >> my two cents on price.  who cares!  if an editor makes one
> >> happy then pay as much as it takes to get it.  consider how many
> >> hours are spent with the editor.  18 hours a day?  in the end, what's
> >> $20?  $200?  homesite is about $90.
> >> oh btw, i use homesite and vim , and vim is free! :)
> >
> >Plus, Homesite has project management and can interface
> >with source control applications (we use VSS) whereas I
> >believe HoTMetaL does not.  I don't particularly like Homesite
> >(there are many things I despise about it, as a matter of fact),
> >but it's the only one that I know of (on a windows OS) that has
> >these features.  If there were another, I think I'd probably switch
> >in a heartbeat.
> >
> >Chris
>--end of quote--
>
>
>
>
>Cynic:
>
>A member of a group of ancient Greek philosophers who taught
>that virtue constitutes happiness and that self control is
>the essential part of virtue.
>
>[EMAIL PROTECTED]
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]




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




Re: [PHP] looking for a PHP editor

2001-01-10 Thread Miles Thompson

Actually, the pages I've been working on lately have been so code-intensive 
I've found it easier to echo/print the HTML, especially as not that much 
has been generated.

When I turn PHP on and off I tend to have "OOPS" scenarios, and have to go 
searching for the previous "?>" or "Hello Alexander,
>
>(AW == "Alexander Wagner") [EMAIL PROTECTED] writes:
>
> >> Mmmmfff... ultraedit's wordlist file still lacks the color of
> >> allaire's homesite - it does detect which parts of the .php file
> >> are HTML and what parts of the file are PHP code, and colours
> >> syntax very well...
>
>AW> Who needs that? Nesting PHP in HTML is bad style, IMHO.
>
>Bad style?!
>
>You _actually_ print() or echo() everything you want to send to the
>browser?
>
>If it doesn't need to be interpolated by PHP, why print() it?
>
>-Brian
>--
>Life may have no meaning, or, even worse,
>it may have a meaning of which you disapprove.
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]




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




Re: [PHP] looking for a PHP editor

2001-01-11 Thread Miles Thompson

Hi Brian,

Yes, I agree.

Early on in using PHP I was working with someone else's code, and kept 
encountering the infamous condition test followed by straight HTML 
scenario, like so:
if( this == true){?>
followed by some HTML

and more HTML, often quite a bit, sometimes 30-40 lines
  maybe with , and then
more and more then
" >
although that's from my own code. It was simply cleaner.

I suppose if there was one thing I'd like it would be creation of a closing 
bracket or tag when one enters the opening tag. But that becomes hellish 
when you're adjusting logic and your editor keeps "helping" you.

Have a great day - it's sunny, cold and clear in Nova Scotia this morning.

Miles

PS Like your sig.

At 10:10 PM 01/10/2001 -0500, you wrote:

>Hello Miles,
>
>(MT == "Miles Thompson") [EMAIL PROTECTED] writes:
>
>MT> When I turn PHP on and off I tend to have "OOPS" scenarios, and
>MT> have to go searching for the previous "?>" or "
>Ah yes, but even that goes back to the Learning HTML days. "When you
>open a tag, immediately create the closing tag."
>
>Out of habit, you'll eventually stop making that mistake.
>
>Likewise, if you get into the habit of doing  or ?> your worries will soon disappear.
>
>MT> Miles
>
>
>-Brian
>--
>Don't try to be like Jackie. There is only one Jackie.
>Study computers instead. -- Jackie Chan
>




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




[PHP] How to keep unauthorized viewers out

2001-01-16 Thread Miles Thompson

I'm using a pretty simple linking system for a subscription-based 
newsletter site.

Stories and articles are in straight html files, reached by links from the 
front page. Clicking on a link passes a story number. So the second story 
on the index page would have this link: 

and story.php consists of just these lines:



If someone comes in the "right way", through the index page, they will have 
to be authenticated, then the header, article and page footer are displayed.

There's nothing, however, to stop someone from typing an URL like this:
http://www.somepub.ca/2.htm and seeing the article. I assume they could 
also come in that way via a search engine.

Any suggestions on how to stop that? Resources I should look at? I do want 
to keep the stories in straight html as the editor is struggling now with 
basic layout, etc.

Regards - Miles Thompson



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




Re: [PHP] How to keep unauthorized viewers out

2001-01-16 Thread Miles Thompson

Nathan,

Thanks for your reply ...

At 04:53 PM 01/16/2001 -0700, Nathan Cook wrote:
>how do they authenticate?  VIA http or a subsequent page?

HTTP authentication,using
  Header("WWW-authenticate: basic realm=\"Business Today\"")

>Whichever it is, there are variables associated with each check for those
>variables before loading.

Yes I'm using $PHP_AUTH_USER and $PHP_AUTH_PW. But I can only check for 
those within a script, not in a straight HTML page. (Although I suppose I 
could change all the page extensions to .php and put a check for these 
var's at the very top and redirect to  the login script if they are not 
present.)

Alternately, I suppose I could create a session ID, following a successful 
login. I really don't want to invoke .htaccess.

Miles

>---
>.:: Nathan Cook- Network/Security Admin
>office:  208.343.3110   - Web Programmer
>email:   [EMAIL PROTECTED] - Qmail Admin
>pager:  208.387.9983   - MIS Admin
>---
>- Original Message -
>From: "Miles Thompson" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Tuesday, January 16, 2001 4:49 PM
>Subject: [PHP] How to keep unauthorized viewers out
>
>
> > I'm using a pretty simple linking system for a subscription-based
> > newsletter site.
> >
> > Stories and articles are in straight html files, reached by links from the
> > front page. Clicking on a link passes a story number. So the second story
> > on the index page would have this link: 
> >
> > and story.php consists of just these lines:
> >
> >  > include "header.inc" ;
> > include $storynum.".htm" ;
> > include "footer.inc" ;
> > ?>
> >
> > If someone comes in the "right way", through the index page, they will
>have
> > to be authenticated, then the header, article and page footer are
>displayed.
> >
> > There's nothing, however, to stop someone from typing an URL like this:
> > http://www.somepub.ca/2.htm and seeing the article. I assume they could
> > also come in that way via a search engine.
> >
> > Any suggestions on how to stop that? Resources I should look at? I do want
> > to keep the stories in straight html as the editor is struggling now with
> > basic layout, etc.
> >
> > Regards - Miles Thompson
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >




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




Re: [PHP] best user authentication method?

2001-01-17 Thread Miles Thompson

IIS I'm not familiar with, and Apache has a native scheme involving .htaccess.

If you want a portable authentication method, I'd recommend authenticating 
against a list of users/passwords contained in a database. Using MySQL, 
PostgreSQL or Interbase would keep your database platform neutral, and low 
cost.

Here's code picked up from a Rasmus Lerdorf article which authenticates 
against a MySQL database, there are variations on this everywhere. I put 
this in a file called auth.inc, and then the top of every page which 
requires authentication simply includes "auth.inc".

cut

 In order to proceed you will need a valid username/password.
 
-- cut ---

Hope this is useful. If you use PostgreSQL the calls will be different, and 
it may be best to use ODBC, then you will truly have portability.

Regards - Miles Thompson



At 11:27 PM 01/16/2001 -0500, Romulo Roberto Pereira wrote:
>hello!
>
>What is the best user authentication methd for linux (apache)? and for 
>windows (IIS)?




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




Re: [PHP] best user authentication method?

2001-01-17 Thread Miles Thompson


Opps -
Forgot -- dbname.inc just contains the name of the database.
In production it also contains the name of the user and the password.
Miles

At 08:44 PM 01/17/2001 -0400, Miles Thompson wrote:
>IIS I'm not familiar with, and Apache has a native scheme involving .htaccess.
>
>If you want a portable authentication method, I'd recommend authenticating 
>against a list of users/passwords contained in a database. Using MySQL, 
>PostgreSQL or Interbase would keep your database platform neutral, and low 
>cost.
>
>Here's code picked up from a Rasmus Lerdorf article which authenticates 
>against a MySQL database, there are variations on this everywhere. I put 
>this in a file called auth.inc, and then the top of every page which 
>requires authentication simply includes "auth.inc".
>
>cut
> function authenticate() {
> Header("WWW-authenticate: basic realm=\"Auction Maintenance\"");
> Header("HTTP/1.0 401 Unauthorized");
> $title="Invalid Login";
> include( 'header.inc' ); ?>
> In order to proceed you will need a valid username/password.
>  exit;
> }
>
> if(!isset($PHP_AUTH_USER)) {
> authenticate();
> } else {
> mysql_pconnect("localhost","root")
> or die("Unable to connect to SQL server");
> mysql_select_db( "$auction" ) or die("Unable to select database");
> $login_id=strtolower($PHP_AUTH_USER);
> $query = mysql_query("select * from admin where 
> cAdminId='$login_id'".
>  " and cPassword='$PHP_AUTH_PW'");
> if(!mysql_num_rows($query))
>{
>authenticate();
>}
> else
>{
>    include( 'header.inc' );
>}
> }
>?>
>-- cut ---
>
>Hope this is useful. If you use PostgreSQL the calls will be different, 
>and it may be best to use ODBC, then you will truly have portability.
>
>Regards - Miles Thompson
>
>
>
>At 11:27 PM 01/16/2001 -0500, Romulo Roberto Pereira wrote:
>>hello!
>>
>>What is the best user authentication methd for linux (apache)? and for 
>>windows (IIS)?
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]




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




RE: [PHP] Script not updating

2001-02-25 Thread Miles Thompson



The query flagged by if ($submit) will always fire first, and it appears 
you will always have a $name value as well. I believe it's actually firing 
twice in some scenarios - runs the insert and then immediately updates.

Will $submit contain different values? Then

switch ( $submit )
{
case "update":
 $sql = "update blah blah ";
   break;
case "new":
  $sql = "insert into blah blah ...";
   break;
 default:
  echo "No value to process for submit";
   unset( $sql );
}

if isset( $submit )
{
$result = mysql_query( $sql );
 and so forth ..
}

With this structure you can use an array to hold the value of your buttons, 
such as $action[ ], in which case the switch statement is "switch( 
$action[0] )"

Cheers - Miles


Miles

At 10:43 AM 2/26/01 +1100, Peter Houchin wrote:

>but that's why i've got the
>if($name){ 
>if($submit) ...
>
>
>clause in it .. thinking that if there was a name then update the record..
>otherwise create a new one
>-Original Message-
>From: Simon Garner [mailto:[EMAIL PROTECTED]]
>Sent: Monday, February 26, 2001 10:36 AM
>To: Peter Houchin; PHP MAIL GROUP
>Subject: Re: [PHP] Script not updating
>
>
>From: "Peter Houchin" <[EMAIL PROTECTED]>
>
>
> > Could some one please have a look thru my code and tell me why it creates
>a new record instead of updating the record?
> >
>
>[snip]
>
> >
> > if ($submit){
> >
> >  $result = mysql_query("INSERT INTO app
>(name,company,address,suburb,state,post,areacode,phone,faxareacode,fax,email
>,secret) VALUES
>('$name','$company','$address','$suburb','$state','$post','$areacode','$phon
>e','$faxareacode','$fax','$email','$secret')");
> >
>
>
>^^ Here's your culprit. Check your logic. Whenever they push submit it
>INSERTs a new record (I think...).
>
>
>Regards
>
>Simon Garner
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


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




Re: [PHP] Script not updating

2001-02-25 Thread Miles Thompson

Peter,

In case "AAA" When $submit is set, you will always get an an insert; you 
have a mysql_query executing.

In case "BBB" you are only assigning the SQL statement to $result, I didn't 
look further to see where it executes. It really doesn't matter because 
case "AAA" will always fire first.

Can you structure your flow so that, depending on your conditions you 
assign the SQL statement to a variable, such as $sql_string, and then at 
the end of your conditions execute $result = mysql_query( $sql_string ); ?

This also looks like a scenario where having a good hard look at using 
switch ... case .. break. I've really liked it for control structures 
involving buttons.

You may also want to consider redisplaying your input page with a flag 
identifying the missing or incorrect values. Julie Meloni has a very nice 
example of this at http://www.thickbook.com

Hope you are having lovely weather. Our forecast tonight is snow, followed 
by ice pellets, freezing rain, rain and then back to snow. All that's 
missing is the sunshine!

Regards - Miles Thompson

At 10:30 AM 2/26/01 +1100, Peter Houchin wrote:
>Could some one please have a look thru my code and tell me why it creates 
>a new record instead of updating the record?
>
>What this script is suposed to do is show a HTML form .. then once the 
>user fills it out it then shows another form which echo's the values 
>inputted in the first so the user can update if they made a mistake .. it 
>does everything right .. up until the user clicks on update ... where 
>instead of updating the record it creates a new one ..
>
>Any sussestions/Help would be greatful
>
>
>Peter Houchin
>Sun Rentals
>[EMAIL PROTECTED]
>
>$db = mysql_connect("localhost","root","password");
>  mysql_select_db("rentdb",$db);
>
>if ($submit){

"AAA"

>
>  $result = mysql_query("INSERT INTO app 
> (name,company,address,suburb,state,post,areacode,phone,faxareacode,fax,email,secret) 
> VALUES 
> 
>('$name','$company','$address','$suburb','$state','$post','$areacode','$phone','$faxareacode','$fax','$email','$secret')");
>
>  if($name){
>  $result="SELECT * FROM app WHERE name=$name";
>  if ($submit){
>
>  $result ="UPDATE app SET 
> 
>name='$name',company='$company',address='$address',suburb='$suburb',state='$state',post='$post',areacode='$areacode',phone='$phone',faxareacode='$faxareacode',fax='$fax',email='$email',secret='$secret'
> 
> WHERE name=$name";
>echo mysql_error();
>
>}



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




Re: [PHP] Can't connect php to mysql on linux

2001-02-25 Thread Miles Thompson

George,

1. Is this a brand new project, or were you connecting before, on your web 
pages? If the latter, what changed?
2. **IMPORTANT**  Have you also run phpinfo() and confirmed that you have 
mysql support installed? **IMPORTANT**
3. Did you stop and restart Apache?
4. Have you tried a minimal page - just connecting and echoing the result? 
or with a built-in die message?
5. Is  this a self-hosted server, or someone elses? What name combinations 
of localhost, username and password have you played with? What name is 
mysql running under?

I'll also confess I've given up on .rpms for all of mysql, apache and php. 
It's fairly quick to build them from source, and you have full control over 
where things are placed. Search for something like "LAMP Apache" and that 
will turn up the necessary tutorials.

This probably hasn't been much direct help, but maybe it'll get you going. 
It's not fun, but I've slowly learned to check basics first! (Like the 
wire, when there's a network connectivity problem - sheepish grin.)

Regards - Miles Thompson


At 10:11 AM 2/26/01 +1030, David Robley wrote:
>On Sat, 24 Feb 2001 16:10, George  Alexander wrote:
> > Hi,
> >
> > I working on Redhat Linux 6.1 and I've installed
> > MySQL-3.23.33-1.i386.rpm and MySQL-client-3.23.33-1.i386.rpm. MySql is
> > working fine. I've even created a database also using MySqlAdmin.
> > Regarding Php I've installed php-3.0.18-1.6.x.i386.rpm and as for
> > Apache : apache-1.3.14-2.6.2.i386.rpm. I've even installed
> > php-mysql-3.0.16-1.i386.rpm and mod-php3-3.0.12-2.i386.rpm.
> >
> > My problem is I can't connect PHP to Mysql Db using the
> > mysyql_connect("localhost","root","mypassword") command.
> >
> > Please help me asap.
> > Regards,
> > George
>
>Use mysql_error() after your unsuccessful call to mysql_connect to return
>a mysql error string
>
>--
>David Robley| WEBMASTER & Mail List Admin
>RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
>AusEinet| http://auseinet.flinders.edu.au/
> Flinders University, ADELAIDE, SOUTH AUSTRALIA
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


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




Re: [PHP] Using one invocation of PHP executable to generate multiple pages?

2001-02-25 Thread Miles Thompson

Jim,
PHP works with your server to generate the HTML output, so PHP is "running" 
all the time, it's not like a CGI script. PHP code is embedded in your HTML 
pages, so you can use it to control the generated HTML. You can turn it on 
and off within the page. Carefully look at Chapter 1 Page 1 of the manual 
"What is PHP?"

Then look at a couple of the tutorials at www.thickbook.com, WeberDev, 
Devshed, and so on. The concept will become clearer. From there on, take it 
away; it's powerful, flexible and occasionally frustrating and embarrassing 
(like all languages).

So you can have little pages full of buttons or links which open up other 
pages, or sometimes a lot of PHP script generating relatively few lines of 
code, all depending on various conditions.

Miles Thompson


At 07:21 PM 2/25/01 -0500, Jim Lum wrote:
>Hi,
>
>I have PHP installed on a Win95 machine.  What I'd like to do is to use
>a PHP page that will create multiple HTML pages.
>
>I guess that I can execute PHP.EXE multiple times, but was thinking that
>this means that it's going thru the overhead of starting up PHP.EXE each
>time.  Is there any way to tell PHP.EXE to build multiple HTML pages,
>i.e., kind of like a loop?
>
>Jim
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


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




  1   2   3   4   5   6   >