[PHP] secure access

2002-10-09 Thread Roman Duriancik

If I want to secure the access to the database by asking for passwd, what
should I do ? I suppose I need a secure connection to transfer the username
and passwd between HTML form and the script - how do I make that ?
How do I secure the database file with passwords and user names so that
it cannot be accessed by anyone, just by allowed users ?

thank you
roman


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




Re: [PHP] This fact ruins my understanding of php :( please explain!

2002-10-09 Thread Markas

Thnaks for an explanation.

Rasmus Lerdorf [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 This has been explained a few times.  PHP does shallow copies, or
 copy-on-write which means that the data is not actually copied until you
 change it.  That is:

   $a = 1234567890;
   $b = $a;

 internally we do not copy the data from $a to $b until you change $b.

 We you use references we have a bit more work to do as we need to decouple
 this and indicate that copy-on-write should not be taking place.

 Basically things are optimized for the most common case.

 -Rasmus

 On Tue, 8 Oct 2002, Markas wrote:

  I tried some trivial expirements:
 
  /* here I define an array $big, which I guess would eat ~100kb of
memory */
  for($i=0; $i1; $i++)
  {
   $big[$i] = 1234567890;
  }
 
  /* this func only returns the value it gets as a param...*/
  function f($a){return $a;}
 
  $start = microtime();
 
  /* here all the job is done */
  for ($i=0; $i  100; $i++){$a = f($big);} /* --- every iteration I just
pass $big array to this func and it simply returns it*/
 
  $end = microtime();
 
  /* here I find out the time the job above takes to run, similar to the
code from the help:*/
  function getmicrotime($time){
  list($usec, $sec) = explode( ,$time);
  return ((float)$usec + (float)$sec);
  }
 
  $time_start = getmicrotime($start);
  $time_end = getmicrotime($end);
  $time = $time_end - $time_start;
 
  echo Did nothing in $time seconds;
 
  So the script above takes on my server ~0.00115 sec, so as far as I
understand, it takes php to copy that $big array which is rather large, at
least 100 times... So I decided to change the function f($a):
   function f($a){return $a;} changed to  function f($a){return $a;},
  as you can see, I only wanted to pass that $a param by reference,
without copying it, so I thought I win in performance and the 100 iterations
will work faster, as no copying of such a large array $big (which is this
time going to be passed by refernce) will be involved,... BUT this case the
job took ~3.75093 seconds, which is  3262 times SLOWER !!! I also found out,
that while using refernces, the time of job's run strictly depends on the
$big array dimension, and while NOT using references, the time doesn't
depend on that, but I thought just on the contrary. I thought, that while
using references, we dont copy the data and therefore do not depend on that
data amount, but the example above shows just the opposite results...
 
  What's going on,  if anybody gets interested, please explain?
 




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




[PHP] Re: :( This fact ruins my understanding of php :( please explain!

2002-10-09 Thread Markas

Thanks for ur interest.

Seairth Jacobs [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I have a couple thoughts...

 1) In some other languages, passing an array by value only passes the
first
 element value, not the whole array.  This may be happening here, which
would
 explay the fast execution times.  I don't know this for sure, but it could
 easily be tested by seeing what's in $a inside the function f().

 2) Try returning the array by reference...

 function f($a){return $a;}

 for ($i=0; $i  100; $i++){$a =  f($big);}

 ---
 Seairth Jacobs
 [EMAIL PROTECTED]


 Markas [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  I tried some trivial expirements:
 
  /* here I define an array $big, which I guess would eat ~100kb of
memory
  */
  for($i=0; $i1; $i++)
  {
   $big[$i] = 1234567890;
  }
 
  /* this func only returns the value it gets as a param...*/
  function f($a){return $a;}
 
  $start = microtime();
 
  /* here all the job is done */
  for ($i=0; $i  100; $i++){$a = f($big);} /* --- every iteration I just
  pass $big array to this func and it simply returns it*/
 
  $end = microtime();
 
  /* here I find out the time the job above takes to run, similar to the
 code
  from the help:*/
  function
  microtime($time){
  list($usec, $sec) = explode( ,$time);
  return ((float)$usec + (float)$sec);
  }
 
  $time_start = getmicrotime($start);
  $time_end = getmicrotime($end);
  $time = $time_end - $time_start;
 
  echo Did nothing in $time seconds;
 
  So the script above takes on my server ~0.00115 sec, so as far as I
 understand, it takes php to copy that $big array which is rather large, at
 least 100 times... So I decided to change the function f($a):
   function f($a){return $a;} changed to  function f($a){return $a;},
  as you can see, I only wanted to pass that $a param by reference,
without
 copying it, so I thought I win in performance and the 100 iterations will
 work faster, as no copying of such a large array $big (which is this time
 going to be passed by refernce) will be involved,... BUT this case the job
 took ~3.75093 seconds, which is  3262 times SLOWER !!! I also found out,
 that while using refernces, the time of job's run strictly depends on the
 $big array dimension, and while NOT using references, the time doesn't
 depend on that, but I thought just on the contrary. I thought, that while
 using references, we dont copy the data and therefore do not depend on
that
 data amount, but the example above shows just the opposite results...
 
  What's going on,  if anybody gets interested, please explain?
 
 
 
 
 
 
 





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




[PHP] Mail

2002-10-09 Thread Steel

Hi group,

I have a problem.
There is no sendmail on the hoster's computer. (OS Unix-like)
Can I send mail in any other way?
Please help!

-- 
The Same,
 Steel  mailto:[EMAIL PROTECTED]
 http://www.none.ru


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




RE: [PHP] Mail

2002-10-09 Thread Timothy J Hitchens

Get a SMTP sender class.. have a look at www.zend.com


Timothy Hitchens (HITCHO)
[EMAIL PROTECTED]

HITCHO has Spoken!






-Original Message-
From: Steel [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, 9 October 2002 7:32 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Mail


Hi group,

I have a problem.
There is no sendmail on the hoster's computer. (OS Unix-like) Can I send
mail in any other way? Please help!

-- 
The Same,
 Steel  mailto:[EMAIL PROTECTED]
 http://www.none.ru


-- 
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] Session and URL

2002-10-09 Thread Max Buvry


I meet a probleme with the session.

My example considers 2 scripts :

- the first script (test_session_url.php) opens a session
(session.auto_start=1 in php.ini), defines a counter,
prints some information and an hypertext to execute the second script
which 
has session id as parameter 


?php
$_SESSION['count']= 1;
echo HTMLTITLESession and URL/TITLEBODY;
echo hello ! : it's .$_SESSION['count']. visit;
echo brbr Information :br;
echo ---name = .session_name().br;
echo ---id = .session_id().br;
echo A HREF=nextpage_session_url.php?;
echo session_name().=.session_id();
echo next page/A;
echo /BODY/HTML;
?


- the second script (nextpage_session_url.php) validates the parameter
(set, empty, value), add one to the counter and then check the value of 
the counter. It makes the same thing
5 times by printing an hypertext with itself and after, it prints an new
hypertext to come back to the first script by beginning a NEW SESSION.


?php
if ( !isset($_GET[session_name()]) || empty($_GET[session_name()]) )
{
   echo HTMLTITLESession and URL/TITLEBODY;
   echo parameter error;
   echo /BODY/HTML;
   exit;
}

$id= $_GET[session_name()];

if ( $id != session_id() )
{
   echo HTMLTITLESession and URL/TITLEBODY;
   echo value of session id error : BR;
   echo parameter : $id and current session_id :.session_id().--;
   echo /BODY/HTML;
}
else
{
   $_SESSION['count']++;

   if ( $_SESSION['count']  5 )
   {
  $_SESSION= array();  
  session_destroy();
  session_start(); // problem is the same with or without this
instruction
  include(test_session_url.php);
   }
   else
   {
  echo HTMLTITLESession and URL/TITLEBODY;
  $cpt = $_SESSION['count'];
  echo hello ! : it's .$_SESSION['count']. visit;
  echo brbr Information :br;
  echo ---name = .session_name().br;
  echo ---id = .session_id().br;
  echo A HREF=nextpage_session_url.php?;
  echo session_name().=.session_id();
  echo next page/A;
  echo /BODY/HTML;
   }
}
?



Now my problem : NEVER a new session (with a new ident) is created.
However I execute $_SESSION= array(); and session_destroy();

I use php 4.2.3 and apache 1.3.26
For testing, I configurate my browser to refuse the cookies (but the
problem 
is the same when I accept the cookies).

Perhaps something to change in php.ini ?

In advance thanks.

mb

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




[PHP] how to create files??

2002-10-09 Thread Aidal

Hi NG.

I'm having problems creating files at a certain location.
If I attemt to create a file it gets created in the rootdir (htdocs) even
though I add a path infront of the file name. I've tried severel ways of
adding a path (with / and \\) but nothing works.

eksample: /nef/articles/54.txt

File 54.txt gets created but not at the intented location, instead it gets
created in htdocs.

Can anyone help me by telling me how I'm suppose to do this?
I'm running PHP on Win98 with Apache.

~ Aidal



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




RE: [PHP] how to create files??

2002-10-09 Thread Timothy J Hitchens

If the script is in the same directory just try either {file} nothing
in front or ./{file}

What function are you using to create files?



Timothy Hitchens (HITCHO)
[EMAIL PROTECTED]

HITCHO has Spoken!






-Original Message-
From: Aidal [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, 9 October 2002 4:24 PM
To: [EMAIL PROTECTED]
Subject: [PHP] how to create files??


Hi NG.

I'm having problems creating files at a certain location.
If I attemt to create a file it gets created in the rootdir (htdocs)
even though I add a path infront of the file name. I've tried severel
ways of adding a path (with / and \\) but nothing works.

eksample: /nef/articles/54.txt

File 54.txt gets created but not at the intented location, instead it
gets created in htdocs.

Can anyone help me by telling me how I'm suppose to do this? I'm running
PHP on Win98 with Apache.

~ Aidal



-- 
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] POST method not allowed

2002-10-09 Thread Muhammad Khairuzzaman

Hi,

I'm having problem with processing my form file. It seems that everytime I
use the Post method to process the for the browser return :

Method Not Allowed
The requested method POST is not allowed for the URL /quote.php3.

And if i use a GET method, all the variables are returned as 0 (null , no
value) is there some configuration i miss configured or what?

i'm using PHP 4 and apache 1.3 on windows XP

thank u



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




[PHP] POST method not allowed

2002-10-09 Thread Muhammad Khairuzzaman

Hi,

I'm having problem with processing my form file. It seems that everytime I
use the Post method to process the for the browser return :

Method Not Allowed
The requested method POST is not allowed for the URL /quote.php3.

And if i use a GET method, all the variables are returned as 0 (null , no
value) is there some configuration i miss configured or what?

i'm using PHP 4 and apache 1.3 on windows XP

thank u




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




RE: [PHP] POST method not allowed

2002-10-09 Thread Timothy J Hitchens

Are you sure that .php3 files are being processed by PHP ???


Timothy Hitchens (HITCHO)
[EMAIL PROTECTED]

HITCHO has Spoken!






-Original Message-
From: Muhammad Khairuzzaman [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, 9 October 2002 12:54 PM
To: [EMAIL PROTECTED]
Subject: [PHP] POST method not allowed


Hi,

I'm having problem with processing my form file. It seems that everytime
I use the Post method to process the for the browser return :

Method Not Allowed
The requested method POST is not allowed for the URL /quote.php3.

And if i use a GET method, all the variables are returned as 0 (null ,
no
value) is there some configuration i miss configured or what?

i'm using PHP 4 and apache 1.3 on windows XP

thank u



-- 
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] POST method not allowed

2002-10-09 Thread Muhammad Khairuzzaman


Timothy J Hitchens [EMAIL PROTECTED] wrote in message
006c01c26f7b$529a7530$0500a8c0@BAMBINO">news:006c01c26f7b$529a7530$0500a8c0@BAMBINO...
 Are you sure that .php3 files are being processed by PHP ???


 Timothy Hitchens (HITCHO)
 [EMAIL PROTECTED]

 HITCHO has Spoken!

Yes, i've tried *.php and *.php3



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




RE: [PHP] POST method not allowed

2002-10-09 Thread Timothy J Hitchens

Have you confirmed that they are php processed... eg made a phpinfo()
page and run it?


Timothy Hitchens (HITCHO)
[EMAIL PROTECTED]

HITCHO has Spoken!






-Original Message-
From: Muhammad Khairuzzaman [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, 9 October 2002 8:14 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] POST method not allowed



Timothy J Hitchens [EMAIL PROTECTED] wrote in message
006c01c26f7b$529a7530$0500a8c0@BAMBINO">news:006c01c26f7b$529a7530$0500a8c0@BAMBINO...
 Are you sure that .php3 files are being processed by PHP ???


 Timothy Hitchens (HITCHO)
 [EMAIL PROTECTED]

 HITCHO has Spoken!

Yes, i've tried *.php and *.php3



-- 
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] POST method not allowed

2002-10-09 Thread Muhammad Khairuzzaman


Timothy J Hitchens [EMAIL PROTECTED] wrote in message
006d01c26f7d$236b39a0$0500a8c0@BAMBINO">news:006d01c26f7d$236b39a0$0500a8c0@BAMBINO...
 Have you confirmed that they are php processed... eg made a phpinfo()
 page and run it?


 Timothy Hitchens (HITCHO)
 [EMAIL PROTECTED]

 HITCHO has Spoken!

Yes, done that too.



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




Re: [PHP] POST method not allowed

2002-10-09 Thread Stuart Dallas

Muhammad Khairuzzaman wrote:
 Yes, done that too.

Have you checked that you don't have method limits in your httpd.conf? 
That would be my first guess re: the POST issue.

Have you checked your register_globals setting in php.ini? That would be 
my first guess re: the GET variables issue.

-- 
Stuart


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




RE: [PHP] Speeding up a Mysql Select

2002-10-09 Thread John W. Holmes

 I'm doing a select on a database that has about 45000 records and
growing
 and its a bit SLOW.
 
 Its using a unix timestand to mark the beginning of a call and the end
of
 a
 call.  This is also used so I know what date the call was received.
 
 When I do a
 
 select * from support where begintime between 'timestamp1' and
 'timestamp2';
 
 It takes a while to execute...  The timestamp fieldtype is
varchar(10)...
 Will I see any speed difference with a different column type?
 
 Any advice on how to speed this up would be greatly appreciated! :)

It would probably help to make it an INT column, since that's what
timestamps are and then index the column. Also, I've heard that it's
faster to use begintime  timestamp1 and begintime  timestamp2
instead of BETWEEN. It's probably minor, though, compared to the
advantage you'll get from an indexed INT column.

---John Holmes...



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




Re: [PHP] Speeding up a Mysql Select

2002-10-09 Thread Maurits Lawende

You should include a LIMIT to the sql-query or mysql parses the whole 
database

example:

SELECT * FROM `support` WHERE `begintime`  'timestamp1' AND
`begintime`  'timestamp2' LIMIT 0,1';



John W. Holmes wrote:

I'm doing a select on a database that has about 45000 records and


growing
  

and its a bit SLOW.

Its using a unix timestand to mark the beginning of a call and the end


of
  

a
call.  This is also used so I know what date the call was received.

When I do a

select * from support where begintime between 'timestamp1' and
'timestamp2';

It takes a while to execute...  The timestamp fieldtype is


varchar(10)...
  

Will I see any speed difference with a different column type?

Any advice on how to speed this up would be greatly appreciated! :)



It would probably help to make it an INT column, since that's what
timestamps are and then index the column. Also, I've heard that it's
faster to use begintime  timestamp1 and begintime  timestamp2
instead of BETWEEN. It's probably minor, though, compared to the
advantage you'll get from an indexed INT column.

---John Holmes...



  





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




[PHP] Re: MySQL back up

2002-10-09 Thread Ken

Here is the code I tired to use:

?php

session_start();

require(./config.php);

$sqlserver = $server1;

$sqlusername = $username1;

$sqlpassword = $password1;

$sqldatabase = $database1;

$nam=date('D,d-m-Y');

 $db = mysql_pconnect($sqlserver, $sqlusername, $sqlpassword);

if (!$db)

{

echo Could not connect to MySQL;

exit;

}

$backup=@passthru(mysqldump --opt \$sqldatabase\  $backupdir/$nam.sql);

passthru(gzip $backupdir/$nam.sql);

?




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




Re: [PHP] Speeding up a Mysql Select

2002-10-09 Thread Marco Tabini

Also, probably a stupid question, but, is the `begintime` column
indexed? If it isn't, no matter what you do, the whole thing will keep
getting slower at an alarmingly fast pace :)


