Re: [PHP] Classes

2001-11-26 Thread Rudi Ahlers

Thanx for all the explanations, it did help quite a bit, although I don't
have a use for a class yet, I might just use one to see how it works, and
when to use it, and when not to use it.
Regards

Rudi Ahlers

- Original Message -
From: Christopher William Wesley [EMAIL PROTECTED]
To: Rudi Ahlers [EMAIL PROTECTED]
Cc: PHP General [EMAIL PROTECTED]
Sent: Sunday, November 25, 2001 1:28 PM
Subject: Re: [PHP] Classes


On Sun, 25 Nov 2001, Rudi Ahlers wrote:
 Can anyone explain classes to me please? On many sites have I seen
classes,

There are people earning PHD's while explaining classes.  I know your
question originates from using PHP, and this is a PHP general mailing list
... but your question is just a tad too general for this list.

 I'm not sure how these work, or how to use them. I'm still learning about

Classes aren't unique to PHP.  You need to learn a true object-oriented
programming language (C++, Java, ... etc.) to really learn classes.
Truly gifted individuals can learn object-oriented programming w/o too
much help, but they'd first have a firm grip on programming.  I'd expect
the average, novice programmer to need a good amount of help learning 
understanding objecte-oriented programming ...  like that attained from a
University, a good High School, or a lot of independent study and time
experimenting with code.

That said ...

You weren't completely missing the boat with your analogy of a class to a
variable, but in the same breath, that idea is totally missing the boat (I
can see from where you're coming, and to where you're headed).  Classes
are an IDEA.  They're not actually anything.  They're the definition of
private and public data members and methods that should make up an object.
When a class is instantiated, an object is created with the defined data
members and methods available.  You can then use the objects' methods to
set, get, alter, or otherwise interact with its data members, or to simply
perform a set of related operations.  Insert a couple semesters of theory
here. That's my feeble attempt to explain classes.  It's abstract, I
know, and possibly not a help at all.  But it's because of the paragraph
above this one.

Let's look at some petty code:

class chair{
// DATA
var num_legs;
var color;
var num_arms;

// METHODS
function chair( $legs = 3, $arms = 0 ){ //CONSTRUCTOR
$this-num_legs = $legs;
$this-num_arms = $arms;
}

function setLegs( $legs ){
$this-num_legs = $legs;
return;
}
function getLegs( ){
return $this-num_legs;
}

// ... *clip* ...
}


Above is the [incomplete] definition of a chair class.  As you can see,
the class is useless.  But you can instantiate the class, and create a
useable object ... you can now create a chair.

$myChair = new chair( 4, 2 );

Now I have a chair [object] with 4 legs and 2 arms, called $myChair.
Let's have the chair tell us how many legs it has ...

$numLegsOnMyChair = $myChair-getLegs();
print( My Chair has $numLegsOnMyChair legs. );

Lets change how many legs the chair has ...

$myChair-setLegs( 7 ); // very odd, seven-legged chair

We should have a chair with 7 legs now, instead of 4.  Prove it ...

$numLegsOnMyChair = $myChair-getLegs();
print( My Chair has $numLegsOnMyChair legs. );

(As you alluded to previously, the object $myChair is seemingly a variable
that has access to scripts ... but I hope you see now that $myChair is an
object with methods and data members, not a variable.)

That's very simple, and not too useful.  Which brings me to the next
point.  Knowing object-oriented programming is to know when and when not
to use it (especially with PHP).  I don't need a class definition and an
object for a one-time use 7-legged chair.  But I may need a class
definition if I were making many complete graph data structures, each with
a number of nodes equal to a unique number in the Fibonacci sequence.  I
wouldn't want to re-code the basic logic of a complete graph over and over
for each graph.  I could just instantiate graph objects, each with
different numbers of nodes, much like I did with the chair, above.
/ramble

g.luck,
~Chris   /\
 \ / September 11, 2001
  X  We Are All New Yorkers
 / \ rm -rf /bin/laden




-- 
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] Infomation wanted

2001-11-26 Thread De Necker Henri

I want to know where can i find a script that will allow a user to login
every certain time period! 
I just cant get it right!

-- 
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] changing a variable according to the input in a checkbox

2001-11-26 Thread Rudi Ahlers

How would I be able to change a variable from the input in a checkbox? I
need to write an sms script, that would be able to sms to three different
providers, and I only want the use to type in the phone number. Thus, if he
types in 083xx, it should goto provider 1, if he types in
082xx, it should goto provider 2, and if he types in 084xx,
it should goto provider 3. I have a simple mail script, with $phone for the
phone number variable, and this is the one that needs to change.

Rudi Ahlers
UNIX Specialist and Web Developer
Bonzai Web Design - http://www.bonzai.org.za
Cell: 082 926 1689



-- 
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] Pulling information out of a MySQL database

2001-11-26 Thread Douglas McKenzie

Im new to php but I would suggest using a pre/pre tag to wrap round your
text output. This should keep any formatting. I think.

Tim Thorburn wrote:

 Thanks to everyone for their help - especially Martin, that fixed my
 problem and now all the records (both basic and extended) display properly.

 I did have one last aesthetic question ... I have one field set as TEXT
 which holds descriptions of the events.  When the information was entered
 into this field, in many cases, spaces between lines were entered ...
 however, when I pull the info from the database onto the webpage ... all my
 line formatting is erased and its just one continuous line of text.  Is
 there a way to maintain my line formatting with spaces?

 Its not mission critical or anything ... just one of those things that
 would be nice.

 Thanks again
 -Tim

 --
 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] Pulling information out of a MySQL database

2001-11-26 Thread Jon Haworth

You could look into the nl2br() function, which converts \n -style newlines
(entered in  TEXTAREAs) into HTML brs.

http://www.php.net/nl2br

HTH
Jon


-Original Message-
From: Tim Thorburn [mailto:[EMAIL PROTECTED]]
Sent: 26 November 2001 07:32
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Pulling information out of a MySQL database


I did have one last aesthetic question ... I have one field set as TEXT 
which holds descriptions of the events.  When the information was entered 
into this field, in many cases, spaces between lines were entered ... 
however, when I pull the info from the database onto the webpage ... all my 
line formatting is erased and its just one continuous line of text.  Is 
there a way to maintain my line formatting with spaces?


