General Question

Link's avatar

What technology is used to create websites that allow users to "sign in?"?

Asked by Link (327points) August 6th, 2009

How exactly are websites, like Fluther ,created so that users can sign in. I’m creating a site where I’ll be showing video tutorials. In order to watch the tutorials I would like my site’s visitors to sign in. I would also like to give them the option of leaving comments on the videos. I’m still learning Web design, and my site still needs a lot of work, but I’d like to get a good idea on what I have to look forward to. Thanks dudes.

-Link

Observing members: 0 Composing members: 0

12 Answers

jrpowell's avatar

Anything can do it. I would go with PHP and MySQL. It is easy to start with.

Here is a good tutorial. <—The site is down for the moment but should be back soon.

edit.. It is back now.

edit 2 :: That is a paid for tutorial. Sorry.

This might be better. And is free.

MrItty's avatar

You generally need a program on the backend. It can’t be done with straight HTML. You need some server program, written in something like Perl, PHP, Python, ASP, whatever. That program will typically generate the form in HTML, validate the user and password against a database or flat-file, and then store a cookie on the user’s machine, linked to some session data on the server.

FrogOnFire's avatar

Web sites like you’re describing use sever-side technologies like ASP.net, ASP, PHP, JSP, CGI, etc. to manage users, comments, etc.

PHP and Mysql are the most popular and easy to work with. You would use a mysql database to hold the comments, user names, and any other information, then use PHP code in your pages to query the database and display that information and/or process log-ins. PHP isn’t very hard to learn, but if you wanted to go with something easier, there’s several content management systems (CMS) out there on the internet to do this kind of stuff for you (though I’ve never used any of them so I’m not quite sure how they’ll work—I prefer just hand-coding everything).

You can find some good php tutorials at http://w3schools.com/ or just go to the PHP manual at http://www.php.net/ (though I found w3schools much easier to understand as a beginner).

gggritso's avatar

@johnpowell was on the right track with linking to Nettuts, that’s a great website. Here is a tutorial that may help you, it uses PHP and MySQL. The method isn’t the greatest, but it will get you started.

dynamicduo's avatar

This is the first step in database websites. Well, I take it as that first step, there are ways you can make logins with text files but these are not really secure, and advanced interaction requires databases anyway so you might as well use this opportunity to bite the bullet.

The basic premise is this: you have a database living on the server called “links_site”. Inside that database is a table called “users”, which contains rows. Each row is one person’s account and like a row on a spreadsheet, it contains their username, their password (this is encrypted, I will talk later about this), last login date, their bio, and whatever other information you want to associate with the user individually.

You then use a scripting language to access that information. I love using PHP but I also use ASP.net quite a lot. PHP and the database program MySQL are free and open source so many people, myself included, use it. Wordpress is built on it too.

So you have your website. For simplicity’s sake, let’s say we’re looking on the main page, index.php (you need to use such extensions to enable the use of such code). It has, in addition to the main page content, a form on it with two fields, a username field and a password field. This is an HTML form and the password field will be made into ***s by designating it as a password. There is also another input element given the type of “submit” which makes the Submit button (again you can rename it in the HTML and style it too).

A note here, there are many ways of doing the following, I am explaining the easiest one and one I learned way back when. When the user presses the “submit” button, the username and plain text password are sent to a next page. That page will be a PHP page with a name like “login.php”. This is where the magic all happens. You use PHP code to create the logic and interact with the database to compare the password given with the one on file. Here’s some pseudo code in regular English:

inside of login.php
-> Via POST*, read in the username and password variables.
-> Connect with the database and request the password on file for the username given.
-> Convert the password you were given into its encrypted form, and compare to the encrypted one you got from the database.
-> If they are the same, ok! The person is who they say they are, log them in by giving them a cookie. (Not a chocolate chip one, a digital one.) Maybe even redirect them to index.php
-> If they aren’t the same, problem. Maybe keep track so that if this happens more than 5 times in a row, you know someone’s trying to crack in to an account.

Let us then go back to index.php. You add interaction to it by inserting more PHP and HTML which is only shown when the user is logged in. To check such things an easy way is the cookie method. A small cookie file is placed on the logged in person’s computer. You can put variables inside of this, such as their username. The index page can access this cookie and read the username, if there is no cookie at all then the person is not logged in. If the cookie has a username, the index page can use this as a variable and call up the proper information for them.

*There are two ways to send data from a website to another via a form, POST and GET. The difference is that GET variables are in the URL, such as index.html?name=jimbo&password=happypants whereas POST variables are not seen in the URL, they are only passed behind the curtains.

I find it is great to know how this all works, in fact it’s important to make secure applications (the one above for instance has a few holes, but is good for learning the basics). But in practice it is not feasible to manually create such systems for each and every application you want to make! This is why @andrew is recommending Django, another one is PEAR, these are support structures which contain all of this stuff prewritten so you don’t have to reinvent the wheel each time and can instead focus on making your site look pretty or functional to the users.

Then again, there’s something to be said for rolling your own login system, especially when all you need is a user and notification system and you don’t want the overhead of installing a helping system as well.

Edit: I accept and value your “dude” and request it not be changed to the politically correct dudette :)

NerdRageIT's avatar

Download and install Joomla

www.Joomla.org

It will give you a nice membership site with limitless possibilities.

I wouldn’t recommend a framework like cake or django for a beginner.

He needs a turn key solution.

ryancp's avatar

CodeIgniter – This is a great web application development framework for PHP. It’s similar to CakePHP mentioned above, but I’ve found it easier to get a grasp of.

I use it for web apps I develop and love it! Yes, you can do robust sign in procedures with it. Check out their forums for threads about “user authentication”.

Oh, it’s also open source and goes great with other free technologies like PHP, MySQL, Apache, and Linux.

If you don’t necessarily want to code from scratch, I recommend WordPress. An experienced coder can do pretty much anything you want with it.

Link's avatar

Thanks dudes. I appreciate all the help. I got the sense that there are applications out there that can do the work for me, or at least help me get this done quickly. I’m not sure if these applications are Joomla, Django, or WordPress as some of you mentioned, but if anyone can let me know for sure I’d appreciate it. Although I rather learn PHP and MySQL, I want to get this site up and running fast, so these are definitely choices I would consider. If you guys want to give me more information on these technologies, I would appreaciate it. Thanks again.

-Link

ryancp's avatar

The reason I recommend WordPress is because it’s primarily a blog system yes, but with some plugins and the right theme, you can make it a CMS for pretty much anything.

For what you are looking to do based on your original post’s description, you should check out the wordTube plugin for WordPress.

You can upload videos in flv format and it works great.

When you have some free time, install xampp and you’ll get PHP/MySQL/Apache easily installed as a test server on your localhost. Then you can download CodeIgniter and start playing around with it.
The documentation is really good and the forums are helpful if you get stuck.

Good luck

Link's avatar

Would it be easier to just use WordPress?

Answer this question

Login

or

Join

to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther