0 Users appreciate this thread.
Register Script: Password Confirm not Working
Fayne_Aldan (2012-08-21 08:03:18)Use != instead of ! = (No space)
T_STRING is usually an error with if() with me.
Also, I would recommend adding a username length limit and username character filtering.
For example, if I make the length limit 10 and the username character filtering include the symbol ", then the username test"ing123 would not be allowed because it is over 10 characters long and contains a ".
I would EXTREMELY recommend not allowing the following the < or > symbols since someone could add PHP to their username allowing them to hack someone when they just see their username. Also, make sure you block the < and > symbols in ANYTHING that can be typed by a user on your website. For example, block it on comments, forums, chat, profile bio, etc.
Thanks for reading.
SPCOxion (2012-08-21 11:24:44)(off-topic)
@bunny123
Oh my gosh...
I've never been so proud in a friend!
Fayne_Aldan (2012-08-21 11:50:20)@Proxion
How do you get those badges?
@Angelrulez7
I just found another problem with that section of code, a BIG problem. Replace:
< Start of code >
if (blah blah blah);
}
{
< End of code >
with:
< Start of code >
if (blah blah blah) {
Put whatever code you wanted here
}
else
{
< End of code >
SPCOxion (2012-08-21 18:44:58)@bunny123
You make them at bighugelabs.com .
2012-08-21 18:47:11
(Capt.)Orb (2012-08-26 00:37:43)Btw judging on your script,passwords are not encrepted....
Dangerous....
Aviation fact: The a380 is the largest commerical aircraft in service!
Go to Splashiverse! Splashiverse
Go to Splashiverse! Splashiverse
angelrulez7 (2012-08-26 03:00:47)MD5 doesn't match the login I use. But my site, 3DSRun works with MD5.
a
Log in to submit a comment
Back to forum: Web Programming (HTML, JS, CSS, PHP, MySQL)
New registered users today: 7
Newest registered user: ElegantVulpes
<?php
// Connects to your Database
mysql_connect("localhost", "HIDDEN", "HIDDEN"
mysql_select_db("HIDDEN"
//This code runs if the form has been submitted
if (isset($_POST['submit'])) {
//This makes sure they did not leave any fields blank
if (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2pointo'] ) {
die('You did not complete all of the required fields'
}
// checks if the username is in use
if (!get_magic_quotes_gpc()) {
$_POST['username'] = addslashes($_POST['username']);
}
$usercheck = $_POST['username'];
$check = mysql_query("SELECT username FROM users WHERE username = '$usercheck'"
or die(mysql_error());
$check2 = mysql_num_rows($check);
//if the name exists it gives an error
if ($check2 != 0) {
die('Sorry, the username '.$_POST['username'].' is already in use.'
}
//
this makes sure both passwords entered match
if ($_POST['pass'] ! = $_POST['pass2pointo']);
}
{
die('Your passwords did not match. '
}
// here we encrypt the password and add slashes if needed
if (!get_magic_quotes_gpc()) {
$_POST['pass'] = addslashes($_POST['pass']);
$_POST['username'] = addslashes($_POST['username']);
}
// now we insert it into the database
$insert = "INSERT INTO users (username, password)
VALUES ('".$_POST['username']."', '".$_POST['pass']."'
$add_member = mysql_query($insert);
?>
<h1>Registered</h1>
<p>Thank you, you have registered - you may now login</a>.</p>
<?php
}
else
{
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table border="0">
<tr><td>Username:</td><td>
<input type="text" name="username" maxlength="60">
</td></tr>
<tr><td>Password:</td><td>
<input type="password" name="pass" maxlength="10">
</td></tr>
<tr><td>Confirm Password:</td><td>
<input type="password" name="pass2pointo" maxlength="10">
</td></tr>
<tr><th colspan=2><input type="submit" name="submit"
value="Register"></th></tr> </table>
</form>
<?php
}
?> <meta name="viewport" content="width=device-width">
The bolded text is the error. It brings:
Parse error: syntax error, unexpected T_STRING in /home/rulez7/public_html/register.php on line 52
I need the correct syntax. Please? :/
Thanks.