**
'The information included in this Email is of a confidential nature and is 
intended only for the addressee. If you are not the intended addressee, 
any disclosure, copying or distribution by you is prohibited and may be 
unlawful. Disclosure to any party other than the addressee, whether 
inadvertent or otherwise is not intended to waive privilege or confidentiality'

**

-- 
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] changing a variable according to the input in a checkbox

2001-11-26 Thread Miles Thompson

At 02:04 PM 11/26/2001 +0200, Rudi Ahlers wrote:
How would I be able to change a variable from the input in a checkbox? I
need to write an sms script, that would be able to sms to three different
providers, and I only want the use to type in the phone number. Thus, if he
types in 083xx, it should goto provider 1, if he types in
082xx, it should goto provider 2, and if he types in 084xx,
it should goto provider 3. I have a simple mail script, with $phone for the
phone number variable, and this is the one that needs to change.

Rudi Ahlers
UNIX Specialist and Web Developer
Bonzai Web Design - http://www.bonzai.org.za
Cell: 082 926 1689

Rudi,

Try this -  a function definition, followed by where I use it further down the
page.

Miles

// is_checked
// preserves status of previous selection of radio buttons or checkboxes
// when page redisplays by inserting checked into appropriate line of 
option group
// used in a group of radio buttons or checkboxes.
// usage: is_checked( $radio_val == 'open')
// CQA Consulting 2000
//
function is_checked( $opt_expression )
{
 if( $opt_expression )
 {
 $retval = checked;
 }
 else
 {
 $retval = ;
 }
 echo $retval;
}
//end of function is_checked

And then further down the page, in a form, these radio buttons:

td Display:/td
td input type=radio name=AuctionChoice value = open ? is_checked( 
$AuctionChoice=='open') ?  Open /td
td input type=radio name=AuctionChoice value = closed ? 
is_checked( $AuctionChoice=='closed') ?  Closed  /td
td input type=radio name=AuctionChoice value = both ? is_checked( 
$AuctionChoice=='both') ?   Both /td

The use of checked is not good terminology, because it implies a 
checkbox. You can replace AuctionChoice with PhoneChoice, and open ... 
both with your phone numbers or ISP id's and you're off to the races.

Now these next bits are out of sequence. They properly belong between the 
function definition and the display fragment, but are inserted here so you 
can see how I use the $AuctionChoice when it is read when the page is 
reloaded. It's used to build up a WHERE clause for a SELECT.

 switch( $AuctionChoice )
{
 case open:
 $auction_where =  lOnAuction = 1 ;
 break;
 case closed:
 $auction_where =  lOnAuction = 0 ;
 break;
 default:
 unset( $auction_where);
}

and there is also a choice coming from a combo box, which returns a string 
representing a class, hence $class_where,  used like so:

// where clause fragment for the chosen class
if( $ClassChoice )
{
 $class_where =  nClass = $ClassChoice ;
}

The WHERE condition for the select is put together like this:

// assemble the _where clause fragments into a
// coherent WHERE condition
if( $auction_where  $class_where )
{
 $sql_where =  WHERE $auction_where AND $class_where ;
}
elseif( $auction_where)
{
 $sql_where =  WHERE $auction_where ;
}
elseif( $class_where )
{
 $sql_where =  WHERE $class_where ;
}
 // now put the select statement together, test for results and 
display accordingly
 $sql = SELECT * FROM item $sql_where order by cItemId;

There's probably someone on the list who can do it with fewer lines, but I 
find this clear, and it accommodates all my conditions, and if no choices 
are made $sql_where does not exist and the SELECT is still valid. I still 
find the statelessness of web pages strange, how variables just cease to 
exist next time around if you don't explicitly pass them.

If this is overkill, or I missed the mark completely, apologies. Otherwise, 
I hope you find it useful.

Miles Thompson

http://www.cqagroup.ca


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




[PHP] Re: [PHP-DB] postgres optimization

2001-11-26 Thread Miles Thompson

Browse the Linux Journal archives. Sometime this year there was an article 
on tunig PGSQL for performance.
Miles Thompson

At 02:45 PM 11/26/2001 +0800, you wrote:
hi,

for php-db list users, i'm not sure if this is off-topic. please
inform me if it is.

i'd like to ask anyone who have worked with PostgreSQL
for any advise on how to optimize its performance.
i have a database that has a few tables. one of which
may contain more than 50,000 records in the future.

thanks!

ric

--

==
Note: The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this to the intended recipient, you are
hereby notified that any dissemination, distribution or copying of
this communication is strictly prohibited. If you have received
this communication in error, please notify us immediately by
replying to the message and deleting it from your computer.
Thank you.
==


--
PHP Database 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] Infomation wanted

2001-11-26 Thread Michael Hall


If you want to stop people logging on more than every, say, 24 hours, you
could record the most recent log-on time in a database and then check that
24hrs has passed before another log-on is allowed.

I don't know where you can find a script that does this exactly, but it
wouldn't be hard to hack one up.

Michael

On Mon, 26 Nov 2001, De Necker Henri wrote:

 I want to know where can i find a script that will allow a user to login
 every certain time period! 
 I just cant get it right!
 
 

-- 

Michael Hall
[EMAIL PROTECTED]
[EMAIL PROTECTED]
http://openlearningcommuntiy.org



-- 
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] Infomation wanted

2001-11-26 Thread B. van Ouwerkerk


I want to know where can i find a script that will allow a user to login
every certain time period!
I just cant get it right!

Check www.hotscripts.com
Dunno if something exists but you could build one yourself or modify an 
existing script..

Bye,



B.


-- 
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] email info

2001-11-26 Thread Caspar Kennerdale

can anyone recommend a site or discussion list relating to email

I have a form to mail script which sends attachments - it all works if I
have my private email address as the recipient,

however if I use my work email address the mail comes out with no attachment
but displays gobbledigook like-

Content-type: multipart/mixed;boundary= cd3b0ec60c75e8454ec2d36d9db1b16e
Message-Id: [EMAIL PROTECTED]Date: Mon, 26 Nov 2001
12:25:31 + (GMT)--cd3b0ec60c75e8454ec2d36d9db1b16eContent-type:
text/plain; charset=us-ascii Content-transfer-encoding: 7bit  Name caspar
[EMAIL PROTECTED] Title text submit Description test
submit --cd3b0ec60c75e8454ec2d36d9db1b16eContent-type:image/gif; name=text
submit
Content-transfer-encod

