Thanks for your comment, the use of the $db class was no problem, I was already thinking of doing that. More useful was this article:
https://vborg.vbsupport.ru/showthread.php?t=82625
which I found thanks to you mentioning the word hook, I have read it before in the code but couldn't think of what was used for.
What about the IP loggin on each login? Is there a function in vBulletin or an existing plugin or would I have to write my own hook for that?
Hm somehow I can't get the hook to work. I inserted it at 'register_addmember_process' but now the step "Complete Registration" just takes forever and does not show the next page. My hook code is:
PHP Code:
$exist = $db->query_read("SELECT name FROM table WHERE name = '".$vbulletin->GPC['username']."'");
if(!$db->num_rows($exist))
$userdata->error('namenotexistant');
I already removed the "exit;" I had at the end and also replaced the eval - standard_error - fetch_error by $userdata->error, but nothing works

.