Marco


On Wed, 2002-10-09 at 07:14, Maurits Lawende wrote:
 You should include a LIMIT to the sql-query or mysql parses the whole 
 database
 
 example:
 
 SELECT * FROM `support` WHERE `begintime`  'timestamp1' AND
 `begintime`  'timestamp2' LIMIT 0,1';
 
 
 
 John W. Holmes wrote:
 
 I'm doing a select on a database that has about 45000 records and
 
 
 growing
   
 
 and its a bit SLOW.
 
 Its using a unix timestand to mark the beginning of a call and the end
 
 
 of
   
 
 a
 call.  This is also used so I know what date the call was received.
 
 When I do a
 
 select * from support where begintime between 'timestamp1' and
 'timestamp2';
 
 It takes a while to execute...  The timestamp fieldtype is
 
 
 varchar(10)...
   
 
 Will I see any speed difference with a different column type?
 
 Any advice on how to speed this up would be greatly appreciated! :)
 
 
 
 It would probably help to make it an INT column, since that's what
 timestamps are and then index the column. Also, I've heard that it's
 faster to use begintime  timestamp1 and begintime  timestamp2
 instead of BETWEEN. It's probably minor, though, compared to the
 advantage you'll get from an indexed INT column.
 
 ---John Holmes...
 
 
 
   
 
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



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




[PHP] Seek for a value in a html file ...

2002-10-09 Thread Bård Tommy Nilsen

 
I want to read the contents from a html file to a pointer, and seek for
A value, and return it 
 
The text under is an example, and I want to get the 2505 value to be
returned.
Eks. $id = '2505'
 
 
 
(a onmouseover=window.status='show text';return true;
href=javascript:get(2505);
 
 
Regards
Bård Tommy Nilsen



[PHP] Re: Seek for a value in a html file ...

2002-10-09 Thread Erwin

Bård tommy nilsen wrote:
 I want to read the contents from a html file to a pointer, and seek
 for
 A value, and return it 

 The text under is an example, and I want to get the 2505 value to be
 returned.
 Eks. $id = '2505'

 (a onmouseover=window.status='show text';return true;
 href=javascript:get(2505);

Try something like this:

$content = file( 'filename' );
$pattern = /a onmouseover=\window.status='show text';return true;\
href=\javascript:get(.*);/;

$result = preg_grep( $pattern, $content );

The $result variable is an array, where the elements are all the matching
lines from the $content array, which is your inputfile. You can then filter
out the value you want using strpos, strrpos and substr.

HTH
Erwin


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




RE: [PHP] Re: MySQL back up

2002-10-09 Thread John W. Holmes



 -Original Message-
 From: Ken [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, October 09, 2002 7:25 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: MySQL back up
 
 Here is the code I tired to use:
 
 ?php
 
 session_start();

You don't need to start a session...

 require(./config.php);
 
 $sqlserver = $server1;
 
 $sqlusername = $username1;
 
 $sqlpassword = $password1;
 
 $sqldatabase = $database1;
 
 $nam=date('D,d-m-Y');
 
 @ $db = mysql_pconnect($sqlserver, $sqlusername, $sqlpassword);

You don't need to connect to the mysql server.

 
 if (!$db)
 
 {
 
 echo Could not connect to MySQL;
 
 exit;
 
 }
 
 $backup=@passthru(mysqldump --opt \$sqldatabase\ 
 $backupdir/$nam.sql);

You need to send mysqldump the username and password. Syntax is 

Mysqldump -uuser -ppassword databasename  filename.sql

 passthru(gzip $backupdir/$nam.sql);

Why are you using passthru? Neither of these commands should return any
output, so passthru isn't returning anything. You can use backticks or
exec() instead.

---John Holmes...



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




[PHP] Re: POST method not allowed

2002-10-09 Thread Muhammad Khairuzzaman

Ok, my bad, firstup i didnot set in httpd.conf to process *.php3 files. But
i already fix that. So, now all I'm getting is that when I I try to process
the data from a form whether I'm using GET or POST method,  the value that i
get processed form is still null.

I check in the error log file and this is what it say:
[Wed Oct 09 20:18:47 2002] [error] PHP Notice:  Undefined variable:  name in
e:\program files\apache group\apache\htdocs\test.php3 on line 3

Or is there something wrong in my code?

form method=GET action=test.php3

tr
  td width=50% style=border-style: none; border-width: medium
height=20
  pName: input type=text name=name size=20/p
  pnbsp;/p
  pinput type=submit value=Submit name=submitinput type=reset
value=Reset name=B2/p
/form

---
html
?php
print my name is $name;
?
/html



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




[PHP] Undefined variable

2002-10-09 Thread Muhammad Khairuzzaman

I'm trying to process data from a form, regardless whether I'm using GET or
POST method,  the value that i get in the processed form is still null.

I check in the error log file and this is what it say:
[Wed Oct 09 20:18:47 2002] [error] PHP Notice:  Undefined variable:  name in
e:\program files\apache group\apache\htdocs\test.php3 on line 3

Or is there something wrong in my code? Or something with my setting?

form method=GET action=test.php3

tr
  td width=50% style=border-style: none; border-width: medium
height=20
  pName: input type=text name=name size=20/p
  pnbsp;/p
  pinput type=submit value=Submit name=submitinput type=reset
value=Reset name=B2/p
/form

---
html
?php
print my name is $name;
?
/html





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




RE: [PHP] Undefined variable

2002-10-09 Thread Daniel Kushner

Try using $_POST['name'] or $_GET['name']. 

E.g.: 
?php
print my name is $_POST[name];
?


Regards,
Daniel Kushner
_
Need hosting? http://thehostingcompany.us



-Original Message-
From: Muhammad Khairuzzaman [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, October 09, 2002 8:22 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Undefined variable


I'm trying to process data from a form, regardless whether I'm using GET
or POST method,  the value that i get in the processed form is still
null.

I check in the error log file and this is what it say:
[Wed Oct 09 20:18:47 2002] [error] PHP Notice:  Undefined variable:
name in e:\program files\apache group\apache\htdocs\test.php3 on line 3

Or is there something wrong in my code? Or something with my setting?

form method=GET action=test.php3

tr
  td width=50% style=border-style: none; border-width: medium
height=20
  pName: input type=text name=name size=20/p
  pnbsp;/p
  pinput type=submit value=Submit name=submitinput
type=reset value=Reset name=B2/p /form


---
html
?php
print my name is $name;
?
/html





-- 
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] Encrypting passwords in a flat file before import

2002-10-09 Thread Verdon Vaillancourt

Hi,

I hope this question isn't too basic...

I have a flat file (CSV) that I want to import into a mySQL db via
phpMyAdmin. The file has about 1200 rows and is in a format like:
value,value,password,value,value,etc
The passwords are in clear text. I need them to be encrypted in md5.

Is there any advice out there as to how I could process this flat-file
before I import into my db or after the fact?

Thanks, verdon
Ps. Please cc me if replying to list as I am on digest mode


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




[PHP] Re: Undefined variable

2002-10-09 Thread Muhammad Khairuzzaman

Hi, thanks for the help!

I worked, but i dont get it, why use $_POST['name'] or $_GET['name'] when
the text from the internet and books I've read says just put a dollar sign
before the variable's name.

If it wouldn't be a burden can u pls xplain?



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




RE: [PHP] Re: MySQL back up

2002-10-09 Thread Daniel Masson

I agree everything, but
Im not very sure if this is going to work:

  $backup=@passthru(mysqldump --opt \$sqldatabase\  
  $backupdir/$nam.sql);

 You need to send mysqldump the username and password. Syntax is


 Mysqldump -uuser -ppassword databasename  filename.sql

Y think tou should use:

Mysqldump -u user --password user_password  filename.sql

I had an expirience with perl trying like John mysqldump -uuser
-ppassword databasename  filename.sql did not work, i think you have
to send the password too.


Regards.
Daniel


 -Original Message-
 From: Ken [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, October 09, 2002 7:25 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: MySQL back up
 
 Here is the code I tired to use:
 
 ?php
 
 session_start();

You don't need to start a session...

 require(./config.php);
 
 $sqlserver = $server1;
 
 $sqlusername = $username1;
 
 $sqlpassword = $password1;
 
 $sqldatabase = $database1;
 
 $nam=date('D,d-m-Y');
 
 @ $db = mysql_pconnect($sqlserver, $sqlusername, $sqlpassword);

You don't need to connect to the mysql server.

 
 if (!$db)
 
 {
 
 echo Could not connect to MySQL;
 
 exit;
 
 }
 
 $backup=@passthru(mysqldump --opt \$sqldatabase\  
 $backupdir/$nam.sql);

You need to send mysqldump the username and password. Syntax is 

Mysqldump -uuser -ppassword databasename  filename.sql

 passthru(gzip $backupdir/$nam.sql);

Why are you using passthru? Neither of these commands should return any
output, so passthru isn't returning anything. You can use backticks or
exec() instead.

---John Holmes...



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



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




[PHP] Reversing the Colour.

2002-10-09 Thread Alexis Antonakis

Hi,

I have a site whereby the user can select the colour of links for their
individual sections.

What I would like to do is to get the exact opposite colour of the one that
they choose and use that in the 'hover over' option of the a tag.

The value for the colour is stored in hex.

To add to this, the user can also choose the background colour. I have made
sure that they cannot have the same background colour as colour of the link,
but obviously if the background colour is the exact opposite of the link
colour, then when they hover over the link, it would 'disappear'. In this
case I would like to choose HALFWAY between the two sets of colours. I know
that this might not always produce the best colour combinations, but I'm
trying to get it so that the links always 'stand out'. I cannot let them
choose the colour of the 'Hover Over' option unfortunately.

Any suggestions as to how to achieve this, especially the calculations, or
for that matter improve upon it, would be most appreciated.

Regards
Alexis



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




[PHP] Re: Undefined variable

2002-10-09 Thread Johannes Janson

Hi,

Muhammad Khairuzzaman wrote:
 Hi, thanks for the help!
 
 I worked, but i dont get it, why use $_POST['name'] or $_GET['name'] when
 the text from the internet and books I've read says just put a dollar sign
 before the variable's name.

from php version 4.?.x on register_globals is turned
off by default in your php.ini so you can't use the posted variables (or
the ones passed by url) by just putting a $ at the beginning of the
variable name.

cheers
J


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




[PHP] Different Content-types

2002-10-09 Thread Archibald Zimonyi


Hi everyone,

I'm trying to write a PHP script that is meant to conjure up some
string context and force the browser to download this context into a
file.

For this I have used the following header code:

header(Cache-control: private);
header(Content-Type: application/octet-stream);
header(Content-Length: .strlen($file));
header(Content-Disposition: attachment; filename=$filename);


where $file is the string to save as a file which value is fetched from
$filename.

This works like a charm. I get my downloaded file and I am happy.

My problem is as follows. I use frames on my site and once I have
managed to download the file I lock the browser until I refresh the
frame from where I did the download. This is annoying.

I have read the documentation on the header() function and I also
checked the RFC for Content-Disposition and noticed you can add
multipart content to a page but all my efforts go awry. The following is
written by me and is my interpretation on how things should look.
Instead of downloading the first content and then displaying the second,
it downloads everything.

Any ideas?

header(Content-Type: multipart/mixed; boundary=outer);

header(Cache-control: private);
header(Content-Type: application/octet-stream);
header(Content-Length: .strlen($file));
header(Content-Disposition: attachment; filename=$filename);

$fp = fopen($filename, r);
fpassthru($fp);

header(Content-Type: text/html);
header(Content-Disposition: inline);

echo PTest/P;

Thanks in advance,

Archie

---
Archibald Zimonyi
[EMAIL PROTECTED]

There is no logic like no logic


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




Re: [PHP] Encrypting passwords in a flat file before import

2002-10-09 Thread Adam Voigt

Off the top of my head I would use:

$f = fopen(filename.csv,r);
$data = fread($f,filesize(filename.csv));
fclose($f);

$split = explode(\n,$data);
$counter = 0;

foreach($split AS $row)
{
$myarray = explode(,,$row);
$myarray[2] = md5($myarray[2]);
$split[$counter] = implode(,,$myarray);
$counter++;
}

$save = implode(\n,$split);

$f = fopen(outfile.csv,w);
fwrite($f,$save);
fclose($f);

Don't quote me on that though since thats just off
the top of my head.

Adam Voigt
[EMAIL PROTECTED]

On Wed, 2002-10-09 at 08:39, Verdon Vaillancourt wrote:
 Hi,
 
 I hope this question isn't too basic...
 
 I have a flat file (CSV) that I want to import into a mySQL db via
 phpMyAdmin. The file has about 1200 rows and is in a format like:
 value,value,password,value,value,etc
 The passwords are in clear text. I need them to be encrypted in md5.
 
 Is there any advice out there as to how I could process this flat-file
 before I import into my db or after the fact?
 
 Thanks, verdon
 Ps. Please cc me if replying to list as I am on digest mode
 
 
 -- 
 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] Encrypting passwords in a flat file before import

2002-10-09 Thread Adam Voigt

Oh, and if you wanted to do it after you inserted, you could
just do:

mysql_query(UPDATE tablename SET pwfieldname = md5(pwfieldname););

On Wed, 2002-10-09 at 08:39, Verdon Vaillancourt wrote:
 Hi,
 
 I hope this question isn't too basic...
 
 I have a flat file (CSV) that I want to import into a mySQL db via
 phpMyAdmin. The file has about 1200 rows and is in a format like:
 value,value,password,value,value,etc
 The passwords are in clear text. I need them to be encrypted in md5.
 
 Is there any advice out there as to how I could process this flat-file
 before I import into my db or after the fact?
 
 Thanks, verdon
 Ps. Please cc me if replying to list as I am on digest mode
 
 
 -- 
 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] Reversing the Colour.

2002-10-09 Thread Pekka Saarinen

At 10/9/2002, you wrote:
Hi,

I have a site whereby the user can select the colour of links for their
individual sections.

What I would like to do is to get the exact opposite colour of the one that
they choose and use that in the 'hover over' option of the a tag.

The value for the colour is stored in hex.

To add to this, the user can also choose the background colour. I have made
sure that they cannot have the same background colour as colour of the link,
but obviously if the background colour is the exact opposite of the link
colour, then when they hover over the link, it would 'disappear'. In this
case I would like to choose HALFWAY between the two sets of colours. I know
that this might not always produce the best colour combinations, but I'm
trying to get it so that the links always 'stand out'. I cannot let them
choose the colour of the 'Hover Over' option unfortunately.

Any suggestions as to how to achieve this, especially the calculations, or
for that matter improve upon it, would be most appreciated.

Hi,

I struggled with the same issues a few months ago, and coded a function for 
brightening or darkening a HEX color.
Maybe it can help you in your dilemma.

The code converts HEX to RGB, multiplies each color channel
and converts back to HEX. This way the hue stays correct. The function
could of course have been written in more concise manner, but as I'm
only learning PHP more deeply, I like to write code that even I can
understand :)

