<?php

# ---------------------------------------------------------
# MARK AS PASSPHRASED ALL DELETED CREDIT CARDS
# TO GENERATE THE CORRESPONDING INVOICES
# ---------------------------------------------------------

$query = "SELECT `name` FROM `setting` WHERE `name` LIKE '%Accept CC Number%' AND `value` = 1";
$result = mysql_query($query) or die("ERROR in query: $query");
while (list($name) = mysql_fetch_row($result)) {
    $startingindex = strpos ($name, '_') + 1;
    $length = strpos ($name, '_', $startingindex) - $startingindex;
    $name = substr ($name, $startingindex, $length);
    $update = "UPDATE `users` SET `passphrased` = 1 WHERE `data1` is null AND `data2` is null AND `data3` is null AND `passphrased` = 0 AND `cclastfour` = '' AND `paymenttype` = '$name'";
    mysql_query($update) or die("ERROR in query: $update");
}
?>