Buggy registration system
Posted on
16th Feb 2014 07:03 pm by
admin
Hey, I just started scripting in PHP, and I ran into a few problems.
Code: <?php
include('config.php');
if (isset($_POST['set'])){
Did you know?Explore Trending and Topic pages for more stories like this.
$user=mysql_real_escape_string($_POST['user']);
$pass=mysql_real_escape_string(md5($_POST['pass']));
if ($user="" or $pass=""){
echo 'Invalid Username/Password';
}
else{
mysql_select_db("db_mycountdown",$db_connect);
$sql=mysql_query("SELECT * FROM users WHERE username='$user'",$db_connect);
$fetch = mysql_num_rows($sql);
if ($fetch>0){
unset($user);
echo 'Error: This user already exists!
';
}
else{
mysql_select_db("db_mycountdown",$db_connect);
$sql = mysql_query("INSERT INTO users (username, password)
VALUES ('$user','$pass')",$db_connect);
echo 'Account Successfully Created!';
}
}
}
echo '<a href="Index.php">Already have an account? Log in!</a>
<form action="" method="post">
Username:<br/>
<input type="text" name="user"/><br />
Password:<br/>
<input type="password" name="pass"/><br />
Confirm Password:<br/>
<input type="password" name="passconfirm"/><br /><br />
<input type="submit" name="set" value="Register" /> <br />
</form>';
?>
my php code here seems really buggy. Can anyone point out any errors? Thanks
No comments posted yet
Your Answer:
Login to answer
232
10
Other forums
Line break?
Hi, I'm new to the forum and new to php. I'm not sure if I'm using the correct terminology so here i
1,000 select boxes with 100 options?!
I have 1 drop down select box with 1,000 options.
In some case, there will be 100+ of the
Include with Parameters
In a particular page I would like to include a file that requires $_GET parameters.
when I go
Best PHP Documentation generator
Hello guys!
I would like to hear from you what is the best PHP documentation generator. Perso
Strip Slashes Help
I've got a script that i've downloaded of the net to edit multiple fields from my sql database, and
Using loop to count number of entries
I'm writing a program that must ask user to type in numbers. After each entry, the program has to re
limitations on array_unique()
Does any one know what/how imitations are applied to array_unique? I have an issue where no matter h
LinkedList help
Ok so I just learned quickly about lists, so I have a not too hard project I think, but am having a
mysql query with single quotes in a variable
$sitedetails = "INSERT INTO vars (address, sitename, description, ownername, theme) VALUES ('$u
Thread in PHP
Thread in PHP
Some basic use and basic code for thread in php
This is my question?