Okay, really off topic, but need some help on coding... February 20, 2016, 04:29:36 pm How to Transfer Data in Web Form to a MySQL Database?Okay, I've tried this, and failed at getting it to work. Database work, is not my strong point. I have a script, that counts the links for my downloads. I'd like a simple form, to submit them, instead of going into phpMyAdmin.The original download system, I got from a site, PHPJabbers. One of their unsupported free scripts.But, it does the job for counting the downloads.
Re: Okay, really off topic, but need some help on coding... Reply #1 – February 20, 2016, 05:37:55 pm Found the solution.
Re: Okay, really off topic, but need some help on coding... Reply #2 – February 20, 2016, 06:22:12 pm Do note: insert data from "users" directly in a query is BadTM.Doing this you are open to SQL-injection of any kind.So you have to either clean anything coming from $_POST (mysqli_real_escape_string), or even better if you are "new" to this kind of things, use PDO or other database abstraction layers and let them handle the sanitization/security for you.
Re: Okay, really off topic, but need some help on coding... Reply #3 – February 20, 2016, 06:33:44 pm @emanuele, only I can get to the file to submit.The file is restricted to my IP only.Even got it where the files can't be indexed, too.
Re: Okay, really off topic, but need some help on coding... Reply #4 – February 20, 2016, 07:18:24 pm This is usually not a limit to the exploiting of similar unsafe code, but if you feel safe, good for you. For all those looking at the code above: be aware it's unsafe.
Re: Okay, really off topic, but need some help on coding... Reply #5 – February 20, 2016, 07:39:53 pm @emanuele just an aside...W3Schools, is where I had gotten that fix from. XDAlso, like said, this form is just for me, no one else can access the submission form.If you could tell me how to do the $_POST (mysqli_real_escape_string), into that code, I'd be happy to do it. But I can't go the other way, as the way I got it, was the only way it would work.
Re: Okay, really off topic, but need some help on coding... Reply #6 – February 21, 2016, 04:25:49 am May I ask what do you need that for Burke? Is it part of any known software? If that so, why don't you use that software framework to add that data? I think it should be like using SimpleAds in ElkArte forum as it is more safer.
Re: Okay, really off topic, but need some help on coding... Reply #7 – February 21, 2016, 07:28:17 am This is for a simple downloads page for my main site.So I can just add the links to my downloads.What it does, is keeps a count of the times the download links are used.The counter script was a free script, so they choose not to offer much more to it.The submission page, is not for anyone other than me, and I rename the file to where it can't be used, when I'm done.It's just a lot easier, than going into phpMyAdmin all the time, to add files to the database.
Re: Okay, really off topic, but need some help on coding... Reply #8 – February 21, 2016, 08:05:56 am Ok. It is simply a download page then but you wish to keep a count of download (or click) for each item. I am not so sure you need to use database jut for that. I somehow believe you can also use a free service like https://github.com/mmilidoni/github-downloads-count. May be @Spuds can answer that github thingy.
Re: Okay, really off topic, but need some help on coding... Reply #9 – February 21, 2016, 08:32:25 am Quote from: ahrasis – February 21, 2016, 08:05:56 amI somehow believe you can also use a free service like https://github.com/mmilidoni/github-downloads-count.That would help, if all my downloads were on GitHub, but they are not.In fact, the majority are not.But, like said, there's many ideas I wish could do for this, but there's no actual downloads system, free, with an admin panel to add the files into the database, so had to go with this.
Re: Okay, really off topic, but need some help on coding... Reply #10 – February 21, 2016, 10:32:26 am Quote from: derived – February 21, 2016, 09:17:57 amhxxps://github.com/joshf/Indicationhas dashboard, liberal mit licenseNow this, is what I was looking for, all along!Thank you!