Jump to content

Recommended Posts

Never got it before.

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

 

<link rel="stylesheet" type="text/css" href="style.css" /> 
<div align="center"><div class="box"><div align="left"><img src="Banner.png" border="0"><div class="line">Home | Start<div class="line"></div></div><br><br><?php
require ("settings.php");
$username = $_POST['username'];
$password = $_POST['password'];
$anti = $_POST['anti'];
$secret_password = md5($password);
$anti1 = "djksdfjiu44";
  
if (!$username || !$password)
   die (" <p align='left'><form action='register.php' method='POST'>
<b>Please note that special characters will be removed upon registering.</b><br /><br />
* Username: <input type='text' name='username' maxlength='13'><br /><br />
* Anti-spam verification: <input type='text' name='anti'><br>//The code is $anti1//<br /><br />
* Password: <input type='password' name='password' maxlength='25'></div><br /><br />
<input type='submit' value='Register'>
</form></p>");

if (!$anti)
   die ("You didn't enter in the anti-spam verification code!");

if ($anti==$anti1) {

if (strlen($password)<=3) {
        echo "Password must be more then 3 characters long! <a href='register.php'> << Back </a>";
}
else
{

if (strlen($username)<=3) {
        echo "Username must be more then 3 characters long! <a href='register.php'> << Back </a>";
}
else
{
$ip = $_SERVER['REMOTE_ADDR'];

//protection
$before = array('(', ')', '^', '<', '>', '`', '*', '<script>', '</script>', ';DROP TABLE users;', 'users', 'DROP', 'TABLE');
$after   = array('', '', '', '', '', '', '', '', '', '', '', '', '');
$output  = str_replace($before, $after, $username);

//protection
$display_name_output = str_replace($before, $after, $dname);

//protection
$output4  = str_replace($before, $after, $email);

//protection
$output2  = str_replace($before, $after, $signature);

$connect = mysql_connect("$dbhost","$dbuser","$dbpassword") or die("Connection failed!");
mysql_select_db("$db") or die("Database fail!");

$query = mysql_query("SELECT * FROM users WHERE username='$output'");

$numrows = mysql_num_rows($query);

if ($numrows!=0) {
   echo "This username already exists!";
}
else
{

//write
$write = mysql_query("INSERT INTO users (id, username, password, frpcash, premium, ip) VALUES ('', '$output', '$secret_password', '10', '0', '$ip'") or die(mysql_error());

echo "<div class='box'>Thank you for registering ". $output ."! Login <a href='login.php'>here</a>!</div>";
}
}
}
} else {
echo "You entered the incorrect anti-spam verification code!";
}
?></div><br><br><Br><br><img src="1.png" border="0"></img></div></div>

Link to comment
https://forums.phpfreaks.com/topic/194078-weird-error/
Share on other sites

you have an error on this line:

 

$write = mysql_query("INSERT INTO users (id, username, password, frpcash, premium, ip) VALUES ('', '$output', '$secret_password', '10', '0', '$ip'") or die(mysql_error())

 

You forgot the last ")" for your values. also make sure that you use mysql_real_escape_string

Link to comment
https://forums.phpfreaks.com/topic/194078-weird-error/#findComment-1021208
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.