If i forward my work email to my private email then the emaiul is fine-

is this a script error, a mail server/ isp error, local mail server error

any ideas thanks in advance




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




[PHP] PHP to ASP ?

2001-11-26 Thread Jean-Arthur Silve

Hi !

I work with someone who use ASP :-(( ...
Is someone could translate this function to ASP ??
I don't think it's hard, but when you don't know ASP...

function encrypt($str)
{
global $STRCRYPT;

$i = strlen($str);
$newstr=;
for ($j=0;$j$i;$j++)
{
$car = substr($str,$j,1);
$car = ord($car);
$car = $car + ord(substr($STRCRYPT,$j,1));
$car = sprintf(%03d,$car);
$newstr.=$car;
}
return $newstr;
}




EuroVox
4, place Félix Eboue
75583 Paris Cedex 12
Tel : 01 44 67 05 05
Fax : 01 44 67 05 19
Web : http://www.eurovox.fr



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




Re: [PHP] PHP to ASP ?

2001-11-26 Thread Casey Allen Shobe

This is a PHP mailing list, I doubt you'll find anyone who knows, or wants to 
know ASP.  Why not use PHP for this, and dump ASP (along with the slow, 
bug-ridden webserver it runs on [unless you're using Apache::ASP])?  

On 26 November 2001 9:00, Jean-Arthur Silve wrote:
 Hi !

 I work with someone who use ASP :-(( ...
 Is someone could translate this function to ASP ??
 I don't think it's hard, but when you don't know ASP...

 function encrypt($str)
 {
 global $STRCRYPT;

 $i = strlen($str);
 $newstr=;
 for ($j=0;$j$i;$j++)
 {
 $car = substr($str,$j,1);
 $car = ord($car);
 $car = $car + ord(substr($STRCRYPT,$j,1));
 $car = sprintf(%03d,$car);
 $newstr.=$car;
 }
 return $newstr;
 }



 
 EuroVox
 4, place Félix Eboue
 75583 Paris Cedex 12
 Tel : 01 44 67 05 05
 Fax : 01 44 67 05 19
 Web : http://www.eurovox.fr
 

-- 
Casey Allen Shobe
[EMAIL PROTECTED]
GCS/CM d+ s+:-+: a-- C++() ULU$ P- L+++ E- W++ N++ !o K- w-- !O
M V- PS++ PE Y+ PGP++ t+ 5+ X R+ tv-- b++ DI+ D G++ e h-(*) r--- z--

-- 
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] Re: failure notice

2001-11-26 Thread Steve Werby

[EMAIL PROTECTED] wrote:
 For those running php 4 on raq 3, how did you compile freetype?

 ./configure
 make
 make install

 or just 2 make's?

Read the INSTALL file for freetype.  2.0.4 says:

make setup
make
make install

Then install PHP with the options you need in ./configure.  You'll get
better bang for your buck searching the archives for cobalt-users and
posting there.  After all, *everyone* on that list runs Cobalt servers
whereas probably only a small percentage do on the PHP list.  See archives
at marc.theaimsgroup.com and list subscription at www.cobalt.com.

--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/


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




Re: [PHP] email info

2001-11-26 Thread R'twick Niceorgaw

looks like your email client at work is not capable of handling the image
(.gif) attachments. check in the help secion of your email client.
HTH
- Original Message -
From: Caspar Kennerdale [EMAIL PROTECTED]
To: Php-General [EMAIL PROTECTED]
Sent: Monday, November 26, 2001 8:16 AM
Subject: [PHP] email info


 can anyone recommend a site or discussion list relating to email

 I have a form to mail script which sends attachments - it all works if I
 have my private email address as the recipient,

 however if I use my work email address the mail comes out with no
attachment
 but displays gobbledigook like-

 Content-type: multipart/mixed;boundary=
cd3b0ec60c75e8454ec2d36d9db1b16e
 Message-Id: [EMAIL PROTECTED]Date: Mon, 26 Nov
2001
 12:25:31 + (GMT)--cd3b0ec60c75e8454ec2d36d9db1b16eContent-type:
 text/plain; charset=us-ascii Content-transfer-encoding: 7bit  Name caspar
 [EMAIL PROTECTED] Title text submit Description test
 submit --cd3b0ec60c75e8454ec2d36d9db1b16eContent-type:image/gif;
name=text
 submit
 Content-transfer-encod

 If i forward my work email to my private email then the emaiul is fine-

 is this a script error, a mail server/ isp error, local mail server error

 any ideas thanks in advance




 --
 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] Recursive directory scan

2001-11-26 Thread Hank Marquardt

This ought to do what you want:


?php
function dir_print($dir) {
chdir($dir);
$dh = opendir($dir);
while($fname = readdir($dh)) {
if($fname!='.'  $fname!='..') {
if(is_dir($fname)) {
dir_print($dir.'/'.$fname);
} else {
echo $dir/$fnamebr;
}
}
}
closedir($dh);
}

dir_print(/home/hmarq);
?

Caveats:

It's unix style slashes --
Does no error checking -- perms in particular

Hank
On Mon, Nov 26, 2001 at 04:15:45PM +0100, Christoph Starkmann wrote:
 Ooops...
 
 I'm just ging mad about a function to recursively scan a directory tree.
 Maybe I'm just too stupid, maybe it's just because today is monday, but I
 don't get this  managed.
 
 Has anybody got a code sniplet the runs from $currentDir recursively through
 all directories, does something with all files found there and stops after
 returning to the starting directory?
 
 Phew... Would be great, I'm kind of in a hurry...
 
 Cheers,
 
 Kiko
 
 -
 It's not a bug, it's a feature.
 christoph starkmann
 mailto:[EMAIL PROTECTED]
 http://www.fh-augsburg.de/~kiko
 ICQ: 100601600
 -
 
 -- 
 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]
 

-- 
Hank Marquardt [EMAIL PROTECTED]
http://web.yerpso.net
GPG Id: 2BB5E60C
Fingerprint: D807 61BC FD18 370A AC1D  3EDF 2BF9 8A2D 2BB5 E60C
*** Web Development: PHP, MySQL/PgSQL - Network Admin: Debian/FreeBSD
*** PHP Instructor - Intnl. Webmasters Assn./HTML Writers Guild 
*** Beginning PHP -- Starts January 7, 2002 
*** See http://www.hwg.org/services/classes

-- 
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] Need a script that will read Apache Log files and generate reports

2001-11-26 Thread Dan McCullough

Anyone have an idea, I know there are perl scripts, but I would have to set up Perl 
and other
stuff on my server to do this ... I dont want to.  Does anyone know where the access 
log
reader/displayer can be found.

__
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

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




Re: [PHP] PHP to ASP ?

2001-11-26 Thread Jean-Arthur Silve

Thank for your help !

At 08:08 26/11/01 -0700, JSheble wrote:
Oh really?  I know ASP, PHP, ColdFusion and a few others.  You really 
shouldn't make such global statements... just because you don't know ASP 
doesn't mean it's not a viable tool, nor is it a good idea as a web 
developer to lock yourself into one singular technology.  Knowing more 
than one makes you a bit more marketable.

Here's your Encrypt function in ASP, the only difference being I passed 
the encryption key in while in the PHP counterpart it was a GLOBAL.  You 
can make it a global type of variable in your ASP too.

function Encrypt( strEncryptThis, strEncryptionKey)
 dim i
 dim strNewString
 dim strCurChar

 for i = 1 to Len( strEncryptThis )
 strCurChar = Asc( Mid( strEncryptThis, i, 1 ))
 strCurChar = strCurChar + Asc( Mid( strEncryptionKey, i, 1))
 strNewString = strNewString  strCurChar
 next

 Encrypt = strNewString
end function

At 09:24 AM 11/26/2001 -0500, Casey Allen Shobe wrote:
This is a PHP mailing list, I doubt you'll find anyone who knows, or wants to
know ASP.  Why not use PHP for this, and dump ASP (along with the slow,
bug-ridden webserver it runs on [unless you're using Apache::ASP])?

On 26 November 2001 9:00, Jean-Arthur Silve wrote:
  Hi !
 
  I work with someone who use ASP :-(( ...
  Is someone could translate this function to ASP ??
  I don't think it's hard, but when you don't know ASP...
 
  function encrypt($str)
  {
  global $STRCRYPT;
 
  $i = strlen($str);
  $newstr=;
  for ($j=0;$j$i;$j++)
  {
  $car = substr($str,$j,1);
  $car = ord($car);
  $car = $car + ord(substr($STRCRYPT,$j,1));
  $car = sprintf(%03d,$car);
  $newstr.=$car;
  }
  return $newstr;
  }
 
 
 
  
  EuroVox
  4, place Félix Eboue
  75583 Paris Cedex 12
  Tel : 01 44 67 05 05
  Fax : 01 44 67 05 19
  Web : http://www.eurovox.fr
  

--
Casey Allen Shobe
[EMAIL PROTECTED]
GCS/CM d+ s+:-+: a-- C++() ULU$ P- L+++ E- W++ N++ !o K- w-- !O
M V- PS++ PE Y+ PGP++ t+ 5+ X R+ tv-- b++ DI+ D G++ e h-(*) r--- z--

--
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]


EuroVox
4, place Félix Eboue
75583 Paris Cedex 12
Tel : 01 44 67 05 05
Fax : 01 44 67 05 19
Web : http://www.eurovox.fr



--
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 Digest 26 Nov 2001 16:59:18 -0000 Issue 1017

2001-11-26 Thread php-general-digest-help


php-general Digest 26 Nov 2001 16:59:18 - Issue 1017

Topics (messages 75697 through 75726):

Re: Pulling information out of a MySQL database
75697 by: Martin Towell
75701 by: Tim Thorburn
75709 by: Douglas McKenzie
75710 by: Jon Haworth

Re: Installing PHP 4 on a RAQ3
75698 by: Steve Werby

Re: failure notice
75699 by: Joelmon2001.aol.com
75719 by: Steve Werby

Reading the value of a serialize object in session
75700 by: py

preventing multiple submissions
75702 by: Derek Mailer

Creating a new file  saving it with date  time name
75703 by: Kevin Garrett
75704 by: Michael Hall

unsetting a session
75705 by: Joffrey van Wageningen

Re: Classes
75706 by: Rudi Ahlers

Infomation wanted
75707 by: De Necker Henri
75714 by: Michael Hall
75715 by: B. van Ouwerkerk

changing  a variable according to the input in a checkbox
75708 by: Rudi Ahlers
75712 by: Miles Thompson

Re: xslt compile error?
75711 by: Papp Gyozo

Re: [PHP-DB] postgres optimization
75713 by: Miles Thompson

email info
75716 by: Caspar Kennerdale
75720 by: R'twick Niceorgaw
75723 by: Caspar Kennerdale

PHP to ASP ?
75717 by: Jean-Arthur Silve
75718 by: Casey Allen Shobe
75721 by: JSheble
75726 by: Jean-Arthur Silve

Recursive directory scan
75722 by: Christoph Starkmann
75724 by: Hank Marquardt

Need a script that will read Apache Log files and generate reports
75725 by: Dan McCullough

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]


--

---BeginMessage---

If id is unique, you can change the first sql from:

$result = mysql_query(SELECT *, DATE_FORMAT(EventStartDate, '%W %M %D %Y') 
AS FormattedEventStartDate, DATE_FORMAT(EventEndDate, '%W %M %D %Y') AS 
FormattedEventEndDate, TIME_FORMAT(EventStartTime, '%r') AS 
FormattedEventStartTime, TIME_FORMAT(EventEndTime, '%r') AS 
FormattedEventEndTime FROM comcal WHERE id=$id and EventMonth='.$month.' 
and EventYear='.$year.',$db);

to:

$result = mysql_query(SELECT *, DATE_FORMAT(EventStartDate, '%W %M %D %Y') 
AS FormattedEventStartDate, DATE_FORMAT(EventEndDate, '%W %M %D %Y') AS 
FormattedEventEndDate, TIME_FORMAT(EventStartTime, '%r') AS 
FormattedEventStartTime, TIME_FORMAT(EventEndTime, '%r') AS 
FormattedEventEndTime FROM comcal WHERE id=$id,$db);

in other words: remove the month and year from the where clause

Martin


-Original Message-
From: Tim Thorburn [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 26, 2001 3:58 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Pulling information out of a MySQL database


Hi again,

Ok, I've heard some suggestions to my problem ... but I'm not entirely 
certain how to incorporate them, perhaps taking a look at the code would be 
helpful.

Again, the problem I'm having is as follows.  I have a simple form in which 
the user selects a month and year from two drop down menu's - based on 
their choice, the following PHP script searches a MySQL database and 
displays a basic listing (event name and date) for the selected 
month.  Then the user has the option to click an event name and receive a 
more detailed listing of the event - this is the portion that isn't working.

It seems that the script is forgetting the values entered by the user - I 
have come to this conclusion as when I replaced .$month. and .$year. 
with an actual month and year ie. 'November' and '2001' respectively, the 
detailed display works perfectly.

How can I get both the basic and detailed event listings working at the 
same time?

Thanks
-Tim


?

$db = mysql_connect(localhost, login, password);
mysql_select_db(edoinfo,$db);

if ($id) {

// query for extented information

$result = mysql_query(SELECT *, DATE_FORMAT(EventStartDate, '%W %M %D %Y') 
AS FormattedEventStartDate, DATE_FORMAT(EventEndDate, '%W %M %D %Y') AS 
FormattedEventEndDate, TIME_FORMAT(EventStartTime, '%r') AS 
FormattedEventStartTime, TIME_FORMAT(EventEndTime, '%r') AS 
FormattedEventEndTime FROM comcal WHERE id=$id and EventMonth='.$month.' 
and EventYear='.$year.',$db);

$myrow = mysql_fetch_array($result);

//display extended information

 echo table width='65%' border='0' cellspacing='2'
cellpadding='2';
   echo tr;
 echo td valign='top' align='left'bEvent: /b/td;
 echo td valign='top' align='left';
echo ($myrow[EventName]);
echo /td;
   echo /tr;
   echo tr;
 echo td valign='top' align='left'bLocation: /b/td;
echo td valign='top'
align='left'.($myrow[EventLocation])./td;
   echo /tr;
 

[PHP] RE: php-general Digest 23 Nov 2001 14:10:17 -0000 Issue 1011

2001-11-26 Thread Andrew Chase

You might want to give 'wget' a try - it's a GNU utility for downloading
mirrors of web sites:

http://www.gnu.org/software/wget/wget.html

If you use it with the '-r' and '-k' options it will crawl your site
recursively, and convert absolute links to relative ones in the downloaded
HTML files.

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]
 Sent: Friday, November 23, 2001 6:10 AM
 To: [EMAIL PROTECTED]
 Subject: php-general Digest 23 Nov 2001 14:10:17 - Issue 1011



 php-general Digest 23 Nov 2001 14:10:17 - Issue 1011

 Topics (messages 75546 through 75577):

 Missing PHP.ini
   75546 by: John Monfort
   75547 by: Joseph Blythe
   75548 by: Martin Towell
   75549 by: John Monfort
   75551 by: David Robley

 Re: error handling and __LINE__
   75550 by: Papp Gyozo

 Re: SQL in Function
   75552 by: David Robley

 strip php out of html
   75553 by: Joseph Blythe
   75554 by: David Robley
   7 by: Michael Sims
   75556 by: Joseph Blythe
   75558 by: Joseph Blythe

 Object Persistence like Resource Persistence already implemented?
   75557 by: Yermo M. Lamers

 MySQL query problem!
   75559 by: De Necker Henri
   75561 by: David Robley
   75562 by: De Necker Henri
   75564 by: David Robley

 Re: GD, PNG
   75560 by: Yamin Prabudy
   75563 by: Joseph Blythe

 read file
   75565 by: PHP Newbie
   75566 by: Andrey  Hristov

 HTTP_REFERER
   75567 by: Jordan Elver
   75568 by: gaouzief
   75569 by: Sebastian Wenleder
   75570 by: Matt Williams
   75572 by: Jordan Elver
   75573 by: Matt Williams
   75577 by: Jordan Elver

 file upload troubles
   75571 by: Nikola Veber
   75574 by: fitiux

 php-html
   75575 by: Christoph Starkmann

 upload problems
   75576 by: Nikola Veber

 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]


 --



-- 
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] preventing multiple submissions

2001-11-26 Thread Neil Freeman

Have a look at:

http://www.faqts.com/knowledge_base/view.phtml/aid/863/fid/129

May be of some use.

Neil

Derek Mailer wrote:

 I have a problem with a form on my website.

 it's part of a shopping cart application, whereby the form consists of a list of 
products and the user enters the quantity they require of each product in the field 
provided.  Everything works okay except for the fact that if someone hits the submit 
button more than once the products will be added to the 'cart' more than once.

 I've tried altering the script that handles the posted form info, but the problem 
persists.  I've also simplified the page that loads after adding products to the 
shopping cart so that it loads quicker (people are less likely to click the submit 
button more than once).

 Can anyone suggest a solution?

 Thanks in advance for any help.

 Regards,

 Derek

 **
 This e-mail (and any attachment) is intended only for the attention
 of the addressee(s). Its unauthorised use, disclosure, storage
 or copying is not permitted. If you are not the intended recipient,
 please destroy all copies and inform the sender by return e-mail.
 This e-mail (whether you are the sender or the recipient) may be
 monitored, recorded and retained by Business Information
 Publications Limited (BiP). E-mail monitoring/ blocking software
 may be used, and e-mail content may be read at any time.You
 have a responsibility to ensure laws are not broken when composing
 or forwarding e-mails and their contents.
 **

 ***
  This message was virus checked with: SAVI 3.51
  last updated 20th November 2001
 ***

--

 Email:  [EMAIL PROTECTED]
 [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] Objects and sessions

2001-11-26 Thread Greg Sidelinger

Can someone tell me how to store a class in a session var.   I want to
test to see if it has been defined and if not create it.  I'm having
problems with it right now.
 
This is what I'm trying currently
 
?
Class a
{ 
var $temp;
 
function a() 
{ 
$this-temp=1;
}
}
 
session_start();
 
if ( !isset( $c )
{
$c = new a();
session_register(a);
}
?
 
later on I get errors about the class functions being undefined.Can
anyone please point me in the right direction on how to register my
objects as session vars.



Re: [PHP] Objects and sessions

2001-11-26 Thread Tamas Arpad

 later on I get errors about the class functions being undefined.   
 Can anyone please point me in the right direction on how to
 register my objects as session vars.
Class definition *must* be before any session_start() or 
sessgion_register() if there are previously stored objects in the 
session.

Regards,
Arpi

-- 
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] Which 'make' is needed for linux to install php?

2001-11-26 Thread Craig Vincent

 I learned I need 3.8 at least gnu make for installing this freetype
 which seems mandatory for good fonts with gd/php image creation

 ok, so that made me think, which 'make' version on linux (raq 3 fyi)
 would one need for php 4+?

I currently use 3.79.1 of GNU make (Linux slackware and redhat) and have
never had a problem with any version of PHP (3.x or 4.x)

Sincerely,

Craig Vincent


-- 
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] Installing PHP 4 on a RAQ3

2001-11-26 Thread Phil Ewington

Followed those instructions and apache gives an error when I restart:

Syntax error on line 33 of /etc/httpd/conf/httpd.conf:
Cannot load /usr/lib/apache/libphp4.so into server:
/usr/lib/apache/libphp4.so: cannot open shared object file: No such file or
directory
/usr/sbin/httpd

I have looked in /usr/lib/apache/ and all that is there is libperl.so, where
is it, and how can I find it? Help!!, Please :o)


-
Phil Ewington
Cold Fusion Developer
-
T: 01344 643138
E: mailto:[EMAIL PROTECTED]
-

 -Original Message-
 From: Philip Olson [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, November 25, 2001 6:50 PM
 To: Phil Ewington
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Installing PHP 4 on a RAQ3


 Hello Phil,

 I've seen this come up a few times, search the archives for a bit:

   http://marc.theaimsgroup.com/?l=php-generals=raq

 The following comes up and may be useful.  Don't hesitate to reply back on
 how helpful it is, perhaps eventually some raq instructions can
 make their
 way into installation section of manual.  Try:

   HOWTO: Installation on Cobalt RaQ  (RaQ3 or RaQ4)  :
   
   http://marc.theaimsgroup.com/?l=php-generalm=98039640119670

 Also, the manual's install instructions should be of some use:

  http://www.php.net/manual/en/install.unix.php

regards,
Philip Olson

On Sun, 25 Nov 2001, Phil Ewington wrote:

 Hi,

 As I have only ever worked on a Windows platform, installing PHP  MySQL
on
 a RAQ3 is completely alien to me. I attempted to install the binaries by
 following instructions I dug up somewhere, and it all went badly wrong :o(

 I have since had the RAQ reset so I could start again. This time round I
 installed the RaQ3-RaQ4-MySQL-3.23.37-1.pkg from cobalt, this went on OK,
 but now I need to install PHP. As there is no .pkg for the RAQ3, I have
been
 advised that I do need to install the binaries for PHP 4. Do I need to
give
 a path for the --with mysql option, and if so where does the .pkg install
 MySQL? Any idiot proof step by step instructions will be greatly
 appreciated, along with which is the best/most stable version of PHP 4?,
and
 where is best to install it?

 Thanks in advance,

 Phil.

 -
 Phil Ewington
 Cold Fusion Developer
 -
 T: 01344 643138
 E: mailto:[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] Need a script that will read Apache Log files and generate reports

2001-11-26 Thread Chris Allen

http://www.analog.cx/
Subject: [PHP] Need a script that will read Apache Log files and generate
reports




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




[PHP] php frontpage

2001-11-26 Thread Tobe Johnson - Johnsons

I am trying to use PHP3.x and Front Page 2000.  I am able to get it to work
o.k. in Frontpage.  However, when I rename my *.htm page to a *.php3 page
and click 'Save', it drops all the theme information when I upload it to my
server.  Is there an easy way to stop this from happening?  I'm not sure if
this is a php issue or a FrontPage issue.

Thanks for any help you can provide.  I saw several references to php and
FrontPage in researching this issue, but didn't come across this specific
thing.

Tobe


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




Re: [PHP] php frontpage

2001-11-26 Thread Brandon Lamb

Why are you even using frontpage themes? If you know how to program PHP you
should be above using MS frontpage features... Frontpage is good for a
WYSIWYG editor, but I highly recommend NOT using its proprietary features...

use CSS or something...

Brandon L.

- Original Message -
From: Tobe Johnson - Johnsons [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, November 26, 2001 2:23 PM
Subject: [PHP] php  frontpage


I am trying to use PHP3.x and Front Page 2000.  I am able to get it to work
o.k. in Frontpage.  However, when I rename my *.htm page to a *.php3 page
and click 'Save', it drops all the theme information when I upload it to my
server.  Is there an easy way to stop this from happening?  I'm not sure if
this is a php issue or a FrontPage issue.

Thanks for any help you can provide.  I saw several references to php and
FrontPage in researching this issue, but didn't come across this specific
thing.

Tobe


--
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] Objects and sessions

2001-11-26 Thread Christopher William Wesley

On Mon, 26 Nov 2001, Greg Sidelinger wrote:

 Can someone tell me how to store a class in a session var.   I want to

There are several things you need to do.

1) include the class definition before you do anything
2) start the session shortly thereafter
3) register a session variable
4) create your object
5) serialize your object
6) store the serialized object (now a string) in your registered session
   variable

