Re: Re[2]: [PHP-DB] Table locking

2004-07-15 Thread emre erdogan
Hi...

I want to say some words about the Table Locking problem.

I had a problem something like this one, I find solution for this by locking
only the item that will updated. I added two areas one that has a value 0 or
1 giving it is currently used by someone, and second time it is started to
use, default 0. When someone trying to update the item, first area has the
value 1 and the second has the current time. After update completes, ifrst
has the value 0, and second also 0.

So if someone tries to update the area first system will chack and if
someone is updating the item it will not give permission for this. Also it
will chack the time if update is out of time (ex:more than 15 minutes) it
will reset the time section and will give permission to update this item.

This will provide people to see all other table elements ather then the
updated.

It worked for me...

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



Re: Re[2]: [PHP-DB] Table locking

2004-07-15 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Emre Erdogan wrote:
 Hi...
 
 I want to say some words about the Table Locking problem.
 
 I had a problem something like this one, I find solution for this by locking
 only the item that will updated. I added two areas one that has a value 0 or
 1 giving it is currently used by someone, and second time it is started to
 use, default 0. When someone trying to update the item, first area has the
 value 1 and the second has the current time. After update completes, ifrst
 has the value 0, and second also 0.

I think one row will satisfy, namele a timestamp last_update.

If you generate a form for the user to update the values of the current
record, just add the timestamp as a hidden value. If the user submits
the updated values compare the submitted last_update with the value in
the database. If they are equal, perform the update (and change the
value for last_update). If they are not equal, somebody else has changed 
the values in the meantime and the update should not be executed.

If you are looking for other synchronization techniques you should have
a look at the algorithms by Dekker and Peterson etc... Every website on
computer algorithms will know how they work...

-- 
Tim Van Wassenhove http://home.mysth.be/~timvw

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



[PHP-DB] Re: PHP Max execution time

2004-07-15 Thread Peter Westergaard

Lisi [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I am running a script (called through a browser) that checks entries in a
 table one at a time. As the table has grown, the script takes longer to
run
 than is allowed - 30 seconds.

Of course, I have to ask... is there absolutely no way to optimize your
table so as to use an index or two, or to add a few extra columns to handle
requisite calculations so that you don't need to process each row every
time?

-P

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



RE: [PHP-DB] Re: Hold System

2004-07-15 Thread Justin Palmer
Hi,

Thank you, Peter and all.  This has been of great help.  

Regards,

Justin Palmer


-Original Message-
From: Peter Westergaard [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 15, 2004 6:48 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Re: Hold System


 In the example of Bob, Mary and Barbara that I gave in my last post.  
 If Bob cancels his hold and I reset date_held for mary to the current 
 date, so that she has adiquite time to place her student.  If I do 
 that this will put Barbara into the #1 position because she has now 
 put a hold before Mary.

 With this beig the case, would the best solution be to recursively go 
 through the others holding the student(Mary and Barbara), and set 
 Mary's date_held to now, and Barabara's date_held to a minute after (a

 time which has most likely has not occurred yet) Mary's.

I'd simply go by your date_created (and I'm assuming that's a timestamp
of some kind with minute or second granularity).  Leave that to the time
the record was created.  Then, by definition, the #1 position is
always:

SELECT * FROM hold_tracker
WHERE STUDENT_ID = {whatever} AND valid = 1
ORDER BY date_created ASC
LIMIT 0,1

No need to update anybody's record except Bob's (when it is expired or
cancelled), and Mary's (to indicate when her time window opens).
Barbara's record shouldn't need any sort of touching whatsoever.  No
touchy!

Unless you meant date_created to be the date they created the firm
booking,
not the date they placed the request for a hold.   In which case you
might
substitute 'id', since it will number everything sequentially by order
of receipt anyhow.

-P

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



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



Re: [PHP-DB] Restrict account access to single user

2004-07-15 Thread Pablo M. Rivas
Hello veditio,

You can use sessions: http://www.php.net/manual/en/ref.session.php
and pay attention to: http://www.php.net/manual/en/function.session-cache-expire.php
and session.use_cookies = 0
-- 
Best regards,
 Pablo

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



[PHP-DB] Re: Restrict account access to single user

2004-07-15 Thread Peter Westergaard
 In other words, how do we prevent two users from using the same password
to access the same account at the same time?

There are a few strategies I'd consider... each has plusses and minuses.

1) Lock to one IP.  Keep a table with the most recent IP address, and the
most recent access time.  Any requests coming in within (x) minutes of the
last request, but with a new IP address are blocked.  Downside, people with
rotating IP addresses (doesn't AOL do this?) will be virtually unable to use
the system.  Also, people who switch connections in less time than (x)
minutes will have to wait for their login to expire before re-connecting,
unless they explicitly log out.

2) Lock to a GUID in a session variable.  Keep some sort of GUID in a
session variable open with the logged in user's session.  Tag that user's
account with the GUID (or even, I suppose, with the session identifier?) and
the last access time.  If a new request comes in with a different session
identifier, within a (x) minutes of the last request, block it.  Downside,
people who switch connections (or who close and reopen their browsers) in
less time than (x) minutes will have to wait for their login to expire
before re-connecting, unless they explicitly log out.

