}
$sql = "SELECT DISTINCT `additional_description` AS name FROM `wp_product_list` WHERE `active` = 1 AND `visible` = 1 AND `additional_description` > '' ORDER BY id DESC";
global $wpdb;
$result_array = $wpdb->get_results($sql, ARRAY_A);
pokazh($result_array);
exit;
//$result_array = array_map('trim',$result_array);
$result_string = r_implode(",", $result_array);
$result_string = str_replace(".", ",", $result_string);
$result_string = str_replace(",,", ",", $result_string);
$result_string = str_replace(", ", "|", $result_string);
$result_string = str_replace(",", "|", $result_string);
$tags = explode("|", $result_string);
array_walk($tags, 'edit_value');
sort($tags);
pokazh($tags);
exit;
foreach ($tags as $key => $value) {
    if (is_null($value)) {
        unset($tags[$key]);
        //echo "<br />unset null<br />";
    }
    if ($value == '') {
        unset($tags[$key]);
        //echo "<br />unset empty<br />";
    }
    if ($value == ' ') {
        unset($tags[$key]);
        //echo "<br />unset space<br />";
    }
}
Exemple #2
0
function get_cartoon($id)
{
    $sql = "SELECT `wp_product_list`.id, `wp_product_list`.name, `wp_product_list`.description, `wp_product_list`.additional_description, `wp_product_list`.image, `wp_product_brands`.`name` as brand, `wp_product_categories`.`name` as kategoria FROM `wp_product_list`,`wp_item_category_associations`, `wp_product_brands`, `wp_product_categories` WHERE `wp_product_list`.`id` = `wp_item_category_associations`.`product_id` AND `wp_product_brands`.`id` = `wp_product_list`.`brand` AND `wp_item_category_associations`.`category_id` = `wp_product_categories`.`id` AND `wp_product_list`.`id`=" . $id . " LIMIT 1";
    global $cartoon_id, $cartoon_name, $cartoon_description, $cartoon_additional_description, $cartoon_image, $cartoon_kategoria, $cartoon_brand;
    include "config.php";
    $link = mysql_connect($mysql_hostname, $mysql_user, $mysql_password);
    mysql_set_charset('utf8', $link);
    pokazh($sql);
    $result = mysql_query($sql);
    if (!$result) {
        die('Invalid query: ' . mysql_error());
    }
    $row = mysql_fetch_array($result);
    $cartoon_id = $row['id'];
    $cartoon_name = $row['name'];
    $cartoon_description = $row['description'];
    $cartoon_additional_description = $row['additional_description'];
    $cartoon_image = $row['image'];
    $cartoon_kategoria = $row['kategoria'];
    $cartoon_brand = $row['brand'];
    pokazh($cartoon_id . " " . $cartoon_name . " " . $cartoon_description . " " . $cartoon_additional_description . " " . $cartoon_image . " " . $cartoon_brand . " " . $cartoon_kategoria);
}
Exemple #3
0
<?php