Then to use the object again, you just have to

7) start the session back up
8) get the serialized value of your object from the registered session
   variable
9) unserialize the string value back into an object

Wanna see how this works?  I have a trivial example below, which involves
3 files.
- chair.class is my class definition.
- chair1.php sets up the session, creates the object, serializes and
  stores it in a registered session variable.
- chair2.php gets the session variable's value, unserializes it, and uses
  the object again.

-- chair.class
?php
class chair{

// DATA MEMBERS
var $num_legs;
var $num_arms;

// CONSTRUCTOR
function chair( $legs = 3, $arms = 0 ){
$this-num_legs = $legs;
$this-num_arms = $arms;
}

// SETTERS
function setLegs( $legs ){
$this-num_legs = $legs;
return true;
}

function setArms( $arms ){
$this-num_arms = $arms;
return true;
}

// GETTERS
function getLegs( ){
return $this-num_legs;
}

function getArms( ){
return $this-num_arms;
}
}
?

-- chair1.php

?php
include( chair.class );

session_start();

$myChair = new chair( 5, 3 );

print( My chair has  . $myChair-getLegs() .  legs, and  .
$myChair-getArms() .  arms. );

$serChair = serialize( $myChair );

session_register( aChair );

$aChair = $serChair;
?

-- chair2.php