3) Prevent flip-flops.  Choose either of the above two methods, and if the
user's data changes, track that in a table which tracks the 3 (or 5, or
whatever) most recent distinct connections.  If a PREVIOUS connection
attempts to interact within a certain time window, lock out one or both for
a certain period.  Advantage - allows a user to recover from an inadvertent
disconnection gracefully.  Disadvantage - malicious users who manage to
somehow steal the connection information could deny service and can inject
transactions until the existing connection attempts a new action.

I'd probably go with 3, but it is more work.

Very curious to hear what others are thinking, though.
-P


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



[PHP-DB] LAST_INSERT_ID?????

2004-07-15 Thread NIPP, SCOTT V (SBCSI)
OK.  I know that a BUNCH of people have had this question, and I
have read numerous Google threads on this, but nothing really seems to
point out the resolution...  I have a table with the Primary Key as an
auto_increment field.  Once I insert a new row of data into the table I
want to direct the user to a Submitted page.  I am trying to pull the
entry number to display for the user as a ticket number.  I would
assume that I should use the LAST_INSERT_ID function for this.
Unfortunately, I am getting either failures or all zeroes for this
output.
I can't even get this function to work in a SQL query window.
Please help!!!  I would attach code to this, but I am not sure what to
attach.

Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com

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



Re: [PHP-DB] LAST_INSERT_ID?????

2004-07-15 Thread Justin Patrin
Try the PHP funciton mysql_insert_id().

http://us3.php.net/manual/en/function.mysql-insert-id.php

On Thu, 15 Jul 2004 15:16:44 -0500, NIPP, SCOTT V (SBCSI)
[EMAIL PROTECTED] wrote:
 OK.  I know that a BUNCH of people have had this question, and I
 have read numerous Google threads on this, but nothing really seems to
 point out the resolution...  I have a table with the Primary Key as an
 auto_increment field.  Once I insert a new row of data into the table I
 want to direct the user to a Submitted page.  I am trying to pull the
 entry number to display for the user as a ticket number.  I would
 assume that I should use the LAST_INSERT_ID function for this.
 Unfortunately, I am getting either failures or all zeroes for this
 output.
 I can't even get this function to work in a SQL query window.
 Please help!!!  I would attach code to this, but I am not sure what to
 attach.
 

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

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



RE: [PHP-DB] LAST_INSERT_ID?????

2004-07-15 Thread Hutchins, Richard
Scott,

I typically use PHP's mysql_insert_id() function on a result. For example,
the following snippet from a function I use:

snip
$result = mysql_query($sql) or
die(mysql_error());

if(!$result){
$evNew = -1;//set evID to an impossible value in case the
query fails
}else{
$evNew = mysql_insert_id();//if the query succeeds, return
the id of the new event
}

return $evNew;
/snip

Works like a charm.

Rich


 -Original Message-
 From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]
 Sent: Thursday, July 15, 2004 4:17 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] LAST_INSERT_ID?
 
 
   OK.  I know that a BUNCH of people have had this question, and I
 have read numerous Google threads on this, but nothing really seems to
 point out the resolution...  I have a table with the Primary Key as an
 auto_increment field.  Once I insert a new row of data into 
 the table I
 want to direct the user to a Submitted page.  I am trying 
 to pull the
 entry number to display for the user as a ticket number.  I would
 assume that I should use the LAST_INSERT_ID function for this.
 Unfortunately, I am getting either failures or all zeroes for this
 output.
   I can't even get this function to work in a SQL query window.
 Please help!!!  I would attach code to this, but I am not sure what to
 attach.
 
 Scott Nipp
 Phone:  (214) 858-1289
 E-mail:  [EMAIL PROTECTED]
 Web:  http:\\ldsa.sbcld.sbc.com
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