function hexcolorshifter($color,$amount)
{
 $r = hexdec(substr($color, 0, 2));
 $g = hexdec(substr($color, 2, 2));
 $b = hexdec(substr($color, 4, 2));
 $new_r = abs(intval($r*$amount)); if ($new_r255) $new_r=255;
 $new_g = abs(intval($g*$amount)); if ($new_g255) $new_g=255;
 $new_b = abs(intval($b*$amount)); if ($new_b255) $new_b=255;
 $hex_r =  sprintf(%02X,$new_r);
 $hex_g =  sprintf(%02X,$new_g);
 $hex_b =  sprintf(%02X,$new_b);
 // print line is only for debugging:
 // print  R: . $new_r  . , .  $hex_r .  G: .
$new_g . , .  $hex_g .  B: . $new_b  . , .  $hex_b . br;
 $color = $hex_r .$hex_g .$hex_b;
 return $color;
}


Use it like this:
$my_bg_color = hexcolorshifter($my_bg_color,.8);

If you brighten a color, each channel will clip at 255, so in
situations where you have light source color you will most likely have
hue shifts if channels don't clip 'equally'.





-
Pekka Saarinen
http://photography-on-the.net
-



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




Re: [PHP] Encrypting passwords in a flat file before import

2002-10-09 Thread Marek Kilimajer

If you don't need the file to be changed to contain md5 encrypted 
passwords use *fgetcsv() *to read the contenta,
then use *md5()* on the password and insert it into database using 
mysql_query. No need to write a new file.

Verdon Vaillancourt wrote:

Hi,

I hope this question isn't too basic...

I have a flat file (CSV) that I want to import into a mySQL db via
phpMyAdmin. The file has about 1200 rows and is in a format like:
value,value,password,value,value,etc
The passwords are in clear text. I need them to be encrypted in md5.

Is there any advice out there as to how I could process this flat-file
before I import into my db or after the fact?

Thanks, verdon
Ps. Please cc me if replying to list as I am on digest mode


  



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




[PHP] Object methods - memory usage?

2002-10-09 Thread Bogdan Stancescu

Hello!

Ok, this is probably a very stupid question for someone who knows how 
these things work internally - but I don't, therefore I ask. :)

When I instantiate an object, do the methods get instantiated as well? 
The question is asked memory-wise, not functionality-wise. More to the 
point, if I instantiate many identical objects with no class variables 
of their own but with many methods, will I get memory used up for the 
methods?

If I were to guess, I'd say no extra memory is used for the methods 
since I don't think you can dynamically redefine class methods, so there 
would be no reason for duplicating them instead of simply referencing 
the class definition - but then again, I don't know how PHP works 
internally...

Thank you!

Bogdan


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




[PHP] Re: PHP to Excel (csv)

2002-10-09 Thread Ivo Stoykov

Thank you for your help.

Ivo

Ivo Stoykov [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi

 I have following problem.

 Some data retreived from mysql db I need to send to the user as a *.csv
 file. Usually I separate fields (usually double quoted) with comma (,) or
 semicolomn (;) and the records with cr/lf (Windows)
 It works fin until I do not have cr/lf in any of the fields.

 Unfortunately the last field is TEXT type and may have more that one cr/lf
 inside (as data). When this is the case the *,csv file cannot be open
 correctly in Excel. If there are cr/lf in any field it is split in Excel
as
 a separate row and the record structure is broken.\

 Any idea how could solve this? Thank you

 Ivo





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




[PHP] parts of sentences

2002-10-09 Thread Oliver Witt

Hi,
I have a problem that I don't know how to solve within php.
I have the variable $x = How are you today and the variable $y. Now, I
want the variable to be $y = are you today or $y = you today. How do
I do that?
Thanks,
Oliver


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




Re: [PHP] Reversing the Colour.

2002-10-09 Thread ::[ Julien Bonastre ]::

Assumptions:
- background colour is stored in $bgcol (ie 4592FF)
- chosen link colour is stored in $lncol (ie *same as above*)
- Finds half-way colour between $bgcol and $lncol (returns a RRGGBB in hex
as above)

Notes:
This is actually fairly simple Alexis.. Simply convert your hex vals to
something you can work with (ie dec) using hexdec() and then do some basic
maths to find the half way between each of the R G B vals and then finally
spitting out a hex value for the midway mark..


Implementation:

?php
/** Func: getMidColour **/
// Returns the midway value in HEX between the two DEC values $dec1, $dec2
function getMidColour($dec1,$dec2) {
  return
dechex(abs(hexdec($dec1)-hexdec($dec2))/2+(hexdec($dec1)hexdec($dec2)?hexde
c($dec2):hexdec($dec1)));
}

// Parses 6char hex colour (RRGGBB) into 3 part RGB string and feeds into an
array
$bgcol_arr=split(,,preg_replace(([\d]{2})([\d]{2})([\d]{2}),$1,$2,$3,$
bgcol));
$lncol_arr=split(,,preg_replace(([\d]{2})([\d]{2})([\d]{2}),$1,$2,$3,$
lncol));

// We now can access the hex RGB values through the [0],[1],[2] elements of
these arrays..
// Using our custom function we can throw into our final array the actual 3
hex values
// desired which is the midpoint between $bgcol and $lncol
$midcol_arr=Array(getMidColour($bgcol_arr[0],$lncol_arr[0]),getMidColour($bg
col_arr[1],$lncol_arr[1]),getMidColour($bgcol_arr[2],$lncol_arr[2]));




---

HIH.. Not tested.. Please tell me how it goes (if it goes :-p)



Bye


- Original Message -
From: Alexis Antonakis [EMAIL PROTECTED]
To: Php-General@Lists. Php. Net [EMAIL PROTECTED]
Sent: Wednesday, October 09, 2002 10:48 PM
Subject: [PHP] Reversing the Colour.


 Hi,

 I have a site whereby the user can select the colour of links for their
 individual sections.

 What I would like to do is to get the exact opposite colour of the one
that
 they choose and use that in the 'hover over' option of the a tag.

 The value for the colour is stored in hex.

 To add to this, the user can also choose the background colour. I have
made
 sure that they cannot have the same background colour as colour of the
link,
 but obviously if the background colour is the exact opposite of the link
 colour, then when they hover over the link, it would 'disappear'. In this
 case I would like to choose HALFWAY between the two sets of colours. I
know
 that this might not always produce the best colour combinations, but I'm
 trying to get it so that the links always 'stand out'. I cannot let them
 choose the colour of the 'Hover Over' option unfortunately.

 Any suggestions as to how to achieve this, especially the calculations, or
 for that matter improve upon it, would be most appreciated.

 Regards
 Alexis



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






[PHP] Re: parts of sentences

2002-10-09 Thread Bogdan Stancescu

You might want to take a look at explode() and array functions - I don't 
understand exactly what you want (I want this -- or that), but those 
will probably solve the problem, whatever that is specifically.

Bogdan

Oliver Witt wrote:
 Hi,
 I have a problem that I don't know how to solve within php.
 I have the variable $x = How are you today and the variable $y. Now, I
 want the variable to be $y = are you today or $y = you today. How do
 I do that?
 Thanks,
 Oliver
 


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




Re: [PHP] parts of sentences

2002-10-09 Thread Robert Cummings

Oliver Witt wrote:
 
 Hi,
 I have a problem that I don't know how to solve within php.
 I have the variable $x = How are you today and the variable $y. Now, I
 want the variable to be $y = are you today or $y = you today. How do
 I do that?

$y = ereg_replace( '^[[:space:]]*[[:alpha:]]+[[:space:]]+', '', $x );

Unless you had more exotice needs. There may even be a word chop function
since I didn't bother to look :)

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




[PHP] Re: parts of sentences

2002-10-09 Thread Oliver Witt

Bogdan Stancescu schrieb:

 You might want to take a look at explode() and array functions - I don't
 understand exactly what you want (I want this -- or that), but those
 will probably solve the problem, whatever that is specifically.

 Bogdan

 Oliver Witt wrote:
  Hi,
  I have a problem that I don't know how to solve within php.
  I have the variable $x = How are you today and the variable $y. Now, I
  want the variable to be $y = are you today or $y = you today. How do
  I do that?
  Thanks,
  Oliver
 

Thanks, explode() is what i needed ^^
Olli



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




[PHP] Re: parts of sentences

2002-10-09 Thread Bogdan Stancescu

Glad it helps - be sure to also check implode() for the reverse action!

Bogdan

Oliver Witt wrote:
 Bogdan Stancescu schrieb:
 
 
You might want to take a look at explode() and array functions - I don't
understand exactly what you want (I want this -- or that), but those
will probably solve the problem, whatever that is specifically.

Bogdan

Oliver Witt wrote:

Hi,
I have a problem that I don't know how to solve within php.
I have the variable $x = How are you today and the variable $y. Now, I
want the variable to be $y = are you today or $y = you today. How do
I do that?
Thanks,
Oliver

 
 
 Thanks, explode() is what i needed ^^
 Olli
 
 


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




Re: [PHP] Reversing the Colour.

2002-10-09 Thread ::[ Julien Bonastre ]::

Ok below is the fully tested and working code:

NOTE: . I have attached it too so wordwrapping email clients don't stuff the
lines up .. ;-)

This script will take in two 6character HTML hex colours (ie 44F0DD) and
return the midway colour between them (in Hex also)..


--
?php
//Example values..
$bgcol=39DFD9;
$lncol=F02816;

/** Func: getMidColour **/
// Returns the midway value in HEX between the two DEC values $dec1, $dec2
function getMidColour($dec1,$dec2) {
  return
dechex(abs(hexdec($dec1)-hexdec($dec2))/2+(hexdec($dec1)hexdec($dec2)?hexde
c($dec2):hexdec($dec1)));
}

// Parses 6char hex colour (RRGGBB) into 3 part RGB string and feeds into an
array
$bgcol_arr=split(,,preg_replace(/(.{2})(.{2})(.{2})/,$1,$2,$3,$bgcol))
;
$lncol_arr=split(,,preg_replace(/(.{2})(.{2})(.{2})/,$1,$2,$3,$lncol))
;

// We now can access the hex RGB values through the [0],[1],[2] elements of
these arrays..
// Using our custom function we can throw into our final array the actual 3
hex values
// desired which is the midpoint between $bgcol and $lncol
$midcol_arr=Array(getMidColour($bgcol_arr[0],$lncol_arr[0]),getMidColour($bg
col_arr[1],$lncol_arr[1]),getMidColour($bgcol_arr[2],$lncol_arr[2]));

// Formats the array into a string and Upper cases it..
$midcol=strtoupper(join(,$midcol_arr));

?
-

You then have the $midcol var which holds a uppercase HTML hex colour string
which represents the midway colour between $bgcol and $lncol..



Finally.. :-p


Ok HIH

- Original Message -
From: ::[ Julien Bonastre ]:: [EMAIL PROTECTED]
To: ::[ Julien Bonastre ]:: [EMAIL PROTECTED]
Sent: Thursday, October 10, 2002 12:19 AM
Subject: Re: [PHP] Reversing the Colour.


 Hang on..

 Yep I just tested it.

 Make sure you incldue the forward slash REGEX seperators in those preg
 functions..

 Ie.. my lines in previous email have:

$bgcol_arr=split(,,preg_replace(([\d]{2})([\d]{2})([\d]{2}),$1,$2,$3,$
 bgcol));

 Which should be:

$bgcol_arr=split(,,preg_replace(/([\d]{2})([\d]{2})([\d]{2})/,$1,$2,$3
 ,$bgcol));



 Anyway...
 - Original Message -
 From: ::[ Julien Bonastre ]:: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, October 09, 2002 11:59 PM
 Subject: Re: [PHP] Reversing the Colour.


 Assumptions:
 - background colour is stored in $bgcol (ie 4592FF)
 - chosen link colour is stored in $lncol (ie *same as above*)
 - Finds half-way colour between $bgcol and $lncol (returns a RRGGBB in
hex
 as above)

 Notes:
 This is actually fairly simple Alexis.. Simply convert your hex vals to
 something you can work with (ie dec) using hexdec() and then do some basic
 maths to find the half way between each of the R G B vals and then finally
 spitting out a hex value for the midway mark..


 Implementation:

 ?php
 /** Func: getMidColour **/
 // Returns the midway value in HEX between the two DEC values $dec1, $dec2
 function getMidColour($dec1,$dec2) {
   return

dechex(abs(hexdec($dec1)-hexdec($dec2))/2+(hexdec($dec1)hexdec($dec2)?hexde
 c($dec2):hexdec($dec1)));
 }

 // Parses 6char hex colour (RRGGBB) into 3 part RGB string and feeds into
an
 array

$bgcol_arr=split(,,preg_replace(([\d]{2})([\d]{2})([\d]{2}),$1,$2,$3,$
 bgcol));

$lncol_arr=split(,,preg_replace(([\d]{2})([\d]{2})([\d]{2}),$1,$2,$3,$
 lncol));

 // We now can access the hex RGB values through the [0],[1],[2] elements
of
 these arrays..
 // Using our custom function we can throw into our final array the actual
3
 hex values
 // desired which is the midpoint between $bgcol and $lncol

$midcol_arr=Array(getMidColour($bgcol_arr[0],$lncol_arr[0]),getMidColour($bg
 col_arr[1],$lncol_arr[1]),getMidColour($bgcol_arr[2],$lncol_arr[2]));




 ---

 HIH.. Not tested.. Please tell me how it goes (if it goes :-p)



 Bye


 - Original Message -
 From: Alexis Antonakis [EMAIL PROTECTED]
 To: Php-General@Lists. Php. Net [EMAIL PROTECTED]
 Sent: Wednesday, October 09, 2002 10:48 PM
 Subject: [PHP] Reversing the Colour.


  Hi,
 
  I have a site whereby the user can select the colour of links for their
  individual sections.
 
  What I would like to do is to get the exact opposite colour of the one
 that
  they choose and use that in the 'hover over' option of the a tag.
 
  The value for the colour is stored in hex.
 
  To add to this, the user can also choose the background colour. I have
 made
  sure that they cannot have the same background colour as colour of the
 link,
  but obviously if the background colour is the exact opposite of the link
  colour, then when they hover over the link, it would 'disappear'. In
