stabs909 Posted March 27, 2012 Share Posted March 27, 2012 Hi i need help once agine. i need to make a register.php can any one help me out if you can please podt here thanks Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted March 27, 2012 Share Posted March 27, 2012 How about..... you try and make it and if you dont succeed then post your code so you can get help and learn from where you went wrong. Quote Link to comment Share on other sites More sharing options...
stabs909 Posted March 27, 2012 Author Share Posted March 27, 2012 because i have no idea where to evern start Quote Link to comment Share on other sites More sharing options...
a_bertrand Posted March 27, 2012 Share Posted March 27, 2012 Odd, I typed "registration page php" in google and you have tons of tutorials... A lazy bee here have we? http://www.html-form-guide.com/php-form/php-registration-form.html Quote Link to comment Share on other sites More sharing options...
stabs909 Posted March 27, 2012 Author Share Posted March 27, 2012 ok i was a bit lazy because im still new to all this but here goes. can you help me fix it when i click submit it dont work <?php echo "<h3>Register here for free account</h3>"; $submit = $_POST['submit']; //form data $username = strip_tags($POST['username']); $password = md5(strip_tags($POST['password'])); $repeatpassword = md5(strip_tags($POST['repeatpassword'])); if ($submit) { echo $username; } ?> <html> <form action='register.php' method='POST'> <table> <tr> <td> Choose a username: </td> <td> <input type='text' name='username'> </td> </tr> <tr> <td> Choose a Password: </td> <td> <input type='password' name='password'> </td> </tr> <tr> <td> Repeat Password: </td> <td> <input type='password' name='repeatpassword'> </td> </tr> </table> <p> <input type='submit' name='submit' value='register'> </form </html> Quote Link to comment Share on other sites More sharing options...
Guest Posted March 27, 2012 Share Posted March 27, 2012 if ($_POST['submit']) { $username = strip_tags($_POST['username']); $password = md5(strip_tags($_POST['password'])); $repeatpassword = md5(strip_tags($_POST['repeatpassword'])); echo $username; } ?> That should do it I think, kinda tired, if it's wrong i'll relook it over when i get up Quote Link to comment Share on other sites More sharing options...
stabs909 Posted March 28, 2012 Author Share Posted March 28, 2012 thanks that worked :) but it no creating a users account when it registers how would i fix this Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted March 28, 2012 Share Posted March 28, 2012 Well really have a look at this http://makewebgames.io/content.php/151-Helpful-Links Honestly I dont think there is much point in you carrying on until you learn the basics and form submission and recording the values into the database is quite basic stuff. Quote Link to comment Share on other sites More sharing options...
stabs909 Posted March 28, 2012 Author Share Posted March 28, 2012 well trying to teach my self. so far im doing prity good for the frist time codeing i looked up w3shools.com i learned a little of there. but some times i dont understand what i need to put in Quote Link to comment Share on other sites More sharing options...
stabs909 Posted March 28, 2012 Author Share Posted March 28, 2012 it took me about 12 an a half hours trying to figuar out how to make a register.php page Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted March 28, 2012 Share Posted March 28, 2012 It took me over a year to get my game together and I had already been coding for quite some time. You just need to learn before continuing. Roll through tutorials which will give you the basics and then go through them again after reading on security and better methods to employ. For example I would not use the code iExze posted. Quote Link to comment Share on other sites More sharing options...
SilverStar Posted March 28, 2012 Share Posted March 28, 2012 if ($_POST['submit']) { $username = strip_tags($_POST['username']); $password = md5(strip_tags($_POST['password'])); $repeatpassword = md5(strip_tags($_POST['repeatpassword'])); echo $username; } ?> That should do it I think, kinda tired, if it's wrong i'll relook it over when i get up Why not use mres? Quote Link to comment Share on other sites More sharing options...
stabs909 Posted March 28, 2012 Author Share Posted March 28, 2012 i got no clue what that is. Quote Link to comment Share on other sites More sharing options...
grant Posted March 28, 2012 Share Posted March 28, 2012 (edited) do you have an INSERT INTO VALUES if not then you wont be able to register as it not posting any input to the db $username = strip_tags($_POST['username']); $password = md5(strip_tags($_POST['password'])); $repeatpassword = md5(strip_tags($_POST['repeatpassword'])); echo $username; $sql= "INSERT INTO `user db` ( username, password)"."VALUES ('$username', '$password'); echo 'Your account has been created successfully! <meta http-equiv="refresh" content="0; url=home.php">'; } Edited March 28, 2012 by grant Quote Link to comment Share on other sites More sharing options...
Guest Posted March 28, 2012 Share Posted March 28, 2012 (edited) It took me over a year to get my game together and I had already been coding for quite some time. You just need to learn before continuing. Roll through tutorials which will give you the basics and then go through them again after reading on security and better methods to employ. For example I would not use the code iExze posted. I wouldn't use my code, I was just re arranging the given code correctly. @Grant that wouldn't insert into the db either as you never called $sql. mysql_query("INSERT INTO `users` (`username`, `password`) VALUES ('".$username."', '".$password."')") or die(mysql_error()); Edited March 28, 2012 by Guest Quote Link to comment Share on other sites More sharing options...
grant Posted March 28, 2012 Share Posted March 28, 2012 I wouldn't use my code, I was just re arranging the given code correctly. @Grant that wouldn't insert into the db either as you never called $sql. mysql_query("INSERT INTO `users` (`username`, `password`) VALUES ('".$username."', '".$password."')") or die(mysql_error()); was just example to show him how you do it lol Quote Link to comment Share on other sites More sharing options...
mixmaster Posted March 28, 2012 Share Posted March 28, 2012 was just example to show him how you do it lol If you are going to show him , atleast do it properly so he doesn't get mis-lead on what to do Quote Link to comment Share on other sites More sharing options...
grant Posted March 28, 2012 Share Posted March 28, 2012 If you are going to show him , atleast do it properly so he doesn't get mis-lead on what to do dont see you helping so dont comment on my post inless your going to help him Quote Link to comment Share on other sites More sharing options...
Guest Posted March 28, 2012 Share Posted March 28, 2012 was just example to show him how you do it lol Haha sorry if it sounded harsh If you are going to show him , atleast do it properly so he doesn't get mis-lead on what to do If you are going to complain please contribute to the thread. Quote Link to comment Share on other sites More sharing options...
stabs909 Posted March 29, 2012 Author Share Posted March 29, 2012 im confused. do i add my db info to mysql_query("INSERT INTO `user` (`username`, `password`) VALUES ('".$username."', '".$password."')") or die(mysql_error()); if so where Quote Link to comment Share on other sites More sharing options...
a_bertrand Posted March 29, 2012 Share Posted March 29, 2012 the db info is before via a mysql connect. BTW don't use mysql_query, those are old functions. If you start from scratch I would strongly suggest to use MySQLi which allows to make your code safer. (Doesn't mean you cannot be safe with the older functions, it just require more work). Quote Link to comment Share on other sites More sharing options...
grant Posted March 29, 2012 Share Posted March 29, 2012 the db info is before via a mysql connect. BTW don't use mysql_query, those are old functions. If you start from scratch I would strongly suggest to use MySQLi which allows to make your code safer. (Doesn't mean you cannot be safe with the older functions, it just require more work). lol he cant use mysql_query yet so going to take him some time to use mysqli .i have learned php by myself and i still have some issues back and forwords stabs just google tuts on how to code php and you will soon pick it up Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted March 29, 2012 Share Posted March 29, 2012 LOL grant like your the expert. You dont need to learn mysql first to learn mysqli and its probably better you dont. Just go with mysqli and you will be in a much better position. Quote Link to comment Share on other sites More sharing options...
grant Posted March 30, 2012 Share Posted March 30, 2012 LOL grant like your the expert. You dont need to learn mysql first to learn mysqli and its probably better you dont. Just go with mysqli and you will be in a much better position.never says i was an expert say it would be easy for him to understand better Quote Link to comment Share on other sites More sharing options...
stabs909 Posted March 30, 2012 Author Share Posted March 30, 2012 This is my register.php code. when i click register thisshows you account created sucessful but when i go to database nothing there? i dont understand <html> <title></title> <body> <center><img src="http://.photobucket.com/albums/ii513//Untitled-4.jpg" border="0" alt=".com"></a></center> <head> <style type="text/css"><!-- body {scrollbar-3dlight-color:silver; scrollbar-arrow-color:white; scrollbar-track-color:black; scrollbar-darkshadow-color:gray; scrollbar-face-color:gray; scrollbar-highlight-color:gray; scrollbar-shadow-color:black} body { background-color:#404040; } --></style> </head> </html> <p><?php echo date("F j, g:i:s a"); ?></p> <?php echo "<h3>Register here for free account</h3>"; $submit = $_POST['submit']; //form data if ($_POST['submit']) { $username = strip_tags($_POST['username']); $password = md5(strip_tags($_POST['password'])); $repeatpassword = md5(strip_tags($_POST['repeatpassword'])); echo $username; error_reporting(0); require "connect.php"; $write = mysql_query("INSERT INTO mysql_xxxxxxxxx VALUES('username','password')"); echo"<p><b>Account created sucessful</b>"; } ?> <html> <form action='register.php' method='POST'> <table> <tr> <td> Choose a username: </td> <td> <input type='text' name='username'> </td> </tr> <tr> <td> Choose a Password: </td> <td> <input type='password' name='password'> </td> </tr> <tr> <td> Repeat Password: </td> <td> <input type='password' name='repeatpassword'> </td> </tr> </table> <p> <left><input type='submit' name='submit' value='Register'> </form <p><a href='index.html'><u><b>Back to log in page</b></u></a></p> </html> this is my connect.php <?php $connect = mysql_connect("xxxxxxxx", "xxxxxxxx", "xxxxxxxx") or die ("Couldnt connect"); mysql_select_db("xxxxxxxxl") or die ("Couldnt find database"); echo "connection successful"; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.