[PHP-DB] Re: LAST_INSERT_ID?????

2004-07-15 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Scott V Nipp wrote:
 I am trying to pull the
 entry number to display for the user as a ticket number.  I would
 assume that I should use the LAST_INSERT_ID function for this.
 Unfortunately, I am getting either failures or all zeroes for this
 output.
   I can't even get this function to work in a SQL query window.
 Please help!!!  I would attach code to this, but I am not sure what to
 attach.

Try SELECT LAST_INSERT_ID() AS id;

-- 
Tim Van Wassenhove http://home.mysth.be/~timvw

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



Re: [PHP-DB] LAST_INSERT_ID?????

2004-07-15 Thread Justin Patrin
On Thu, 15 Jul 2004 16:25:26 -0400, Hutchins, Richard
[EMAIL PROTECTED] wrote:
 Scott,
 
 I typically use PHP's mysql_insert_id() function on a result. For example,
 the following snippet from a function I use:
 
 snip
 $result = mysql_query($sql) or
 die(mysql_error());
 

With the or die() above, $result will never be false.

 if(!$result){
 $evNew = -1;//set evID to an impossible value in case the
 query fails
 }else{
 $evNew = mysql_insert_id();//if the query succeeds, return
 the id of the new event
 }
 
 return $evNew;
 /snip
 
 Works like a charm.
 
 Rich
 
 
 
 
  -Original Message-
  From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]
  Sent: Thursday, July 15, 2004 4:17 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] LAST_INSERT_ID?
 
 
OK.  I know that a BUNCH of people have had this question, and I
  have read numerous Google threads on this, but nothing really seems to
  point out the resolution...  I have a table with the Primary Key as an
  auto_increment field.  Once I insert a new row of data into
  the table I
  want to direct the user to a Submitted page.  I am trying
  to pull the
  entry number to display for the user as a ticket number.  I would
  assume that I should use the LAST_INSERT_ID function for this.
  Unfortunately, I am getting either failures or all zeroes for this
  output.
I can't even get this function to work in a SQL query window.
  Please help!!!  I would attach code to this, but I am not sure what to
  attach.
 



-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

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



[PHP-DB] Printing selected characters (strcnt?)

2004-07-15 Thread Vincent Jordan
I am trying to figure out how to select the first letter of from the form
field print it then append by datetime.

Here is an example:

snip
$first_name = $_POST['first_name'];
$last_name  = $_POST['last_name'];
$name = $first_name . ' ' . $last_name
$rma = ?strcnt($last_name), 1 . Datetime(?) // takes the 1st character from
$last_name and adds datetime in format of 715041200
/snip

Thanks any help appreciated


Vincent Jordan
Technical Support
Smart Parts, Inc.
Loyalhanna Business Complex
100 Station Street
Loyalhanna, PA 15661
800-992-2147 X 5617

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



RE: [PHP-DB] Printing selected characters (strcnt?)

2004-07-15 Thread Galbreath, Mark A
Isn't there a tokenizer method?

Mark

-Original Message-
From: Vincent Jordan [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 15, 2004 5:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Printing selected characters (strcnt?)


I am trying to figure out how to select the first letter of from the form
field print it then append by datetime.

Here is an example:

snip
$first_name = $_POST['first_name'];
$last_name  = $_POST['last_name'];
$name = $first_name . ' ' . $last_name
$rma = ?strcnt($last_name), 1 . Datetime(?) // takes the 1st character from
$last_name and adds datetime in format of 715041200
/snip

Thanks any help appreciated


Vincent Jordan
Technical Support
Smart Parts, Inc.
Loyalhanna Business Complex
100 Station Street
Loyalhanna, PA 15661
800-992-2147 X 5617

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

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



Re: [PHP-DB] Printing selected characters (strcnt?)

2004-07-15 Thread Matt M.
 $first_name = $_POST['first_name'];
 $last_name  = $_POST['last_name'];
 $name = $first_name . ' ' . $last_name
 $rma = ?strcnt($last_name), 1 . Datetime(?) // takes the 1st character from
 $last_name and adds datetime in format of 715041200

$rma = substr ($last_name, 0 , 1).Your.Datetime;

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



[PHP-DB] Ldap query problem

2004-07-15 Thread Ryan Jameson
My LDAP queries seem to have a problem with parenthesis, does anyone know
how to fix this?

Example...

Criteria  cn=Ryan Jameson* works fine returning user with cn=Ryan Jameson
(MyDomain)

But...

Criteria cn=Ryan Jameson (MyDomain) returns nothing. :-\

 Ryan

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



RE: [PHP-DB] Ldap query problem

2004-07-15 Thread Swan, Nicole
Do you have some code you can provide so we can get a better idea of what you're 
trying to do?  

My guess is that the filter isn't set up quite right (as in the base dn you're 
attaching to get the dn is not formatted correctly).  What exactly are you trying to 
achieve?

