PDA

View Full Version : mySQL error


Mijae
04-23-2003, 01:28 AM
Database error in vBulletin Control Panel 2.3.0:

Invalid SQL: INSERT INTO useractivation VALUES (NULL,'1498','1051062010','91932666',0)
mysql error: Column count doesn't match value count at row 1

mysql error number: 1136

Date: Tuesday 22nd of April 2003 07:40:10 PM
Script: http://www.url.com/forum/forum/admin/email.php
Referer: http://www.url.com/forum/admin/email.php?action=start&

It has never happened to me before, I've been trying to email users their activation codes...

DigitalDesktops
04-23-2003, 01:35 AM
you're missing the "usergroupid" column

Mijae
04-23-2003, 03:57 AM
And to fix that...? I dont really know why its not there...

DigitalDesktops
04-23-2003, 04:01 AM
search for this in email.php(Unhacked):

INSERT INTO useractivation

make sure below that it says:

(useractivationid, userid, dateline, activationid, type, usergroupid)
VALUES
(NULL, $activate[activationid], ".time().", '$user[activationid]', 0, 2)
");
if it doesn't say that, replace the query, with the one above. :) hope this helps. :)

Mijae
04-23-2003, 05:23 PM
//check for existing one...if not generate new one
if (!$activate=$DB_site->query_first("SELECT activationid FROM useractivation WHERE userid='$user[userid]' AND type=0")) {
// or generate new one!
// delete old activation id
$DB_site->query("DELETE FROM useractivation WHERE userid='$user[userid]' AND type=0");

// make random number
mt_srand ((double) microtime() * 1000000);
$activate[activationid]=mt_rand(0,100000000);

//save to DB
$DB_site->query("INSERT INTO useractivation VALUES (NULL,'$user[userid]','".time()."','$activate[activationid]',0)");
}
}

$sendmessage=str_replace("\$activateid",$activate[activationid],$sendmessage);
}
$sendmessage=str_replace("\$bburl",$bburl,$sendmessage);
$sendmessage=str_replace("\$bbtitle",$bbtitle,$sendmessage);

if (!$test) {
echo "sending ... \n";
vbmail($user['email'], $subject, $sendmessage, $from);
} else {
echo "testing ... \n";
}

echo "ok<br>\n";


Thats the code that has the INSERT INTO useractivation and yes this is an unhacked email.php from vb2.3.0

DigitalDesktops
04-23-2003, 10:47 PM
Today at 06:23 PM v0id said this in Post #5 (https://vborg.vbsupport.ru/showthread.php?postid=386006#post386006)

//check for existing one...if not generate new one
if (!$activate=$DB_site->query_first("SELECT activationid FROM useractivation WHERE userid='$user[userid]' AND type=0")) {
// or generate new one!
// delete old activation id
$DB_site->query("DELETE FROM useractivation WHERE userid='$user[userid]' AND type=0");

// make random number
mt_srand ((double) microtime() * 1000000);
$activate[activationid]=mt_rand(0,100000000);

//save to DB
$DB_site->query("INSERT INTO useractivation VALUES (NULL,'$user[userid]','".time()."','$activate[activationid]',0)");
}
}

$sendmessage=str_replace("\$activateid",$activate[activationid],$sendmessage);
}
$sendmessage=str_replace("\$bburl",$bburl,$sendmessage);
$sendmessage=str_replace("\$bbtitle",$bbtitle,$sendmessage);

if (!$test) {
echo "sending ... \n";
vbmail($user['email'], $subject, $sendmessage, $from);
} else {
echo "testing ... \n";
}

echo "ok<br>\n";


Thats the code that has the INSERT INTO useractivation and yes this is an unhacked email.php from vb2.3.0

VB - 2.3.0

Replace This:
(NULL,'$user[userid]','".time()."','$activate[activationid]',0)");

With this code:
(NULL, $activate[activationid], ".time().", '$user[activationid]', 0, 2)");