Using Google Drive as a database for a login form - javascript

Recently i created a website with Godaddy's website builder . In the website there is a free membership, though here is the problem.
Godaddy's website builder doesn't allow you to create a login area, you have to do that with your own tools, and the other problem is website builder does not allow you to upload any files like html or php or install anything like MySql. It does allow you though to put some code in your website. The current way I'm managing the login function is by putting some JavaScript in my website which i found elsewhere , the bad thing is the usernames and passwords are shown in the source code and every time there is a new user i have to change the code. Not only that, the link of the membership area is also in the source code, currently i change it every month. After doing lots of research and finding nothing i had an idea.
By putting a text file on google drive which contains all usernames and passwords, i could make it act as a database. Then put some code in my website which reads the text file in google drive. If this didn't work (Which i think it does) How about using a spreadsheet? And the code on my website reads the spreadsheet. The link to the membership area (Which is also in my website) Could be in another text file.
I'm new with code, and that is really all i need, the code to make this idea work. If anyone can write the code, please post it below. You have no idea how much this will help. Thanks in advance - Braulio

If you can use javascript, you could probably use something like
https://www.firebase.com/
or any other 'database as a service' type thing. This will allow you to query the database, and save to the database with client side javascript.
With firebase you could do something roughly like
var myFirebaseRef = new Firebase("https://<YOUR-FIREBASE-APP>.firebaseio.com/");
myFirebaseRef.set({
username: "Braulio",
password: "pass"
}
});
Just one option

yes you can use a google spreadsheet. yes it will be 100% secure. look at the spreadsheet api for this.
however, beware of the limitations:
there is a limit as to how many cells you can have (in the millions).
since all the requests will be made from the same google account, rate limit quotas will apply, and total daily api calls will be limited (to a few million i think).
if you really will have many users, you can workaround these limitations by caching as much as possible the spreadsheet data in your backend.

Related

Running one web page across devices with the same data

I want to make a simple todo list web page for myself so that I can be a more organized person but I have a problem. I want to be able to close the website or switch to another computer and still keep the data of what I have done or not done on this to do list. I have tried to search up ways that I could do this online but I don't know what to search to find the right results.
I know about js and web design stuff but I don't know any back end stuff so.
One way to do this is to upload your code to Github, which is a code management application for developers. Try searching on youtube how to navigate through GitHub and how to upload your code because im not that good with explanations just yet since im a beginner. Once your code has been uploaded, you can simply log into GitHub with the other device and open your code in a code base.
You need to have some kind of backend for what you are planing to accomplish. Such a backend could be a database storing each of your to-dos on a single database row, or some sort of file, which is located on a central server (the file could for example be a .json, .xml or .csv).
However, you can also write a JavaScript app, that stores your to-dos in your local browser storage, but then you would have to implement an export, import logic for a manual sync.
I assume that is not what you are looking for, so I would suggest checking out some services like for example the Google Drive API. You can interact with JavaScript with it and store your to-dos in your Google account: https://developers.google.com/drive/api/v3/quickstart/js

Is there any function to update your web site when another site post something new?

As example, i want to update my item list every time Amazon add a new product, is possible to do it without knowing their system or DB?
Unfortunately, no!!! This is the disadvantage of relying on a 3rd party site for the content of your site. However, using the API of the site, whose data you want to access, can give this functionality, but this will not work for all the sites.
If the 3rd-party site does not provide an API to access their data, you'll need to "scrape" the site of that data. In theory this is easy, however, large companies like Amazon deliberately attempt to foil scraping attempts. See an open source project dedicated to this exact prupose: https://github.com/adamlwgriffiths/amazon_scraper The author says it best:
Amazon have resorted to moving more and more content into iFrames which this scraper can't handle. I envisage a time where most data will be inaccessible without more complex logic.
I've spent a long time trying to get these scrapers working and it's a never ending battle. I don't have the time to continually keep up the pace with Amazon. If you are interested in improving Amazon Scraper, please let me know (creating an issue is fine). Any help is appreciated.
If you want to build a custom tool to scrape public websites, I would check out Node.js. It is popular due to its ability to query the page DOM effectively. There are some good writeups out there to get started: https://scotch.io/tutorials/scraping-the-web-with-node-js

How to prevent script sharing from it's users?

