The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Registration
Author Message
Llirik
Journeyman
*

Posts: 115
Likes Given: 0
Likes Received: 10 in 8 posts
Joined: Feb 2015
Reputation: 0

UO Forum

Post: #1
Registration
This is right script?

[FUNCTION f_account_register]
if !<file.inuse>
file.mode.create=1
file.mode.append=1
file.mode.writeflag=1
if <file.open accounts/sphereacct.scp>
db.query SELECT * FROM register WHERE activ=0
if <db.row.numrows>
for i 0 <eval <db.row.numrows>-1>
file.writeline [<db.row.<eval <local.i>>.0>]
file.writeline password=<db.row.<eval <local.i>>.1>
db.execute UPDATE register SET activ=1 WHERE login=<db.row.<eval <local.i>>.0>
endfor
endif
file.close
ACCOUNT UPDATE
endif
else
serv.log Write error(f_test)
endif
09-30-2015 07:38 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #2
RE: Registration
Do you have any special need of using FILE commands there? ACCOUNT ADD <db.row.<dlocal.i>.0> <db.row.<dlocal.i>.1> will do the job.
09-30-2015 09:43 PM
Find all posts by this user Like Post Quote this message in a reply
Llirik
Journeyman
*

Posts: 115
Likes Given: 0
Likes Received: 10 in 8 posts
Joined: Feb 2015
Reputation: 0

UO Forum

Post: #3
RE: Registration
[FUNCTION f_account_register]
db.query SELECT * FROM register WHERE activ=0
if <db.row.numrows>
for i 0 <eval <db.row.numrows>-1>
ACCOUNT ADD <db.row.<dlocal.i>.0> <db.row.<dlocal.i>.1>
db.execute UPDATE register SET activ=1 WHERE login=<db.row.<eval <local.i>>.0>
endfor
endif
ACCOUNT UPDATE

Right?
(This post was last modified: 10-01-2015 02:09 AM by Llirik.)
10-01-2015 01:52 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #4
RE: Registration
ACCOUNT UPDATE is used only to move your temporary accounts from sphereacct.scp to permanently create it sphereaccu.scp. So you can remove this ACCOUNT UPDATE since you're not using these files anymore

also for security reasons you must always use ' ' on values and " " around the SQL function. This can prevent some SQL exploits like ppl trying to hack your SQL command to add more fields, etc

Code:
[FUNCTION f_account_register]
DB.QUERY "SELECT * FROM register WHERE activ='0'"
IF (<DB.ROW.NUMROWS>)
  FOR 0 <eval <DB.ROW.NUMROWS>-1>
    ACCOUNT ADD <DB.ROW.<LOCAL._FOR>.0> <DB.ROW.<LOCAL._FOR>.1>
    DB.EXECUTE "UPDATE register SET activ='1' WHERE login='<DB.ROW.<LOCAL._FOR>.0>' LIMIT 1"
  ENDFOR
ENDIF
10-01-2015 07:40 AM
Find all posts by this user Like Post Quote this message in a reply
Llirik
Journeyman
*

Posts: 115
Likes Given: 0
Likes Received: 10 in 8 posts
Joined: Feb 2015
Reputation: 0

UO Forum

Post: #5
RE: Registration
This is right?

[ITEMDEF i_account_register]
ID=i_guildstone

ON=@CREATE
TIMERF 1, f_account_register

[FUNCTION f_account_register]
db.query SELECT * FROM register WHERE activ="0"
if <db.row.numrows>
serv.account add <db.row.login> <db.row.pass>
db.execute UPDATE register SET activ="1" WHERE login="<db.row.login>"
serv.account update
serv.log Account created: <db.row.login>
endif
TIMERF 1, f_account_register

Or

db.query SELECT * FROM register WHERE activ="0" limit 1 // limit???
if <db.row.numrows>
serv.account add <db.row.login> <db.row.pass>
db.execute UPDATE register SET activ="1" WHERE login="<db.row.login>" limit 1 // limit???
serv.account update
serv.log Account created: <db.row.login>
endif

Thank you!
(This post was last modified: 08-15-2016 09:19 AM by Llirik.)
08-15-2016 09:08 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Llirik
Journeyman
*

Posts: 115
Likes Given: 0
Likes Received: 10 in 8 posts
Joined: Feb 2015
Reputation: 0

UO Forum

Post: #6
RE: Registration
db.query SELECT * FROM register WHERE activ="0"
if <db.row.numrows>
serv.account add <db.row.login> <db.row.pass>
db.execute UPDATE register SET activ="1" WHERE login="<db.row.login>" and activ="0" limit 1
serv.account update
serv.log Account created: <db.row.login>
endif

;-)
08-15-2016 10:31 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)