Feb-04-2019, 08:51 PM
I am trying to learn about forms and server side scripting with python. I read the w3c forms tutorial and then watched the tutorials here: https://pythonschool.net/server-side-scr...de-script/ where he shows how to capture form data, and then goes on to show how to use a MySQL DB.
So I got things working, and have apache, MySQL and MySQL connector installed and working. I can type a name in and the code checks (using a simple name lookup) if it is in the DB, and if not adds it.
So as part of this I decided to try to make a login type form, with username and password - this works, but was stored plaintext, and I wanted to go further so read about hashing, and installed passlib with pip, and also did pip install passlib[argon2].
Now if I write a program and run it locally it works fine, but when I run the localhost code it says module not found. I think it is because the cgi-bin directory is in /usr/lib/cgi-bin. Does anyone know how I can fix this?
Other questions: I have heard about SQL injection and watched a video on youtube where he showed how it works and how he could then get data out of the DB. So I thought there would be some sort of SQL validator, either server side with python, or client side with javascript, but I couldn't find one. Obviously this is all running locally but in learning I want to do it right, so do I need to worry about this with MySQL and the python MySQL connector package?
For these next questions, I don't need code, more pointing in the right direction so I know where to look to figure them out. So I have seen forms where when you hover over them, something pops up to give you info about that field. Is this javascript or come css trickery?
Another thing I was thinking about trying to implement is the distance between users, so they could enter a location, and then it would tell them the distance to another user (like online dating sites do, according to my sister who loves them!) so I wondered how this was done. Also how do sites geolocate via IP?
If you have any other tips or advice for me regarding this area of python I would be happy to hear them.
I knew I'd forget a question: I have seen sign-up forms where, when you type in a username, it checks if it is available, is this javascript or how is this done?
So I got things working, and have apache, MySQL and MySQL connector installed and working. I can type a name in and the code checks (using a simple name lookup) if it is in the DB, and if not adds it.
So as part of this I decided to try to make a login type form, with username and password - this works, but was stored plaintext, and I wanted to go further so read about hashing, and installed passlib with pip, and also did pip install passlib[argon2].
Now if I write a program and run it locally it works fine, but when I run the localhost code it says module not found. I think it is because the cgi-bin directory is in /usr/lib/cgi-bin. Does anyone know how I can fix this?
Other questions: I have heard about SQL injection and watched a video on youtube where he showed how it works and how he could then get data out of the DB. So I thought there would be some sort of SQL validator, either server side with python, or client side with javascript, but I couldn't find one. Obviously this is all running locally but in learning I want to do it right, so do I need to worry about this with MySQL and the python MySQL connector package?
For these next questions, I don't need code, more pointing in the right direction so I know where to look to figure them out. So I have seen forms where when you hover over them, something pops up to give you info about that field. Is this javascript or come css trickery?
Another thing I was thinking about trying to implement is the distance between users, so they could enter a location, and then it would tell them the distance to another user (like online dating sites do, according to my sister who loves them!) so I wondered how this was done. Also how do sites geolocate via IP?
If you have any other tips or advice for me regarding this area of python I would be happy to hear them.
I knew I'd forget a question: I have seen sign-up forms where, when you type in a username, it checks if it is available, is this javascript or how is this done?