View previous topic :: View next topic |
Author |
Message |
damento Newbie cheater Reputation: 0
Joined: 25 Mar 2014 Posts: 17
|
Posted: Wed Jan 20, 2016 8:56 pm Post subject: remember me - checkbox for login form? |
|
|
I've been trying to do this for a while, I guess I need to make a .conf file and have io.read() check the username and password and send it to php script as normal,
is this possible? so if remember.conf exists, the login window will use the username=example and password=example lines, and send the data after = on each straight to my php script?
Not sure how to explain better, been playing around a lot with it and can't get it to work, not looking for a complete spoonfeed but any help/advice would be greatly appreciated
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 54
Joined: 01 Oct 2008 Posts: 941
|
Posted: Wed Jan 20, 2016 10:34 pm Post subject: |
|
|
May use getSettings function.
It return an object allow save/load data in your user's registry, so external/disk storage is not need, and the operation is simpler, ie. no io.read/write.
Code: | -- code not tested
local mysetting = getSettings("myTrainer") -- this is path, may think it group relevance setting into a set
mysetting.Value["username"] = 'abc' -- save username string input form user, for example
mysetting.Value["paid"] = 100 -- save number
--read back from registry
local username = mysetting.Value["username"]
local paid = tonumber(mysetting.Value["paid"]) -- number is save as string internally, need to convert it back to number type
local password = mysetting.Value["password"]
local inet = getInternet() -- send data to server, ce 6.5 function
local response = inet.getURL("http://myserver.com/check.php?username="..username.."&password="..password) -- etc.
|
You may want to validate the input on server for security.
bye~
_________________
- Retarded. |
|
Back to top |
|
|
damento Newbie cheater Reputation: 0
Joined: 25 Mar 2014 Posts: 17
|
Posted: Thu Jan 21, 2016 11:48 am Post subject: |
|
|
Thanks panraven, will give it a go.
My login script sends 3 or 4 posts to a php script, to check the IP matches the username in database, to make sure the user has a subscription, and to make sure the username and password match.
I wonder if it's possible to use your example for this? Fries my brain thinking how, bit of a tricky situation here
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 54
Joined: 01 Oct 2008 Posts: 941
|
Posted: Thu Jan 21, 2016 3:00 pm Post subject: |
|
|
The Internet Class has a Header property, probably with proper setting of this property , the internet class can also send larger and even binary data by post method, but I knew little about this~
Code: | Internet class (Object)
global functions
getInternet(string) - Returns an internet class object
properties
Header : string - the additional header to be sent with the next getURL request
methods
getURL(path) - returns a string containing the contents of the url. nil on failure |
_________________
- Retarded. |
|
Back to top |
|
|
damento Newbie cheater Reputation: 0
Joined: 25 Mar 2014 Posts: 17
|
Posted: Thu Jan 21, 2016 5:57 pm Post subject: |
|
|
What would I put for path, to be the same folder as the trainer? Because I have no idea what folder users may put it in.
EDIT:
Figured the getSettings may be the best class to use here, and use a 'REMEMBER' button to remember the content of the username & password textbox.
I can't seem to make the value, the same value as the textbox?
settings=getSettings('sSaveSettings')
settings.Value['sUsername']= GUI[1].editu.Text
settings.Value['sPassword']= GUI[1].editp.Text
Any idea how I can do this correctly? May be a noob question, still learning
UPDATE:
I managed to do it, took me a bit of playing around but was determined to get it done. This was the end working result to any future viewers:
settings=getSettings('sSaveSettings')
settings.Value['sUsername']= editu.Text;
settings.Value['sPassword']= editp.Text;
Thank you for the help given, great community
|
|
Back to top |
|
|
|