[PHP] Re: Problem with output buffering in PHP 4.0.6 and Apache/1.3.20

2002-08-10 Thread Lars Olsson

Ing.Martin prášek wrote:
> Hi..
> I have found a strange problem. I try to use php output buffering, but I found this 
>problem.
> Working with small amount of data everything is fine. But If I set example script 
>like this:
> 
>  
> function callback($buffer)
>  {
>  return do_something_with($buffer);
>  }
> 
> 
> ob_start("callback")
> .
> .
> 
> do_something_that_produce_big_output() // more than 1.5 MB
> .
> .
> .
> ob_end_flush();
> 
> ?>
> 
> Everything works fine when $buffer < approx 1.5 Mb, but if the size of the output, 
>that need to be bufered exceeded some strange limit aprox 1593400 bytes, buffer is 
>cut to that length and rest of the output is lost(!). I look in docs and manuals,  
>but found nothing about it. Is it posssible to set large size for the output 
>buffering operations or this strange limit is hard coded and cant be exceeded ???  I 
>try to play with PHP.INI or add swapspace and DIMs memory with no effect.  Please 
>help.  
> 
> 
> ---
> Odchozí zpráva neobsahuje viry.
> Zkontrolováno antivirovým systémem AVG (http://www.grisoft.cz).
> Verze: 6.0.381 / Virová báze: 214 - datum vydání: 2.8.2002

Hi!

I don't think that should be considered a problem for PHP output 
buffering. Du you know ANY user that would that would wait for a 1.5MB 
page to display? And if you're transferring large binary files to the 
browser (a LARGE bitmap for example) you could get around this problem 
by doing

1. Open the file
2. Read a reasonable amount of data (say, 10 bytes)
3. use ob_flush to sende the data to the browser
4. Repeat step 2 and 3 until all of file is read
5. Use ob_end_flush to send the rest of the buffer
6. Close the file

Hope this helps

/lasso ([EMAIL PROTECTED])


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




[PHP] How to create basic LOGIN procedure

2002-08-10 Thread Kristoffer Strom

This PHP stuff is still pretty new to me (still prefer IBM's NetData), so I
need help to create a login procedure for a website.
The point being to make sure only authenticated people can access the admin
pages and post/edit news items and stuff. Should be simple, huh?

Anyways, the three objectives are:
1. Login that checks the username and password with a user defined table in
a MySQL database. Not actual authentication for the database!
2. Store the username and load the e-mail for that user from that table and
store them both as a session variable.
3. Make sure that none of the pages in that directory works unless you're
athenticated

Help? Is there some ready function for all of this that I haven't found?
So far I've only run across the actual database authentication, but I don't
wanna add users to the database.

/Kristoffer (from www.NataliePortman.com)



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




[PHP] cgi error

2002-08-10 Thread radio x

I receive this when I try to send an e-mail.
All works fine until yesterday and my script is the same.
Could u tell what is the problem?
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP 
headers. The headers it did return are:













[PHP] and this is the script

2002-08-10 Thread radio x

 $fp = fopen("msg1.dat", "r"); 
while (!feof($fp)) 
{ 
   $data = fgetcsv ($fp, 4096, ":");
$subiect_email="Important to all my users!!!";
$design="

   bla
   
   blablaaa";
  
   @mail ($data[4],$subiect_email, $design, "From: [EMAIL PROTECTED]\n");
   } 
   fclose ($fp);



[PHP] Re: mysql_result

2002-08-10 Thread Marcel Besancon

Hi Sascha,

just use the modulus-operator (%).

It's the best way.

Bye Marcel
--
registered Fli4l-User #0388
Answer to the newsgroup please 


"Sascha Braun" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
001201c23f29$760a22e0$a48a07d5@billsgate">news:001201c23f29$760a22e0$a48a07d5@billsgate...
I need some help!

I am getting a result out of my link Database an want it to Display the
result in two
collums like this:

+-++
+ Result 1+  Result 2  +
+-++
+Result 3 + Result 4   +
+-++

and so on please help!

Thanx




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




Re: [PHP] E-commerce site issue?

2002-08-10 Thread Justin French

on 10/08/02 12:05 AM, The Gabster ([EMAIL PROTECTED]) wrote:

> Thanks a lot...
> Hmm... I gues for the beginning I would go and process the purchases
> manually. Later on if the purchases increase, than I would opt for
> proccesing credit cards via the server.

So initially you would just store/transmit the credit cards securely (a
whole other can of worms!!), and process them manually offline.  I'd
recommend this for any start-up e-commerce site, because it cuts down some
development, start up costs and saves the margins that an online credit-card
merchant takes.

When and if you decide to automate the credit card process (authorising and
charging the card), it's done through a merchant.  This will totally depend
on your circumstances and budget, but you basically pass the details to a
third party that specialises in this stuff, like authorise.net (and hundreds
of other similar business'), a bank or financial institution etc etc.

All of them will have different procedures and code, but you basically pass
them the details, they pass back a "success" or "failure", charge the credit
card, take their % cut (everything from a flat fee like $1, through to 3% or
5%), and pass on the rest to you.

There are further options above and beyond this, but they'd be out of
reach/budget of almost any small-medium e-comm site.






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




Re: [PHP] Sending automatically mail

2002-08-10 Thread Justin French

Depending on your OS, you would set up some sort of cron job to run at
certain intervals.

If that can't be done, Windows-type OS' can run a schedule to launch URLs
into browser, so if your desktop machine was on at the time, it could launch
a URL on the server which sends the emails for you...

if you can set up a cron with your host, that'd be the way to go.


Justin French


on 10/08/02 3:03 AM, Jan Souman ([EMAIL PROTECTED]) wrote:

> I would like my php-script to send a mail every day automatically, without
> anyone opening my site.
> 
> Is this possible and if yes can anyone tell how to do this?
> 
> Kind regards,
> 
> Jan
> 
> 


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




Re: [PHP] special characters

2002-08-10 Thread Justin French

Have a look at htmlspecialchars() as well.

If these don't meet your needs, you might have to start building your own
function to extend what htmlspecialchars() and htmlentities() do.

Justin French


on 10/08/02 4:58 AM, Jeb A. Scarbrough (home) ([EMAIL PROTECTED])
wrote:

> Is there a way to have PHP to either:
> 
> a)  strip out any non-standard ascii characters (like the TM or copyright
> symbol)
> 
> b) have PHP encode all these symbols.
> 
> I know about htmlentities, but it not catch everything.
> 
> Thanks!
> 


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




Re: [PHP] How to create basic LOGIN procedure

2002-08-10 Thread Justin French

Check out Kevin Yank's article "restricting page access with php & mysql"
(or something like that!) on webmasterbase.com / sitepoint.com.

Justin French


on 10/08/02 7:19 PM, Kristoffer Strom ([EMAIL PROTECTED]) wrote:

> This PHP stuff is still pretty new to me (still prefer IBM's NetData), so I
> need help to create a login procedure for a website.
> The point being to make sure only authenticated people can access the admin
> pages and post/edit news items and stuff. Should be simple, huh?
> 
> Anyways, the three objectives are:
> 1. Login that checks the username and password with a user defined table in
> a MySQL database. Not actual authentication for the database!
> 2. Store the username and load the e-mail for that user from that table and
> store them both as a session variable.
> 3. Make sure that none of the pages in that directory works unless you're
> athenticated
> 
> Help? Is there some ready function for all of this that I haven't found?
> So far I've only run across the actual database authentication, but I don't
> wanna add users to the database.
> 
> /Kristoffer (from www.NataliePortman.com)
> 
> 


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




[PHP] Shelling out to Aspell: Linux gurus please

2002-08-10 Thread Geoff Caplan

Hi folks

There is a lot on the web suggesting that the PHP pspell functions are
buggy.

So I am trying to use aspell to check single words by shelling out of
PHP using backticks via the bash shell on Linux. The problem is that
this is a two stage process. First, you launch aspell with "aspell
-a". Aspell then returns an identification message, and waits for a
word to be supplied from standard input. For each misspelled word, it
returns a delimited string of suggestions. But my *nix skills are
limited and I can't figure out how to send the word in the second
command using the backticked string.

The aspell manual page for the -a option is here:

http://aspell.net/aspell-man/6_Writing.html#SECTION0072

Also, how to ensure that I don't create orphan aspell processes if for
some reason the request is interrupted?

I know that this is a bit OT and more of a Unix question that a PHP
question, but I am under time pressure and any tips would be much
appreciated.

--

Geoff Caplan
Advantae Ltd

mailto:[EMAIL PROTECTED]
http://www.advantae.com


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




[PHP] PHP Errors - someone please take a look

2002-08-10 Thread Christopher J. Crane

I get the following errors when I run my script. It works fine with only 20
records, but at 100 I get errors.

"PHP has encountered an Access Violation at 00DA088E Warning: Unknown list
entry type in request shutdown (2) in
c:\www\htdocs\demos\ct.org\directory.php on line 0"

or

 "PHP has encountered an Access Violation at 00DA088E "

Basically, I have a CSV file with about 3500 records (lines). I have a while
statement that goes through the file line by line. I am using fgetcsv().
While on a line I also open another file and search for a matching field
(CustomerID) and if it matches print the information on that line unless a
field in that file is set to "1".

This was initially tried using a query since this data is in a database.
That did not work. I exported the data into csv files. It worked in testing
limiting the amount of records to be displayed to less than 30. I just tried
it with limit set to 100 and that's when I got the problem.

Here is the code;
http://inxdesign.com|
 |  [EMAIL PROTECTED]|
 |  |
 |__|
This script was created to help prepare the directory information, for the
Connecticut Technical Council for the Year 2002.

My Material - Please do not copy or modify it with checking with me first.
([EMAIL PROTECTED])
Please leave the INFORMATION banner in place.
*/


file://==Global Definitions
file://
define('SCRIPT_NAME', 'Connecticut Technology Council Directory Maker');
define('SCRIPT_VERSION', 'v1.0');
define('SCRIPT_CREATOR', 'mailto:[EMAIL PROTECTED]";>Christopher
J. Crane');
define('CREATE_DATE', '08/06/02');
define('REVISED_DATE', '08/06/02');


$TestingMode = "On"; file://On or Off
$ShowCount = "10";

$row = 0;
print "Company Directory 2002";
print "T e s t i n gM o d e - ";
 if($TestingMode == "On") { print "OnOnly Showing The First $ShowCount
Records.\n"; }
 else { print "Off\n"; }
print "End";
print "\n";


file://==C o m p a n y   D a t a   O u t p u t
file://===
$Data1 = fopen("Final.csv","r");
 while ($Line1 = fgetcsv($Data1, 1000, ",")) {
  $CompanyID = $Line1[0];   $CompanyName = $Line1[1]; $MemberTypeID =
$Line1[2];
  $RevenueID = $Line1[3];   $Ownership = $Line1[4];  $NoPubRevenue =
$Line1[5];
  $YearEstablished = $Line1[6]; $Exchange = $Line1[7];  $TotalEmployees =
$Line1[8];
  $ConnEmployees = $Line1[9];  $Ticker = $Line1[10];  $Email = $Line1[11];
  $Website = $Line1[12];   $IndustryID = $Line1[13]; $AddressTypeID =
$Line1[14];
  $AddressLine1 = $Line1[15];  $AddressLine2 = $Line1[16]; $City =
$Line1[17];
  $State = $Line1[18];   $Zip = $Line1[19];   $CountyName = $Line1[20];
  $Profile = $Line1[21];

  if($row != 0) {
   print " $CompanyName\n";
   if($AddressLine1 != "") { print "$AddressLine1\n"; }
   if($AddressLine2 != "") { print "$AddressLine2\n"; }
   print "$City, $State $Zip\n";


file://==P h o n e   D a t a   O u t p u t
file://===
$Data2 = fopen("PhoneTable.csv","r");
 while ($Line2 = fgetcsv ($Data2, 1000, ",")) {
  $CompanyID2 = $Line2[0]; $PhoneType = $Line2[1]; $AreaCode = $Line2[2];
  $Prefix = $Line2[3];  $Suffix = $Line2[4];

  if($CompanyID2 == $CompanyID) {
   if($PhoneType == "Office") {
print "Phone:
($AreaCode)$Prefix-$Suffix"; }
}
   }
fclose($Data2);


file://==F a x   D a t a   O u t p u t
file://===
$Data3 = fopen("PhoneTable.csv","r");
 while ($Line3 = fgetcsv ($Data3, 1000, ",")) {
  $CompanyID3 = $Line3[0]; $PhoneType = $Line3[1]; $AreaCode = $Line3[2];
  $Prefix = $Line3[3];  $Suffix = $Line3[4];

  if($CompanyID3 == $CompanyID) {
   if($PhoneType == "FAX") {
print "Fax:
($AreaCode)$Prefix-$Suffix"; }
}
   }
fclose($Data3);
print "";


file://==W e b s i t e / E m a i l  D a t a   O u t p u t
file://==
if(($Website != "") || ($Email != "[EMAIL PROTECTED]")) {
 if($Website != "") { print "Website: $Website\n"; }
 if($Email != "[EMAIL PROTECTED]") { print "E-Mail: $Email\n"; }
 }


file://==O w n e r s h i p   D a t a   O u t p u t
file://===
print "Ownership: ";
 if($Ownership == "1") { print "Private  "; }
 if($Ownership == "2") {
  print "Public  ";
  if(!($Exchange == "OTHER" or $Exchange == "")) { print "($Exchange:
$Ticker)  "; }
  }
 if($YearEstablished != "0") { print "Est. $YearEstablished"; }
print "";


file://==E m p l o y e e   D a t a   O u t p u t
file://=
print "CT Emp: ";
 if(($ConnEmployees >= 1) && ($ConnEmployees <= 9)) { print
"1-9 "; }
 elseif(($ConnEmployees >= 10) && ($ConnEmployees <= 50)) { print
"10-50 "; }
 elseif(($ConnEmployees >= 51) && ($ConnEmployees <= 100)) { print
"51-100 "; }
 elseif(($ConnEmployees >= 101) && ($ConnEmployees <= 250)) { print
"101-250 "; }
 elseif(

[PHP] classes and references in session

2002-08-10 Thread gianpaolo racca

I have some unclear (to me) behaviour in using classes and references to 
session.
I submit you this code:

pippo = "pluto";
  }
  function echoname(){
echo (get_class($this)."\n");
  }

}

class B {
  var $score;
  function B(){
//assigning by value cause istances 
//to be istances of a (same of $_SESSION[recorded])
//but non reference is made, so it's a copy
$this = $_SESSION["recorded"];
  }

  function echoname(){
echo (get_class($this)."\n");
  }

}

class C {
  var $score;
  function C(){
//assigning by reference cause istances 
//to be istances of c and not the same of $_SESSION[recorded]
$this = &$_SESSION["recorded"];
  }

  function echoname(){
echo (get_class($this)."\n");
  }

}

session_start();
//new object stored in session.
$_SESSION["recorded"] =& new A();

echo "";
echo "session[\"recorded\"] classname:  ";
$_SESSION["recorded"]->echoname();
$_SESSION["recorded"]->score = 99;

echo "test_var classname:  ";
$test_var = new B();
$test_var->echoname();
$test_var->score = 100;

echo "test_var2 classname:  ";
$test_var2 = new C();
$test_var2->echoname();
$test_var2->score = 200;

print_r($test_var);
print_r($test_var2);
print_r($_SESSION);
echo "";
?>

This three classes ar equal, except in the constructor. The problem is 
explained in the comments, but essentially is this:
How do I create an istance of a class that has is a reference to another 
istance previuously stored in session?
During this day of coding I finally (I hope) wrote a test that explains what 
I can't do.

I really appreciate any help.

   gianpaolo

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




[PHP] Re: Pictures and sound in MySQL and access via PHP

2002-08-10 Thread danny


thank you,
If i understand the best way would be to place the MP3's in a seperate
directory and giving each MP3's a unique id? In the database every record
has already a unique idea. If i name my mp3 something like this: record
ID=10, name MP3 = MP3_10.mp3.
I already have about 200 little MP3's with the prononciation of the words in
a dictionary.  Is there a way to automate this task? So changing the
original name of the MP3 ex.. "komen.mp3" in "MP3_10.mp3"?


Lallous <[EMAIL PROTECTED]> schreef in berichtnieuws
[EMAIL PROTECTED]
> Personally I wouldn't store BIG files (like .mp3) into the database.
>
> If you insist checkout the mysql LOAD_FILE()
>
> Elias
>
> "Danny" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > hi,
> >
> > I already posted this message but the time on my computer was wrong
(26/07
> > so i post it again).
> >
> > I am new on MySQL and PHP.
> > I'm making a on-line dictionary. I use PHP and a MySQL Database.
> > Now I want to add audio-streaming (MP3) and pictures (JPG) to the
database
> > and retrieve it true PHP. Can sombody help me out with a little
> > example-code?
> > The database is working well (only text).
> >
> > Danny
> >
> >
> >
> >
>
>



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




Re: [PHP] security concern with curl

2002-08-10 Thread Daniel Tryba

On Fri, Aug 09, 2002 at 10:10:28PM +0200, Andy wrote:
[curl]
> So I fear that someone would be able to tranfer files on / off my server.
> 
> Has anybody some experiance on that, or can give a comment on that?

Ehhh, PHP already has enough capabilities to transfer files to/from your
server from/to the rest of the world without using curl. Or are you
(healthy) paranoied about oasis?

-- 

  Daniel Tryba


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




Re: [PHP] security concern with curl

2002-08-10 Thread andy

> > So I fear that someone would be able to tranfer files on / off my
server.
> >
> > Has anybody some experiance on that, or can give a comment on that?
>
> Ehhh, PHP already has enough capabilities to transfer files to/from your
> server from/to the rest of the world without using curl. Or are you
> (healthy) paranoied about oasis?

well it is just that I have to install an aditional pice of software and it
does something I am not familar with it.

All I want to know if this could be security issue and a reason not to
install oasis. How about oasis itself? This pease of SW will run on my
server and could do anything what php is allowed to do (maybe delete some
files or transfer them, open a gateway to some other user to take over my
server, send spam over my server and so on)

Are there any rummors about oasis, or is this a reputable software? Right
now I just know what the site is telling me.

Thanx for all your comments on that.

Andy


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




[PHP] HTTP authentication - de authentication

2002-08-10 Thread vic

How does one logout from such an authentication? I know that through a
HTTP status code, but how exactly? Everything I tried allows the browser
to view the page info after "logout" if the user hits the back button.
The only way I found it works if the user closes the browser window, but
I can't make sure they do, so *how do I make sure they do?*

Is there a script to better de-autheticate from such an authentication
method, or to make the browser close the window?

// ___ AUTHENTICATION SCRIPT _

$auth = false; 

if (isset($PHP_AUTH_USER) && isset($PHP_AUTH_PW)) { 

// Connect to MySQL 
mysql_connect( 'xxx', 'xxx', 'xxx' ) 
or die ( 'Unable to connect to server.' ); 

// Select database on MySQL server 
mysql_select_db( 'xxx' ) 
or die ( 'Unable to select database.' ); 

// Formulate the query 
$sql = "SELECT * FROM xxx 
WHERE user_id = '$PHP_AUTH_USER' 
AND password = PASSWORD('$PHP_AUTH_PW')"; 

// Execute the query and put results in $result 
$result = mysql_query( $sql ) 
or die ( 'Unable to execute query.' ); 

// Get number of rows in $result. 
$num = mysql_numrows( $result ); 

// A matching row was found - the user is authenticated. 
if ( $num != 0 ) { 

$auth = true;

// End do the check
}

//STOP AUTHETICATION SCRIPT EXAMPLE __


//_ LOGOUT SCRIP EXAMPLE 

// the "logout" link would look like: 
//Logout

if (isset($logout)) { 
header('status: 401 Unauthorized'); 
header('WWW-Authenticate: Basic realm="Private"'); 
header('HTTP/1.0 403 Forbidden'); 
echo ('You have successfully logged out.');
?>



http://personals.yahoo.ca

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




Re: [PHP] Thumb nail of a web page

2002-08-10 Thread Julio Nobrega

> This would be a major task. You would have to write a complete HTML
renderer
> in PHP.

  Perhaps you can cheat and let other programs do all the work ;-)

  Open a page with the browser and take a "screenshot", all using php's
exec(). Then trim the browser's border and toolbars using the gd module. The
problem is getting to know if (and how much) you need to scroll down to see
the rest of the content...

--
Julio Nobrega
Pode acessar:
http://www.inerciasensorial.com.br


"Jason Wong" <[EMAIL PROTECTED]> escreveu na mensagem
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Saturday 10 August 2002 05:03, Henry wrote:
> > Hi All,
> >
> > Just out of interest, does anyone know of a way to generate a thumb nail
of
> > a web page given a URL?
>
> This would be a major task. You would have to write a complete HTML
renderer
> in PHP. Maybe some clever soul could write a library that interfaces to
> Mozilla's gecko engine.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> Nothing matters very much, and few things matter at all.
> -- Arthur Balfour
> */
>



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




[PHP] Save ability... Duplicate DB entries

2002-08-10 Thread JJ Harrison

i have this code snippet:

  if(isset($_POST['save'])){
  $query = 'INSERT INTO article_data VALUES (\'\', '.$_SESSION['uid'].',
'.time().', \''.$_POST['title'].'\', \''.$_POST['description'].'\',
'.$_POST['cat'].', \''.$_POST['text'].'\', 0)';
  $result = mysql_query($query) or die("Query failed: $query" .
mysql_error());
echo 'you saved your work.';
  } elseif(isset($_POST['pub'])) {
$query = 'INSERT INTO article_data VALUES (\'\', '.$_SESSION['uid'].',
'.time().', \''.$_POST['title'].'\', \''.$_POST['description'].'\',
'.$_POST['cat'].', \''.nl2br($_POST['text']).'\', 0)';
echo 'you published your work.';
 }

Which has a save or a publish option. I only want to keep one copy of each
article in the DB. This adds a new one each time. I know about updates in
SQL but the file may or may not already be in the db. Does anyone have a
good way to go about this?




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




Re: [PHP] How to create basic LOGIN procedure

2002-08-10 Thread Kristoffer Strom

Found it:
http://www.webmasterbase.com/article/319/95

Thanx!

One more problem, then we're ready to go

/Kris

> Check out Kevin Yank's article "restricting page access with php & mysql"
> (or something like that!) on webmasterbase.com / sitepoint.com.
>
> Justin French
>
> on 10/08/02 7:19 PM, Kristoffer Strom ([EMAIL PROTECTED]) wrote:
>
> > This PHP stuff is still pretty new to me (still prefer IBM's NetData),
so I
> > need help to create a login procedure for a website.
> > The point being to make sure only authenticated people can access the
admin
> > pages and post/edit news items and stuff. Should be simple, huh?
> >
> > Anyways, the three objectives are:
> > 1. Login that checks the username and password with a user defined table
in
> > a MySQL database. Not actual authentication for the database!
> > 2. Store the username and load the e-mail for that user from that table
and
> > store them both as a session variable.
> > 3. Make sure that none of the pages in that directory works unless
you're
> > athenticated
> >
> > Help? Is there some ready function for all of this that I haven't found?
> > So far I've only run across the actual database authentication, but I
don't
> > wanna add users to the database.
> >
> > /Kristoffer (from www.NataliePortman.com)




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




Re: [PHP] HTTP authentication - de authentication

2002-08-10 Thread Matt

>From: "vic" <[EMAIL PROTECTED]>
> Sent: Saturday, August 10, 2002 11:24 AM
>Subject: [PHP] HTTP authentication - de authentication


> How does one logout from such an authentication? 

There's no way to logout.  Use a session based authentication.



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




[PHP] PHP form port

2002-08-10 Thread Daniel Guerrier

How do i execute a form post with php?
I want to validate CCard info etc.. then perform the
post with no furtheraction from the user.

Basically If not valid stay here and show whats wrong
ELSE post form to process.php

__
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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




Re: [PHP] Save ability... Duplicate DB entries

2002-08-10 Thread DL Neil

JJ,

> i have this code snippet:
>
>   if(isset($_POST['save'])){
>   $query = 'INSERT INTO article_data VALUES (\'\', '.$_SESSION['uid'].',
> '.time().', \''.$_POST['title'].'\', \''.$_POST['description'].'\',
> '.$_POST['cat'].', \''.$_POST['text'].'\', 0)';
>   $result = mysql_query($query) or die("Query failed: $query" .
> mysql_error());
> echo 'you saved your work.';
>   } elseif(isset($_POST['pub'])) {
> $query = 'INSERT INTO article_data VALUES (\'\', '.$_SESSION['uid'].',
> '.time().', \''.$_POST['title'].'\', \''.$_POST['description'].'\',
> '.$_POST['cat'].', \''.nl2br($_POST['text']).'\', 0)';
> echo 'you published your work.';
>  }
>
> Which has a save or a publish option. I only want to keep one copy of each
> article in the DB. This adds a new one each time. I know about updates in
> SQL but the file may or may not already be in the db. Does anyone have a
> good way to go about this?


First perform a SELECT to establish previous existence (can lock row at this
point, if using suitable RDBMS), then decide to INSERT or UPDATE, save or
publish.

Regards,
=dn



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




Re: [PHP] PHP form port

2002-08-10 Thread Matt

>From: "Daniel Guerrier" <[EMAIL PROTECTED]>
>Sent: Saturday, August 10, 2002 12:14 PM
>Subject: [PHP] PHP form port


> How do i execute a form post with php?

http://www.php-faq.com/postToHost.html



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




Re: [PHP] Two version of php in the same system

2002-08-10 Thread Analysis & Solutions

On Sat, Aug 10, 2002 at 02:34:30AM -0300, Breno Cardoso Perucchi wrote:
> It have some order for installation of the versions of PHP?
> First 4.03
> Second 4.22
> 
> or
> 
> First install 4.22
> Second 4.03

Does not matter.


> You showed as installing version of php for Windows ?
> That go work with system Linux and FreeBSD ?

Does not matter.


> Below this configuration of systems Linux and FreeBSD
> 
> AddType application/x-httpd-php .php .php4 .php3 .phtml

So, change that, and the other things I said, to what I said in my first
email.

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

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




Re: [PHP] PHP form port

2002-08-10 Thread John Wards

either do this

$your vars = value
include process.php;

or

header "process.php?your_var=value&your other stuff";

or

$url = http://www.yourserver.com/process.php?your_var=value&etc;
$contents = file($send);
This will execute your php file and return into $contents the html that is
outputed. You don't need to use the html if you don't want to.

John Wards
SportNetwork.net
- Original Message -
From: "Daniel Guerrier" <[EMAIL PROTECTED]>
To: "php user group" <[EMAIL PROTECTED]>
Sent: Saturday, August 10, 2002 5:14 PM
Subject: [PHP] PHP form port


> How do i execute a form post with php?
> I want to validate CCard info etc.. then perform the
> post with no furtheraction from the user.
>
> Basically If not valid stay here and show whats wrong
> ELSE post form to process.php
>
> __
> Do You Yahoo!?
> HotJobs - Search Thousands of New Jobs
> http://www.hotjobs.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] Newbie question about UNIX command-line directives

2002-08-10 Thread Al

I'm on a virtual host without a shell account and need execute a UNIX 
command.

ln -s ../afile.php index.php

Is there some way to do this [e.g., with a htaccess file]?

What happens when you execute UNIX commands like the one above?  Does it 
make a file, change the config?


Thanks





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




Re: [PHP] Two version of php in the same system

2002-08-10 Thread Breno Cardoso Perucchi

This It is command for installing in another directory.  You think this is
correct  ?

./configure --prefix=/usr/local/php/ver403 --with-config-file-path=/usr/loca
l/php/ver403/etc --with-exec-dir=/usr/local/php/ver403 --with-mysql --with-m
ysql=/usr/local/mysql


Sorry to inconveniencing

"Analysis & Solutions" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Sat, Aug 10, 2002 at 02:34:30AM -0300, Breno Cardoso Perucchi wrote:
> > It have some order for installation of the versions of PHP?
> > First 4.03
> > Second 4.22
> >
> > or
> >
> > First install 4.22
> > Second 4.03
>
> Does not matter.
>
>
> > You showed as installing version of php for Windows ?
> > That go work with system Linux and FreeBSD ?
>
> Does not matter.
>
>
> > Below this configuration of systems Linux and FreeBSD
> >
> > AddType application/x-httpd-php .php .php4 .php3 .phtml
>
> So, change that, and the other things I said, to what I said in my first
> email.
>
> --Dan
>
> --
>PHP classes that make web design easier
> SQL Solution  |   Layout Solution   |  Form Solution
> sqlsolution.info  | layoutsolution.info |  formsolution.info
>  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
>  4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409



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




Re: [PHP] PHP form port

2002-08-10 Thread Matt

>From: "Daniel Guerrier" <[EMAIL PROTECTED]>
>Sent: Saturday, August 10, 2002 12:14 PM
>Subject: [PHP] PHP form port


> How do i execute a form post with php?
> I want to validate CCard info etc.. then perform the
> post with no furtheraction from the user.
>
> Basically If not valid stay here and show whats wrong
> ELSE post form to process.php

Sorry, I mis-understood your question.  PHP is server-side, so you have to
post the form to validate.  The way I handle the situation you have is to
have the same script process the form for both the initial request
(method=get) and the form post (method=post).

If 'POST' == $_SERVER['REQUEST_METHOD'], then validate.
  If validation passes, process the transaction, and redirect with header()
to a new page.
  if it fails, make use the prior supplied data in input values so you
retain the input from the person using your form.

Example:







HTH




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




[PHP] is this possible ...

2002-08-10 Thread M.E. Suliman

Hi

I need the contents of a form to be emailed as an attached Excel file or
html file.  Is this possible using PHP.  I think comma delimited files open
in Excel.  Can anyone advise.

Thanks in advance

Mohamed


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




[PHP] records in db

2002-08-10 Thread Tyler Durdin

If I have a field in my DB that can have 4 different answers, lets say a,b,c 
and d. How can I count the number of each in that field. So if there are 4 
a's 1 b 0 c's and 12 d's how can I get php to count this?


_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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




[PHP] weird urls

2002-08-10 Thread XoXGrimreaper

How come some URLs have all these questions marks and stuff like that? Below:

source.php?url=/index.php

__
Pre-order the NEW Netscape 7.0 browser. Reserve your FREE CD and pay only $2.99 
shipping and handling. http://cd.netscape.com/promo_one/ 

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/

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




RE: [PHP] Save ability... Duplicate DB entries

2002-08-10 Thread Mark Charette

Or, of course, a selection of fields as a unique key. The insert will fail
if there is an exisiting record with that key; you can interrogate the error
and report on the exisitence of a duplicate record.

The select/lock method is used for update purposes ('select for update' et
al.), not to keep duplicate records out of the DB.


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




Re: [PHP] weird urls

2002-08-10 Thread Chris Knipe

Erm, because that's the way it works?

Regards,
Chris Knipe
Cell: (072) 434-7582
MegaLAN Corporate Networking Services


/---
| This email is confidential and may contain legally privileged information.
| If you are not the intended recipient, you must not disclose or use
| the information contained in it. If you have received this email in error,
| please notify us immediately by return email and delete the document.
\---

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, August 10, 2002 7:56 PM
Subject: [PHP] weird urls


> How come some URLs have all these questions marks and stuff like that?
Below:
>
> source.php?url=/index.php
>
> __
> Pre-order the NEW Netscape 7.0 browser. Reserve your FREE CD and pay only
$2.99 shipping and handling. http://cd.netscape.com/promo_one/
>
> Get your own FREE, personal Netscape Mail account today at
http://webmail.netscape.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] weird urls

2002-08-10 Thread César Aracena

That's because PHP detects whatever it's after that question marks as
variables so it's able to process them in requests you make in your
scripts. The one you quote means that there is a variable being passed
from one page to another named $url which has the value /index.php.

So, if you call (in the incoming page) a script which need to know what
is the value of $url that was passed, the script will know that is
/index.php.

C.

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, August 10, 2002 2:56 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] weird urls
> 
> How come some URLs have all these questions marks and stuff like that?
> Below:
> 
> source.php?url=/index.php
> 
> __
> Pre-order the NEW Netscape 7.0 browser. Reserve your FREE CD and pay
only
> $2.99 shipping and handling. http://cd.netscape.com/promo_one/
> 
> Get your own FREE, personal Netscape Mail account today at
> http://webmail.netscape.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] Re: weird urls

2002-08-10 Thread Julio Nobrega

  Well, it's a GET parameter, not a server file. Probably the file
"source.php" has a command to include the file "/index.php".

if (isset($_GET['url'])) {
// Security check, prepend filesystem or webserver root and
include($url);
}

--
Julio Nobrega
Pode acessar:
http://www.inerciasensorial.com.br


<[EMAIL PROTECTED]> escreveu na mensagem
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> How come some URLs have all these questions marks and stuff like that?
Below:
>
> source.php?url=/index.php
>
> __
> Pre-order the NEW Netscape 7.0 browser. Reserve your FREE CD and pay only
$2.99 shipping and handling. http://cd.netscape.com/promo_one/
>
> Get your own FREE, personal Netscape Mail account today at
http://webmail.netscape.com/



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




[PHP] Re: is this possible ...

2002-08-10 Thread Julio Nobrega

  Yes, it's possible. You concatenate the form variables with the html,
transform it to a file and attach to the email.

--
Julio Nobrega
Pode acessar:
http://www.inerciasensorial.com.br


"M.E. Suliman" <[EMAIL PROTECTED]> escreveu na mensagem
000701c24097$044a1b00$9fb71fc4@b1s0n2">news:000701c24097$044a1b00$9fb71fc4@b1s0n2...
> Hi
>
> I need the contents of a form to be emailed as an attached Excel file or
> html file.  Is this possible using PHP.  I think comma delimited files
open
> in Excel.  Can anyone advise.
>
> Thanks in advance
>
> Mohamed
>



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




[PHP] checkbox => POST => array??

2002-08-10 Thread PeterV

I,
I don't have my books here and it's been a while since I did PHP, and 
google isn't helping:
How do I code a bunch of checkboxes with id's, and then loop trough the 
result as an array after POSTing it?
What I have now:

doesn't return an array $topic??
Thanks,
Peter


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




Re: [PHP] Win PHP Editor...

2002-08-10 Thread Randy Johnson

I noticed they have not come out with a new version in quite a long time and
do not answer their emails?   anybody else heard about any future releases
of editplus?


Randy
- Original Message -
From: "Liam MacKenzie" <[EMAIL PROTECTED]>
To: "Dave at Sinewaves.net" <[EMAIL PROTECTED]>; "PHPlist"
<[EMAIL PROTECTED]>
Sent: Friday, August 09, 2002 9:38 PM
Subject: Re: [PHP] Win PHP Editor...


> Well, I still believe the best editor for windows is Editplus
> (www.editplus.com)
>
> Small, fast, stable, tonnes of features and it supports a lot of file
type.
> If it doesn't give you colour coding for a particular language, say Cold
> Fusion, go to the homepage and download the plugin.
>
> It's only 800K to download, give it a shot.  It's uninstall program
actually
> gets rid of it aswell, completely.  so if you don't like it, no sweat  :-P
>
> Just my 2 cents...
>
> Liam
>
>
>
> - Original Message -
> From: "Dave at Sinewaves.net" <[EMAIL PROTECTED]>
> To: "PHPlist" <[EMAIL PROTECTED]>
> Sent: Saturday, August 10, 2002 3:42 AM
> Subject: [PHP] Win PHP Editor...
>
>
> > Just have to add one little fine piece of free software that nobody's
> > mentioned yet, Crimson Editor (http://www.crimsoneditor.com )
> >
> > No code completion, but it's got every other feature of the big
commercial
> > beasts... definitely check it out - I just switched over, and it's
great.
> >
> >
> > From the site:
> > --
> > Edit multiple documents
> >- switch between documents using file selection tab
> >- pressing Ctrl+Tab brings the last accessed document to top
> >
> > Syntax highlighting
> >- configurable via custom syntax files
> >- preconfigured for more than 50 computer languages
> >
> > Multi-level undo / redo
> >- all editing actions are recorded from the opening of a file
> >- unlimited undo and redo buffers
> >
> > Find & Replace
> >- replace specified text one by one, or as a whole
> >- support regular expression
> >
> > Natural word wrapping
> >- word wrapping does not affect syntax highlighting
> >- configurable wrapping indentation (easer to understand the syntax)
> >
> > Spell checker
> >- around 10 words were added in the dictionary
> >- users can register new words in their own dictionary
> > (InstallDir/user.dic)
> >
> > User tools and macros
> >- execute external programs with proper arguments
> >- compile, execute and test your code
> >- ease your fingers with key stroke recording (record & replay)
> >
> > Directory tree view window
> >- click to open documents
> >- filter to display only selected file class
> >
> > Edit remote files directly using built-in FTP client
> >- open, edit, and save documents in remote FTP servers
> >- save account information (encoded) for automatic logon
> >
> > Print & Print preview
> >- configurable page header and footer
> >- print with line numbers
> >- print with syntax highlighting (used in color printer)
> >- true type font selection for printer
> >
> > Other useful features
> >single instance / multiple instances, ability to detect changed
files,
> >bookmark & go to, highlight active line, highlight matching pairs,
> >multi-byte support with integrated IME (for eastern languages),
> >auto indent, wheel mouse support, copy & paste, line numbers,
> >configurable line spacing, option to save files in Unix format,
> >option to set working directory
> >
> >
> >
> >
> > Very nice little IDE, and the price is right! Nothing!
> >
> > Dave
> >
> >
> > --
> > 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
>
- Original Message -
From: "Liam MacKenzie" <[EMAIL PROTECTED]>
To: "Dave at Sinewaves.net" <[EMAIL PROTECTED]>; "PHPlist"
<[EMAIL PROTECTED]>
Sent: Friday, August 09, 2002 9:38 PM
Subject: Re: [PHP] Win PHP Editor...


> Well, I still believe the best editor for windows is Editplus
> (www.editplus.com)
>
> Small, fast, stable, tonnes of features and it supports a lot of file
type.
> If it doesn't give you colour coding for a particular language, say Cold
> Fusion, go to the homepage and download the plugin.
>
> It's only 800K to download, give it a shot.  It's uninstall program
actually
> gets rid of it aswell, completely.  so if you don't like it, no sweat  :-P
>
> Just my 2 cents...
>
> Liam
>
>
>
> - Original Message -
> From: "Dave at Sinewaves.net" <[EMAIL PROTECTED]>
> To: "PHPlist" <[EMAIL PROTECTED]>
> Sent: Saturday, August 10, 2002 3:42 AM
> Subject: [PHP] Win PHP Editor...
>
>
> > Just have to add one little fine piece of free software that nobody's
> > mentioned yet, Crimson Editor (http://www.crimsoneditor.com )
> >
> > No code completion, but it's got every other feature of the big
commercial
> > beasts... definitely check it out - I j

Re: [PHP] checkbox => POST => array??

2002-08-10 Thread Jason Stechschulte

On Sat, Aug 10, 2002 at 02:56:48PM -0400, PeterV wrote:
> What I have now:
> 
> doesn't return an array $topic??

Probaby due to register_globals.  It should exist in $_POST['topic']

-- 
Jason Stechschulte
[EMAIL PROTECTED]
http://www.ypisco.com
--
I am a bookaholic.  If you are a decent person, you will not sell me
another book.

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




php-general Digest 10 Aug 2002 19:17:09 -0000 Issue 1517

2002-08-10 Thread php-general-digest-help


php-general Digest 10 Aug 2002 19:17:09 - Issue 1517

Topics (messages 111932 through 111970):

Re: Problem with output buffering in PHP 4.0.6 and Apache/1.3.20
111932 by: Lars Olsson

How to create basic LOGIN procedure
111933 by: Kristoffer Strom
111940 by: Justin French
111950 by: Kristoffer Strom

cgi error
111934 by: radio x

and this is the script
111935 by: radio x

Re: mysql_result
111936 by: Marcel Besancon

Re: E-commerce site issue?
111937 by: Justin French

Re: Sending automatically mail
111938 by: Justin French

Re: special characters
111939 by: Justin French

Shelling out to Aspell: Linux gurus please
111941 by: Geoff Caplan

PHP Errors - someone please take a look
111942 by: Christopher J. Crane

classes and references in session
111943 by: gianpaolo racca

Re: Pictures and sound in MySQL and access via PHP
111944 by: danny

Re: security concern with curl
111945 by: Daniel Tryba
111946 by: andy

HTTP authentication - de authentication
111947 by: vic
111951 by: Matt

Re: Thumb nail of a web page
111948 by: Julio Nobrega

Save ability... Duplicate DB entries
111949 by: JJ Harrison
111953 by: DL Neil
111963 by: Mark Charette

PHP form port
111952 by: Daniel Guerrier
111954 by: Matt
111956 by: John Wards
111959 by: Matt

Re: Two version of php in the same system
111955 by: Analysis & Solutions
111958 by: Breno Cardoso Perucchi

Newbie question about UNIX command-line directives
111957 by: Al

is this possible ...
111960 by: M.E. Suliman
111967 by: Julio Nobrega

records in db
111961 by: Tyler Durdin

weird urls
111962 by: XoXGrimreaper.netscape.net
111964 by: Chris Knipe
111965 by: César Aracena
111966 by: Julio Nobrega

checkbox => POST => array??
111968 by: PeterV
111970 by: Jason Stechschulte

Re: Win PHP Editor...
111969 by: Randy Johnson

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--

--- Begin Message ---

Ing.Martin prášek wrote:
> Hi..
> I have found a strange problem. I try to use php output buffering, but I found this 
>problem.
> Working with small amount of data everything is fine. But If I set example script 
>like this:
> 
>  
> function callback($buffer)
>  {
>  return do_something_with($buffer);
>  }
> 
> 
> ob_start("callback")
> .
> .
> 
> do_something_that_produce_big_output() // more than 1.5 MB
> .
> .
> .
> ob_end_flush();
> 
> ?>
> 
> Everything works fine when $buffer < approx 1.5 Mb, but if the size of the output, 
>that need to be bufered exceeded some strange limit aprox 1593400 bytes, buffer is 
>cut to that length and rest of the output is lost(!). I look in docs and manuals,  
>but found nothing about it. Is it posssible to set large size for the output 
>buffering operations or this strange limit is hard coded and cant be exceeded ???  I 
>try to play with PHP.INI or add swapspace and DIMs memory with no effect.  Please 
>help.  
> 
> 
> ---
> Odchozí zpráva neobsahuje viry.
> Zkontrolováno antivirovým systémem AVG (http://www.grisoft.cz).
> Verze: 6.0.381 / Virová báze: 214 - datum vydání: 2.8.2002

Hi!

I don't think that should be considered a problem for PHP output 
buffering. Du you know ANY user that would that would wait for a 1.5MB 
page to display? And if you're transferring large binary files to the 
browser (a LARGE bitmap for example) you could get around this problem 
by doing

1. Open the file
2. Read a reasonable amount of data (say, 10 bytes)
3. use ob_flush to sende the data to the browser
4. Repeat step 2 and 3 until all of file is read
5. Use ob_end_flush to send the rest of the buffer
6. Close the file

Hope this helps

/lasso ([EMAIL PROTECTED])


--- End Message ---
--- Begin Message ---

This PHP stuff is still pretty new to me (still prefer IBM's NetData), so I
need help to create a login procedure for a website.
The point being to make sure only authenticated people can access the admin
pages and post/edit news items and stuff. Should be simple, huh?

Anyways, the three objectives are:
1. Login that checks the username and password with a user defined table in
a MySQL database. Not actual authentication for the database!
2. Store the username and load the e-mail for that user from that table and
store them both as a session variable.
3. Make sure that none of the pages in that directory works unless you're
athenticated

Help? Is there some ready function for all of this that I haven't found?
So far I've only run across the actual database authentication, but I don't
wanna add users to the database

[PHP] Random mirrors and download quota

2002-08-10 Thread Andrew Conner

Hello,
I have a script (at bottom) that, upon loading, will randomly select a
mirror or primary server (on average, the primary servers will be selected
twice as much). It all works good, but now, I have to add a "quota manager"
that will, for both mirrors, limit the times the file can be downloaded to
1200 times (there is only one file being downloaded). I have thought about
storing a text file for each of the two mirrors that shows the current count
of downloads, and it will be checked if the mirror is randomly selected and
if it is above 1200, will randomly select another server, and if it isn't,
will just add one to it and update the file. How would I go about this, or
is there a better way to do this?
Thanks in advance.
Andrew Conner

The script (I know it doesn't use the best design, but it works, any better
ways of doing this?):

http://www.someprimaryserver.com/file.exe";,

"http://www.someprimaryserver.com/file.exe";,

"http://www.someprimaryserver2.com/file.exe";,

"http://www.someprimaryserver2.com/file.exe";,

"http://www.someprimaryserver3.com/file.exe";,

"http://www.someprimaryserver3.com/file.exe";,

"http://www.someprimaryserver4.com/file.exe";,

"http://www.someprimaryserver4.com/file.exe";,

"http://www.somemirror.com/file.exe";,

"http://www.somemirror2.com/file.exe";);

// This randomly gets a server...

srand((double)microtime()*100);

$wOne = rand(0, 9);

$choice = $adArr[$wOne];

// This fwds the user to the server picked.

// Somewhere in here needs to be the mirror stuff...

header("Location: $choice");

?>




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




Re: [PHP] Win PHP Editor...

2002-08-10 Thread Glenn Sieb

My favorite win-editor is UltraEdit (http://www.idmcomp.com)

Also does nice color-tagging, and is very user-customizable that way!

Glenn

At 03:02 PM 8/10/2002 -0400, Randy Johnson posted the following...
>I noticed they have not come out with a new version in quite a long time and
>do not answer their emails?   anybody else heard about any future releases
>of editplus?

---
The original portions of this message are the copyright of the author
(c)1998-2002 Glenn E. Sieb.ICQ UIN: 300395IRC Nick: Rainbear
"All acts of Love and Pleasure are Her rituals"-Charge of the Goddess



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




[PHP] PHPS on apache2

2002-08-10 Thread FileCop

Hi!

I have installed apache 2.0.39 and php 4.2.2 on a windows maschine (yes I
know that sucks). I have added the "AddType application/x-httpd-php-source
.phps" line to my httpd.conf file, but .phps does not work. I just attempts
to download the file. phps was working when I used apache 1.3.24 and php
4.2.0/1, so I guess its a problem with apache2. Has anyone encountered the
same problem or does anyone have a solution?

Regards FileCop



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




[PHP] PHPS on apache 2

2002-08-10 Thread FileCop

Hi!

I have installed apache 2.0.39 and php 4.2.2 on a windows maschine (yes I
know that sucks). I have added the "AddType application/x-httpd-php-source
.phps" line to my httpd.conf file, but .phps does not work. I just attempts
to download the file. phps was working when I used apache 1.3.24 and php
4.2.0/1, so I guess its a problem with apache2. Has anyone encountered the
same problem or does anyone have a solution?

Regards FileCop




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




[PHP] Cookie array

2002-08-10 Thread Jan - CWIZO

Hi !

How can I stoor array in to a cookie ?

Do I just define an array and stoore it in a cookie ?
How do I access the data in the array then ?


-- 
LP
CWIZO
www.3delavnica.com
www.ks-con.si
www.WetSoftware.com

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




[PHP] Re: Cookie array

2002-08-10 Thread Lee Doolan

> "Jan" == Jan  <[EMAIL PROTECTED]> writes:

Jan> Hi !  How can I stoor array in to a cookie ?

Jan> Do I just define an array and stoore it in a cookie ?  How do
Jan> I access the data in the array then ?

you can use serialize() / unserialize() but be careful because the
amount of storage allowed in a cookie is limited.  what i do is to
store thing like serialized arrays and serialized objects in a database
table indexed by the session id.


-- 
Flowers of morning glory.  +-+
The sky above this street  |donate to causes I care about:   |
Begins to overcast.|  http://svcs.affero.net/rm.php?r=leed_25|
   --Sugita+-+

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




Re: [PHP] Save ability... Duplicate DB entries

2002-08-10 Thread Analysis & Solutions

Hi JJ:

On Sun, Aug 11, 2002 at 01:44:53AM +1000, JJ Harrison wrote:
> 
> Which has a save or a publish option. I only want to keep one copy of each
> article in the DB. This adds a new one each time. I know about updates in
> SQL but the file may or may not already be in the db. Does anyone have a
> good way to go about this?

Here's a quick outline of what I do.  I have a form for entering in
articles.  If the form is opened without an ArticleID, the ArticleID (a
hidden form field) becomes 0.  But, if the form is opened with an
ArticleID, the given ArticleID is put in the hidden field.

Now, when I make my changes and hit the Save (submit) button, the script 
checks the ArticleID.  If it's 0, do an insert.  If it's non-zero, do an 
update.

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

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




Re: [PHP] PHP form port

2002-08-10 Thread Analysis & Solutions

On Sat, Aug 10, 2002 at 09:14:03AM -0700, Daniel Guerrier wrote:
> How do i execute a form post with php?
> I want to validate CCard info etc.. then perform the
> post with no furtheraction from the user.
> 
> Basically If not valid stay here and show whats wrong
> ELSE post form to process.php

Don't.  Put the whole procedure into one script.  In the first step, do 
the validation, if it's bad, tell the people so and exit.  If it's okay, 
continue the processing.

This will make things easier to control and work reliably.  Forwarding
post information can lead to a variety of difficulties such as strange
behavior when people hit the back button, odd timeouts, let alone, people 
could play games and go directly to process.php without doing the 
validation step... among other things.

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

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




Re: [PHP] Newbie question about UNIX command-line directives

2002-08-10 Thread Analysis & Solutions

On Sat, Aug 10, 2002 at 01:12:38PM -0400, Al wrote:
> I'm on a virtual host without a shell account and need execute a UNIX 
> command.
> 
> ln -s ../afile.php index.php

In a PHP script, you can do this -- if permissions are favorable:

   exec('ln -s ../afile.php index.php');


> Is there some way to do this [e.g., with a htaccess file]?

In an .htaccess file, you can put this

DirectoryIndex afile.php


> What happens when you execute UNIX commands like the one above?  Does it 
> make a file, change the config?

It makes a link in the file system.  -s makes the link symbolic.
http://www.tac.eu.org/cgi-bin/man-cgi?ln++NetBSD-current

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

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




Re: [PHP] PHPS on apache 2

2002-08-10 Thread Analysis & Solutions

On Sat, Aug 10, 2002 at 07:38:05PM +0200, FileCop wrote:
> 
> I have installed apache 2.0.39 and php 4.2.2 on a windows maschine (yes I
> know that sucks). I have added the "AddType application/x-httpd-php-source
> .phps" line to my httpd.conf file, but .phps does not work.

Did you add the corresponding "Action" and "ScriptAlias" lines to the 
configuration file as well?  If so, what do you have in there for them?

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

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




Re: [PHP] records in db

2002-08-10 Thread Analysis & Solutions

On Sat, Aug 10, 2002 at 05:52:42PM +, Tyler Durdin wrote:

> If I have a field in my DB that can have 4 different answers, lets say 
> a,b,c and d. How can I count the number of each in that field. So if there 
> are 4 a's 1 b 0 c's and 12 d's how can I get php to count this?

Us the database to do that:

   SELECT FieldName, count(*) FROM TableName GROUP BY FieldName

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

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




[PHP] Re: PHP Errors - someone please take a look

2002-08-10 Thread Joni Järvinen

Hi.

This isn't the most helpful comment but it seems your working on a
windows-platform.
Have you tried to use your script in a *nix platform?

-- Joni
--
// Joni Järvinen
// [EMAIL PROTECTED]
// http://www.reactorbox.org/~wandu

"Christopher J. Crane" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I get the following errors when I run my script. It works fine with only
20
> records, but at 100 I get errors.
>
> "PHP has encountered an Access Violation at 00DA088E Warning: Unknown list
> entry type in request shutdown (2) in
> c:\www\htdocs\demos\ct.org\directory.php on line 0"
>
> or
>
>  "PHP has encountered an Access Violation at 00DA088E "
>
> Basically, I have a CSV file with about 3500 records (lines). I have a
while
> statement that goes through the file line by line. I am using fgetcsv().
> While on a line I also open another file and search for a matching field
> (CustomerID) and if it matches print the information on that line unless a
> field in that file is set to "1".
>
> This was initially tried using a query since this data is in a database.
> That did not work. I exported the data into csv files. It worked in
testing
> limiting the amount of records to be displayed to less than 30. I just
tried
> it with limit set to 100 and that's when I got the problem.
>
> Here is the code;
>  /* INFORMATION:
>  ____
>   __/_/\_\__
>__|__|__
>   (___O)  (O___)
>  (_O)   Christopher J. Crane (O_)
>  (_O)   Web Designer (O_)
>   (__O)  I N X D E S I G N (O__)
>  |  http://inxdesign.com|
>  |  [EMAIL PROTECTED]|
>  |  |
>  |__|
> This script was created to help prepare the directory information, for the
> Connecticut Technical Council for the Year 2002.
>
> My Material - Please do not copy or modify it with checking with me first.
> ([EMAIL PROTECTED])
> Please leave the INFORMATION banner in place.
> */
>
>
> file://==Global Definitions
> file://
> define('SCRIPT_NAME', 'Connecticut Technology Council Directory Maker');
> define('SCRIPT_VERSION', 'v1.0');
> define('SCRIPT_CREATOR', 'mailto:[EMAIL PROTECTED]";>Christopher
> J. Crane');
> define('CREATE_DATE', '08/06/02');
> define('REVISED_DATE', '08/06/02');
>
>
> $TestingMode = "On"; file://On or Off
> $ShowCount = "10";
>
> $row = 0;
> print "Company Directory 2002";
> print "T e s t i n gM o d e - ";
>  if($TestingMode == "On") { print "OnOnly Showing The First $ShowCount
> Records.\n"; }
>  else { print "Off\n"; }
> print "End";
> print "\n";
>
>
> file://==C o m p a n y   D a t a   O u t p u t
> file://===
> $Data1 = fopen("Final.csv","r");
>  while ($Line1 = fgetcsv($Data1, 1000, ",")) {
>   $CompanyID = $Line1[0];   $CompanyName = $Line1[1]; $MemberTypeID =
> $Line1[2];
>   $RevenueID = $Line1[3];   $Ownership = $Line1[4];  $NoPubRevenue =
> $Line1[5];
>   $YearEstablished = $Line1[6]; $Exchange = $Line1[7];  $TotalEmployees =
> $Line1[8];
>   $ConnEmployees = $Line1[9];  $Ticker = $Line1[10];  $Email = $Line1[11];
>   $Website = $Line1[12];   $IndustryID = $Line1[13]; $AddressTypeID =
> $Line1[14];
>   $AddressLine1 = $Line1[15];  $AddressLine2 = $Line1[16]; $City =
> $Line1[17];
>   $State = $Line1[18];   $Zip = $Line1[19];   $CountyName = $Line1[20];
>   $Profile = $Line1[21];
>
>   if($row != 0) {
>print " $CompanyName\n";
>if($AddressLine1 != "") { print "$AddressLine1\n"; }
>if($AddressLine2 != "") { print "$AddressLine2\n"; }
>print "$City, $State $Zip\n";
>
>
> file://==P h o n e   D a t a   O u t p u t
> file://===
> $Data2 = fopen("PhoneTable.csv","r");
>  while ($Line2 = fgetcsv ($Data2, 1000, ",")) {
>   $CompanyID2 = $Line2[0]; $PhoneType = $Line2[1]; $AreaCode = $Line2[2];
>   $Prefix = $Line2[3];  $Suffix = $Line2[4];
>
>   if($CompanyID2 == $CompanyID) {
>if($PhoneType == "Office") {
> print "Phone:
> ($AreaCode)$Prefix-$Suffix"; }
> }
>}
> fclose($Data2);
>
>
> file://==F a x   D a t a   O u t p u t
> file://===
> $Data3 = fopen("PhoneTable.csv","r");
>  while ($Line3 = fgetcsv ($Data3, 1000, ",")) {
>   $CompanyID3 = $Line3[0]; $PhoneType = $Line3[1]; $AreaCode = $Line3[2];
>   $Prefix = $Line3[3];  $Suffix = $Line3[4];
>
>   if($CompanyID3 == $CompanyID) {
>if($PhoneType == "FAX") {
> print "Fax:
> ($AreaCode)$Prefix-$Suffix"; }
> }
>}
> fclose($Data3);
> print "";
>
>
> file://==W e b s i t e / E m a i l  D a t a   O u t p u t
> file://

Re: [PHP] records in db

2002-08-10 Thread DL Neil

Tyler,

> If I have a field in my DB that can have 4 different answers, lets say
a,b,c
> and d. How can I count the number of each in that field. So if there are 4
> a's 1 b 0 c's and 12 d's how can I get php to count this?


You must combine IF() with SUM().

Break it down into smaller problems:
1 getting the data out of the tbl and grab all of the answer rows
2 'count' the number of "a"s
3 do the same for the number of "b"s

The first is trivial, but let's limit our attention to question 1 until we
figure out how to word the query:

SELECT questionNr
  FROM tblNm
  WHERE questionNr = 1 AND answer = 'a'

Obviously this won't satisfy you - you don't want line after line of data,
and it only works if the chosen answer is "a" and you read off the number of
rows affected. What happens if the answer is "b". We'd have to execute the
query all over again, but substituting "b" for "a".

Is there another way? Yes, there is an IF() in SQL (manual: 6.3  Functions
for Use in SELECT and WHERE Clauses). Let's try listing the question number
and noting if the answer is "a" or "b" or...:

SELECT questionNr, IF( answer = 'a', TRUE, FALSE ) AS Answer-A, IF( answer =
'b', TRUE, FALSE ) AS Answer-B, ...
  FROM tblNm
  WHERE questionNr = 1

Now we have a list of all of the answers to question 1, but instead of only
"a" answers, we have a column of TRUEs and FALSEs for the "a" answers, and
beside that a column of TRUEs and FALSEs for the "b"s, through "c" and "d".
So beside the questionNr we have four columns telling us which data is
relevant to count - if we simply count the TRUEs. So we've saved the
repetitious executions, but the machine no longer does any useful counting
for us.

Substitute 1 for TRUE and 0 for FALSE, and we can have SQL do that last calc
for us, ie SUM all of those "TRUE" values:

SELECT questionNr, SUM( IF( answer = 'a', 1, 0 ) ) AS Answer-A, SUM( IF(
answer = 'b', 1, 0 ) ) AS Answer-B, ...
  FROM tblNm
  WHERE questionNr = 1

Finally, if you get rid of the WHERE clause, and replace it with GROUP BY
questionNr, it should work for every question in the test/survey.

Regards,
=dn


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




[PHP] limit the number of users: query syntax?

2002-08-10 Thread Øystein Håland

I want to limit the number of users from different groups allowed to create
a user account on a website. I belive that can be done using two tables in a
DB, one for the user accounts and one for the group information (with one
field 'maxusers'). I even want to limit the time for the account to be
valid. This can't be too hard to accomplish, but I'm new to mysql, so help
would be appreciated. (Yes, I have tried to read the mysql-manual, but when
you don't know what to look for that can be really hard)



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




Re: [PHP] show_source()

2002-08-10 Thread Øystein Håland

This helped on my laptop (win2000, Apache 1.3.26, php 4.2.1, but when I
uploaded to my webserver (SunOS (sparc), Apache 1.3.xx, php 4.0.6) only the
first row was numbered (yes, I even tried \n instead).
Is there another solution that could work?

"Rasmus Lerdorf" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]...
> So just replace \r then.  And use str_replace() instead of ereg_replace().
>
> -Rasmus
>
> On Thu, 8 Aug 2002, Øystein Håland wrote:
>
> > I use the following script found at php.net:
> > 
> >
> >  > ob_start();
> > show_source( "THE_FILE!" );
> > $t = ob_get_contents();
> > ob_end_clean();
> > echo ereg_replace( "" , "" , $t );
> > ?>
> > 
> >
> > Since the ereg_replace don't work with my php-code i just do
> > echo $t;
> > instead.
> > What I want is to do something like this:
> > echo ereg_replace( "\r\n" , "" , $t );
> > (my files are created in a win2000-environment), but this gives the
> > linenumber only for the first line. Anyone see a solution to this?



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




Re: [PHP] Save ability... Duplicate DB entries

2002-08-10 Thread JJ Harrison

I'll do that. When I load an article I supply the article's id.


--
JJ Harrison
[EMAIL PROTECTED]
www.tececo.com

--
Please reply on the list/newsgroup unless the reply it OT.

"Analysis & Solutions" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi JJ:
>
> On Sun, Aug 11, 2002 at 01:44:53AM +1000, JJ Harrison wrote:
> >
> > Which has a save or a publish option. I only want to keep one copy of
each
> > article in the DB. This adds a new one each time. I know about updates
in
> > SQL but the file may or may not already be in the db. Does anyone have a
> > good way to go about this?
>
> Here's a quick outline of what I do.  I have a form for entering in
> articles.  If the form is opened without an ArticleID, the ArticleID (a
> hidden form field) becomes 0.  But, if the form is opened with an
> ArticleID, the given ArticleID is put in the hidden field.
>
> Now, when I make my changes and hit the Save (submit) button, the script
> checks the ArticleID.  If it's 0, do an insert.  If it's non-zero, do an
> update.
>
> --Dan
>
> --
>PHP classes that make web design easier
> SQL Solution  |   Layout Solution   |  Form Solution
> sqlsolution.info  | layoutsolution.info |  formsolution.info
>  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
>  4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409



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




Re: [PHP] cgi error

2002-08-10 Thread Bob Lockie

>I receive this when I try to send an e-mail.
>All works fine until yesterday and my script is the same.
>Could u tell what is the problem?
>CGI Error
>The specified CGI application misbehaved by not returning a complete set of HTTP 
>headers. The headers it did return are:

What does your httpd log say?




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




Re: [PHP] Cookie array

2002-08-10 Thread Bob Lockie


>How can I stoor array in to a cookie ?
>
>Do I just define an array and stoore it in a cookie ?

Yes.


>How do I access the data in the array then ?

$_COOKIE['array element'];




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




[PHP] Converting datestamp to text?

2002-08-10 Thread Kristoffer Strom

In my MySQL db I have a date-field on every entry looking like this :
2002-08-10
When presented on a PHP page, I want it converted to "Saturday, Augusth
10th, 2002".

How do I achieve that? I've been playing around with the date-command and
strtotime-command but haven't achieved it.

Help please.

/Kris




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




RE: [PHP] Converting datestamp to text?

2002-08-10 Thread David Freeman


 > In my MySQL db I have a date-field on every entry looking like this :
 > 2002-08-10
 > When presented on a PHP page, I want it converted to 
 > "Saturday, Augusth
 > 10th, 2002".
 > 
 > How do I achieve that? I've been playing around with the 
 > date-command and
 > strtotime-command but haven't achieved it.

Do it in your mysql query instead.  Have a look at DATE_FORMAT() in your
friendly local neighbourhood mysql manual.  Chapter 6.3.4 or
thereabouts.

CYA, Dave




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




[PHP] Tried that..

2002-08-10 Thread Kristoffer Strom

I've tried that, but as usual rtfm doesn't help me. I need concise examples
:(

How would I write this basic select query to get the date in my format
(Saturday, August 10th, 2002)?
SELECT datum FROM news_items
(where "datum" is the date-stamp in "-MM-DD" format)

I've tried the combo's I can think of and still get nothing on the other
side...

/Kris



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




Re: [PHP] Tried that..

2002-08-10 Thread Rasmus Lerdorf

This isn't really a PHP question, is it?  This is a function of your
database, and since you don't mention which database you are using it is a
bit hard to answer.  Assuming MySQL, there is an entire chapter in the
MySQL docs on exactly how to do this:

http://www.mysql.com/doc/en/Date_and_time_functions.html

If it is another database, go read the appropriate docs, or ask on a
mailing list related to that database.

-Rasmus

On Sun, 11 Aug 2002, Kristoffer Strom wrote:

> I've tried that, but as usual rtfm doesn't help me. I need concise examples
> :(
>
> How would I write this basic select query to get the date in my format
> (Saturday, August 10th, 2002)?
> SELECT datum FROM news_items
> (where "datum" is the date-stamp in "-MM-DD" format)
>
> I've tried the combo's I can think of and still get nothing on the other
> side...
>
> /Kris
>
>
>
> --
> 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] Win PHP Editor...

2002-08-10 Thread Liam MacKenzie

No, sorry.
I will try to contact them soon about that.
But there's no bugs that I've come across in Editplus.  Full of features
too, but there's always room for imporvement.

Cheers,
Liam

-Original Message-
From: Randy Johnson [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, 11 August 2002 5:03 AM
To: Liam MacKenzie; Dave at Sinewaves.net; PHPlist
Subject: Re: [PHP] Win PHP Editor...


I noticed they have not come out with a new version in quite a long time
and
do not answer their emails?   anybody else heard about any future
releases
of editplus?


Randy
- Original Message -
From: "Liam MacKenzie" <[EMAIL PROTECTED]>
To: "Dave at Sinewaves.net" <[EMAIL PROTECTED]>; "PHPlist"
<[EMAIL PROTECTED]>
Sent: Friday, August 09, 2002 9:38 PM
Subject: Re: [PHP] Win PHP Editor...


> Well, I still believe the best editor for windows is Editplus
> (www.editplus.com)
>
> Small, fast, stable, tonnes of features and it supports a lot of file
type.
> If it doesn't give you colour coding for a particular language, say 
> Cold Fusion, go to the homepage and download the plugin.
>
> It's only 800K to download, give it a shot.  It's uninstall program
actually
> gets rid of it aswell, completely.  so if you don't like it, no sweat

> :-P
>
> Just my 2 cents...
>
> Liam
>
>
>
> - Original Message -
> From: "Dave at Sinewaves.net" <[EMAIL PROTECTED]>
> To: "PHPlist" <[EMAIL PROTECTED]>
> Sent: Saturday, August 10, 2002 3:42 AM
> Subject: [PHP] Win PHP Editor...
>
>
> > Just have to add one little fine piece of free software that 
> > nobody's mentioned yet, Crimson Editor (http://www.crimsoneditor.com

> > )
> >
> > No code completion, but it's got every other feature of the big
commercial
> > beasts... definitely check it out - I just switched over, and it's
great.
> >
> >
> > From the site:
> > --
> > Edit multiple documents
> >- switch between documents using file selection tab
> >- pressing Ctrl+Tab brings the last accessed document to top
> >
> > Syntax highlighting
> >- configurable via custom syntax files
> >- preconfigured for more than 50 computer languages
> >
> > Multi-level undo / redo
> >- all editing actions are recorded from the opening of a file
> >- unlimited undo and redo buffers
> >
> > Find & Replace
> >- replace specified text one by one, or as a whole
> >- support regular expression
> >
> > Natural word wrapping
> >- word wrapping does not affect syntax highlighting
> >- configurable wrapping indentation (easer to understand the 
> > syntax)
> >
> > Spell checker
> >- around 10 words were added in the dictionary
> >- users can register new words in their own dictionary
> > (InstallDir/user.dic)
> >
> > User tools and macros
> >- execute external programs with proper arguments
> >- compile, execute and test your code
> >- ease your fingers with key stroke recording (record & replay)
> >
> > Directory tree view window
> >- click to open documents
> >- filter to display only selected file class
> >
> > Edit remote files directly using built-in FTP client
> >- open, edit, and save documents in remote FTP servers
> >- save account information (encoded) for automatic logon
> >
> > Print & Print preview
> >- configurable page header and footer
> >- print with line numbers
> >- print with syntax highlighting (used in color printer)
> >- true type font selection for printer
> >
> > Other useful features
> >single instance / multiple instances, ability to detect changed
files,
> >bookmark & go to, highlight active line, highlight matching
pairs,
> >multi-byte support with integrated IME (for eastern languages),
> >auto indent, wheel mouse support, copy & paste, line numbers,
> >configurable line spacing, option to save files in Unix format,
> >option to set working directory
> >
> >
> >
> >
> > Very nice little IDE, and the price is right! Nothing!
> >
> > Dave
> >
> >
> > --
> > 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
>
- Original Message -
From: "Liam MacKenzie" <[EMAIL PROTECTED]>
To: "Dave at Sinewaves.net" <[EMAIL PROTECTED]>; "PHPlist"
<[EMAIL PROTECTED]>
Sent: Friday, August 09, 2002 9:38 PM
Subject: Re: [PHP] Win PHP Editor...


> Well, I still believe the best editor for windows is Editplus
> (www.editplus.com)
>
> Small, fast, stable, tonnes of features and it supports a lot of file
type.
> If it doesn't give you colour coding for a particular language, say 
> Cold Fusion, go to the homepage and download the plugin.
>
> It's only 800K to download, give it a shot.  It's uninstall program
actually
> gets rid of it aswell, completely.  so if you don't like it, no sweat

> :-P
>
> Just my 2 cents...
>
> Liam
>
>
>
> - Original Message -
> From: "Dave at Sinewaves.

RE: [PHP] Tried that..

2002-08-10 Thread David Freeman


 > I've tried that, but as usual rtfm doesn't help me. I need 
 > concise examples
 > :(
 > 
 > How would I write this basic select query to get the date in 
 > my format
 > (Saturday, August 10th, 2002)?
 > SELECT datum FROM news_items
 > (where "datum" is the date-stamp in "-MM-DD" format)

Rasmus is right, this is a database question...

Anyway... Something like this should get you close...

SELECT DATE_FORMAT(datum, '%e %b %y') AS my_formatted_date FROM
news_items WHERE whatever = something_else

The key here is DATE_FORMAT(column, 'format') AS whatever

You'll need to insert your own column name and get the format stuff from
the mysql manual (as previously noted, chapter 6.4.something will do
that).

CYA, Dave




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




Re: [PHP] records in db

2002-08-10 Thread Justin French

on 11/08/02 3:52 AM, Tyler Durdin ([EMAIL PROTECTED]) wrote:

> If I have a field in my DB that can have 4 different answers, lets say a,b,c
> and d. How can I count the number of each in that field. So if there are 4
> a's 1 b 0 c's and 12 d's how can I get php to count this?

I'm pretty certain there's a way to do this with just one MySQL query, but
here's a PHP version that does 4 queries:

 $answer)
{
$sql = "SELECT * FROM answers_table WHERE answer_col='{$answer}'";
$result = mysql_query($sql);
if($result)
{
$count = mysql_num_rows($result);
}
else
{
$count = "0";
}
echo "{$count} people selected answer {$answer}";
}
?>

Should print out something like:

4 people selected answer a
1 people selected answer b
0 people selected answer c
12 people selected answer d


hack it to suit your needs,

Justin



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




Re: [PHP] is this possible ...

2002-08-10 Thread Justin French

Yes attaching files to email is possible.  There's such a class available at
phpclasses.org by Manuel

Justin French


on 11/08/02 3:53 AM, M.E. Suliman ([EMAIL PROTECTED]) wrote:

> Hi
> 
> I need the contents of a form to be emailed as an attached Excel file or
> html file.  Is this possible using PHP.  I think comma delimited files open
> in Excel.  Can anyone advise.
> 
> Thanks in advance
> 
> Mohamed
> 


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




[PHP] Access Violations with PHP Please Help Please

2002-08-10 Thread Christopher J. Crane

I get the following errors when I run my script. It works fine with only 20
records, but at 100 I get errors.

"PHP has encountered an Access Violation at 00DA088E Warning: Unknown list
entry type in request shutdown (2) in
c:\www\htdocs\demos\ct.org\directory.php on line 0"

or

 "PHP has encountered an Access Violation at 00DA088E "

Basically, I have a CSV file with about 3500 records (lines). I have a while
statement that goes through the file line by line. I am using fgetcsv().
While on a line I also open another file and search for a matching field
(CustomerID) and if it matches print the information on that line unless a
field in that file is set to "1".

This was initially tried using a query since this data is in a database.
That did not work. I exported the data into csv files. It worked in testing
limiting the amount of records to be displayed to less than 30. I just tried
it with limit set to 100 and that's when I got the problem.

Here is the code;
http://inxdesign.com|
 |  [EMAIL PROTECTED]|
 |  |
 |__|
This script was created to help prepare the directory information, for the
Connecticut Technical Council for the Year 2002.

My Material - Please do not copy or modify it with checking with me first.
([EMAIL PROTECTED])
Please leave the INFORMATION banner in place.
*/


file://==Global Definitions
file://
define('SCRIPT_NAME', 'Connecticut Technology Council Directory Maker');
define('SCRIPT_VERSION', 'v1.0');
define('SCRIPT_CREATOR', 'mailto:[EMAIL PROTECTED]";>Christopher
J. Crane');
define('CREATE_DATE', '08/06/02');
define('REVISED_DATE', '08/06/02');


$TestingMode = "On"; file://On or Off
$ShowCount = "10";

$row = 0;
print "Company Directory 2002";
print "T e s t i n gM o d e - ";
 if($TestingMode == "On") { print "OnOnly Showing The First $ShowCount
Records.\n"; }
 else { print "Off\n"; }
print "End";
print "\n";


file://==C o m p a n y   D a t a   O u t p u t
file://===
$Data1 = fopen("Final.csv","r");
 while ($Line1 = fgetcsv($Data1, 1000, ",")) {
  $CompanyID = $Line1[0];   $CompanyName = $Line1[1]; $MemberTypeID =
$Line1[2];
  $RevenueID = $Line1[3];   $Ownership = $Line1[4];  $NoPubRevenue =
$Line1[5];
  $YearEstablished = $Line1[6]; $Exchange = $Line1[7];  $TotalEmployees =
$Line1[8];
  $ConnEmployees = $Line1[9];  $Ticker = $Line1[10];  $Email = $Line1[11];
  $Website = $Line1[12];   $IndustryID = $Line1[13]; $AddressTypeID =
$Line1[14];
  $AddressLine1 = $Line1[15];  $AddressLine2 = $Line1[16]; $City =
$Line1[17];
  $State = $Line1[18];   $Zip = $Line1[19];   $CountyName = $Line1[20];
  $Profile = $Line1[21];

  if($row != 0) {
   print " $CompanyName\n";
   if($AddressLine1 != "") { print "$AddressLine1\n"; }
   if($AddressLine2 != "") { print "$AddressLine2\n"; }
   print "$City, $State $Zip\n";


file://==P h o n e   D a t a   O u t p u t
file://===
$Data2 = fopen("PhoneTable.csv","r");
 while ($Line2 = fgetcsv ($Data2, 1000, ",")) {
  $CompanyID2 = $Line2[0]; $PhoneType = $Line2[1]; $AreaCode = $Line2[2];
  $Prefix = $Line2[3];  $Suffix = $Line2[4];

  if($CompanyID2 == $CompanyID) {
   if($PhoneType == "Office") {
print "Phone:
($AreaCode)$Prefix-$Suffix"; }
}
   }
fclose($Data2);


file://==F a x   D a t a   O u t p u t
file://===
$Data3 = fopen("PhoneTable.csv","r");
 while ($Line3 = fgetcsv ($Data3, 1000, ",")) {
  $CompanyID3 = $Line3[0]; $PhoneType = $Line3[1]; $AreaCode = $Line3[2];
  $Prefix = $Line3[3];  $Suffix = $Line3[4];

  if($CompanyID3 == $CompanyID) {
   if($PhoneType == "FAX") {
print "Fax:
($AreaCode)$Prefix-$Suffix"; }
}
   }
fclose($Data3);
print "";


file://==W e b s i t e / E m a i l  D a t a   O u t p u t
file://==
if(($Website != "") || ($Email != "[EMAIL PROTECTED]")) {
 if($Website != "") { print "Website: $Website\n"; }
 if($Email != "[EMAIL PROTECTED]") { print "E-Mail: $Email\n"; }
 }


file://==O w n e r s h i p   D a t a   O u t p u t
file://===
print "Ownership: ";
 if($Ownership == "1") { print "Private  "; }
 if($Ownership == "2") {
  print "Public  ";
  if(!($Exchange == "OTHER" or $Exchange == "")) { print "($Exchange:
$Ticker)  "; }
  }
 if($YearEstablished != "0") { print "Est. $YearEstablished"; }
print "";


file://==E m p l o y e e   D a t a   O u t p u t
file://=
print "CT Emp: ";
 if(($ConnEmployees >= 1) && ($ConnEmployees <= 9)) { print
"1-9 "; }
 elseif(($ConnEmployees >= 10) && ($ConnEmployees <= 50)) { print
"10-50 "; }
 elseif(($ConnEmployees >= 51) && ($ConnEmployees <= 100)) { print
"51-100 "; }
 elseif(($ConnEmployees >= 101) && ($ConnEmployees <= 250)) { print
"101-250 "; }
 elseif(

[PHP] Re: PHP Errors - someone please take a look

2002-08-10 Thread Christopher J. Crane

I did and got the same error.

"Joni JäRvinen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi.
>
> This isn't the most helpful comment but it seems your working on a
> windows-platform.
> Have you tried to use your script in a *nix platform?
>
> -- Joni
> --
> // Joni Järvinen
> // [EMAIL PROTECTED]
> // http://www.reactorbox.org/~wandu
>
> "Christopher J. Crane" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I get the following errors when I run my script. It works fine with only
> 20
> > records, but at 100 I get errors.
> >
> > "PHP has encountered an Access Violation at 00DA088E Warning: Unknown
list
> > entry type in request shutdown (2) in
> > c:\www\htdocs\demos\ct.org\directory.php on line 0"
> >
> > or
> >
> >  "PHP has encountered an Access Violation at 00DA088E "
> >
> > Basically, I have a CSV file with about 3500 records (lines). I have a
> while
> > statement that goes through the file line by line. I am using fgetcsv().
> > While on a line I also open another file and search for a matching field
> > (CustomerID) and if it matches print the information on that line unless
a
> > field in that file is set to "1".
> >
> > This was initially tried using a query since this data is in a database.
> > That did not work. I exported the data into csv files. It worked in
> testing
> > limiting the amount of records to be displayed to less than 30. I just
> tried
> > it with limit set to 100 and that's when I got the problem.
> >
> > Here is the code;
> >  > /* INFORMATION:
> >  ____
> >   __/_/\_\__
> >__|__|__
> >   (___O)  (O___)
> >  (_O)   Christopher J. Crane (O_)
> >  (_O)   Web Designer (O_)
> >   (__O)  I N X D E S I G N (O__)
> >  |  http://inxdesign.com|
> >  |  [EMAIL PROTECTED]|
> >  |  |
> >  |__|
> > This script was created to help prepare the directory information, for
the
> > Connecticut Technical Council for the Year 2002.
> >
> > My Material - Please do not copy or modify it with checking with me
first.
> > ([EMAIL PROTECTED])
> > Please leave the INFORMATION banner in place.
> > */
> >
> >
> > file://==Global Definitions
> > file://
> > define('SCRIPT_NAME', 'Connecticut Technology Council Directory Maker');
> > define('SCRIPT_VERSION', 'v1.0');
> > define('SCRIPT_CREATOR', ' href="mailto:[EMAIL PROTECTED]";>Christopher
> > J. Crane');
> > define('CREATE_DATE', '08/06/02');
> > define('REVISED_DATE', '08/06/02');
> >
> >
> > $TestingMode = "On"; file://On or Off
> > $ShowCount = "10";
> >
> > $row = 0;
> > print "Company Directory 2002";
> > print "T e s t i n gM o d e - ";
> >  if($TestingMode == "On") { print "OnOnly Showing The First
$ShowCount
> > Records.\n"; }
> >  else { print "Off\n"; }
> > print "End";
> > print "\n";
> >
> >
> > file://==C o m p a n y   D a t a   O u t p u t
> > file://===
> > $Data1 = fopen("Final.csv","r");
> >  while ($Line1 = fgetcsv($Data1, 1000, ",")) {
> >   $CompanyID = $Line1[0];   $CompanyName = $Line1[1]; $MemberTypeID =
> > $Line1[2];
> >   $RevenueID = $Line1[3];   $Ownership = $Line1[4];  $NoPubRevenue =
> > $Line1[5];
> >   $YearEstablished = $Line1[6]; $Exchange = $Line1[7];  $TotalEmployees
=
> > $Line1[8];
> >   $ConnEmployees = $Line1[9];  $Ticker = $Line1[10];  $Email =
$Line1[11];
> >   $Website = $Line1[12];   $IndustryID = $Line1[13]; $AddressTypeID =
> > $Line1[14];
> >   $AddressLine1 = $Line1[15];  $AddressLine2 = $Line1[16]; $City =
> > $Line1[17];
> >   $State = $Line1[18];   $Zip = $Line1[19];   $CountyName = $Line1[20];
> >   $Profile = $Line1[21];
> >
> >   if($row != 0) {
> >print " $CompanyName\n";
> >if($AddressLine1 != "") { print "$AddressLine1\n"; }
> >if($AddressLine2 != "") { print "$AddressLine2\n"; }
> >print "$City, $State $Zip\n";
> >
> >
> > file://==P h o n e   D a t a   O u t p u t
> > file://===
> > $Data2 = fopen("PhoneTable.csv","r");
> >  while ($Line2 = fgetcsv ($Data2, 1000, ",")) {
> >   $CompanyID2 = $Line2[0]; $PhoneType = $Line2[1]; $AreaCode =
$Line2[2];
> >   $Prefix = $Line2[3];  $Suffix = $Line2[4];
> >
> >   if($CompanyID2 == $CompanyID) {
> >if($PhoneType == "Office") {
> > print "Phone:
> > ($AreaCode)$Prefix-$Suffix"; }
> > }
> >}
> > fclose($Data2);
> >
> >
> > file://==F a x   D a t a   O u t p u t
> > file://===
> > $Data3 = fopen("PhoneTable.csv","r");
> >  while ($Line3 = fgetcsv ($Data3, 1000, ",")) {
> >   $Com

Re: [PHP] Can't find my font file - Please help

2002-08-10 Thread Rasmus Lerdorf

Try leaving off the .ttf

On Fri, 9 Aug 2002, JR wrote:

> I am trying to use the "imagettfbbox"  function. Am testing the script on my
> local network
> running W2K.  Have defined :
> $fontfile = "arial.tff";   // this file is in the same directory
> with my script
> The instruction that fails:
> $thetextbox = ImageTTFBBox ($fontsize, 0, $fontfile, "My Button");
> The error message is:
> Warning: Could not find/open font in
> c:\phpdev\www\public\kazaam\rendertext.php on line 9
>
>
>
> --
> 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