Livecode Server and Repeat Scripts on Server
JOHN PATTEN
johnpatten at me.com
Thu Jul 31 20:31:57 EDT 2014
Hi All,
I’m experimenting with LiveCode server. Trying to get my head around some of the challenges of scripting on the server. I’ve come up with one I’m a bit stuck on.
I have a four line csv text file on server consisting of username, password, and email. i.e. jdoe, password, jdoe at bmail.com etc.
I am trying to test for duplicate user names when user creates an account in the stack. I’m having trouble with the recognizing the duplicate user account in my script. It just runs through the complete script.
Here’s my script:
<?lc
put $_POST["username"] into tUsername
put $_POST["password"] into tPassword
put $_POST["email"] into tEmail
put url("file:users.txt") into tUserFile
repeat for each line thisLine in tUserFile
if item 1 of tLine is tUsername then
put "Sorry, username (" && tUserName && ") has already been used. Try another."
exit repeat
else
put return & tUsername & "," & tPassword & "," & tEmail & "," & "Button 1" --after tUserFile
--open file "users.txt" for write
--write tUserFile to file "users.txt"
--close file "users.txt"
--put tUsername & "," & "Button 1"
--exit repeat
end if
end repeat
?>
Anybody have an idea why even with a duplicate username the script continues on?
Thank you!
John Patten
SUSD
More information about the use-livecode
mailing list