this
  case I would like to choose HALFWAY between the two sets of colours. I
 know
  that this might not always produce the best colour combinations, but I'm
  trying to get it so that the links always 'stand out'. I cannot let them
  choose the colour of the 'Hover Over' option unfortunately.
 
  Any suggestions as to how to achieve this, especially the calculations,
or
  for that 

Re: [PHP] Reversing the Colour

2002-10-09 Thread ::[ Julien Bonastre ]::

Hang on..

Yep I just tested it.

Make sure you incldue the forward slash REGEX seperators in those preg
functions..

Ie.. my lines in previous email have:
$bgcol_arr=split(,,preg_replace(([\d]{2})([\d]{2})([\d]{2}),$1,$2,$3,$
bgcol));

Which should be:
$bgcol_arr=split(,,preg_replace(/([\d]{2})([\d]{2})([\d]{2})/,$1,$2,$3
,$bgcol));



Anyway...
- Original Message -
From: ::[ Julien Bonastre ]:: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, October 09, 2002 11:59 PM
Subject: Re: [PHP] Reversing the Colour.


Assumptions:
- background colour is stored in $bgcol (ie 4592FF)
- chosen link colour is stored in $lncol (ie *same as above*)
- Finds half-way colour between $bgcol and $lncol (returns a RRGGBB in hex
as above)

Notes:
This is actually fairly simple Alexis.. Simply convert your hex vals to
something you can work with (ie dec) using hexdec() and then do some basic
maths to find the half way between each of the R G B vals and then finally
spitting out a hex value for the midway mark..


Implementation:

?php
/** Func: getMidColour **/
// Returns the midway value in HEX between the two DEC values $dec1, $dec2
function getMidColour($dec1,$dec2) {
  return
dechex(abs(hexdec($dec1)-hexdec($dec2))/2+(hexdec($dec1)hexdec($dec2)?hexde
c($dec2):hexdec($dec1)));
}

// Parses 6char hex colour (RRGGBB) into 3 part RGB string and feeds into an
array
$bgcol_arr=split(,,preg_replace(([\d]{2})([\d]{2})([\d]{2}),$1,$2,$3,$
bgcol));
$lncol_arr=split(,,preg_replace(([\d]{2})([\d]{2})([\d]{2}),$1,$2,$3,$
lncol));

// We now can access the hex RGB values through the [0],[1],[2] elements of
these arrays..
// Using our custom function we can throw into our final array the actual 3
hex values
// desired which is the midpoint between $bgcol and $lncol
$midcol_arr=Array(getMidColour($bgcol_arr[0],$lncol_arr[0]),getMidColour($bg
col_arr[1],$lncol_arr[1]),getMidColour($bgcol_arr[2],$lncol_arr[2]));




---

HIH.. Not tested.. Please tell me how it goes (if it goes :-p)



Bye


- Original Message -
From: Alexis Antonakis [EMAIL PROTECTED]
To: Php-General@Lists. Php. Net [EMAIL PROTECTED]
Sent: Wednesday, October 09, 2002 10:48 PM
Subject: [PHP] Reversing the Colour.


 Hi,

 I have a site whereby the user can select the colour of links for their
 individual sections.

 What I would like to do is to get the exact opposite colour of the one
that
 they choose and use that in the 'hover over' option of the a tag.

 The value for the colour is stored in hex.

 To add to this, the user can also choose the background colour. I have
made
 sure that they cannot have the same background colour as colour of the
link,
 but obviously if the background colour is the exact opposite of the link
 colour, then when they hover over the link, it would 'disappear'. In this
 case I would like to choose HALFWAY between the two sets of colours. I
know
 that this might not always produce the best colour combinations, but I'm
 trying to get it so that the links always 'stand out'. I cannot let them
 choose the colour of the 'Hover Over' option unfortunately.

 Any suggestions as to how to achieve this, especially the calculations, or
 for that matter improve upon it, would be most appreciated.

 Regards
 Alexis



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








Re: [PHP] confirm box

2002-10-09 Thread Holger Heinze, Portalmeister GmbH

hi there
youre missing a return.

here is the code i use in order to supress the submission of the form in
case the field validation (or the are you sure... ? confirm()) returns
false:

 form onSubmit=return validateForm(this)

Have fun,

Holger
- Original Message -
From: Davy Obdam [EMAIL PROTECTED]
To: PHP Mailinglist [EMAIL PROTECTED]; PHP-WIN Mailinglist
[EMAIL PROTECTED]
Sent: Wednesday, October 09, 2002 4:17 PM
Subject: [PHP] confirm box


 Hi people,

 Maybe a bit off-topic, but i thought lets ask anyway. I have a guestbook
 admin page were i can delete multiple items from the database using
 checkboxes. So when i click on the Submit button i would like a
 javascript confirm box coming up. I have done that, but it deletes the
 item(s) anyway, also if i click on cancel.

 This is my javascript code in the head of the document:

 script language=JavaScript type=text/javascript
 !--
 function ConfirmDelete()
 {
 input_box=confirm(Are you sure that you want to delete the
 selected items?);
 if (input_box!=true)
 {
 return false;
 }
 else
 {
 return true;
 }
 }
 //--
 /script

 This is what i use in my PHP code:

 ?php
 //Guestbook admin page
 echo 
 form name=\admin\ onSubmit=\ConfirmDelete();\;
 //The rest of my form
 echo 
 input type=\submit\ name=\submit\ value=\delete\
 /form;
 ?

 ?php
 //Delete items from guestbook
 if(isSet($submit))
 {
 //Delete items
 }
 ?

 Any help is appreciated, thanks for your time,

 Best regards,

 Davy Obdam,
 mailto:[EMAIL PROTECTED]



 --
 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] Installing both static and dynamic modules

2002-10-09 Thread Jonathan Duncan

Ah, that makes sense.  Thanks Tom and David.

Jonathan


Tom Rogers [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

 Wednesday, October 9, 2002, 1:24:31 AM, you wrote:
 JD In the INSTALL file notes for PHP is says:

 JD 1: Only install either the static module or the dynamic one.  Do not
 JDinstall both.

 JD No reasoning is given for this statement.  Does anyone know what the
reason
 JD for this is?

 JD The reason I want to know is because I run both the Apache module and
the
 JD static cgi module on my server and I haven't had any problems.  I have
the
 JD cgi module for running php scripts as cron jobs.

 JD Anyone know why the statement?

 JD Thanks,
 JD Jonathan Duncan

 They are not talking about the cgi version, they mean don't compile
 php into apache as a permanent module and also try to load it as a
 dynamic one at the same time cgi is treated as a completely seperate
 program so it can co-exist with an internal apache php module.

 --
 regards,
 Tom




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




[PHP] confirm box

2002-10-09 Thread Davy Obdam

Hi people,

Maybe a bit off-topic, but i thought lets ask anyway. I have a guestbook
admin page were i can delete multiple items from the database using
checkboxes. So when i click on the Submit button i would like a
javascript confirm box coming up. I have done that, but it deletes the
item(s) anyway, also if i click on cancel. 

This is my javascript code in the head of the document: 

script language=JavaScript type=text/javascript
!--
function ConfirmDelete() 
{
input_box=confirm(Are you sure that you want to delete the
selected items?);
if (input_box!=true) 
{
return false;
} 
else
{
return true;
}
}
//--
/script

This is what i use in my PHP code:

?php
//Guestbook admin page
echo 
form name=\admin\ onSubmit=\ConfirmDelete();\;
//The rest of my form
echo 
input type=\submit\ name=\submit\ value=\delete\
/form; 
?

?php
//Delete items from guestbook
if(isSet($submit))
{
//Delete items
}
?

Any help is appreciated, thanks for your time,

Best regards,
 
Davy Obdam,
mailto:[EMAIL PROTECTED]



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




Re: [PHP] confirm box

2002-10-09 Thread Archibald Zimonyi


Hi there,

 echo 
 form name=\admin\ onSubmit=\ConfirmDelete();\;
 //The rest of my form

I am not exactly sure about this but I think you have to define the
onSubmit with a return, otherwise it will always fall through, onSubmit 
only fails the submission if it returns a false value, otherwise it
will always continue.

Add the following and test.

form name=\admin\ onSubmit=\return ConfirmDelete();\;

Archie

---
Archibald Zimonyi
[EMAIL PROTECTED]

There is no logic like no logic


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




[PHP] Re: confirm box

2002-10-09 Thread Craig Donnelly

On your submit button put the following:

input type=submit name=submit onClick=return confirm('Are you sure
you want to delete??')

Hope that helps,

Craig

Davy Obdam [EMAIL PROTECTED] wrote in message
001a01c26f9e$a1c78a80$960a@davy">news:001a01c26f9e$a1c78a80$960a@davy...
 Hi people,

 Maybe a bit off-topic, but i thought lets ask anyway. I have a guestbook
 admin page were i can delete multiple items from the database using
 checkboxes. So when i click on the Submit button i would like a
 javascript confirm box coming up. I have done that, but it deletes the
 item(s) anyway, also if i click on cancel.

 This is my javascript code in the head of the document:

 script language=JavaScript type=text/javascript
 !--
 function ConfirmDelete()
 {
 input_box=confirm(Are you sure that you want to delete the
 selected items?);
 if (input_box!=true)
 {
 return false;
 }
 else
 {
 return true;
 }
 }
 //--
 /script

 This is what i use in my PHP code:

 ?php
 //Guestbook admin page
 echo 
 form name=\admin\ onSubmit=\ConfirmDelete();\;
 //The rest of my form
 echo 
 input type=\submit\ name=\submit\ value=\delete\
 /form;
 ?

 ?php
 //Delete items from guestbook
 if(isSet($submit))
 {
 //Delete items
 }
 ?

 Any help is appreciated, thanks for your time,

 Best regards,

 Davy Obdam,
 mailto:[EMAIL PROTECTED]





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




Re: [PHP] confirm box ----- Resolved by E M I N

2002-10-09 Thread EMIN CALIKLI


Hi ,
Change  OnSubmit=return ConfirmDelete();.
Add your code return Like this :)

?php
//Guestbook admin page
echo 
form name=\admin\ onSubmit=\return ConfirmDelete();\; // --- -=-=-=- THIS LINE 
-=-=-=-
//The rest of my form
echo 
input type=\submit\ name=\submit\ value=\delete\
/form;
?

Have a nice day.







   
 
Davy Obdam   
 
info@davyobda   To: PHP Mailinglist 
[EMAIL PROTECTED], PHP-WIN
m.comMailinglist [EMAIL PROTECTED] 
 
 cc: (bcc: EMIN CALIKLI/FINANSBANK)
 
09.10.2002   Subject: [PHP] confirm box
 
17:17  
 
   
 
   
 




Hi people,

Maybe a bit off-topic, but i thought lets ask anyway. I have a guestbook
admin page were i can delete multiple items from the database using
checkboxes. So when i click on the Submit button i would like a
javascript confirm box coming up. I have done that, but it deletes the
item(s) anyway, also if i click on cancel.

This is my javascript code in the head of the document:

script language=JavaScript type=text/javascript
!--
function ConfirmDelete() 
{
  input_box=confirm(Are you sure that you want to 
delete the
selected items?);
 if (input_box!=true) 
{
   return false;
  } 
  else
 
{
   return
true;
}
}
//--
/script

This is what i use in my PHP code:

?php
//Guestbook admin page
echo 
form name=\admin\ onSubmit=\ConfirmDelete();\;
//The rest of my form
echo 
input type=\submit\ name=\submit\ value=\delete\
/form;
?

?php
//Delete items from guestbook
if(isSet($submit))
{
   //Delete items
}
?

Any help is appreciated, thanks for your time,

Best regards,

Davy Obdam,
mailto:[EMAIL PROTECTED]



--
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] confirm box ----- Resolved by E M I N

2002-10-09 Thread EMIN CALIKLI


Hi ,
Change  OnSubmit=return ConfirmDelete();.
Add your code return Like this :)

?php
//Guestbook admin page
echo 
form name=\admin\ onSubmit=\return ConfirmDelete();\; // --- -=-=-=- THIS LINE 
-=-=-=-
//The rest of my form
echo 
input type=\submit\ name=\submit\ value=\delete\
/form;
?

Have a nice day.







   
 
Davy Obdam   
 
info@davyobda   To: PHP Mailinglist 
[EMAIL PROTECTED], PHP-WIN
m.comMailinglist [EMAIL PROTECTED] 
 
 cc: (bcc: EMIN CALIKLI/FINANSBANK)
 
09.10.2002   Subject: [PHP] confirm box
 
17:17  
 
   
 
   
 




Hi people,

Maybe a bit off-topic, but i thought lets ask anyway. I have a guestbook
admin page were i can delete multiple items from the database using
checkboxes. So when i click on the Submit button i would like a
javascript confirm box coming up. I have done that, but it deletes the
item(s) anyway, also if i click on cancel.

This is my javascript code in the head of the document:

script language=JavaScript type=text/javascript
!--
function ConfirmDelete() 
{
  input_box=confirm(Are you sure that you want to 
delete the
selected items?);
 if (input_box!=true) 
{
   return false;
  } 
  else
 
{
   return
true;
}
}
//--
/script

This is what i use in my PHP code:

?php
//Guestbook admin page
echo 
form name=\admin\ onSubmit=\ConfirmDelete();\;
//The rest of my form
echo 
input type=\submit\ name=\submit\ value=\delete\
/form;
?

?php
//Delete items from guestbook
if(isSet($submit))
{
   //Delete items
}
?

Any help is appreciated, thanks for your time,

Best regards,

Davy Obdam,
mailto:[EMAIL PROTECTED]



--
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: [PHP-WIN] Re: [PHP] confirm box

2002-10-09 Thread Davy Obdam

Hi Archie,

Thanks it works. Great i knew i was forgetting something.

Best regards,
 
Davy Obdam,
mailto:[EMAIL PROTECTED]