global $wpdb;
$purchase_log_sql = "SELECT * FROM `wp_purchase_logs` WHERE `id`= " . $inv_id . " LIMIT 1";
$purchase_log = $wpdb->get_results($purchase_log_sql, ARRAY_A);
if (isset($purchase_log[0]['id'])) {
    $purchaseid = $purchase_log[0]['id'];
} else {
    $purchaseid = '0';
}
pokazh($purchaseid, "{$purchaseid}");
// регистрационная информация (пароль #1)
// registration info (password #1)
$mrh_pass1 = "Atljhjdbx1";
// чтение параметров
// read parameters
$out_summ = $_REQUEST["OutSum"];
$inv_id = $_REQUEST["InvId"];
$shp_item = $_REQUEST["Shp_item"];
$crc = $_REQUEST["SignatureValue"];
$crc = strtoupper($crc);
$my_crc = strtoupper(md5("{$out_summ}:{$inv_id}:{$mrh_pass1}:Shp_item={$shp_item}"));
// проверка корректности подписи
// check signature
if ($my_crc != $crc) {
    echo "bad sign\n";
    exit;
}
// проверка наличия номера счета в истории операций
// check of number of the order info in history of operations
$f = @fopen("order.txt", "r+") or die("error");
        // kalininsky
        mail_attachment($my_file, $my_path, $mailto2, $my_mail, $my_name, $my_replyto, $my_subject, $my_message);
        $count = $count - 1;
        if (file_exists($export_dir . $slidename)) {
            unlink($export_dir . $slidename);
            //echo "\n\r>>>> slide removed";
        }
        // Mark image as sent to the Anekdot.ru
        $update_sql = "update wp_fsr_post set anekdotru_date='" . date("d.m.y H:m:s") . "' where ID=" . $ID;
        $res = mysql_query($update_sql);
        if (!$res) {
            die('<br />' . $update_sql . '<br />Invalid delete query: ' . mysql_error());
        }
    }
    if (count($arrAuthors) >= $howmanyemails) {
        pokazh($arrAuthors);
        exit;
    }
}
function mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message)
{
    $file = $path . $filename;
    $file_size = filesize($file);
    $handle = fopen($file, "r");
    $content = fread($handle, $file_size);
    fclose($handle);
    $content = chunk_split(base64_encode($content));
    $uid = md5(uniqid(time()));
    $name = basename($file);
    $header = "From: " . $from_name . " <" . $from_mail . ">\r\n";
    $header .= "Reply-To: " . $replyto . "\r\n";
$sql = substr($sql, 0, -1);
pokazh($sql);
$result = mysql_query($sql);
mysql_close($con);
// get a list of votes to update
$sql = "SELECT purchase_id, cartoon_id from all_purchases where vote_added = 0 limit 500";
$con = mysql_connect($mysql_hostname, $mysql_user, $mysql_password);
if (!$con) {
    die('Could not connect: ' . mysql_error());
}
mysql_select_db($mysql_database, $con);
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
    $id = $row['cartoon_id'];
    $purchase_id = $row['purchase_id'];
    pokazh($id);
    $sql = "Insert into wp_fsr_user (user, post, points, ip, vote_date) values ('sale'," . $id . ",5,'127.0.0.1',now())";
    echo $sql . "<br>";
    $res = mysql_query($sql);
    $sql = "Update wp_fsr_post set votes=votes+1, points=points+5 where id = " . $id;
    echo $sql . "<br>";
    $res = mysql_query($sql);
    $sql = "Update wp_product_list set votes=votes+1, votes_sum=votes_sum+5 where id = " . $id;
    echo $sql . "<br>";
    $res = mysql_query($sql);
    $sql = "Update wp_product_list set votes_rate=(votes_sum/votes)*(sqrt(sqrt(votes))) where id = " . $id;
    echo $sql . "<br>";
    $res = mysql_query($sql);
    $sql = "Update all_purchases set vote_added=1 where purchase_id = " . $purchase_id . " and cartoon_id = " . $id;
    echo $sql . "<br>";
    $res = mysql_query($sql);
Exemple #6
0
function t()
{
    global $time_start;
    $time_end = microtime(true);
    $time = $time_end - $time_start;
    pokazh("{$time} сек.");
    exit;
}
Exemple #7
0
<?php

// run this several times to wipe out extra double votes
include "config.php";
global $wpdb;
$link = mysql_connect($mysql_hostname, $mysql_user, $mysql_password);
mysql_set_charset('utf8', $link);
$result = mysql_query("select post, user, points, ip from `wp_fsr_user` order by post, ip, points desc");
if (!$result) {
    die('Invalid query: ' . mysql_error());
}
//
$count = mysql_num_rows($result);
pokazh($count, "всего рядов");
//
$row = mysql_fetch_array($result);
$current_points = $row['points'];
$current_ip = $row['ip'];
$current_post = $row['post'];
$count = $count - 1;
while ($row = mysql_fetch_array($result)) {
    //echo "<br />";
    //pokazh($count,"count");
    //echo $row['user'] . " " . $row['points']." <b>". $row['post']. "</b> " .$row['ip'].":<br />";
    //if ($row['post']==$current_post && $row['points']==$current_points && $row['ip']==$current_ip)
    if ($row['post'] == $current_post && $row['ip'] == $current_ip) {
        echo "<br /><font color='#FF00FF'><b>this will be deleted!:</b> </font> ip='" . $row['ip'] . "' cartoon=<a href='http://cartoonbank.ru/?page_id=29&cartoonid=" . $current_post . "'>" . $current_post . "</a>";
        $del_sql = "delete from `wp_fsr_user` where user='******'user'] . "' and ip='" . $row['ip'] . "' and post=" . $current_post;
        $res = mysql_query($del_sql);
        //  recalculate point and sum
        $_votes = $wpdb->get_var("SELECT COUNT( * ) FROM  `wp_fsr_user` WHERE post = {$picture_id}");
Exemple #8
0
<?php

// reset votres and point in `wp_fsr_post`
include "config.php";
global $wpdb;
$link = mysql_connect($mysql_hostname, $mysql_user, $mysql_password);
mysql_set_charset('utf8', $link);
$result = mysql_query("select ID from `wp_fsr_post` order by ID asc LIMIT 9000, 2000");
if (!$result) {
    die('Invalid query: ' . mysql_error());
}
$c = 1;
while ($row = mysql_fetch_array($result)) {
    $picture_id = $row['ID'];
    //  recalculate point and sum
    $_votes = mysql_query("SELECT COUNT( * ) FROM  `wp_fsr_user` WHERE post = {$picture_id}");
    $_points = mysql_query("SELECT SUM( points ) FROM  `wp_fsr_user` WHERE post = {$picture_id}");
    //pokazh($c);
    $_votes = mysql_result($_votes, 0);
    $_points = mysql_result($_points, 0);
    pokazh($c . ": <b>" . $picture_id . "</b> " . $_votes . "/" . $_points, "c: id _votes/points: ");
    //pokazh($_points,"_points");
    $sql = "UPDATE `wp_fsr_post` SET votes={$_votes}, points={$_points} WHERE ID={$picture_id};";
    //pokazh($sql,"sql");
    $rez = mysql_query($sql);
    ++$c;
}