PDA

View Full Version : Need PHP Help Part II



adm
16-10-2006, 05:42 PM
Ok, again my site user system is playing up:-

http://habboit.info
or
http://xvisor.connect-hosting.com

If you try and register, fill out all the forms etc it says "some fields were left blank" or something like that.

Here's the register file:-


<html>
<head>
<title>Home</title>
<style type="text/css">
a {
font-size: 10px;
color: #000000;
}
a:link {
text-decoration: none;
color: #000000;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: underline;
color: #000000;
}
a:active {
text-decoration: none;
color: #000000;
}
body,td,th,p {
font-family: Verdana;
font-size: 10px;
color: #000000;
}
.5 { color: #ff0000; font-weight: bold; }
.4 { color: #ff6600; font-weight: bold; }
.3 { color: #006600; font-weight: bold; }
.2 { color: #000099; font-weight: bold; }
.1 { color: #000000; }
input {
font-family: Tahoma, Arial;
font-size: 8pt;
font-weight: bold;
color: #000000;
background-color: #FFFFFF;
border: 1px solid #000000;
}


</style>
</head>
<body bgcolor="#EFEFEF">
Before you can use our User System you must register below.
</body>
</html>
<?php
ob_start();
// allows you to use cookies
include("config.php");
//gets the config page
if ($_POST[register]) {
// the above line checks to see if the html form has been submitted
$username = $_POST[username];
$password = $_POST[pass];
$cpassword = $_POST[cpass];
$email = $_POST[emai1];
//the above lines set variables with the user submitted information
if($username==NULL|$password==NULL|$cpassword==NUL L|$email==NULL|$checkbox==FALSE) {
//checks to make sure no fields were left blank
echo "A field was left blank.";
}else{
//none were left blank! We continue...
if($password != $cpassword) {
// the passwords are not the same!
echo "Passwords do not match";
}else{
// the passwords are the same! we continue...
$password = md5($password);
// encrypts the password
$checkname = mysql_query("SELECT username FROM users WHERE username='$username'");
$checkname= mysql_num_rows($checkname);
$checkemail = mysql_query("SELECT email FROM users WHERE email='$email'");
$checkemail = mysql_num_rows($checkemail);
if ($checkemail>0|$checkname>0) {
// oops...someone has already registered with that username or email!
echo "The username or email is already in use";
}else{
// noone is using that email or username! We continue...
$username = htmlspecialchars($username);
$password = htmlspecialchars($password);
$email = htmlspecialchars($email);
// the above lines make it so that there is no html in the user submitted information.
//Everything seems good, lets insert.
$query = mysql_query("INSERT INTO users (username, password, email) VALUES('$username','$password','$email')");
// inserts the information into the database.
echo "You have successfully registered!";
}
}
}
}
else
{
// the form has not been submitted...so now we display it.
echo ("
<form method=\"POST\">
<table border=\"0\" width=\"100%\">
<tr>
<td width=\"50%\">
Username:&nbsp;</td>
<td width=\"50%\"> <input type=\"text\" size=\"20\" maxlength=\"25\" name=\"username\"></td>
</tr>
<tr>
<td width=\"50%\">
Password:&nbsp;</td>
<td width=\"50%\"> <input type=\"password\" size=\"20\" maxlength=\"25\" name=\"pass\"></td>
</tr>
<tr>
<td width=\"50%\">
Confirm Password:</td>
<td width=\"50%\"> <input type=\"password\" size=\"20\" maxlength=\"25\" name=\"cpass\"></td>
</tr>
<tr>
<td width=\"50%\">
Email:&nbsp;</td>
<td width=\"50%\"> <input type=\"text\" size=\"20\" maxlength=\"50\" name=\"emai1\"></td>
</tr>
</table>
<p>
<input type='checkbox' name='checkbox' /> <a href='rules.php'>I have read, and agree with the rules</a><br />
<input name=\"register\" type=\"submit\" value=\"Register\">
</p>
</form>

");
}
?>

uber
16-10-2006, 05:46 PM
remove the "agreed to terms and conditions" thing I think that is causing the prob

adm
16-10-2006, 06:15 PM
I'm no good at PHP and I will probably **** the code up completely.

No, it didn't work - thanks for trying.

xRoyal15
16-10-2006, 07:07 PM
Ah, My usersystem. If you wish to contact me on MSN Ill send you the new file, it has no errors.

adm
16-10-2006, 08:19 PM
I contacted you before and you said...

RYANNNNN
16-10-2006, 08:49 PM
xRoyal, how is that yours?

It's clear to see that's techtuts code lol..

EDIT: The error is because you haven't used POST to see if the user has clicked or hasn't clicked the box thing for the rules.

adm
16-10-2006, 08:52 PM
This system is full of errors.

Now, when I register, and try to log in it says incorrect username and/or password...

James.Easy
16-10-2006, 09:37 PM
Just ask for a refund.

adm
17-10-2006, 03:13 PM
Just ask for a refund.
That was a pointless posts - he doesn't believe in refunds.

ADAMS
17-10-2006, 03:28 PM
The person who sold you that script is a idiot.

He should of checked that there was no errors before selling it to you.

He should give you support and if its an error down to him doing the coding wrong he should repair is a.s.a.p.

Plus you can cleary see that it is a rip from techtuts. The only difference is, is that change the look of it and added some very simple CSS.

Techtuts [http://www.techtuts.com/forums/index.php?showtopic=48]

<?php
ob_start();
// allows you to use cookies
include("config.php");
//gets the config page
if ($_POST[register]) {
// the above line checks to see if the html form has been submitted
$username = $_POST[username];
$password = $_POST[pass];
$cpassword = $_POST[cpass];
$email = $_POST[emai1];
//the above lines set variables with the user submitted information
if($username==NULL|$password==NULL|$cpassword==NUL L|$email==NULL) {
//checks to make sure no fields were left blank
echo "A field was left blank.";
}else{
//none were left blank! We continue...
if($password != $cpassword) {
// the passwords are not the same!
echo "Passwords do not match";
}else{
// the passwords are the same! we continue...
$password = md5($password);
// encrypts the password
$checkname = mysql_query("SELECT username FROM users WHERE username='$username'");
$checkname= mysql_num_rows($checkname);
$checkemail = mysql_query("SELECT email FROM users WHERE email='$email'");
$checkemail = mysql_num_rows($checkemail);
if ($checkemail>0|$checkname>0) {
// oops...someone has already registered with that username or email!
echo "The username or email is already in use";
}else{
// noone is using that email or username! We continue...
$username = htmlspecialchars($username);
$password = htmlspecialchars($password);
$email = htmlspecialchars($email);
// the above lines make it so that there is no html in the user submitted information.
//Everything seems good, lets insert.
$query = mysql_query("INSERT INTO users (username, password, email) VALUES('$username','$password','$email')");
// inserts the information into the database.
echo "You have successfully registered!";
}
}
}
}
else
{
// the form has not been submitted...so now we display it.
echo ("

Idiot That Sold It You

<?php
ob_start();
// allows you to use cookies
include("config.php");
//gets the config page
if ($_POST[register]) {
// the above line checks to see if the html form has been submitted
$username = $_POST[username];
$password = $_POST[pass];
$cpassword = $_POST[cpass];
$email = $_POST[emai1];
//the above lines set variables with the user submitted information
if($username==NULL|$password==NULL|$cpassword==NUL L|$email==NULL|$checkbox==FALSE) {
//checks to make sure no fields were left blank
echo "A field was left blank.";
}else{
//none were left blank! We continue...
if($password != $cpassword) {
// the passwords are not the same!
echo "Passwords do not match";
}else{
// the passwords are the same! we continue...
$password = md5($password);
// encrypts the password
$checkname = mysql_query("SELECT username FROM users WHERE username='$username'");
$checkname= mysql_num_rows($checkname);
$checkemail = mysql_query("SELECT email FROM users WHERE email='$email'");
$checkemail = mysql_num_rows($checkemail);
if ($checkemail>0|$checkname>0) {
// oops...someone has already registered with that username or email!
echo "The username or email is already in use";
}else{
// noone is using that email or username! We continue...
$username = htmlspecialchars($username);
$password = htmlspecialchars($password);
$email = htmlspecialchars($email);
// the above lines make it so that there is no html in the user submitted information.
//Everything seems good, lets insert.
$query = mysql_query("INSERT INTO users (username, password, email) VALUES('$username','$password','$email')");
// inserts the information into the database.
echo "You have successfully registered!";
}
}
}
}
else
{
// the form has not been submitted...so now we display it.
echo ("

Selling other people's work. Shame on you plus it proves that you must be crap at PHP to copy Techtuts member system :|

adm
17-10-2006, 03:31 PM
So its a techtuts usersystem and yet it still doesn't work...

Heinous
18-10-2006, 06:20 AM
where this:
// the above line checks to see if the html form has been submitted
$username = $_POST[username];
$password = $_POST[pass];
$cpassword = $_POST[cpass];
$email = $_POST[emai1];
//the above lines set variables with the user submitted information
if($username==NULL|$password==NULL|$cpassword==NUL L|$email==NULL|$checkbox==FALSE) {
//checks to make sure no fields were left blank
echo "A field was left blank.";

remove:
|$checkbox==FALSE

Want to hide these adverts? Register an account for free!