When I run my code I'm facing the next 2 errors:
mysql_num_rows() expects parameter 1 to be resource, boolean
That happens at rare lines of the file. Rest of them works just fine.
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 't '' at line 1
Yes, Its vulnerable, I see. Its probably some weird charecters making up the issue, but I can really edit them, because I save the words to the db for md5ing them.
I assume mysql_real_escape_string
will add some slashes which will give me another md5 value. So how can I not edit the datas and get the script secure at the same time?
require ("dbconnect.php");
$list = fopen("huge.txt","r");
//convert and save to db
while(!feof($list))
{
$word = fgets($list);
//check if already in db.
$check = mysql_query("SELECT id FROM `database` WHERE word='$word'") or
die(mysql_error());
if (mysql_num_rows($check)==0)
{
//rest of the codes
I added die()
just for me to see whats wrong.