?php
include( chair.class );

session_start();

$myChair = unserialize( $aChair );

print( My chair has  . $myChair-getLegs() .  legs, and  .
$myChair-getArms() .  arms. );

?

g.luck,
~Chris   /\
 \ / September 11, 2001
  X  We Are All New Yorkers
 / \ rm -rf /bin/laden


-- 
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] Info : L'Annuaire Francais par Departement facilite vos recherches

2001-11-26 Thread annuaire

Bonjour,

L'annuaire Francais Par departement http://www.annuairefrancais.com integre desormais 
un moteur de recherche pour affiner vos recherches sur le web.

L'inscription reste gratuite et la validation toujours manuelle. L'adresse 
d'inscription est desormais http://inscrip.annuairefrancais.com

Pour toutes suggestions contactez par mail :
direction : [EMAIL PROTECTED]
validation : [EMAIL PROTECTED]
publicite : [EMAIL PROTECTED]
partenariat : [EMAIL PROTECTED]

INFORMATIONS :
retrait de notre liste d'info : http://supressinfo.annuairefrancais.com
(L'annuaire francais envoi 2 infos par an)

L'annuaire Francais
119 Rue des Pyrenees
75020 PARIS
+33 (0)1 43 67 00 74

-- 
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] SQL in Function

2001-11-26 Thread Mark Roedel

 -Original Message-
 From: Oosten, Sjoerd van [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, November 22, 2001 2:01 AM
 To: '[EMAIL PROTECTED]'
 Subject: [PHP] SQL in Function
 
 
 function Activeyesno($month,$day,$year,$Project_id){
 $dayactief = mktime(0, 0, 0, $month, $day, $year);
 $daytemp = date(Y-m-d, $dayactief);
 $resultactive = mysql_query(SELECT * FROM EIAProjecten WHERE
 ((Project_begindatum = '$daytemp' AND Project_id = '$Project_id') OR
 (Project_einddatum = '$daytemp' AND Project_id =
'$Project_id')),$db);

 $num_rows = mysql_num_rows($resultactive);
 if ($num_rows == '1'){
 return red; }
 }

 1. Is it possible to make a sql connection in my function

Yes.

 2. did i do something wrong?

Yes.

The thing you have to remember is that your database link identifiers,
etc., follow the same rules of scope as any other variable (and thus,
need to either be passed into your function as parameters or declared as
global).

Specifically, in your case, the $db variable referenced in your
mysql_query() call  doesn't appear to have a value that's local to this
function.


---
Mark Roedel |  Blessed is he who has learned to laugh
Systems Programmer  |   at himself, for he shall never cease
LeTourneau University   |   to be entertained.
Longview, Texas, USA|   -- John Powell 

--
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] addslashes, stripslashes

