コード例 #1
0
function subscribe($email, $listid)
{
    if (!$email || !$listid || !list_exists($listid) || !subscriber_exists($email)) {
        return false;
    }
    //if already subscribed exit
    if (subscribed($email, $listid)) {
        return false;
    }
    if (!db_connect()) {
        return false;
    }
    $query = "insert into sub_lists values ('{$email}', {$listid})";
    $result = mysql_query($query);
    return $result;
}
コード例 #2
0
function subscribe($email, $listid)
{
    //var_dump($email);
    /*if(!$listid||!list_exists($listid))
      {
    	  echo "<p>Something not right</p>";
        return false;
      }*/
    //if already subscribed exit
    if (subscribed($email, $listid)) {
        echo "<p>Already exists</p>";
        return false;
    }
    if (!($conn = db_connect())) {
        echo "<p>Could not connect to database</p>";
        return false;
    }
    $query = "insert into sub_lists(email,listid) values ('{$email}', {$listid})";
    if ($conn = db_connect()) {
        if ($conn->query($query)) {
            return true;
        } else {
            return false;
        }
    } else {
        echo "<p>Could not store;</p>";
        return false;
    }
}