Jump to content
xisto Community
HmmZ

Php Simple Login Tutorial Learn how to make a simple login

Recommended Posts

When I tried this, the register page came with and error saying that on line 11 and 55, "op"was an undefined index, can someone help me on this?

"op" is an abbreviation for "operation" that should be a part of the query string in the link to this page.

 

For example, domain.com?op=login should be a part of the anchor (link) for accessing this page.

Share this post


Link to post
Share on other sites

Yeah, I used a simular script to this one when I coded an exclusive Invision Power Board modification. I intigrated the PHP Login Script and imploded the code into my IPB modification, thus allowing my Staff to login to our Moderator Control Panel. From Invision Power Board version 1.3, v2.0.0.x and up had no Moderator Control Panel. Invision Power Services development team changed the Moderator Control Panel (aka Mod CP) to an advanced moderation function, where you can moderate threads/posts IN selected forums instead of in a Control Panel of it's own. Me and my coding team friends started to recode our Moderator Control Panel to enhance it, so we was able to just login to our Moderation/Administration area and do the moderation of our forum from there. :) It was much easier. :o

Share this post


Link to post
Share on other sites

Tos solve the error replace
if ($_GET["op"]) == ANYTHING)

with

if (isset($_GET["op"]) && $_GET['op']  == ANYTHING)

-reply by theGuy

There is no problem...He was just asking to get answer,because he wants to know every line for what is,i think...As you can see in the script ?op=login is used to show error,that you don't write correct information.Making login scripts is simple,all you need is a place where you will store all usernames and passwords,and a script which will check is the username existing and all data is correct.Now i am trying t create a forum but i did only posting system,i don't know how to make WYSIWYG editor.I tried to make editable div,and a button for bold,italic,underlined and it works,but it isn't that good as other editors.Can someone give me WYSIWYG pack?

Share this post


Link to post
Share on other sites

That's awesome... Can you please help me too... How to encrypt passwords??? I'm doing my website at this very moment.. But.. I don't know how to encyrpte my password in the database.. Please help! tnx alot!!

-reply by Keizee(PH)

Share this post


Link to post
Share on other sites
Problem!!!Php Simple Login Tutorial

This script works fine with registering but when the user tries to login it says the username and password are wrong. I checked phpMyAdmin and the credentials are in the database. Any advice?

Share this post


Link to post
Share on other sites
Need help on step 2 pls...Php Simple Login Tutorial

Hi I'm new to all this and have just finnished designing my new website, I want to add you login script to it so that users will have to join my site before being able to actually use it..

 I normally use linux/LAMP server to host my sites but for this one I'm trying to do it on a windows/WAMP  server, which I'm still learning to use.

I can follow most of the tutorial except for step 2, as mentioned I'm trying to create this on a windows WAMP server so I wont be creating the database via command line and am trying to create it in phpmyadmin, could I get some help on how to create the database, and when I create the dbConfig.Php ill that go in the same folder location as the rest of the php files mentioned  in this tutorial, lastly will all these files go in the same directory as my website php files...

 

Thanks in advance

 

 

-question by W1nG_It

Share this post


Link to post
Share on other sites

Your system gives no errors but I implemented it in my website I can register and stuff so thats nice ;) 

 
The problem is that it says that the login information is wrong but I'm not stupid so I know its the right one could you maybe take a look ? 
-question by Dutchie

Share this post


Link to post
Share on other sites

$host = "localhost";

$user = "UserName";

$pass = "Password";

$db = "dbName";

 

Would somebody be able to give me an example of what i need to replace these variables with. I keep getting these errors:

 

 

Warning: mysql_pconnect() [function.mysql-pconnect]: Access denied for user 'myUser'@'myIP' (using password: YES) in myDomain/dbConfig.php on line 13

Error connecting to database.

Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'myUser'@'localhost' (using password: NO) in myDomain/dbConfig.php on line 21

 

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in myDomain/dbConfig.php on line 21

Share this post


Link to post
Share on other sites
Easy Question???Php Simple Login Tutorial

Replying to HmmZReplying to HmmZI am new to php but have been reading and following many tutorials that have ben far more complex than this one. With this particular article I have finally understood how to add the table in my database, and I beleive I have everything set up correctly in the dbconfiguration as for the variables. Although I don't know if I am to use the complete hostnameserver info including the.Com at the end???? EXAMPLE: $host = "XXXXXXX.Db.3474803.Hostedresource.Com";So thats one question.The other question would be inreference to the login php. I am a bit confused as to just where I should be filling in my info. So I am goin to put XXXX to to where I beleive they should be going. And hopefully someone can correct me if I am mistaken.EXAMPLE:If ($_GET["op"] == "login") { if (!$_POST["username"] || !$_POST["password"]) { die("You need to provide a username and password."); } // Create query $q = "SELECT * FROM `dbUsers` " ."WHERE `username`='".$_POST["XXXX"]."' " ."AND `password`=PASSWORD('".$_POST["XXXXXX"]."') " ."LIMIT 1"; // Run query $r = mysql_query($q); if ( $obj = @mysql_fetch_object($r) ) { // Login good, create session variables $_SESSION["valid_id"] = $obj->id; $_SESSION["valid_user"] = $_POST["username"]; $_SESSION["valid_time"] = time();-------------------------------------------------Can someone Please help me with this situation. I am baffled as to what I am doing wrong. I have a website that I am working on and I need a breakthrough for a simple registration/login.

-question by DIVAD

 

Share this post


Link to post
Share on other sites
Avoiding revisit of Login Required pages by typing URL in Address BarPhp Simple Login Tutorial

I am new to PHP and am learning the nuances of scripting. I was wondering if there is some code which would restrict Accessing a Login Required Page if someone tries to copy/ paste the URL in the Address Bar (whether he is a registered Member or not).

 

 

-reply by Navtej Singh

Share this post


Link to post
Share on other sites
Thank youPhp Simple Login Tutorial

 Great post, I'm starting to dive into php and mysql and this post was very helpful with a project I'm working on currently.

-reply by Jason

 

Share this post


Link to post
Share on other sites

if you want help, post your code and the error message so that we can help you. or take a screen shoot for the error. else we can't help you here.

Share this post


Link to post
Share on other sites

What does this mean://Input vaildation and the dbase code if ( $_GET["op"] == "reg" ) I m sorry I am new in PHP and MySQL. Where do I need to give this value in html/php page: "reg"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • 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.