How to make a working login functions for my website? [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed last year.
Improve this question
I am just entered this game since last December. Now I finished HTML CSS and a little bit of Java Script yet I got stuck at this stage: I can do basic styling but I don't know how to make it interactive.
So my question is :
how can I make a login function for websites, which can gives visitor an account (sign up, login, forgot password) that can do basic things like comment , add to basket and favorite a product?
Don't need to be specific, please just highlight which language is involved in which stage.
Thanks ahead.

Now I finished HTML CSS and a little bit of Java Script
So your site is what is called a static website.
If you want to allow login and data storing, you need a dynamic website, that requires one of this technologies:
PHP
ASP (check also ASP.NET)
Node.js (with express or http module)
Django (Python's library)
A few others...
All this technologies are called server-side languages/technologies, and the most used for long years has been PHP, that now has some strong rivals in terms of usage.

You can use only html/js to create a website. But, if you need authentication, post comments, a server side is needed.
A js can call easely an API to authenticate (server side) and post comments with XHR. You have to create it. You need to know how Authentication headers works for server side. You need to have a database (sql, file or nosql, it's your choice) to save the users datas and rights.

Related

Can I read and edit files that belong to the website folder using only html and javascript? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am creating a website that must be able to login using the credentials that are saved in a text file(login.txt).After logging in the person must be able to add and remove images(images folder).
These images will then later be used to create a gallery that all users will be able to view.
What I want to know is can i achieve these results by only making use of HTML and JavaScript or must i also make use of server side languages like php or asp.net ?
note : I have done a good amount of research and still wasn't able to find an accurate answer for this question.
Any advice will be useful. Thanks ahead...
Short answer: You have to use a server
I assume you already know Javascript, so my advice is use Node.js.
You have to use a server side language because other users need to see the gallery , besides the ones that are uploading. So you can't use localStorage to save the images, because the front-end is private to the user, not global to every user (like a database or a server).
Some suggestions:
Use a database for user details, is faster, safer, and more maintainable
Define a Rest API on the server-side
On the front-end make a Single page application (using desired framework/libraries), using TDD principle
You should to use a server side language.
And if you save the credentials in a text file then anyone can reach these infos with that file url. ( Eg: http://yoursite.com/login.txt )
What I want to know is can i achieve these results by only making use of HTML and JavaScript or must i also make use of server side languages like php or asp.net ?
You'll need something on the server. That something might be:
Web server software that supports using the PUT verb to put files in a directory on the server. The general term for this is DAV or, in the web context, WebDAV. Apache, for instance, supports it with mod_dav. I've never tried it, but it may be possible to set up Apache with simple authentication (probably not with a plain text username/password file, though) and enable WebDAV for authenticated users. Your client-side code could then send PUT requests via ajax.
A server-side programming environment of some kind whether that's PHP, ASP.Net, NodeJS, or something else.
A content management system of some kind that already provides the ability you would otherwise write.

JavaScript Button Login [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
So I'm trying to create a JavaScript code for a button that allows me to login to a website that I have created. I have my database that the information will be retrieving the verification from. I just can't seem to get the functionality to the button to do such a thing. So far all I have done was trying to reverse engineer the Facebook code login button but yet all I had on my hands after that was a big mess. I know I'm a bit over my head in this situation. JavaScript isn't my best language. I have a button right now and that's it.
This is not a JavaScript question but a design question.
You are dealing with three levels here. In brief -
View - Your html (button), css & JS
Controller - Your space for action, validation and logic
Data - Your data stored in your DB
You've got the view (partially) and the Data layers figured out; however, you haven't worked on your controller layer.
Your controller layer should consume the data from the view (login details), validate the data, transform (if necessary) and authenticate against the DB.
You can build your controller on the server (Java, nodeJS, etc.) or on the client (JavaScript AJAX).
Hence, I suggest you figure out where do you want your code to live - on your server or in the browser. You should also keep in mind security.

Managing back office and front office of website [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm working to a project and my aim is to create an html page to view the train/bus/tram timeboards.
So there is one html page for back-office(for the company) and one page for front-office(for the customers).
The company wants to change files in the page (pdf/links that can be viewed inpage) from back-office.
How can i manage the informations between back-office and front-office by using some simple stuff/programming languages?
Anyone has an idea?
Substantially I want to do something like this for front-office view:
http://codepen.io/anon/pen/NGxrQp <--Check this
OR
http://jsbin.com/mawevuwi/1#tab4
And then something more simple for back-office.
PS: I'm new at stackoverflow and sorry for my bad english explanation.
A back-office should be able to add, edit or delete content. Therefor you should use dynamic webpages, not static. You can use a database to store values. Make the front-office read-only and you're done.
You could also use a Content Management System (CMS) like WordPress.
Some more info:
A static webpage only shows what's in the files. A dynamic webpage could show you generated data or data not in the file itself but from a database for example. Databases use SQL (Structured Query Language). The 4 operations are abbreviated as CRUD:
Create
Read
Update
Delete
I recommand you start learning SQL & PHP if you want to continue with this. Other languages (rather than PHP) are possible.

How does Facebook "like" button work? How to implement a plugin like it? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Say I have a Facebook-like website with a high volume of traffic. Now I want to implement something like a Facebook "Like" plugin(?) for my site that other websites can use on their site. Let's call it "Hooray". How do I exactly implement one?
Or how does Facebook, Pinterest, etc. generally do it?
To implement your "Hooray" button you need to have components mentioned below:
A web service which will consumed by the client SDK to report that someone has ""Hoorayed" the post etc.
You need to have a database where you can store who "hoorayed" what.
You can consider every entry as a post or say "Hurricane".
Now every post is unique so you can identify who "Hoorayed" what.
Create a web service which tells the user who "Hoorayed" what.
Create a client SDK. It could be a JS library for web applications or Objective C framework for iOS etc. These client libraries will consume web services which are mentioned above.
Just like FB you will have to ask the consumer of your "Hooray" service to register an app on your platform. You can generate an appid for them and then all the data can be tagged with that.
Obviously these are just pointers and you can create a much sophisticated workflow based on your needs.
If you go on the Facebook developers page, you can access the code for a Facebook "like" plugin in multiple languages and try to figure it out from there.

Best way to develop a group chat room [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm on developing a new application. It is going to work as follows,
=> All the user will be assigned to a group.
=> When a user logs in, the home page will show a textarea to add a message with all messages of the users who are in that group
=> Somtimes it is possible for one user will be assigned with more than one group, in that case the user have to select the groups they want to share their message.
=> The message sometimes have images and videos as well
In other words a chat room which is almost like the facebook newsfeed.
Now, my question, is there any plugins or script which is easy to be customised. Flash, Javascript.
Or what I can do is send ajax request every second to check the database for new message, grab and fetch on the screen. But the only thing I'm afraid is will it makes the server and/or the app slow or dead.
Please suggest me good solution dear genius brothers.
There are no such scripts to create an chatgroup that easy, you can use ajax to fetch the messages if you like.
But websockets or Server sent events would be a much better idea.
However using Server sent events (SSE) on apache is also not really a good idea as apache will create a proces for each open connection. If you would like to use SSE I suggest using nginx
Link to SSE.
https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Error_handling
Websockets.
https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API
Well learn:
jquery
nodejs
And then come back with other questions.
If you can learn, then learn the following:
Node.js
Angular.js
Socket.io
Express.js
They can make your life easier and this app can be possible in minutes. Look for a demo on the angular site.

Categories