a_bertrand Posted March 30, 2012 Share Posted March 30, 2012 $write = mysql_query("INSERT INTO mysql_xxxxxxxxx VALUES('username','password')"); well... how do you expect it would work? let's admit your table is called mysql_xxxxxxxxx and have only two fields (which I doubt), you would insert all the time the same username / password being username and... password. You should at least pass variables to it. Sorry you need to learn a bit more for that read manuals tutorials. Why don't I give you the answer? First of all I have no clues of your table structure, second if I give you a working registration page (BTW you could download ezRPG or ZAP or GL and grab the registration from them) you would not learn anything. Quote Link to comment Share on other sites More sharing options...
Guest Posted March 30, 2012 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"; ?> If you planning on using it on a live site you need to escape those vars (username, password, repeatpassword). Quote Link to comment Share on other sites More sharing options...
Dominion Posted March 30, 2012 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 I would suggest watching a tutorial in how to create a login/register system. Quote Link to comment Share on other sites More sharing options...
sniko Posted March 30, 2012 Share Posted March 30, 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 May I question your methods here iExze, and I wish not to start a war... Say a user has a strong passcode. One that, for a case of the matter, is this; <^7dhe£>Rjyydg/> Now, Lets execute the following code. <?php /* * Look at your script, you're strip_tags'ing the password. * I won't md5 hash it, as then we won't see the actual value. * Compare the results with the passcode above, in blue. */ echo strip_tags("<^7dhe£>Rjyydg/>"); ?> This will output Rjyydg/> See the problem... ? Quote Link to comment Share on other sites More sharing options...
Guest Posted March 30, 2012 Share Posted March 30, 2012 May I question your methods here iExze, and I wish not to start a war... Say a user has a strong passcode. One that, for a case of the matter, is this; <^7dhe£>Rjyydg/> Now, Lets execute the following code. <?php /* * Look at your script, you're strip_tags'ing the password. * I won't md5 hash it, as then we won't see the actual value. * Compare the results with the passcode above, in blue. */ echo strip_tags("<^7dhe£>Rjyydg/>"); ?> This will output Rjyydg/> See the problem... ? There was code given, it needed fixing, not things such as that taking/adding, that is up to him to work that out ;), I would never give out code that worked how I wanted it to. If you understand. Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted March 30, 2012 Share Posted March 30, 2012 Sorry I dont see how that is helpful in the slightest. I gave out code of my own free will but its up to him to work out that its wrong? Really wasnt much point in you posting it. Quote Link to comment Share on other sites More sharing options...
sniko Posted March 30, 2012 Share Posted March 30, 2012 I guess that's directed at me... I've apologized to iExze as he pointed out that it was the OP that included the strip_tags in the first place. I just thought I'd post that, and I quickly assumed iExze posted that, as I was quick-reading the thread, to help people understand what will happen if they use strip_tags on the passcode input where it should be complicated, like the one I posted in my reply. I don't see how you see that isn't helpful..... Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted March 30, 2012 Share Posted March 30, 2012 No sniko that was directed at iExze. Dont really see the point in posting something that you perhaps know (debatable it was known) doesnt work and wouldnt post code you know does work. Quote Link to comment Share on other sites More sharing options...
Guest Posted March 30, 2012 Share Posted March 30, 2012 No sniko that was directed at iExze. Dont really see the point in posting something that you perhaps know (debatable it was known) doesnt work and wouldnt post code you know does work. What's the point in giving someone something? Telling somebody a solution straight away means they don't learn anything, instead let him post his code and find the bug himself THEN ask for help if he cannot solve it. Of course I have different opinions to some people, so I don't want to argue over a point :). Quote Link to comment Share on other sites More sharing options...
stabs909 Posted March 31, 2012 Author Share Posted March 31, 2012 well i did post my code an it not working i think im just going to give up im sick of it i can fix it. Quote Link to comment Share on other sites More sharing options...
stabs909 Posted March 31, 2012 Author Share Posted March 31, 2012 6 days ive been woring on the same page. Quote Link to comment Share on other sites More sharing options...
sniko Posted March 31, 2012 Share Posted March 31, 2012 (edited) 6 days ive been woring on the same page. Have a look at my replies and the one iExze did, page 3, and page 1. <?php /* * Register :: Skeleton * Fill in the //comments */ if($_POST) { /* * Submit button has been pressed * Filter / Sanitize and encrypt data * Enter data into the database * Show success message */ } ?> <h3>Register</h3> <form action='' method='post'> <!-- Form labels and inputs here --> <input type='submit' value='Register' /> </form> I don't see why this wouldn't work, when you add 'meat to the skeleton' Edited March 31, 2012 by sniko Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted April 1, 2012 Share Posted April 1, 2012 (edited) To be honest no one has given him the first step in making a registration page... It may help that you make a database first, before tempting to make a form, if you are wanting to store users information into a database. Then make the form, and add the INSERT query where it needs to be. Else everyone's input will not work like you want it to, because you have not created a database. I used google here is a simple tut to give you an idea... http://www.mikebernat.com/blog/Creating_a_Simple_Registration_Script_using_PHP Edited April 1, 2012 by lucky3809 Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted April 1, 2012 Share Posted April 1, 2012 Lucky I see 4 posts that have given advice, code and urls plus the new one that you have posted. I doubt the OP wishes to create it themselves. Quote Link to comment Share on other sites More sharing options...
Guest Posted April 1, 2012 Share Posted April 1, 2012 6 days ive been woring on the same page. If you have spent this long working on a simple registration page, I think it would be best to start from scratch learning from "Hello World", once you progress then you can start with more advance PHP and SQL. Quote Link to comment Share on other sites More sharing options...
sniko Posted April 1, 2012 Share Posted April 1, 2012 Have a look at this. Quote Link to comment Share on other sites More sharing options...
Crazy-T Posted April 1, 2012 Share Posted April 1, 2012 strip_tags on a password? lol. Awesome idea. Quote Link to comment Share on other sites More sharing options...
SirChick Posted April 4, 2012 Share Posted April 4, 2012 strip_tags on a password? lol. Awesome idea. IF you're being sarcastic (hard to tell).. its a very important thing to do. Otherwise some one could enter PHP tags, and it might execute. Quote Link to comment Share on other sites More sharing options...
Dominion Posted April 4, 2012 Share Posted April 4, 2012 IF you're being sarcastic (hard to tell).. its a very important thing to do. Otherwise some one could enter PHP tags, and it might execute. You should hash a password, and that is all you need. strip_tags() is pointless once something (yes even md5()) is applied. Quote Link to comment Share on other sites More sharing options...
Lithium Posted April 4, 2012 Share Posted April 4, 2012 Otherwise some one could enter PHP tags, and it might execute. honestly... that ought to be true... IF you are storing the passwords as plain text! Quote Link to comment Share on other sites More sharing options...
sniko Posted April 4, 2012 Share Posted April 4, 2012 IF you're being sarcastic (hard to tell).. its a very important thing to do. Otherwise some one could enter PHP tags, and it might execute. If you've known Crazy-T from his younger days, you'd assume it's sarcasm :P 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.