36 lines
866 B
PHP
36 lines
866 B
PHP
<?php
|
|
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/config.php");
|
|
|
|
if ($_SESSION['id'] && isset($_POST['funnel_id']) && is_numeric($_POST['funnel_id'])) {
|
|
|
|
$clients = json_decode($_POST['clientsId']);
|
|
$all = 0;
|
|
if(isset($_POST['all']) && $_POST['all'] > 0){
|
|
$all = 1;
|
|
}
|
|
|
|
$funnel_id = $_POST['funnel_id'];
|
|
$cl = new Clients();
|
|
if($all > 0){
|
|
if(isset($_SESSION['where_campaigns'])){
|
|
$where = $_SESSION['where_campaigns'];
|
|
$sql = "SELECT id FROM clients WHERE 1 ".$where;
|
|
$q = mysql_query($sql);
|
|
while($r = mysql_fetch_assoc($q)){
|
|
$post['id'] = (int)$r['id'];
|
|
$post['new_funnel_id'] = $funnel_id;
|
|
$cl->updateFunnel($post);
|
|
}
|
|
} else {
|
|
exit();
|
|
}
|
|
} else {
|
|
foreach($clients as $client){
|
|
$post['id'] = $client;
|
|
$post['new_funnel_id'] = $funnel_id;
|
|
$cl->updateFunnel($post);
|
|
}
|
|
}
|
|
}
|
|
?>
|