2001-11-26 Thread Scott Aikin

I've come across a strange problem working backwards with stripslashes after running 
addslashes.  I take a string like:

\t\4

and run it through addslashes, the result is:

\\t\\4

After grabbing this data from the database and running 'stripslashes', the data comes 
out as:

\t

without the \4, for some reason stripslashes always removes any combination of \ and a 
number.  Does anybody know a way around this or can maybe provide some insight about 
why this is happening? 

Thank you!!!
- Scott



Re: [PHP] addslashes, stripslashes

2001-11-26 Thread Pat Lashley

--On Monday, November 26, 2001 04:47:35 PM -0800 Scott Aikin 
[EMAIL PROTECTED] wrote:

 I've come across a strange problem working backwards with stripslashes
 after running addslashes.  I take a string like:

 \t\4

 and run it through addslashes, the result is:

 \\t\\4

 After grabbing this data from the database and running 'stripslashes',
 the data comes out as:

 \t

 without the \4, for some reason stripslashes always removes any
 combination of \ and a number.  Does anybody know a way around this or
 can maybe provide some insight about why this is happening?

It probably isn't removing it, it's converting it into an EOT
character (0x04).  That's pretty standard for most environments
that do backslash substitution.  It should also convert \48 and
\060 into a '0' character.  (The first being decimal, the second
octal due to the leading zero.)



