PDA

View Full Version : Quering userprofile fields in a webform


silverbanana
05-29-2006, 10:41 PM
Hello,

I'm wondering if someone can help me.

I would like to query and validate the username and security number (which is a profile field) in a HTML web form (Click here to see the form (http://www.silverbanana.co.uk/pl/index.html).

Could anyone give me any help in this? I'd really appreciate it. Thanks! :)

Kirk Y
05-30-2006, 09:22 PM
I believe you'd have to CHMOD the script (unless it's in your forum dir.) and then include global.php. Assuming your form is called "info", your Username field is named "user", and your Security Code field is named "sec_code", you could try this:

$username =& $vbulletin->input->clean_gpc('p', 'user', TYPE_STR);
$sec_code =& $vbulletin->input->clean_gpc('p', 'sec_code', TYPE_STR);

if(isset($_POST[info])){
if (!$user = $db->query_first("SELECT username FROM dbtable WHERE username = '" . $db->escape_string($username) . "'))
{
echo "User Not Found!";
}

if (!$sec = $db->query_first("SELECT sec_code FROM dbtable WHERE sec_code = '" . $db->escape_string($sec_code) . "'))
{
echo "Incorrect Security Code";
}
}