Tutorial for Livecode Server log in system
pere xavier Rossello
pxrossello at gmail.com
Tue Mar 26 07:58:06 EDT 2024
cont ( make mistakes pushing tab on keyboard)
full scrip
<?lc
put $_SERVER["REQUEST_METHOD"] into gMetodo
--------------------------------------------------------- getting data from
form
if gMetodo = "POST" then
put $_POST["login"] into gUsr
put $_POST["pass"] into gPass
put $_POST["tipo"] into gTipo
else
put $_GET["login"] into gUsr
put $_GET["pass"] into gPass
put $_GET["tipo"] into gTipo
end if
--------------------------------------------- check if data is valid.
if len(gUsr)<2 or len(gPass)<2 then
put "<script>"
put "window.location='index.html?_e=Error_sin_login';"
put "</script>"
end if
-------------------- retrive pass from database
put revOpenDatabase ("mysql",
"localhost:3363","reparacion","gsmmax","11*Endimion_grd") into gDbId
put "select pass,id,token from tecnicos where login='" & gUsr & "';" into
tSQL
put tSQL & "<br>"
put revDataFromQuery(tab, return, gDbID, tSQL) into tRes
set itemdelimiter to tab
put item 1 of tRes into tPass
put item 2 of tRes into tCod
put item 3 of tRes into tToken
if tPass <> gPass then
-------------------------- error -----------------
put "<script>"
put "window.location='index.html?_e=Error Password';"
put "</script>"
else
------------ Pass oK continue
put "<script>"
put "window.location='vrep.lc?token=" & tToken &"';"
put "</script>"
end if
revCloseDatabase gDbId
?>
if someone want to try it:
https://mpibox.com/rep/
login:
user: test
pass: admin
if you need some help let me know.
P.D.
sorry for spelling mistakes. and other copy/paste
El mar, 26 mar 2024 a las 12:45, pere xavier Rossello (<pxrossello at gmail.com>)
escribió:
> Hi.
>
> To make online log in is quit easy in livecode.
> first you need a webpage with a form asking username, email and password )
> and submit to a livecode script
> <form id="idlogin" name="login" action="rlogin.lc" method="get"
> enctype="text/plain">
> <input type="text" id="signup" name="login"
> placeholder="Usuario" required>
> <input type="password" name="pass" placeholder="Password"
> required>
> <button type="submit">Log in</button>
> </form>
> --- method can be to types get or post - normally I use Get
> this will send username and pass to tloging.lc script
>
> and the livecode code script
> -------------------------
> <?lc
> put $_SERVER["REQUEST_METHOD"] into gMetodo
> if gMetodo = "POST" then
> put $_POST["login"] into gUsr
> put $_POST["pass"] into gPass
> put $_POST["tipo"] into gTipo
>
> else
> put $_GET["login"] into gUsr
> put $_GET["pass"] into gPass
> put $_GET["tipo"] into gTipo
> end if
> if gPass = "print" and gUsr = "print" then
> put "<script>"
> put "window.location='impr_pend.lc?t=impresion';"
> put "</script>"
> end if
> if len(gUsr)<2 or len(gPass)<2 then
>
> put "<script>"
> put "window.location='index.html?_e=Error_sin_login';"
> put "</script>"
> end if
> put revOpenDatabase ("mysql",
> "localhost:3363","reparacion","gsmmax","11*Endimion_grd") into gDbId
>
> --put revdb_execute(gDbId, tSQL, "") into tResultado
> put "select pass,id,token from tecnicos where login='" & gUsr & "';" into
> tSQL
> put tSQL & "<br>"
> put revDataFromQuery(tab, return, gDbID, tSQL) into tRes
>
> set itemdelimiter to tab
> put item 1 of tRes into tPass
> put item 2 of tRes into tCod
> put item 3 of tRes into tToken
>
>
>
>
>
>
>
> El mar, 26 mar 2024 a las 6:15, Tim Selander via use-livecode (<
> use-livecode at lists.runrev.com>) escribió:
>
>> Hi all.
>>
>> As a hobbiest/amateur I continue to plunk away with Livecode, mostly the
>> server product in my on-rev account.
>>
>> Can anyone point me to a tutorial or sample of an online log in system
>> (username, email and password) for a website using Livecode?
>>
>> I've found some php tutorials, and /think/ I could glean enough hints to
>> roll my own in LC server, but would greatly prefer to start with LC
>> itself!
>>
>> Any help appreciated!
>>
>> Tim Selander
>> Japan
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
More information about the use-livecode
mailing list