-Pat




-- 
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] Updating Timestamps

2001-11-26 Thread cosmin laslau

I'm using timestamps (God bless the little things) to keep track of database 
updates, so to give users the latest updates by the second. Kinda neat. But 
anyway, the timestamps are in one table, and when something is that table is 
changed, it automatically updates.

However, I have another table which I want to affect the timestamps. Is 
there a command for 'manually' updating a timestamp rather than by SQL's own 
logic?

Thanks in advance.

Cosmin Laslau

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


-- 
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] Updating Timestamps

2001-11-26 Thread Kurt Lieber

This is more of a MySQL question than a PHP question, but...

The TIMESTAMP format in MySQL isn't a read-only field -- you can update the 
data with your own timestamp information just like you can any other normal 
database field.  So, simply create a timestamp using PHP and insert that into 
the field in MySQL.

--kurt

On Monday 26 November 2001 07:27 pm, cosmin laslau wrote:
 I'm using timestamps (God bless the little things) to keep track of
 database updates, so to give users the latest updates by the second. Kinda
 neat. But anyway, the timestamps are in one table, and when something is
 that table is changed, it automatically updates.

 However, I have another table which I want to affect the timestamps. Is
 there a command for 'manually' updating a timestamp rather than by SQL's
 own logic?

-- 
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] Updating Timestamps

2001-11-26 Thread David Robley

On Tue, 27 Nov 2001 13:57, cosmin laslau wrote:
 I'm using timestamps (God bless the little things) to keep track of
 database updates, so to give users the latest updates by the second.
 Kinda neat. But anyway, the timestamps are in one table, and when
 something is that table is changed, it automatically updates.

 However, I have another table which I want to affect the timestamps. Is
 there a command for 'manually' updating a timestamp rather than by
 SQL's own logic?

 Thanks in advance.

 Cosmin Laslau

The Mysql docs say:

Automatic updating of the  rst TIMESTAMP column occurs under any of the 
following conditions:

  The column is not specified explicitly in an INSERT or LOAD DATA INFILE 
