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'])){
$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
newbie error
what is wrong with this code ?
<html>
<body>
<?
generating all possible random letters
hi'
how can i randomize the letters a,b,c,d,e all possible ways, and i want to print the res
Page not Loading After Test
Hey All
It seemed that an inlcude statement wasn't working for some reason, so I tried a more
Alternate messaging
I have 4 strings in MySQL db1
$string1 : Hello
$string2 : Hi
$string3 : Great
$strin
how to load php class from another domain?
how to load php class from another domain?
how to timeout $doc = new DOMDocument()->load($url)
I am currently using this $doc->load($url) to fetch an rss feed.
If a feed takes long than
Am I setting up my sites oldschool?
Ok,
When I create a site I open a basic template that I have created that consists of a css f
getting most records by count
Code: [Select]<?php
$connect = mysql_connect("localhost","dam
dropdown menu
Hello everbody,
I am php newbie.
I need to develop a program that once click the drop do
(sub)screen resize modification doesn't work after ECC 6 EhP 4 installation
Hello,
We have previously extended the size of the custom data tab on PO transaction ME23