--Nicole
---
Nicole Swan
Web Programming Specialist
Carroll College CCIT
(406)447-4310


-Original Message-
From: Ryan Jameson [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 15, 2004 3:46 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Ldap query problem


My LDAP queries seem to have a problem with parenthesis, does anyone know
how to fix this?

Example...

Criteria  cn=Ryan Jameson* works fine returning user with cn=Ryan Jameson
(MyDomain)

But...

Criteria cn=Ryan Jameson (MyDomain) returns nothing. :-\

 Ryan

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

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



RE: [PHP-DB] Ldap query problem

2004-07-15 Thread Ryan Jameson \(USA\)
I found it! The parenthesis need to be escaped, which I had tried, but
silly PHP went and escaped my escapes... :-\  So the criteria on the
query needed to be cn=Ryan Jameson \(MyDomain\) ... I was entering the
criteria via a form which PHP conveniently turned into cn=Ryan Jameson
\\(MyDomain\\) which didn't work. Thanks for the response!!!

 Ryan

-Original Message-
From: Swan, Nicole [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 15, 2004 4:01 PM
To: Ryan Jameson; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Ldap query problem

Do you have some code you can provide so we can get a better idea of
what you're trying to do?  

My guess is that the filter isn't set up quite right (as in the base dn
you're attaching to get the dn is not formatted correctly).  What
exactly are you trying to achieve?

--Nicole
---
Nicole Swan
Web Programming Specialist
Carroll College CCIT
(406)447-4310


-Original Message-
From: Ryan Jameson [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 15, 2004 3:46 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Ldap query problem


My LDAP queries seem to have a problem with parenthesis, does anyone
know how to fix this?

Example...

Criteria  cn=Ryan Jameson* works fine returning user with cn=Ryan
Jameson
(MyDomain)

But...

Criteria cn=Ryan Jameson (MyDomain) returns nothing. :-\

 Ryan

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

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

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



Re: [PHP-DB] Printing selected characters (strcnt?)

2004-07-15 Thread Matthew McNicol
Try this:
// takes the 1st character from $last_name and adds
// datetime in format of DDMMYYhhmm
$rma = substr( $last_name, 0, 1) . date(dmyHi);
See:
aspn.activestate.com/ASPN/docs/PHP/function.substr.html
uk2.php.net/date


Vincent Jordan wrote:
I am trying to figure out how to select the first letter of from the form
field print it then append by datetime.
Here is an example:
snip
$first_name = $_POST['first_name'];
$last_name  = $_POST['last_name'];
$name = $first_name . ' ' . $last_name
$rma = ?strcnt($last_name), 1 . Datetime(?) // takes the 1st character from
$last_name and adds datetime in format of 715041200
/snip
Thanks any help appreciated
Vincent Jordan
Technical Support
Smart Parts, Inc.
Loyalhanna Business Complex
100 Station Street
Loyalhanna, PA 15661
800-992-2147 X 5617
--
_
Matthew McNicol
yellowmarker.co.uk
PHP / MySQL web development
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] execut MS SQL stored proc

2004-07-15 Thread Damien Babilon
Hi All,
To resolve my last prolem, I've switched of server, I'm now on a WIN2000 
ox with PHP 4.8 and Apache 1.3, thanks for your reply

Now
I try to execute a Stored procedure on a mssql box. The connection is 
ok, ut I can't get the results.
The stored procedure did'n return a recordset, it return simple text and 
I did'n find (since more than 5 hours now) how to set my vars in php !!!

Here is the code:
   $mssql_host=xxx.xxx.xxx.xxx;
   $mssql_username=USER;
   $mssql_password=PASSWD;
   $mssql_db=DBNAME;
   $conn=mssql_connect($mssql_host,$mssql_username,$mssql_password)
   or Die(Couldn't connect to MSSQL Server $mssql_host);
   mssql_select_db($mssql_db,$conn)
   or Die(Couldn't open database $mssql_db);
   $proc=mssql_init(sp_WebCustomerGet,$conn);
  
   $rc=0;
   $userid=damien;
   $lang=;
   $pin=;
   $fma=;
   $fmtn=;
   $res=;

   mssql_bind($proc,@RC,$rc,SQLINT1,TRUE,FALSE);
   mssql_bind($proc,@Id,$userid,SQLVARCHAR,FALSE,20); # = the param 
I give to the SP
   mssql_bind($proc,@Language,$lang,SQLCHAR,TRUE,FALSE,5);
   mssql_bind($proc,@Pin,$pin,SQLCHAR,TRUE,FALSE,4);
   mssql_bind($proc,@FollowMeActive,$fma,SQLBIT,TRUE,FALSE);
   
mssql_bind($proc,@FollowMeTelephoneNumber,$fmtn,SQLVARCHAR,TRUE,TRUE,25);
   mssql_bind($proc,@Result,$res,SQLVARCHAR,TRUE,TRUE,256);

   $rs=mssql_execute($proc);
   echo Return code:.$rc.br;
   echo Lang = .$lang.br;
   echo Pin = .$pin.br;
   echo FollowMeActive = .$fma.br;
   echo FollowMeTelephoneNumer = .$fmtn.br;
   echo Result = .$res;

Here is the result of the SP with Query analyser:
(1 row(s) affected)
Stored Procedure: EuroGSMTest.dbo.sp_WebCustomerGet
   Return Code = 0
   Output Parameter(s):
   @Language = fr-BE
   @Pin = 4321
   @FollowMeActive = 0
   @FollowMeTelephoneNumber = NULL
   @Result = Ok
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] execut MS SQL stored proc

2004-07-15 Thread Damien Babilon
Hi All,
To resolve my last prolem, I've switched of server, I'm now on a WIN2000 
ox with PHP 4.8 and Apache 1.3, thanks for your reply

Now
I try to execute a Stored procedure on a mssql box. The connection is 
ok, ut I can't get the results.
The stored procedure did'n return a recordset, it return simple text and 
I did'n find (since more than 5 hours now) how to set my vars in php !!!

Here is the code:
  $mssql_host=xxx.xxx.xxx.xxx;
  $mssql_username=USER;
  $mssql_password=PASSWD;
  $mssql_db=DBNAME;
  $conn=mssql_connect($mssql_host,$mssql_username,$mssql_password)
  or Die(Couldn't connect to MSSQL Server $mssql_host);
  mssql_select_db($mssql_db,$conn)
  or Die(Couldn't open database $mssql_db);
  $proc=mssql_init(sp_WebCustomerGet,$conn);
 
  $rc=0;
  $userid=damien;
  $lang=;
  $pin=;
  $fma=;
  $fmtn=;
  $res=;

  mssql_bind($proc,@RC,$rc,SQLINT1,TRUE,FALSE);
  mssql_bind($proc,@Id,$userid,SQLVARCHAR,FALSE,20); # = the param 
I give to the SP
  mssql_bind($proc,@Language,$lang,SQLCHAR,TRUE,FALSE,5);
  mssql_bind($proc,@Pin,$pin,SQLCHAR,TRUE,FALSE,4);
  mssql_bind($proc,@FollowMeActive,$fma,SQLBIT,TRUE,FALSE);
  
mssql_bind($proc,@FollowMeTelephoneNumber,$fmtn,SQLVARCHAR,TRUE,TRUE,25);
  mssql_bind($proc,@Result,$res,SQLVARCHAR,TRUE,TRUE,256);

  $rs=mssql_execute($proc);
  echo Return code:.$rc.br;
  echo Lang = .$lang.br;
  echo Pin = .$pin.br;
  echo FollowMeActive = .$fma.br;
  echo FollowMeTelephoneNumer = .$fmtn.br;
  echo Result = .$res;

Here is the result of the SP with Query analyser:
(1 row(s) affected)
Stored Procedure: EuroGSMTest.dbo.sp_WebCustomerGet
  Return Code = 0
  Output Parameter(s):
  @Language = fr-BE
  @Pin = 4321
  @FollowMeActive = 0
  @FollowMeTelephoneNumber = NULL
  @Result = Ok
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Re: Restrict account access to single user

2004-07-15 Thread Miles Thompson
They are all good suggestions, Tim's is probably the most sophisticated, 
but it's inevitable that usernames and passwords will escape.

On top of this I'd add a weekly count of user logins, so that the users in 
effect buy a given amount of accesses each week.

If you're really serious, you will have to be somewhat brutal with your 
users - change the password, make it a difficult to remember combination, 
and do it often enough that they know you mean business.

We've been fighting with this for four years, and there's no perfect 
solution. If it's a site where you are distributing published materials 
(.pdf's) you may take a good look at what Adobe calls, or used to call, Web 
Merchant, bite the bullet on the licensing and royalty fees, and reconcile 
yourself to a Windows / IIS solution.

Cheers - Miles Thompson
At 02:23 PM 7/15/2004, Tim Van Wassenhove wrote:
In article 
[EMAIL PROTECTED], 
[EMAIL PROTECTED] wrote:
 Because this is a revenue-based site, and users buy a password for 
access, we're wondering what the best php/mysql mechanism would be to 
allow only one person to access their account at a time.

 In other words, how do we prevent two users from using the same 
password to access the same account at the same time?

If a user logs in:
store the login timestamp in the database
store the uid and timestamp in a session variable.
If a user requests a page:
compare the uid and timestamp in the session with the ones in the database.
This way:
Every user that tries to login with a valid uid/pwd gets access.
Every session with the same uid but older timestamp expires.
Don't applaud, just throw money :D
--
Tim Van Wassenhove http://home.mysth.be/~timvw
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Easy reg expression problem

2004-07-15 Thread Jason Wong
On Friday 16 July 2004 08:05, Justin Patrin wrote:

  If you're simply trying to get '@email.com' then use strstr().

 Of courseI'm just so used to pregs...

Well the advantage of using a regex is that you can perform some form of 
validation on the address.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Never mind the bullet with your name on it, try to avoid the shrapnel 
addressed to occupant
-- Murphy's New Military Laws n4
*/

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



[PHP-DB] session_start

2004-07-15 Thread Steve Butzel
I have set the session.save_path (in my php.ini-recommended AND php.ini-dist
file) to c:\php4\sess\tmp. I have also created those directories
accordingly.

However, when I try to browse a very simple .php file (see below) that
includes session_start(): I am getting the following error messages:
Warning: session_start(): open(/tmp\sess_09ecd436e04fa9e49bc155300154ad63,
O_RDWR) failed: No such file or directory (2) in c:\program files\apache
group\apache\htdocs\practice\movie1.php on line 2

It appears that Apache/PHP still thinks the session.save_path is /tmp, even
though I changed this in php.ini-recommended and php.ini-dist. **What am I
doing wrong?**


Thanks,
Steve
[EMAIL PROTECTED]

---
?php
session_start();
$_SESSION['username']=Joe12345;
$_SESSION['authuser']=1;
?

html
head
titleFind My Favorite Movie/title
/head

body
?php
 $myfavmovie=urlencode(Long Live Science);
 echo a
href='http://localhost/practice/moviesite.php?favmovie=$myfavmovie';
 echo Click here to see info about my favorite movie./a;
?

/body
/html

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



[PHP-DB] Re: session_start

2004-07-15 Thread Peter Westergaard
Steve Butzel [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 It appears that Apache/PHP still thinks the session.save_path is /tmp,
even
 though I changed this in php.ini-recommended and php.ini-dist. **What am I
 doing wrong?**

Have you changed it in the version of php.ini which was copied to your
windows system folder?

That's the version which matters.  php.ini-recommended and php.ini-dist are
just the templates you can use as a starting point to create your system
php.ini.

-P

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



Re: [PHP-DB] session_start

2004-07-15 Thread Jason Wong
On Friday 16 July 2004 08:15, Steve Butzel wrote:

 It appears that Apache/PHP still thinks the session.save_path is /tmp, even
 though I changed this in php.ini-recommended and php.ini-dist. **What am I
 doing wrong?**

Firstly, to see what your settings really are, use phpinfo(). Secondly, when 
you use phpinfo() you will see that the ini file you need to edit is called 
php.ini. Note the path and edit that file, if it's not there then copy one of 
php.ini-* there.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Okay ... I'm going home to write the I HATE RUBIK's CUBE HANDBOOK FOR
DEAD CAT LOVERS ...
*/

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



Re: [PHP-DB] session_start

2004-07-15 Thread John W. Holmes
Jason Wong wrote:
On Friday 16 July 2004 08:15, Steve Butzel wrote:
It appears that Apache/PHP still thinks the session.save_path is /tmp, even
though I changed this in php.ini-recommended and php.ini-dist. **What am I
doing wrong?**
Firstly, to see what your settings really are, use phpinfo(). Secondly, when 
you use phpinfo() you will see that the ini file you need to edit is called 
php.ini. Note the path and edit that file, if it's not there then copy one of 
php.ini-* there.
and actually rename it to php.ini, please. :)
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php