statement.
  The column is not specified explicitly in an UPDATE statement and some 
other column changes value. (Note that an UPDATE that sets a column to 
the value it already has will not cause the TIMESTAMP column to be 
updated, because if you set a column to its current value, MySQL ignores 
the update for efficiency.)
  You explicitly set the TIMESTAMP column to NULL. TIMESTAMP columns 
other than the first may also be set to the current date and time. Just
set the column to NULL or to NOW().
You can set any TIMESTAMP column to a value different than the current 
date and time by setting it explicitly to the desired value. This is true 
even for the  rst TIMESTAMP column.
You can use this property if, for example, you want a TIMESTAMP to be set 
to the current date and time when you create a row, but not to be changed 
whenever the row is updated later:
  Let MySQL set the column when the row is created. This will initialize 
it to the current date and time.
  When you perform subsequent updates to other columns in the row, set 
the TIMESTAMP column explicitly to its current value.
On the other hand, you may find it just as easy to use a DATETIME column 
that you initialize to NOW() when the row is created and leave alone for 
subsequent updates.
TIMESTAMP values may range from the beginning of 1970 to sometime in the 
year 2037, with a resolution of one second. Values are displayed as 
numbers.

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   WWhhaatt ddooeess dduupplleexx mmeeaann??

-- 
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] Selecting databases

2001-11-26 Thread Craig Vincent

 I have a script that needs to be able to choose between 3 different
 databases related to a pull down menu.  Any ideas about what functions I
 should be looking at

There's really no need for a function.  Most ANSI standard SQL servers will
allow you to specify databases on the fly in your queries.

So say you had a pulldown menu

SELECT name=database
OPTION value=db1Database 1/OPTION
OPTION value=db2Database 2/OPTION
OPTION value=db3Database 3/OPTION
/SELECT

With this the name of the database will be transfered to the $database
variable upon the form being submitted.
Then:

mysql_query(SELECT * FROM $database.table_name);

Will run a query on the appropriate database...of course this format is
assuming that all the table names will be identical, although if you do have
different table names for each database it's very easy to change that
dynamically as well.

Sincerely,

Craig Vincent


-- 
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] Why doesn't this work? HTTP_USER_AGENT

2001-11-26 Thread chip

I have this small test page, below, which returns an error -

Parse error:  parse error in /usr/local/apache/htdocs/test.php on line 4

on the $browser line, if I comment it out, it returns an error on the $ip 
line, etc. I can leave all the php lines out, add an echo statement 

? echo $HTTP_USER_AGENT ?

in the body to get the http_user_agent and it displays the user agent just 
fine. What have I done wrong in such a simple bit of code?
-
htmlheadtitle/title/head
body
?
$browser = $HTTP_USER_AGENT;
$ip = $REMOTE_ADDR ;
$db = mysql_connect ( localhost , username , password );
mysql_select_db ( database , $db );
$sql  =  INSERT INTO table_name(ip,browser,received) 
VALUES('$ip','$browser',now()) ;
$results  =  mysql_query ( $sql);
?
h1Howdy/h1
/body/html  

TIA,
Chip

--
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] Why doesn't this work? HTTP_USER_AGENT

2001-11-26 Thread Craig Vincent

snip
What have I done wrong in such a simple bit of code?
-
htmlheadtitle/title/head
body
?
$browser = $HTTP_USER_AGENT;
$ip = $REMOTE_ADDR ;
$db = mysql_connect ( localhost , username , password );
mysql_select_db ( database , $db );
$sql = INSERT INTO table_name(ip,browser,received)
VALUES('$ip','$browser',now()) ;
$results = mysql_query ( $sql);
?
h1Howdy/h1
/body/html

/snip

I copy  pasted your code onto a test HTML page and modified the mysql
commands to appropriately connect to my MySQL server.  There was absolutely
no problem with this code at all.  What version of PHP are you using?

Sincerely,

Craig Vincent


-- 
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] Why doesn't this work? HTTP_USER_AGENT

2001-11-26 Thread David Robley

On Tue, 27 Nov 2001 17:43, Craig Vincent wrote:
 snip
 What have I done wrong in such a simple bit of code?
 -
 htmlheadtitle/title/head
 body
 ?
 $browser = $HTTP_USER_AGENT;
 $ip = $REMOTE_ADDR ;
 $db = mysql_connect ( localhost , username , password );
 mysql_select_db ( database , $db );
 $sql = INSERT INTO table_name(ip,browser,received)
 VALUES('$ip','$browser',now()) ;
 $results = mysql_query ( $sql);
 ?
 h1Howdy/h1
 /body/html
 
 /snip

 I copy  pasted your code onto a test HTML page and modified the mysql
 commands to appropriately connect to my MySQL server.  There was
 absolutely no problem with this code at all.  What version of PHP are
 you using?

Just about to do that but he saved me the effort.

Any chance you created the script with DOS end of line characters??

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   If you're not confused, you're not paying attention.

-- 
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] Updating Timestamps

2001-11-26 Thread Ben Gollmer

The easiest way is to use an SQL query like this;

update your_table set timestamp_field=null;

This sets the timestamp to the current time automagically. You can of 
course add a where clause and so on to this query.

Ben


On Monday, November 26, 2001, at 09:27 PM, cosmin laslau wrote:

 I'm using timestamps (God bless the little things) to keep track of 
 database updates, so to give users the latest updates by the second. 
 Kinda neat. But anyway, the timestamps are in one table, and when 
 something is that table is changed, it automatically updates.

 However, I have another table which I want to affect the timestamps. Is 
 there a command for 'manually' updating a timestamp rather than by 
 SQL's own logic?

 Thanks in advance.

 Cosmin Laslau

 _
 Get your FREE download of MSN Explorer at 
 http://explorer.msn.com/intl.asp


 -- 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] How can I acces an environment var $SERVER_ADMIN

2001-11-26 Thread Silvia Mahiques

Hi frieds!
I have some problems with get values from environment vars controled by php.
I can't get value from $SERVER_ADMIN var. This var is empty.

In apache log file, I have defined ServerAdmin directive, I suppose this
directive references this environment var, but I not sure if it is necessary
the identical name.

If you have an idea, please, help me!


Silvia Mahiques


-- 
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]