I am making a small payment system, basically it's just a point system, you pay say 1 USD and you get 100 points which is used later on in a game project to get bonuses. It's a script for game servers, something like a user panel.
Now, the script system is ready, but I'm afraid to give it away, since than someone will share it and it will spread all over the gaming area. What would be the solution keeping it working only if I give them a permission?
I thought about re-making whole code and make it work on my website but I don't think that people will want to put their SQL data to website that located NOT on their host. Please help me out, at least with some clues, maybe its possible to make some widgets? or maybe some license system?
I'm really lost.
You should implement the logic on the server side as an api REST call and include in the script only an ajax call to the api. You can limit the use of the api through an api key that you'll provide only to qualified sites.
You'd need to implement some sort or serverside authentication/api so that only varified users can use the script. Much like how software checks a licence.
On script load your javascript could make a ajax call to a server passing through the users IP, auth key, username etc etc.
This can then be varified on the server, maybe returning a dynamically generated url containing a javascript file which contains your business logic
(so that urls are dynamically generated for that users session only)
That way people cant hot link the script, and the script you give out is solely the ajax call
(With the business logic script injected on auth)

How to read data from a private google spreadsheet in javascript -- Nov 2014?

I would like to use a google spreadsheet as a simple read-only data source for a prototype. I want to make an ajax request of some kind for the data and then play with it within a web page. I see lots of conflicting blog posts, old documentation, etc, but nothing simple and definitive.
Ideally, I would be able to do this without making the sheet public, and without using any kind of auth within my page, just requiring that the user of my page be logged into an account with access to the sheet.
Can anyone point me to a simple tutorial or documentation that shows how to do this?
I wound up using tabletop.js. The tricky bit was setting permissions: I shared the document so anyone at my company could edit (view probably would work, too). I also selected File > Publish to web... and made sure that was enabled, but the "Require viewers to sign in with their [Company] account" checkbox was not checked.
I'm not actually sure what level of security I currently have; I suspect that it's less than I'd like.

Streamlined way to validate website ownership (with javascript?)

I have a rails app which requires users to verify that they own a website before submitting links from that site.
I have implemented a website verification system that works thanks to the answers given to a question I made several months ago. This system works but it is rather cumbersome for users. It requires them to create a web page on their site with a specific verification key for a url. I feel like I'm asking the user to jump through a lot of hoops just to submit their pages to my site. Site verification is vital, however, and I can't let go of this feature, however cumbersome.
I'm looking to create some javascript code that will help validate websites. When users install the plugin, all they would then have to do is click "verify" on the web app, and all the work is done for them. They don't have to go through the chore of creating a new web page and deleting it.
I have a faint idea of how to get started...
Step one: the javascript code to be placed on the website (simplified version of google analytics code):
"<script type='text/javascript' id="THE VERIFICATION CODE GENERATED BY THE RAILS APP">
(function() {
var secondScript = document.createElement('script');
secondScript.type = 'text/javascript';
secondScript.src = 'http://www.mywebapp.com/verify.js';
var firstScript = document.getElementsByTagName('script')[0]; firstScript.parentNode.insertBefore(secondScript, firstScript);
})();
</script>"
In the second script(verify.js):
//find some way to ensure that the first script has an id of "VERIFICATION KEY"
//if so, return some data that the rails app can understand and verify the site
Any ideas?
That's a REALLY interesting problem, but I don't know if there is a good solution in the way you're looking for. In other words, I don't think you can create some sort of automated utility to upload the script in step one.
You can't assume they have FTP access, or SSH access; some web hosts might disallow those things. You can't assume they have some sort of 'package' installed to communicate with, or even the ability to install such a thing.
One thing that might work (but still has its own set of issues) is to do a whois lookup and email the owner of the site on record with a confirmation link... Of course that's assuming the whois is listed and they didn't provide a dummy email.
Google accounts checks for domain ownership by doing the file upload thing, or letting the user create a custom subdomain (CNAME) on the site. Of course, if your users are having issues uploading a single file, the CNAME thing is probably right out.
There are other ways to verify ownership of website. Many companies will send an e-mail to the registrant of the domain. Create a file with a certain name. Put a piece of specific text into the header of the index page. I think the way you're attempting above is more complex than it needs to be. It's pretty easy for any webmaster to create a file with a certain name and with certain content. I've done it many times for different tools.
Don't sweat it :-)

Categories