KuJoe
02-02-10, 11:11 AM
I am trying to create a custom hook to check the tblclients table when a client tries to register and check against the IP field to see if that IP is associated with an account already. My developer has been busy with non-work related things so I turn to you for some guidance. Here is the code I currently have which is a mash of examples I've found all over:
<?php
add_hook("ClientDetailsValidation",0,"checkIPIsValid","");
function checkIPIsValid($vars)
{
$regip = $_SERVER['REMOTE_ADDR'];
$result = select_query("tblclients","id",array("ip"=>$regip));
while ($row = mysql_fetch_array($result))
{
if ($regip = $result)
{
$errormessage .= "<li>This IP has already registered an account, please login to that account to place an order.";
}
}
}
?>
<?php
add_hook("ClientDetailsValidation",0,"checkIPIsValid","");
function checkIPIsValid($vars)
{
$regip = $_SERVER['REMOTE_ADDR'];
$result = select_query("tblclients","id",array("ip"=>$regip));
while ($row = mysql_fetch_array($result))
{
if ($regip = $result)
{
$errormessage .= "<li>This IP has already registered an account, please login to that account to place an order.";
}
}
}
?>