-Original Message-
From: Archibald Zimonyi [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, October 09, 2002 4:44 PM
To: Davy Obdam
Cc: PHP Mailinglist; PHP-WIN Mailinglist
Subject: [PHP-WIN] Re: [PHP] confirm box



Hi there,

 echo 
 form name=\admin\ onSubmit=\ConfirmDelete();\;
 //The rest of my form

I am not exactly sure about this but I think you have to define the
onSubmit with a return, otherwise it will always fall through, onSubmit 
only fails the submission if it returns a false value, otherwise it will
always continue.

Add the following and test.

form name=\admin\ onSubmit=\return ConfirmDelete();\;

Archie

---
Archibald Zimonyi
[EMAIL PROTECTED]

There is no logic like no logic


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


Deze e-mail is door E-mail VirusScanner van Planet Internet
gecontroleerd op virussen. Op http://www.planet.nl/evs staat een
verwijzing naar de actuele lijst waar op wordt gecontroleerd.




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




[PHP] site path

2002-10-09 Thread Wilmar Perez

Hello guys

I'm just looking for some advise:  I've got a variable which I use to store 
my site's main path.  Is it better to have it like this:

$site_path = /my/web/path/

or like this:

$site_path = http://my_url.com/;

?

What about the trailing slash?, should I use it or not?

I know these are simple question but haven't been able to get to an answer on 
my own.

Thanks a lot

***
 Wilmar Pérez
 Network Administrator
   Library System
  Tel: ++57(4)2105145
University of Antioquia
   Medellín - Colombia
  2002
***
 
 

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




RE: [PHP] site path

2002-10-09 Thread Jon Haworth

Hi Wilmar,

 I'm just looking for some advise:  I've got a variable 
 which I use to store my site's main path.  Is it better 
 to have it like this:
 
 $site_path = /my/web/path/
 
 or like this:
 
 $site_path = http://my_url.com/;

Depends what you're using it for :-)

You could:

- Use the first if you need it for filesystem access
- Use the second if you need it for URLs
- Use two if you need both
- Forget these and use PHP's predefined variables for this info


Cheers
Jon

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




[PHP] Image problem

2002-10-09 Thread Donahue Ben

I upload an image.  Once I upload this image using the
is_uploaded_file function, then writing this image
file using the copy function.  Everything seems to
work fine.  When i try to update (that is uploading a
new file and saving it with the same name as the first
file created) it shows the first image instead of the
second image.  So what I did was closed my browser,
then reopened it, then everything was ok.  So I figure
that I have a cache problem.  I then tried using the
clearstatcache() function right after I update this
image file.  But it did not seem to work.  So am I
going to have to close and reopen my browser to see
these changes take place or is there something else I
can do?

Ben

__
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos  More
http://faith.yahoo.com

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




[PHP] Re: secure access

2002-10-09 Thread Anup

I belive you can have the file atleast one directory below your root web
folder (so web surfers have no access, just your script). Also since the
HTML-PHP is unsecure over HTTP, look into HTTPS , I believe this is related
to SSL (Secure Socket Layer). Without SSL, you will be POSTing your
user/pass enter from the HTML form in plain text, which is always a target
for packet sniffers.

Hopefully that will shed some light, BUT I myself am not familiar with SSL
so please check with a more experienced/knowledged person.

Roman Duriancik [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 If I want to secure the access to the database by asking for passwd, what
 should I do ? I suppose I need a secure connection to transfer the
username
 and passwd between HTML form and the script - how do I make that ?
 How do I secure the database file with passwords and user names so that
 it cannot be accessed by anyone, just by allowed users ?

 thank you
 roman




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




Re: [PHP] Re: secure access

2002-10-09 Thread Chris Hewitt

If you use a .htaccess file in the directory (assuming Apache), a popup 
box asks for username/password. The password is MD5 encrypted. I think 
the downside is php getting access to these, or maybe I'm wrong in this.

HTH
Chris

Anup wrote:

I belive you can have the file atleast one directory below your root web
folder (so web surfers have no access, just your script). Also since the
HTML-PHP is unsecure over HTTP, look into HTTPS , I believe this is related
to SSL (Secure Socket Layer). Without SSL, you will be POSTing your
user/pass enter from the HTML form in plain text, which is always a target
for packet sniffers.
Roman Duriancik [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

If I want to secure the access to the database by asking for passwd, what
should I do ? I suppose I need a secure connection to transfer the

username

and passwd between HTML form and the script - how do I make that ?
How do I secure the database file with passwords and user names so that
it cannot be accessed by anyone, just by allowed users ?

thank you
roman








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




Re: [PHP] Re: secure access

2002-10-09 Thread Vidyut Luther

1. SSL will encrypt the data sent between the browser and the server, 
2. Depending on the database, it should have it's own authentication mechanism 
which the PHP script needs to pass before the database will allow access. 
3. Depending on what you need to do, you can limit the use of system 
username/passwords even more by setting up your own username/password list 
just for the specific database, which is not part of the database engine 
itself... 

I might be goin too far ahead of myself, but those are some options..


On Wednesday 09 October 2002 12:17, Anup wrote:
 I belive you can have the file atleast one directory below your root web
 folder (so web surfers have no access, just your script). Also since the
 HTML-PHP is unsecure over HTTP, look into HTTPS , I believe this is
 related to SSL (Secure Socket Layer). Without SSL, you will be POSTing your
 user/pass enter from the HTML form in plain text, which is always a target
 for packet sniffers.

 Hopefully that will shed some light, BUT I myself am not familiar with SSL
 so please check with a more experienced/knowledged person.

 Roman Duriancik [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

  If I want to secure the access to the database by asking for passwd, what
  should I do ? I suppose I need a secure connection to transfer the

 username

  and passwd between HTML form and the script - how do I make that ?
  How do I secure the database file with passwords and user names so that
  it cannot be accessed by anyone, just by allowed users ?
 
  thank you
  roman

-- 
Vidyut Luther
Linuxpowered, Inc
http://www.linuxpowered.com

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




[PHP] Spiders, Sessions, trans SID, and mod_rewrite

2002-10-09 Thread Tech Support

Hello

I'm preparing to start an ecommerce project that will require the use of sessions 
throughout the entire site for referrer and affiliate tracking purposes. I also plan 
to use mod_rewrite to make links to dynamic content search spider friendly. example: 
instead of /somescript.php?var1=value1var2=value2 I'll have 
/somescript/var1/value1/var2/value2

The obstacle I'm facing is the automatic appending of the session id to every link 
upon first entering the site and to every link on every page of the site if session 
cookies are disabled. This will make search spiders either not index the linked pages, 
or worse index them with an old session id!

I am hoping to find two solutions to dealing with this inherent problem with sessions, 
spiders, trans sid, and url rewriting.

1) I am thinking of obtaining and using a list of known spiders to determine if the 
visitor is a spider. If they are a spider I simply won't call session_start() thus 
eliminating the auto appending of the session id to every link. URL rewriting will 
take care of the ugly query strings and I'm in business to get spidered. How ever, 
this could mean a lot of overhead if the site gets busy and a lot of work keeping an 
updated spider list. Does anyone have a solution for this? I want some real world 
experience here please.

2) If I rewrite query strings how will I deal with trans sid? For instance, I have a 
rewritten url that looks like this: /somescript/var1/value1/var2/value2 and the 
session id is going to get appended leaving me with this: 
/somescript/var1/value1/var2/value2PHPSESSID=some_session_id. Is there a way to make 
php add the session id in the slash delimited format? I am aware of 
arg_separator.output directive but that does not fix the = in the query string.

I appreciate any help, tips, and/or pointers. The problem is clear - it's the solution 
that's a little fuzzy!

Thanks for reading,

Jim



RE: [PHP] Spiders, Sessions, trans SID, and mod_rewrite

2002-10-09 Thread Timothy J Hitchens

I would suggest that you look at php as the total solution not
mod_rewrite that way you have
access to include the PHPSESS information into the URL directly eg:

http://www.yourhost.com/application/first_name/john/sess_id/99f9f99f9f9f
9ijfjf9f/cart_full/yes

You can achieve this by reading the following artcile... we use it for
websites that will be searchable
by bots with great success.

http://www.phpbuilder.com/columns/tim19990117.php3

Oh and on the bot side of things... simply have an expiry (epoch stamp)
in the url that you read
and if that has expired simply reload the page with a new session... oh
and you will experience the
same problem with bookmarking visitors as well as bots with the expired
sessions.. or you could just
simply say if it doesn't exist recreate... it depends if you are going
to use built in session handlers
or user (eg database) or even custom self written (my suggestion for
your situation - write your own env).


If you need further assistance don't hesitate to ask.



Timothy Hitchens (HITCHO)
[EMAIL PROTECTED]

HITCHO has Spoken!






-Original Message-
From: Tech Support [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, 10 October 2002 4:33 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Spiders, Sessions, trans SID, and mod_rewrite


Hello

I'm preparing to start an ecommerce project that will require the use of
sessions throughout the entire site for referrer and affiliate tracking
purposes. I also plan to use mod_rewrite to make links to dynamic
content search spider friendly. example: instead of
/somescript.php?var1=value1var2=value2 I'll have
/somescript/var1/value1/var2/value2

The obstacle I'm facing is the automatic appending of the session id to
every link upon first entering the site and to every link on every page
of the site if session cookies are disabled. This will make search
spiders either not index the linked pages, or worse index them with an
old session id!

I am hoping to find two solutions to dealing with this inherent problem
with sessions, spiders, trans sid, and url rewriting.

1) I am thinking of obtaining and using a list of known spiders to
determine if the visitor is a spider. If they are a spider I simply
won't call session_start() thus eliminating the auto appending of the
session id to every link. URL rewriting will take care of the ugly query
strings and I'm in business to get spidered. How ever, this could mean a
lot of overhead if the site gets busy and a lot of work keeping an
updated spider list. Does anyone have a solution for this? I want some
real world experience here please.

2) If I rewrite query strings how will I deal with trans sid? For
instance, I have a rewritten url that looks like this:
/somescript/var1/value1/var2/value2 and the session id is going to get
appended leaving me with this:
/somescript/var1/value1/var2/value2PHPSESSID=some_session_id. Is there
a way to make php add the session id in the slash delimited format? I am
aware of arg_separator.output directive but that does not fix the = in
the query string.

I appreciate any help, tips, and/or pointers. The problem is clear -
it's the solution that's a little fuzzy!

Thanks for reading,

Jim


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




[PHP] Found the problem with the libmcrypt.....

2002-10-09 Thread Scott Fletcher

Found the problem with libmcrypt-2.5.3.  When I configured PHP using
the --with-mcrypt option and the PHP configuration found libmcrypt without a
problem.  After compiling and installing it.

Once I fired up Apache.  I checked the PHP Info using phpinfo() function.
The mcrypt showed up but there is no support ciphers (algorithms  modes).
So, I had to use the php.ini as the PHP Manual stated on
'http://php.net/mcrypt'.  So, I added the two lines as shown in the clipping
where libmcrypt was installed in.

--clip--
mcrypt.algorithms_dir = /usr/local/lib/libmcrypt
mcrypt.modes_dir = /usr/local/lib/libmcrypt
--clip--

That is when PHP Info showed the 'mcrypt.algorithms_dir' and
'mcrypt.modes_dir' with data in it.  But the problem is I still get the
error message when I tried any mcrypt function, the error message range from
being unable to initalize the module to whatever the other error messages
are.  I assumed there's a bug and filed a bug report to PHP but was rejected
because I was told that I had the php.ini incorrect.  That doesn't make
sense.  It took me a long time to find some clues to the problem.  What I
found is that with any files in the /usr/local/lib/libmcrypt that end with
*.a and *.la, they don't work.  There is no *.c and *.h files in that
directory.

I discovered that when I set the php.ini to point to the untarred libmcrypt
directory where *.c and *.h are found in both
'/usr/local/src4/libmcrypt-2.5.3/modules/algorithms' and
'/usr/local/src4/libmcrypt-2.5.3/modules/modes'.  That's when the mcrypt
function start working without a problem.  The problem is PHP doesn't work
with the *.la and *.a files.  Again, I saw the OpenSSL directory where *.c
and *.h files are found in both the algorithms and modes directory of the
'/usr/local/ssl/include/openssl/' directory, it work just fine too.

This had lead me to question of whether is there a bug in libmcrypt or php.
You be the judge of it.  It would be so nice if this problem can be
resolved.  I'm not sure if I'm allowed to use the open source code instead
of the compiled codes.



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




Re: [PHP] Image problem

2002-10-09 Thread David Erickson

I had a similar problem and I just put this in front of my php so everytime
my scripts are called they always tell the browser and any proxy servers not
to cache anything from me.


header(Expires: Mon, 26 Jul 1997 05:00:00 GMT);// Date in the past
header(Last-Modified:  . gmdate(D, d M Y H:i:s) .  GMT);
 // always modified
header(Cache-Control: no-store, no-cache, must-revalidate);  // HTTP/1.1
header(Cache-Control: post-check=0, pre-check=0, false);
header(Pragma: no-cache);  // HTTP/1.0


- Original Message -
From: Donahue Ben [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, October 09, 2002 1:00 PM
Subject: [PHP] Image problem


 I upload an image.  Once I upload this image using the
 is_uploaded_file function, then writing this image
 file using the copy function.  Everything seems to
 work fine.  When i try to update (that is uploading a
 new file and saving it with the same name as the first
 file created) it shows the first image instead of the
 second image.  So what I did was closed my browser,
 then reopened it, then everything was ok.  So I figure
 that I have a cache problem.  I then tried using the
 clearstatcache() function right after I update this
 image file.  But it did not seem to work.  So am I
 going to have to close and reopen my browser to see
 these changes take place or is there something else I
 can do?

 Ben

 __
 Do you Yahoo!?
 Faith Hill - Exclusive Performances, Videos  More
 http://faith.yahoo.com

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




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




Re: [PHP] Encrypting passwords in a flat file before import

2002-10-09 Thread Scott Fletcher

Can it be de-encrypt???  I don't see how since you just use the function
md5().

Marek Kilimajer [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 If you don't need the file to be changed to contain md5 encrypted
 passwords use *fgetcsv() *to read the contenta,
 then use *md5()* on the password and insert it into database using
 mysql_query. No need to write a new file.

 Verdon Vaillancourt wrote:

 Hi,
 
 I hope this question isn't too basic...
 
 I have a flat file (CSV) that I want to import into a mySQL db via
 phpMyAdmin. The file has about 1200 rows and is in a format like:
 value,value,password,value,value,etc
 The passwords are in clear text. I need them to be encrypted in md5.
 
 Is there any advice out there as to how I could process this flat-file
 before I import into my db or after the fact?
 
 Thanks, verdon
 Ps. Please cc me if replying to list as I am on digest mode
 
 
 
 




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




Re: [PHP] Encrypting passwords in a flat file before import

2002-10-09 Thread Marco Tabini

I think that generally you do not want passwords to be decryptable. What
I normally do is try to encrypt whatever the user enters as a password
and compare the resulting encrypted string with what's in the database
to make sure they correspond. If the encrypting function is univocal
(and md5 is) then the correct password will always return the same
encrypted string.

 On Wed, 2002-10-09 at 16:06, Scott Fletcher wrote:
 Can it be de-encrypt???  I don't see how since you just use the function
 md5().
 
 Marek Kilimajer [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  If you don't need the file to be changed to contain md5 encrypted
  passwords use *fgetcsv() *to read the contenta,
  then use *md5()* on the password and insert it into database using
  mysql_query. No need to write a new file.
 
  Verdon Vaillancourt wrote:
 
  Hi,
  
  I hope this question isn't too basic...
  
  I have a flat file (CSV) that I want to import into a mySQL db via
  phpMyAdmin. The file has about 1200 rows and is in a format like:
  value,value,password,value,value,etc
  The passwords are in clear text. I need them to be encrypted in md5.
  
  Is there any advice out there as to how I could process this flat-file
  before I import into my db or after the fact?
  
  Thanks, verdon
  Ps. Please cc me if replying to list as I am on digest mode
  
  
  
  
 
 
 
 
 -- 
 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] Encrypting passwords in a flat file before import

2002-10-09 Thread Scott Fletcher

I was comparing it to what I was thinking about.  Like if the field in the
table (database) have a username and password.  Then you encrypt it with
features like this, then how can it be de-crypt if I had like a thousand
users account. It was just a thought in my mind.

Now based on your responses and feedback.  It seem that the md5() is such a
bad idea and instead, using mcrypt function would help.

Marco Tabini [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I think that generally you do not want passwords to be decryptable. What
 I normally do is try to encrypt whatever the user enters as a password
 and compare the resulting encrypted string with what's in the database
 to make sure they correspond. If the encrypting function is univocal
 (and md5 is) then the correct password will always return the same
 encrypted string.

  On Wed, 2002-10-09 at 16:06, Scott Fletcher wrote:
  Can it be de-encrypt???  I don't see how since you just use the function
  md5().
 
  Marek Kilimajer [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   If you don't need the file to be changed to contain md5 encrypted
   passwords use *fgetcsv() *to read the contenta,
   then use *md5()* on the password and insert it into database using
   mysql_query. No need to write a new file.
  
   Verdon Vaillancourt wrote:
  
   Hi,
   
   I hope this question isn't too basic...
   
   I have a flat file (CSV) that I want to import into a mySQL db via
   phpMyAdmin. The file has about 1200 rows and is in a format like:
   value,value,password,value,value,etc
   The passwords are in clear text. I need them to be encrypted in md5.
   
   Is there any advice out there as to how I could process this
flat-file
   before I import into my db or after the fact?
   
   Thanks, verdon
   Ps. Please cc me if replying to list as I am on digest mode
   
   
   
   
  
 
 
 
  --
  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: Object methods - memory usage?

2002-10-09 Thread Bogdan Stancescu

Well, I guess my questions are just too stupid to deserve an answer 
anyway. Sorry for spamming you guys with my retarded questions! I'll 
refrain from asking any more questions on this list in the future, since 
I always seem to ask the wrong ones.

Humbly yours,
Bogdan

Bogdan Stancescu wrote:
 Hello!
 
 Ok, this is probably a very stupid question for someone who knows how 
 these things work internally - but I don't, therefore I ask. :)
 
 When I instantiate an object, do the methods get instantiated as well? 
 The question is asked memory-wise, not functionality-wise. More to the 
 point, if I instantiate many identical objects with no class variables 
 of their own but with many methods, will I get memory used up for the 
 methods?
 
 If I were to guess, I'd say no extra memory is used for the methods 
 since I don't think you can dynamically redefine class methods, so there 
 would be no reason for duplicating them instead of simply referencing 
 the class definition - but then again, I don't know how PHP works 
 internally...
 
 Thank you!
 
 Bogdan
 


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




RE: [PHP] Encrypting passwords in a flat file before import

2002-10-09 Thread Scott Fletcher

Hi!  I don't see yours in the PHP newsgroup.  I understand what you meant
and I don't have a problem with it.  

Problem is the password had to be changed at every 5th login.  We have SSL
features for the duration of the login period.  So, the encrypt and decrypt
will do fine and only the server will do that, not the end-user or their
software.  The login prompt become unavailable if the SSL connection is
invalid. We also have a firewall, so cracking the database get harder.  


-Original Message-
From: SHEETS,JASON (HP-Boise,ex1) [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, October 09, 2002 4:35 PM
To: 'Scott Fletcher'; [EMAIL PROTECTED]
Subject: RE: [PHP] Encrypting passwords in a flat file before import

Storing passwords in MD5 or another hash is an excellent idea because it is
generally not possible to decrypt them (if the user uses a bad password they
can be brute forced but you can only do so much).  By storing passwords in
MD5 you protect your users passwords, if your database gets cracked their
passwords are still relatively secure.

You generally should not use a reversible encryption technique to store
something like user passwords, the reason being that in order to decrypt the
passwords you must store the encryption key in your code, when someone gets
access to your code (which they will or at least you must assume they will)
all they have to do is look in your code for your encryption key, after that
decrypting your user's passwords is trivial.  The worst thing is most users
use the same password for almost everything that means that many of their
other accounts are now compromised and they may not even know it.  It can be
argued the user should use a more secure password and not use the same one
in many places however the user is a being of convenience and is unlikely to
remember more than one password anyway :)

In short this has been covered probably thousands of times on this list but
I did not want a newer user to make the mistake of using an insecure method
of storing passwords, either putting them in the DB in plain text or using a
reversible encryption technique that is equally insecure because of the
implementation.

Jason Sheets, CCNA, MCSE

-Original Message-
From: Scott Fletcher [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, October 09, 2002 2:24 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Encrypting passwords in a flat file before import

I was comparing it to what I was thinking about.  Like if the field in the
table (database) have a username and password.  Then you encrypt it with
features like this, then how can it be de-crypt if I had like a thousand
users account. It was just a thought in my mind.

Now based on your responses and feedback.  It seem that the md5() is such a
bad idea and instead, using mcrypt function would help.

Marco Tabini [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I think that generally you do not want passwords to be decryptable. What
 I normally do is try to encrypt whatever the user enters as a password
 and compare the resulting encrypted string with what's in the database
 to make sure they correspond. If the encrypting function is univocal
 (and md5 is) then the correct password will always return the same
 encrypted string.

  On Wed, 2002-10-09 at 16:06, Scott Fletcher wrote:
  Can it be de-encrypt???  I don't see how since you just use the function
  md5().
 
  Marek Kilimajer [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   If you don't need the file to be changed to contain md5 encrypted
   passwords use *fgetcsv() *to read the contenta,
   then use *md5()* on the password and insert it into database using
   mysql_query. No need to write a new file.
  
   Verdon Vaillancourt wrote:
  
   Hi,
   
   I hope this question isn't too basic...
   
   I have a flat file (CSV) that I want to import into a mySQL db via
   phpMyAdmin. The file has about 1200 rows and is in a format like:
   value,value,password,value,value,etc
   The passwords are in clear text. I need them to be encrypted in md5.
   
   Is there any advice out there as to how I could process this
flat-file
   before I import into my db or after the fact?
   
   Thanks, verdon
   Ps. Please cc me if replying to list as I am on digest mode
   
   
   
   
  
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 





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

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




RE: [PHP] Encrypting passwords in a flat file before import

2002-10-09 Thread SHEETS,JASON (HP-Boise,ex1)

The potential problem with a firewall is your web server must be able to
connect to the database, that means if someone gets sloppy in the PHP code
or just doesn't realize something is a security issue OR there is an exploit
found for apache or PHP the attacker can get access to your server without
ever being blocked by the firewall.

I see your point as well however if you are going to bother to encrypt the
passwords why not use a more secure method?  If passwords are already
encrypted in the database it is trivial to write a tool to decrypt them,
convert them to an md5 hash and update the passwords.  

Forcing the user to change passwords is a good idea, however I would still
use a hash instead of reversible encryption because it is easy to implement
and increases security transparently to the users and I can think of no good
reason to need to know what the users passwords are (keeps system
administrators as well as attackers honest).

This is not hostile, I just come from system admin background and believe in
making an application more secure if it doesn't affect the end user adversly
:)

Jason


-Original Message-
From: Scott Fletcher [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, October 09, 2002 2:48 PM
To: 'SHEETS,JASON (HP-Boise,ex1)'; Scott Fletcher; [EMAIL PROTECTED]
Subject: RE: [PHP] Encrypting passwords in a flat file before import

Hi!  I don't see yours in the PHP newsgroup.  I understand what you meant
and I don't have a problem with it.  

Problem is the password had to be changed at every 5th login.  We have SSL
features for the duration of the login period.  So, the encrypt and decrypt
will do fine and only the server will do that, not the end-user or their
software.  The login prompt become unavailable if the SSL connection is
invalid. We also have a firewall, so cracking the database get harder.  


-Original Message-
From: SHEETS,JASON (HP-Boise,ex1) [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, October 09, 2002 4:35 PM
To: 'Scott Fletcher'; [EMAIL PROTECTED]
Subject: RE: [PHP] Encrypting passwords in a flat file before import

Storing passwords in MD5 or another hash is an excellent idea because it is
generally not possible to decrypt them (if the user uses a bad password they
can be brute forced but you can only do so much).  By storing passwords in
MD5 you protect your users passwords, if your database gets cracked their
passwords are still relatively secure.

You generally should not use a reversible encryption technique to store
something like user passwords, the reason being that in order to decrypt the
passwords you must store the encryption key in your code, when someone gets
access to your code (which they will or at least you must assume they will)
all they have to do is look in your code for your encryption key, after that
decrypting your user's passwords is trivial.  The worst thing is most users
use the same password for almost everything that means that many of their
other accounts are now compromised and they may not even know it.  It can be
argued the user should use a more secure password and not use the same one
in many places however the user is a being of convenience and is unlikely to
remember more than one password anyway :)

In short this has been covered probably thousands of times on this list but
I did not want a newer user to make the mistake of using an insecure method
of storing passwords, either putting them in the DB in plain text or using a
reversible encryption technique that is equally insecure because of the
implementation.

Jason Sheets, CCNA, MCSE

-Original Message-
From: Scott Fletcher [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, October 09, 2002 2:24 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Encrypting passwords in a flat file before import

I was comparing it to what I was thinking about.  Like if the field in the
table (database) have a username and password.  Then you encrypt it with
features like this, then how can it be de-crypt if I had like a thousand
users account. It was just a thought in my mind.

Now based on your responses and feedback.  It seem that the md5() is such a
bad idea and instead, using mcrypt function would help.

Marco Tabini [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I think that generally you do not want passwords to be decryptable. What
 I normally do is try to encrypt whatever the user enters as a password
 and compare the resulting encrypted string with what's in the database
 to make sure they correspond. If the encrypting function is univocal
 (and md5 is) then the correct password will always return the same
 encrypted string.

  On Wed, 2002-10-09 at 16:06, Scott Fletcher wrote:
  Can it be de-encrypt???  I don't see how since you just use the function
  md5().
 
  Marek Kilimajer [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   If you don't need the file to be changed to contain md5 encrypted
   passwords use 

RE: [PHP] Encrypting passwords in a flat file before import

2002-10-09 Thread SHEETS,JASON (HP-Boise,ex1)

Storing passwords in MD5 or another hash is an excellent idea because it is
generally not possible to decrypt them (if the user uses a bad password they
can be brute forced but you can only do so much).  By storing passwords in
MD5 you protect your users passwords, if your database gets cracked their
passwords are still relatively secure.

You generally should not use a reversible encryption technique to store
something like user passwords, the reason being that in order to decrypt the
passwords you must store the encryption key in your code, when someone gets
access to your code (which they will or at least you must assume they will)
all they have to do is look in your code for your encryption key, after that
decrypting your user's passwords is trivial.  The worst thing is most users
use the same password for almost everything that means that many of their
other accounts are now compromised and they may not even know it.  It can be
argued the user should use a more secure password and not use the same one
in many places however the user is a being of convenience and is unlikely to
remember more than one password anyway :)

In short this has been covered probably thousands of times on this list but
I did not want a newer user to make the mistake of using an insecure method
of storing passwords, either putting them in the DB in plain text or using a
reversible encryption technique that is equally insecure because of the
implementation.

Jason Sheets, CCNA, MCSE

-Original Message-
From: Scott Fletcher [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, October 09, 2002 2:24 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Encrypting passwords in a flat file before import

I was comparing it to what I was thinking about.  Like if the field in the
table (database) have a username and password.  Then you encrypt it with
features like this, then how can it be de-crypt if I had like a thousand
users account. It was just a thought in my mind.

Now based on your responses and feedback.  It seem that the md5() is such a
bad idea and instead, using mcrypt function would help.

Marco Tabini [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I think that generally you do not want passwords to be decryptable. What
 I normally do is try to encrypt whatever the user enters as a password
 and compare the resulting encrypted string with what's in the database
 to make sure they correspond. If the encrypting function is univocal
 (and md5 is) then the correct password will always return the same
 encrypted string.

  On Wed, 2002-10-09 at 16:06, Scott Fletcher wrote:
  Can it be de-encrypt???  I don't see how since you just use the function
  md5().
 
  Marek Kilimajer [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   If you don't need the file to be changed to contain md5 encrypted
   passwords use *fgetcsv() *to read the contenta,
   then use *md5()* on the password and insert it into database using
   mysql_query. No need to write a new file.
  
   Verdon Vaillancourt wrote:
  
   Hi,
   
   I hope this question isn't too basic...
   
   I have a flat file (CSV) that I want to import into a mySQL db via
   phpMyAdmin. The file has about 1200 rows and is in a format like:
   value,value,password,value,value,etc
   The passwords are in clear text. I need them to be encrypted in md5.
   
   Is there any advice out there as to how I could process this
flat-file
   before I import into my db or after the fact?
   
   Thanks, verdon
   Ps. Please cc me if replying to list as I am on digest mode
   
   
   
   
  
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 





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

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




[PHP] My boss wants to know...

2002-10-09 Thread Randum Ian

Hi guys, got a tricky question here and I know I will probably get
flamed for asking it here but here goes!

My boss wants me to put a large Access database onto the net so that
people can query it both from the company and from the outside and he
wants to be able to have the database up to date and also easy to
change.

As far as I can see that leaves me with only Active Server Pages in
which to access this database or am I wrong?

Randum Ian
[EMAIL PROTECTED]
DJ / Reviewer / Webmaster, DancePortal (UK) Limited 
DancePortal.co.uk - Global dance music media




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




RE: [PHP] My boss wants to know...

2002-10-09 Thread Timothy J Hitchens

Look at the odbc access using php:

http://www.php.net/manual/en/ref.odbc.php

You will still need to have a windows box with odbc to your
webserver.. pref unixish..



Timothy Hitchens (HITCHO)
[EMAIL PROTECTED]

HITCHO has Spoken!






-Original Message-
From: Randum Ian [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, 10 October 2002 8:17 AM
To: [EMAIL PROTECTED]
Subject: [PHP] My boss wants to know...


Hi guys, got a tricky question here and I know I will probably get
flamed for asking it here but here goes!

My boss wants me to put a large Access database onto the net so that
people can query it both from the company and from the outside and he
wants to be able to have the database up to date and also easy to
change.

As far as I can see that leaves me with only Active Server Pages in
which to access this database or am I wrong?

Randum Ian
[EMAIL PROTECTED]
DJ / Reviewer / Webmaster, DancePortal (UK) Limited 
DancePortal.co.uk - Global dance music media




-- 
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] 4.2.2 4.2.3 - Incompatibility

2002-10-09 Thread Liam MacKenzie

Well, just in case anyone's interested...

My problem was fixed by just compiling PHP as a standard module, not APXS.



- Original Message -
From: Liam MacKenzie [EMAIL PROTECTED]
To: php [EMAIL PROTECTED]
Sent: Tuesday, October 08, 2002 10:37 PM
Subject: Re: [PHP] 4.2.2  4.2.3 - Incompatibility


Another note, phpMyAdmin causes a segmentation fault as well...

APACHE:
--
./configure \
--with-layout=Apache \
--sysconfdir=/home/nobody/conf \
--iconsdir=/home/nobody/icons \
--htdocsdir=/home/nobody/htdocs \
--cgidir=/home/nobody/cgi-bin \
--logfiledir=/home/nobody/logs \
--enable-module=so \
--enable-module=imap \
--enable-module=rewrite \
--enable-module=headers \
$@
--


PHP:
--
'./configure' \
'--with-apxs=/usr/local/apache/bin/apxs' \
'--with-config-file-path=/home/nobody/conf' \
'--with-mysql=/usr/local' \
'--enable-safemode' \
$@
--


Slackware 8.1

Any ideas yet  ;-)

Cheers,
Liam



- Original Message -
From: Liam MacKenzie [EMAIL PROTECTED]
To: php [EMAIL PROTECTED]
Sent: Tuesday, October 08, 2002 10:26 PM
Subject: [PHP] 4.2.2  4.2.3 - Incompatibility


Hi guys,

I've found me a problem...

A portion of a script is causing the child apache process to be terminated:
[notice] child pid 23620 exit signal Segmentation fault (11)

I never had a problem with this script until I upgraded to 4.2.3.
The only other difference is that now I have PHP compiled as an APXS module,
whereas before it was compiled into apache.

The script is below...

$pass_gen = substr(ereg_replace([^A-Za-z0-9], , crypt(time())) .
ereg_replace([^A-Za-z0-9], , crypt(time())) .
ereg_replace([^A-Za-z0-9], , crypt(time())),
9, 10);


Any ideas?

Cheers,
Liam




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







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







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




Re: [PHP] Encrypting passwords in a flat file before import

2002-10-09 Thread Brad Bonkoski

Or if you use md5() which encrypts the same way every time you could just get a
CD-ROM with a trillion different character combinations that could be valid
passwords and encrypt them, then compare the encrypted strings  With the
current hardware available that might take..oh a half a second ro so.  So, it's
more important to protect the actual SOURCE then the information stored in the
source.  Of course this is a debate that coudl go on forever, when does hardware
encryption rule all?
-Brad

SHEETS,JASON (HP-Boise,ex1) wrote:

 Storing passwords in MD5 or another hash is an excellent idea because it is
 generally not possible to decrypt them (if the user uses a bad password they
 can be brute forced but you can only do so much).  By storing passwords in
 MD5 you protect your users passwords, if your database gets cracked their
 passwords are still relatively secure.

 You generally should not use a reversible encryption technique to store
 something like user passwords, the reason being that in order to decrypt the
 passwords you must store the encryption key in your code, when someone gets
 access to your code (which they will or at least you must assume they will)
 all they have to do is look in your code for your encryption key, after that
 decrypting your user's passwords is trivial.  The worst thing is most users
 use the same password for almost everything that means that many of their
 other accounts are now compromised and they may not even know it.  It can be
 argued the user should use a more secure password and not use the same one
 in many places however the user is a being of convenience and is unlikely to
 remember more than one password anyway :)

 In short this has been covered probably thousands of times on this list but
 I did not want a newer user to make the mistake of using an insecure method
 of storing passwords, either putting them in the DB in plain text or using a
 reversible encryption technique that is equally insecure because of the
 implementation.

 Jason Sheets, CCNA, MCSE

 -Original Message-
 From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, October 09, 2002 2:24 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Encrypting passwords in a flat file before import

 I was comparing it to what I was thinking about.  Like if the field in the
 table (database) have a username and password.  Then you encrypt it with
 features like this, then how can it be de-crypt if I had like a thousand
 users account. It was just a thought in my mind.

 Now based on your responses and feedback.  It seem that the md5() is such a
 bad idea and instead, using mcrypt function would help.

 Marco Tabini [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  I think that generally you do not want passwords to be decryptable. What
  I normally do is try to encrypt whatever the user enters as a password
  and compare the resulting encrypted string with what's in the database
  to make sure they correspond. If the encrypting function is univocal
  (and md5 is) then the correct password will always return the same
  encrypted string.
 
   On Wed, 2002-10-09 at 16:06, Scott Fletcher wrote:
   Can it be de-encrypt???  I don't see how since you just use the function
   md5().
  
   Marek Kilimajer [EMAIL PROTECTED] wrote in message
   [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
If you don't need the file to be changed to contain md5 encrypted
passwords use *fgetcsv() *to read the contenta,
then use *md5()* on the password and insert it into database using
mysql_query. No need to write a new file.
   
Verdon Vaillancourt wrote:
   
Hi,

I hope this question isn't too basic...

I have a flat file (CSV) that I want to import into a mySQL db via
phpMyAdmin. The file has about 1200 rows and is in a format like:
value,value,password,value,value,etc
The passwords are in clear text. I need them to be encrypted in md5.

Is there any advice out there as to how I could process this
 flat-file
before I import into my db or after the fact?

Thanks, verdon
Ps. Please cc me if replying to list as I am on digest mode




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

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

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


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




[PHP] ASP Option Explicit equivalent in PHP

2002-10-09 Thread R . Z .

I'm on a roll with the ASP questions these days, since I picked up the 
Chiliasp.

Here's one:

ASP has the function Option Explicit build in, it yells when you use 
variables without prior declaration, couldn't find anything like that in 
PHP documentation.
Thanks in advance.

R

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




RE: [PHP] My boss wants to know...

2002-10-09 Thread John W. Holmes

 Hi guys, got a tricky question here and I know I will probably get
 flamed for asking it here but here goes!
 
 My boss wants me to put a large Access database onto the net so that
 people can query it both from the company and from the outside and he
 wants to be able to have the database up to date and also easy to
 change.
 
 As far as I can see that leaves me with only Active Server Pages in
 which to access this database or am I wrong?

You can use PHP, of course. ODBC or COM.

Here is an example some program automatically created that shows how to
connect to and query an Access database:

$conn = new COM(ADODB.Connection) or die(Cannot start ADO);
$conn-Open(Driver={Microsoft Access Driver (*.mdb)};Dbq=
.realpath(datab/test.mdb). ;Password=;);
$SQL=SELECT COUNT(*) AS Count FROM test;
$countx = 0;
$rs = $conn-Execute($SQL);
while (!$rs-EOF) {
$countx = $rs-Fields(Count);

---John Holmes...



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




RE: [PHP] Re: Object methods - memory usage?

2002-10-09 Thread John W. Holmes

OK.

 -Original Message-
 From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, October 09, 2002 4:30 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: Object methods - memory usage?
 
 Well, I guess my questions are just too stupid to deserve an answer
 anyway. Sorry for spamming you guys with my retarded questions! I'll
 refrain from asking any more questions on this list in the future,
since
 I always seem to ask the wrong ones.
 
 Humbly yours,
 Bogdan
 
 Bogdan Stancescu wrote:
  Hello!
 
  Ok, this is probably a very stupid question for someone who knows
how
  these things work internally - but I don't, therefore I ask. :)
 
  When I instantiate an object, do the methods get instantiated as
well?
  The question is asked memory-wise, not functionality-wise. More to
the
  point, if I instantiate many identical objects with no class
variables
  of their own but with many methods, will I get memory used up for
the
  methods?
 
  If I were to guess, I'd say no extra memory is used for the methods
  since I don't think you can dynamically redefine class methods, so
there
  would be no reason for duplicating them instead of simply
referencing
  the class definition - but then again, I don't know how PHP works
  internally...
 
  Thank you!
 
  Bogdan
 
 
 
 --
 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] ASP Option Explicit equivalent in PHP

2002-10-09 Thread John W. Holmes

 I'm on a roll with the ASP questions these days, since I picked up the
 Chiliasp.
 
 Here's one:
 
 ASP has the function Option Explicit build in, it yells when you use
 variables without prior declaration, couldn't find anything like that
in
 PHP documentation.
 Thanks in advance.

If you set error_reporting to E_ALL (or include E_NOTICE, I think), then
PHP will give warnings when an undeclared variable is used.

---John Holmes...



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




Re: [PHP] ASP Option Explicit equivalent in PHP

2002-10-09 Thread Marco Tabini

Well, you can set error_reporting to E_ALL, which will cause PHP to
complain if you use a variable without having it initialized. There is
no exact equivalent to Option Explicit--and there still isn't any need
to declare the variables, just to initialize them before use.


Marco

On Wed, 2002-10-09 at 18:47, R. Z. wrote:
 I'm on a roll with the ASP questions these days, since I picked up the 
 Chiliasp.
 
 Here's one:
 
 ASP has the function Option Explicit build in, it yells when you use 
 variables without prior declaration, couldn't find anything like that in 
 PHP documentation.
 Thanks in advance.
 
 R
 
 -- 
 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: ASP Option Explicit equivalent in PHP

2002-10-09 Thread Nick Eby

There's 2 ways to get that: use the php.ini setting ERROR_REPORTING, or the
function error_reporting().  to see undeclared variable use, call
error_reporting(E_NOTICE) at the top of your script.

http://www.php.net/manual/en/function.error-reporting.php

/nick

R . Z . [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 I'm on a roll with the ASP questions these days, since I picked up the
 Chiliasp.

 Here's one:

 ASP has the function Option Explicit build in, it yells when you use
 variables without prior declaration, couldn't find anything like that in
 PHP documentation.
 Thanks in advance.

 R



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




[PHP] Re: ASP Option Explicit equivalent in PHP

2002-10-09 Thread Nick Eby

wait, I take that back... I meant to see uninitialized variable use, since
there's really no such thing as declaring a variable in PHP unless it's a
class member.

Nick Eby [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 There's 2 ways to get that: use the php.ini setting ERROR_REPORTING, or
the
 function error_reporting().  to see undeclared variable use, call
 error_reporting(E_NOTICE) at the top of your script.

 http://www.php.net/manual/en/function.error-reporting.php

 /nick

 R . Z . [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]...
  I'm on a roll with the ASP questions these days, since I picked up the
  Chiliasp.
 
  Here's one:
 
  ASP has the function Option Explicit build in, it yells when you use
  variables without prior declaration, couldn't find anything like that in
  PHP documentation.
  Thanks in advance.
 
  R





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




Re: [PHP] Image problem

2002-10-09 Thread Owen Prime

If the browser still doesn't listen, you can always put a time() arg in you 
img src. ie. img src=\image.gif? . time() . \

David Erickson wrote:

 I had a similar problem and I just put this in front of my php so
 everytime my scripts are called they always tell the browser and any proxy
 servers not to cache anything from me.
 
 
 header(Expires: Mon, 26 Jul 1997 05:00:00 GMT);// Date in the past
 header(Last-Modified:  . gmdate(D, d M Y H:i:s) .  GMT);
  // always modified
 header(Cache-Control: no-store, no-cache, must-revalidate);  // HTTP/1.1
 header(Cache-Control: post-check=0, pre-check=0, false);
 header(Pragma: no-cache);  // HTTP/1.0
 
 
 - Original Message -
 From: Donahue Ben [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, October 09, 2002 1:00 PM
 Subject: [PHP] Image problem
 
 
 I upload an image.  Once I upload this image using the
 is_uploaded_file function, then writing this image
 file using the copy function.  Everything seems to
 work fine.  When i try to update (that is uploading a
 new file and saving it with the same name as the first
 file created) it shows the first image instead of the
 second image.  So what I did was closed my browser,
 then reopened it, then everything was ok.  So I figure
 that I have a cache problem.  I then tried using the
 clearstatcache() function right after I update this
 image file.  But it did not seem to work.  So am I
 going to have to close and reopen my browser to see
 these changes take place or is there something else I
 can do?

 Ben

 __
 Do you Yahoo!?
 Faith Hill - Exclusive Performances, Videos  More
 http://faith.yahoo.com

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



-- 
Cheers,

Owen Prime
http://www.noggin.com.au

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




[PHP] problem with SUM and Postgres

2002-10-09 Thread webmaster

I can't figure out why the following code is not returning a column
total:

$sql1 = SELECT SUM(hostingcost) FROM $tablename WHERE webserver =
'$webserver';
$hosting = pg_exec($connect, $sql1);
echo $hosting;

This returns: Resource ID #3

The only thing I can think of is that the hostingcost column's default
value is set to MONEY which is a postgres specific constraint.  The
query works fine within psql on the server, but not with php.

Thanks for any help.



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




Re: [PHP] problem with SUM and Postgres

2002-10-09 Thread Marco Tabini

Because pg_exec only executes the query and returns the resource that's
associated with the returns. If you want to read the results, you should
use pg_fetch_result():

$sql1 = SELECT SUM(hostingcost) FROM $tablename WHERE webserver =
'$webserver';
$hosting_rs = pg_exec($connect, $sql1);
$hosting_data = pg_fetch_row ($hosting_rs, 0);
$hosting = $hosting_data[0];


Marco

On Wed, 2002-10-09 at 19:29, webmaster wrote:
 I can't figure out why the following code is not returning a column
 total:
 
 $sql1 = SELECT SUM(hostingcost) FROM $tablename WHERE webserver =
 '$webserver';
 $hosting = pg_exec($connect, $sql1);
 echo $hosting;
 
 This returns: Resource ID #3
 
 The only thing I can think of is that the hostingcost column's default
 value is set to MONEY which is a postgres specific constraint.  The
 query works fine within psql on the server, but not with php.
 
 Thanks for any help.
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



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




Re: [PHP] problem with SUM and Postgres

2002-10-09 Thread Marco Tabini

Sorry, folks... I meant result and not returns below. End of day =
brain fried. :)


Marco

On Wed, 2002-10-09 at 19:32, Marco Tabini wrote:
 Because pg_exec only executes the query and returns the resource that's
 associated with the returns. If you want to read the results, you should
 use pg_fetch_result():
 
 $sql1 = SELECT SUM(hostingcost) FROM $tablename WHERE webserver =
 '$webserver';
 $hosting_rs = pg_exec($connect, $sql1);
 $hosting_data = pg_fetch_row ($hosting_rs, 0);
 $hosting = $hosting_data[0];
 
 
 Marco
 
 On Wed, 2002-10-09 at 19:29, webmaster wrote:
  I can't figure out why the following code is not returning a column
  total:
  
  $sql1 = SELECT SUM(hostingcost) FROM $tablename WHERE webserver =
  '$webserver';
  $hosting = pg_exec($connect, $sql1);
  echo $hosting;
  
  This returns: Resource ID #3
  
  The only thing I can think of is that the hostingcost column's default
  value is set to MONEY which is a postgres specific constraint.  The
  query works fine within psql on the server, but not with php.
  
  Thanks for any help.
  
  
  
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



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




[PHP] CC Processing Merchants

2002-10-09 Thread Andrew Brampton

Sorry for this slightly off topic question, but I beleive many of you will
have delt with this kind of thing before.

My client is asking for a Online Merchant that will allow him to validate
and charge credit cards. He orginally suggested Pay Pals but after I read
their docs I found that the Customers would have to sign up for a Pay Pals
account, which my client dislikes.

So can anyone recommend a good (maybe cheap) Merchant that can validate and
charge credit cards online? My client is searching for some reviews online,
but he asked if I could maybe get a list from progammers which have done it
before.

Thanks
Andrew


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




RE: [PHP] CC Processing Merchants

2002-10-09 Thread Jarrad Kabral

Most of our local banks here in Australia offer merchant facilities.

Judging by your email address your from the UK but I cant see any reason why
it should be different. Why dont you find out who your boss his/her banking
with and contact them regarding a merchant service...?


Regards
Jarrad Kabral



-Original Message-
From: Andrew Brampton [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 10 October 2002 9:49 AM
To: [EMAIL PROTECTED]
Subject: [PHP] CC Processing Merchants


Sorry for this slightly off topic question, but I beleive many of you will
have delt with this kind of thing before.

My client is asking for a Online Merchant that will allow him to validate
and charge credit cards. He orginally suggested Pay Pals but after I read
their docs I found that the Customers would have to sign up for a Pay Pals
account, which my client dislikes.

So can anyone recommend a good (maybe cheap) Merchant that can validate and
charge credit cards online? My client is searching for some reviews online,
but he asked if I could maybe get a list from progammers which have done it
before.

Thanks
Andrew


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

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




Re: [PHP] Found the problem with the libmcrypt.....

2002-10-09 Thread Tom Rogers

Hi,

Thursday, October 10, 2002, 5:35:12 AM, you wrote:
SF Found the problem with libmcrypt-2.5.3.  When I configured PHP using
SF the --with-mcrypt option and the PHP configuration found libmcrypt without a
SF problem.  After compiling and installing it.

SF Once I fired up Apache.  I checked the PHP Info using phpinfo() function.
SF The mcrypt showed up but there is no support ciphers (algorithms  modes).
SF So, I had to use the php.ini as the PHP Manual stated on
SF 'http://php.net/mcrypt'.  So, I added the two lines as shown in the clipping
SF where libmcrypt was installed in.

SF --clip--
SF mcrypt.algorithms_dir = /usr/local/lib/libmcrypt
SF mcrypt.modes_dir = /usr/local/lib/libmcrypt
SF --clip--

SF That is when PHP Info showed the 'mcrypt.algorithms_dir' and
SF 'mcrypt.modes_dir' with data in it.  But the problem is I still get the
SF error message when I tried any mcrypt function, the error message range from
SF being unable to initalize the module to whatever the other error messages
SF are.  I assumed there's a bug and filed a bug report to PHP but was rejected
SF because I was told that I had the php.ini incorrect.  That doesn't make
SF sense.  It took me a long time to find some clues to the problem.  What I
SF found is that with any files in the /usr/local/lib/libmcrypt that end with
SF *.a and *.la, they don't work.  There is no *.c and *.h files in that
SF directory.

SF I discovered that when I set the php.ini to point to the untarred libmcrypt
SF directory where *.c and *.h are found in both
SF '/usr/local/src4/libmcrypt-2.5.3/modules/algorithms' and
SF '/usr/local/src4/libmcrypt-2.5.3/modules/modes'.  That's when the mcrypt
SF function start working without a problem.  The problem is PHP doesn't work
SF with the *.la and *.a files.  Again, I saw the OpenSSL directory where *.c
SF and *.h files are found in both the algorithms and modes directory of the
SF '/usr/local/ssl/include/openssl/' directory, it work just fine too.

SF This had lead me to question of whether is there a bug in libmcrypt or php.
SF You be the judge of it.  It would be so nice if this problem can be
SF resolved.  I'm not sure if I'm allowed to use the open source code instead
SF of the compiled codes.

You dont normally need to specify anything in php.ini for it to work
just make sure you have

--with-mcrypt=/usr/src/mcrypt-2.6.x (thats where it was untarred)

when you configure php. I have it working with nothing set in php.ini

-- 
regards,
Tom


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




[PHP] PHP problem

2002-10-09 Thread Miguel Brs

Hi there,

I need some help here:

1 - I have a table created on a DB where I insert the data that I want.
2 - I have a submit page to submit the info I want to the DB
3 - I have a page that displays the info from the DB (choosed by id)
4 - I have a page where I have a text box field and a button.

When i want to submit some info to database, I give the pretended id (not 
auto_incremment), for example 11 and the rest of the info.
The info is inserted and the id is 11.

Now, I want to see the info with the id 11, so I use the page with the text box 
filed and insert the ID 11. When hit OK, i want to see the info of id 11 
displayed on the (for example) info.php page, where ?id=11.
If i insert the id 12 and if it exists, I want to see the info displayed on 
info.php page, where ?id=12.

Any soul can give me a possible code to use on the search form, in order to see the 
info displayed on the info.php page??

Thx
Miguel 



RE: [PHP] PHP problem

2002-10-09 Thread John W. Holmes

SELECT * FROM yourtable WHERE id = $_REQUEST['id']

And show the results...

All you have to do is make a page that receives the ID you typed in,
uses it in a query, and then shows the result of the query.

---John Holmes...

 -Original Message-
 From: Miguel Brás [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, October 09, 2002 9:33 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] PHP problem
 
 Hi there,
 
 I need some help here:
 
 1 - I have a table created on a DB where I insert the data that I
want.
 2 - I have a submit page to submit the info I want to the DB
 3 - I have a page that displays the info from the DB (choosed by id)
 4 - I have a page where I have a text box field and a button.
 
 When i want to submit some info to database, I give the pretended id
(not
 auto_incremment), for example 11 and the rest of the info.
 The info is inserted and the id is 11.
 
 Now, I want to see the info with the id 11, so I use the page with
the
 text box filed and insert the ID 11. When hit OK, i want to see
the
 info of id 11 displayed on the (for example) info.php page, where
 ?id=11.
 If i insert the id 12 and if it exists, I want to see the info
 displayed on info.php page, where ?id=12.
 
 Any soul can give me a possible code to use on the search form, in
order
 to see the info displayed on the info.php page??
 
 Thx
 Miguel



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




Re: [PHP] Re: POST method not allowed

2002-10-09 Thread Tom Rogers

Hi,

Wednesday, October 9, 2002, 10:19:30 PM, you wrote:
MK Ok, my bad, firstup i didnot set in httpd.conf to process *.php3 files. But
MK i already fix that. So, now all I'm getting is that when I I try to process
MK the data from a form whether I'm using GET or POST method,  the value that i
MK get processed form is still null.

MK I check in the error log file and this is what it say:
MK [Wed Oct 09 20:18:47 2002] [error] PHP Notice:  Undefined variable:  name in
MK e:\program files\apache group\apache\htdocs\test.php3 on line 3

MK Or is there something wrong in my code?

MK form method=GET action=test.php3

MK tr
MK   td width=50% style=border-style: none; border-width: medium
height=20
MK   pName: input type=text name=name size=20/p
MK   pnbsp;/p
MK   pinput type=submit value=Submit name=submitinput type=reset
MK value=Reset name=B2/p
MK /form
MK 
MK ---
MK html
MK ?php
MK print my name is $name;
?
MK /html

Try

?php
print my name is $_GET['name'];
?

If that works lookup register_globals on www.php.net

-- 
regards,
Tom


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




[PHP] displaying a select number of rows from a sql query

2002-10-09 Thread Keith Posehn

Ok, here is the question:

I have a sql query, nothing special. It has 3 variables. I have created the
php code to display the variables in context with the html code. I need it
to loop a select number of times, most likely twice, and therefore display
the first two rows of the query.

In other words, querying the database for a set of rows, it needs to display
the first two of the rows on the page.

Here is the code I have tried so far, which has either looped continuosly or
displayed the top row twice (edited for security):

?php


 $sql  = SELECT * FROM [database] ORDER BY [collumn] LIMIT 2;
 $result = mysql_query($sql) or die(problem with $sql);
 // list($title) = mysql_fetch_array($result);
?

td width=48% align=left valign=top

h3What's New?/h3

?php

/* It tried this: */ while(list($link, $title, $content) =
mysql_fetch_array($result)){

/* And this: */ while($row = mysql_fetch_array($result) and (($count++)2)){

// The first kept looping infinitely, the second displayed the top row
twice. Grr... _

?

h4
a href=?php echo mysql_result($result,0,link); ??php echo
mysql_result($result,0,title); ?/a
/h4
p
?php echo mysql_result($result,0,content); ?
/p

?php
}
?

/td

Thanks for any help you can provide.

-Keith Posehn



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




[PHP] Re: displaying a select number of rows from a sql query

2002-10-09 Thread Owen Prime

With the line:

while (list($link, $title, $content) = mysql_fetch_array($result)) {

The php docs don't actually say what the list() function returns, but since 
your getting an infinite loop i would say that it probably evaluates to 
true no matter whats on the right hand side of the assignment. I would 
suggest that you use:

while ($tmp = mysql_fetch_array($result)) {
list($link, $title, $content) = $tmp;

Cheers,

Owen Prime
http://www.noggin.com.au


Keith Posehn wrote:

 Ok, here is the question:
 
 I have a sql query, nothing special. It has 3 variables. I have created
 the php code to display the variables in context with the html code. I
 need it to loop a select number of times, most likely twice, and therefore
 display the first two rows of the query.
 
 In other words, querying the database for a set of rows, it needs to
 display the first two of the rows on the page.
 
 Here is the code I have tried so far, which has either looped continuosly
 or displayed the top row twice (edited for security):
 
 ?php
 
 
  $sql  = SELECT * FROM [database] ORDER BY [collumn] LIMIT 2;
  $result = mysql_query($sql) or die(problem with $sql);
  // list($title) = mysql_fetch_array($result);
 ?
 
 td width=48% align=left valign=top
 
 h3What's New?/h3
 
 ?php
 
 /* It tried this: */ while(list($link, $title, $content) =
 mysql_fetch_array($result)){
 
 /* And this: */ while($row = mysql_fetch_array($result) and
 (($count++)2)){
 
 // The first kept looping infinitely, the second displayed the top row
 twice. Grr... _
 
 ?
 
 h4
 a href=?php echo mysql_result($result,0,link); ??php echo
 mysql_result($result,0,title); ?/a
 /h4
 p
 ?php echo mysql_result($result,0,content); ?
 /p
 
 ?php
 }
 ?
 
 /td
 
 Thanks for any help you can provide.
 
 -Keith Posehn



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




[PHP] Extract HTML tags

2002-10-09 Thread Shawn McKenzie

I've loaded an html file into a string.  What I'd like to do is create two
new strings:

first new string with the original string but remove all content from the
beginning of the file up to and including body, and then remove from the
end of file up to and including /body

second new string only containing content after head up to and including
body

Any ideas on simple ways to do this?

TIA
-Shawn



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




RE: [PHP] Extract HTML tags

2002-10-09 Thread Smith, Benjamin

There are a couple of ways you could do it, the proper way with a regular expression, 
or you could just kludge it using explode() and chucking out the stuff you did not 
need.

-Original Message-
From: Shawn McKenzie [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 10 October 2002 7:43 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Extract HTML tags


I've loaded an html file into a string.  What I'd like to do is create two
new strings:

first new string with the original string but remove all content from the
beginning of the file up to and including body, and then remove from the
end of file up to and including /body

second new string only containing content after head up to and including
body

Any ideas on simple ways to do this?

TIA
-Shawn



-- 
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: Extract HTML tags

2002-10-09 Thread Owen Prime

If you can guarantee that your body tags are lowercase and have no args, 
then I would check out strtok() in the string functions. If your body tags 
are not that easy to match then I suggest you use either a regex or write a 
state machine to parse the string. A good html parsing state machine is in 
the php source for htmlstriptags. Note that Regex's are extremely expensive 
on large strings.

Cheers,

Owen Prime
http://www.noggin.com.au

Shawn McKenzie wrote:

 I've loaded an html file into a string.  What I'd like to do is create two
 new strings:
 
 first new string with the original string but remove all content from the
 beginning of the file up to and including body, and then remove from the
 end of file up to and including /body
 
 second new string only containing content after head up to and including
 body
 
 Any ideas on simple ways to do this?
 
 TIA
 -Shawn



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




[PHP] Multi-Dimensional Arrays

2002-10-09 Thread Jonathan Duncan

I am trying to create an array to hold shopping cart information.  The array
I am using is called cartArray.  What I want to do is to define a
sub-array of cartArray with the information from one product.  Then the next
time a product is added it appends then new information as a second
sub-array to cartArray and so forth.  Following is some code I have been
using to test with and so far PHP will let me use .= to append but when I
try to call it back with print_r or echo array[][] only the first entry is
returned.  Any ideas what I am doing wrong?


 $brand=Brand1;
 $itemnumber=456789;
 $itemname=Some Item Name;
 $itemqty=3;
 $cartArray[] .= array(0=array($itemnumber=$brand, $itemqty,
$itemname));
 print_r($cartArray).BRBR;
 $brand=Brand2;
 $itemnumber=123456;
 $itemname=Another Item Name;
 $itemqty=9;
 array_push($cartArray, array($itemnumber=$brand, $itemqty,
$itemname));
 print_r($cartArray).BRBR;
 echo $cartArray[0][0].BRBR;


Thank you,
Jonathan Duncan



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




Re: [PHP] Extract HTML tags

2002-10-09 Thread Jonathan

try something along the lines of:

preg_match('/body[^]*([.]*)/body/im', $string, $foo);

$foo[1] = 'your body string';

preg_match('/head([.]*)body/im', $string, $bar);

$bar[1] = 'your head string';

while not tested (and probably off a little) this should get you going...

-js

Shawn McKenzie wrote:
 I've loaded an html file into a string.  What I'd like to do is create two
 new strings:
 
 first new string with the original string but remove all content from the
 beginning of the file up to and including body, and then remove from the
 end of file up to and including /body
 
 second new string only containing content after head up to and including
 body
 
 Any ideas on simple ways to do this?
 
 TIA
 -Shawn
 
 
 




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




Re: [PHP] CC Processing Merchants

2002-10-09 Thread Peter J. Schoenster


On 10 Oct 2002 at 0:48, Andrew Brampton wrote:

 Sorry for this slightly off topic question, but I beleive many of you
 will have delt with this kind of thing before.

Yeah off-topic but I was wondering the same thing myself as I have not 
done many carts in awhile.

 So can anyone recommend a good (maybe cheap) Merchant that can validate
 and charge credit cards online? My client is searching for some reviews
 online, but he asked if I could maybe get a list from progammers which
 have done it before.

A few months ago I setup a client with Authorize.net. I always hated 
using them as I lose control for a click but it worked out well. I save 
all the data before I send them off and then update their record when 
Authorize.net sends them back to the url that I gave them. It has 
worked well.

Last year I used Verisign and they were very good. Very helpful and 
simple API. They bought cybercash who I used to use all the time.

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




Re: [PHP] Re: MySQL back up

2002-10-09 Thread Ken

Okay here is the new code and this is still not working.

?php

require(./config.php);

$sqlserver = $server1;
$sqlusername = $username1;
$sqlpassword = $password1;
$sqldatabase = $database1;

//**
$nam_bak=date('D,d-m-Y');

exec(mysqldump -u\$sqlusername\ -p\$sqlpassword\ \$sqldatabase\ 
$backupdir/$nam.sql);

exec(gzip $backupdir/$nam.sql);

?



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




  1   2   >