Jump to content
xisto Community

coder2000

Members
  • Content Count

    66
  • Joined

  • Last visited

Everything posted by coder2000

  1. Actually sessions can be stored anywhere including in cookies. But they are only for the server that gave it. So the description above is still correct.
  2. I usually do that but missed it this time. Thanks.
  3. Login Tutorial Protection Tutorial // Reserved for error checking tutorial
  4. Now there are basically 3 functions that a user management system provides: login, register, and protection. A user management system can do more than this but that is all that this tutorial will be covering. I will try to explain what I am doing as I go along but to fully understand what is happening you should have a basic knowledge of PHP, SQL, and HTML. This tutorial assumes you are using MySQL, adjust accordingly for a different DBMS. First off lets define the database table where our users will be stored. Using phpMyAdmin run this statement to create our table: CREATE TABLE tblUsers ( fldId INT NOT NULL AUTO_INCREMENT, fldUsername VARCHAR(40) NOT NULL, fldPassword VARCHAR(40) NOT NULL); Now a little explanation as to what this will do. It will create a table in your database called tblUsers with fields fldId, fldUsername, and fldPassword. The last two fields are self explanitory they contain the username and password of the user. The fldId is the user id automatically assigned by the database. For more information on the syntax read the MySQL documentation. Lets continue by creating the script where our users will register. Open your favorite text editor and enter the following: <?php?> This tells the webserver that we are starting a php code section. You can have more than one in a script and you can include HTML in your code files as well, more on that later. Lets create a function that will actually do the work of adding the user to the database. Lets call it registerUser, now enter the following in between the php tags: function registerUser() { mysql_connect('server', 'username', 'password', 'database'); $username = $_POST['username']; $password = md5($_POST['password']); $sql = "INSERT INTO tblUsers (fldUsername, fldPassword) VALUES ($username, $password);"; mysql_query($sql);} We now have a very basic registration function. Now we need to create the form the user will see. So below the ?> lets start our HTML. It should look a bit like this: <html> <head> <title>Registration</title> </head> <body> <form action="<?php $_SERVER['PHP_SELF']."?register=true" ?>" method="post"> Username: <input type="text" name="username"> Password: <input type="password" name="password"> <input type="submit" value="Register"> </form> </body></html> Now this HTML defines a form with 2 input fields and a button. The thing to look at though is the action attribute of the form tag. Here we have another php code section. This puts the path of the current script as our action with the variable register equal to true. We will deal with that in our code later. For now your code should look like this: <?phpfunction registerUser() { mysql_connect('server', 'username', 'password', 'database'); $username = $_POST['username']; $password = md5($_POST['password']); $sql = "INSERT INTO tblUsers (fldUsername, fldPassword) VALUES ($username, $password);"; mysql_query($sql);}?><html> <head> <title>Registration</title> </head> <body> <form action="<?php $_SERVER['PHP_SELF']."?register=true" ?>" method="post"> Username: <input type="text" name="username"> Password: <input type="password" name="password"> <input type="submit" value="Register"> </form> </body></html> There is one more thing left to do. Handle the variable we passed to the script called register. Lets do that now. Here is the code: <?phpif ($_GET['register'] == 'true') { registerUser();}function registerUser() { .... Here we use an if statement to check and see if it has been set to true if it is we call the function we defined earlier. That is all I will be doing for today. Later we will go over how to login, protect your pages and some basic error checking.
  5. I would suggest trying what was stated before about checking to see if internet explorer has been set to operate through a proxy. I would only suggest reinstalling your pc as a last resort. I generally try to reinstall every year or so because the computer just gets naturally bogged down. I have been using AVG for the past few years and haven't had any problems with it as well I think it is one of the best free virus scanners available. So with that I think it was one of the viruses that it removed that cause the problem and not AVG itself.
  6. Javascript has its place. If done improperly can cause a multitude of problems from crashing your computer to making your site slow. You just have to be careful and make sure your code runs well in a test environment on any browser. It can be used for a great many things from dhtml to simple form validation.
  7. HTML-Kit is good. PHP-Edit is good too if you are using it for personal reasons. There are lots of quality free html and php editors available. Sometimes its personal preference. I like HTMl-Kit for its plugins but don't really like the interface but thats just me.
  8. It seems to be free of ads. The want donations but other than that it appears to be good. From the screenshots it looks professional. I will be downloading and evaluating the software.
  9. // Create a new image object with a size of 100x100 pixels.image1 = new Image(100,100);// Load the image into the objectimage1.src = "myimage.gif"; The src should be the full location of the image.
  10. Its working now. This post was made before I knew someone else could access it. It seems my isp was slow in refreshing. Thanks for the help.
  11. It doesn't have to be a new subdomain. There shouldn't be any issues if its setup properly. You can find a login script on hotscripts.com. You can put the secure part in a different subdomain so its not so obvious where it is and if you really want it secure you can use SSL.
  12. It says cannot find host. It should have propogated by now if it was correct. What are the ips for the dns servers so I can make sure I have them right.
  13. My domain doesn't appear to be working. My dns is setup correctly or so I think and my domain doesn't seem to be working after time for it to propogate. Any suggestions like confirming the dns ips?
  14. A stored procedure in SQL is a statement that is stored on the server. You can call it at any time using the name you gave it.
  15. I would suggest trying rentacoder.com
  16. Another good site is dmusic.com. They don't have any big names because they are a sort of indie record company. But its still free music.
  17. I don't know anything about books but you can start by looking for tutorials on google. There are many available for the beginner. Thats where I started and from there I just looked at the docs if I needed to know something. The PHP mailing lists are probably a good place to start looking for examples.
  18. PCI Express has nothing to do with Intel or AMD its Nvidia or ATI. There are currently three offerings from ATI in the Radeon x300, x600, and x800. I don't know about Nvidia though. In regards to if AGP is out, yes I think that PCI Express is the new way to go. My new system will not even have an AGP slot. Hope that helped.
  19. I have used Western Digital and haven't had any problems. I think you'll find that people stick with what they know and trust. As well there are things like the age of the drive and what it going to be used for to take into consideration.
  20. I think he means encode each into a chr value rather than straight text.
  21. You wouldn't believe how many languages I know. Count me in on this developer exchange.
  22. There are major differences between the two. One: MySQL is geared towards commercial applications whilst PostgreSQL isn't. Two: MySQL isn't 100% SQL compliant as of 4.1 while PostgreSQL is. Three: I personally think MySQL is faster and easier to use.
  23. Further to my post before Postnuke I think has a huge community of developers and designers making a large array of modules. There is an entire section of the site devoted to the over 50 modules available. As well there are a large number of themes. Support is awesome as well. The forums are very active and helpful. Any problems are fixed and available in the next release or as patches from the forums.
  24. My first experiences with HTML were from tutorials and free hosting like freeservers or geocities. That was the easiest way. My pages looked like crap but at the time I didn't care. Now I use XHTML Strict and CSS in all my pages to make them 100% available to everybody.
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.