$result=$sql->query_read('x'," SELECT COUNT(*) AS `Rows`, `user_id` FROM `mangadex_clients` where approved = 1 GROUP BY `user_id` ORDER BY `user_id` ",'fetchAll',PDO::FETCH_ASSOC,-1);
foreach($resultas$row){
$subject="Please update your MD@H client to 1.1.5";
$message="Hello,\n\n".
"The MD@H client has been updated to 1.1.5. Please check the [url=https://mangadex.org/md_at_home/clients]My clients[/url] page for the download link and update as soon as possible. [b]Clients earlier than 1.0.0 will be paused on the network.[/b] Please ignore this message if you have already upgraded.";
$email=$sql->query_read('x'," SELECT email FROM mangadex_users where user_id = {$row['user_id']} LIMIT 1 ",'fetchColumn','',-1);
$username=$sql->query_read('x'," SELECT username FROM mangadex_users where user_id = {$row['user_id']} LIMIT 1 ",'fetchColumn','',-1);
$to=$email;
$subject="Please update your MD@H client to 1.1.5 - $username";
$body="Hello,\n\n".
"The MD@H client has been updated to 1.1.5. Please check this page: https://mangadex.org/md_at_home/clients for the download link and update as soon as possible. Clients earlier than 1.0.0 will be paused on the network. Please ignore this message if you have already upgraded.
$body="Dear sirs, you recently emailed one of my staff members and said that 'Kaiqian Ltd' is attempting to register the following domains: mangadex.cn, mangadex.com.cn, mangadex.net.cn, mangadex.org.cn. You wanted to know whether my company has a connection with this Chinese company. I would like to confirm that this company is NOT related to my company, and we would object to 'Kaiqian Ltd' registering those domain names. We are currently in control of mangadex.com, mangadex.org, mangadex.co.uk, mangadex.uk and mangadex.dev. In fact, if possible, we would like to register mangadex.cn, mangadex.com.cn, mangadex.net.cn and mangadex.org.cn. Kind regards, MangaDex. ";
send_email($to,$subject,$body,4);
*/
/*
$mat=[
'M1-H.png'=>0,
'M2-H.png'=>0,
'M3-H.png'=>0,
'M4-H.png'=>0,
'M5-H.png'=>0,
'M6-H.png'=>0,
'M7-H.png'=>0,
'M2-V.png'=>0,
'M3-V.png'=>0,
'M4-V.png'=>0,
'M5-V.png'=>0,
'M6-V.png'=>0,
'M7-V.png'=>0
];
$orders=$sql->query_read('x'," SELECT * FROM mangadex_orders ",'fetchAll',PDO::FETCH_ASSOC,-1);
foreach($ordersas$order){
$order_array=json_decode($order['items'],true);
foreach($order_arrayas$key=>$value){
if($value){
$key=str_replace('_','.',$key);
$mat[$key]+=$value;
}
}
}
print_r($mat);
*/
/*
$names=[
'M1-H.png'=>'My Neighbour MangaDex (Horizontal)',
'M2-H.png'=>'Anniversary (Horizontal)',
'M3-H.png'=>'Vaporwave (Horizontal)',
'M4-H.png'=>'Stylized White (Horizontal)',
'M5-H.png'=>'Stylized Black (Horizontal)',
'M6-H.png'=>'Simple Logo (Horizontal)',
'M7-H.png'=>'Banana (Horizontal)',
'M2-V.png'=>'Anniversary (Vertical)',
'M3-V.png'=>'Vaporwave (Vertical)',
'M4-V.png'=>'Stylized White (Vertical)',
'M5-V.png'=>'Stylized Black (Vertical)',
'M6-V.png'=>'Simple Logo (Vertical)',
'M7-V.png'=>'Banana (Vertical)'
];
foreach($ordersas$order){
$email=$sql->query_read('x'," SELECT email FROM mangadex_users where user_id = {$order['user_id']} LIMIT 1 ",'fetchColumn','',-1);
$username=$sql->query_read('x'," SELECT username FROM mangadex_users where user_id = {$order['user_id']} LIMIT 1 ",'fetchColumn','',-1);
$to=$email;
$order_array=json_decode($order['items'],true);
$string='';
foreach($order_arrayas$key=>$value){
if($value){
$key=str_replace('_','.',$key);
$string.=$names[$key].": ".$value."\n";
}
}
$subject="MangaDex Shop Order Confirmation: Order {$order['order_id']} - $username";
$body="Thank you for buying mousemat(s) from our shop. \n\n Sorry for the delay in getting these confirmation emails sent out. \n\nYour order contains the following items: \n\n$string\n\n Please confirm your name and shipping address by replying to this email.\n\n You have chosen to pay by ".PAYMENT_METHODS[$order['payment']].". The invoice/instructions for payment will follow in a subsequent email.\n\n Thanks for your support! \n\nHolo (mangadexstaff@gmail.com)";
print$to."".$subject."".$body."\n\n";
send_email($to,$subject,$body);
}
*/
/*
$txs=$sql->query_read('x'," SELECT * FROM mangadex_user_paypal ",'fetchAll',PDO::FETCH_ASSOC,-1);
foreach($txsas$tx){
$sql->modify('x'," update mangadex_user_paypal set count = (select count(*) from mangadex_user_transactions_v2 where email like ?) WHERE paypal like ? LIMIT 1
", [$tx['paypal'], $tx['paypal']]);
print$tx['user_id'];
}
*/
/*
$txs=$sql->query_read('x'," SELECT * FROM mangadex_user_paypal WHERE count > 0 ",'fetchAll',PDO::FETCH_ASSOC,-1);
foreach($txsas$tx){
$sql->modify('x'," update mangadex_users set premium = 1 WHERE user_id LIKE ? LIMIT 1
", [$tx['user_id']]);
print$tx['user_id'].' ';
}
*/
/*
$txs=$sql->query_read('x'," SELECT * FROM mangadex_user_transactions_v2 ",'fetchAll',PDO::FETCH_ASSOC,-1);
foreach($txsas$tx){
$sql->modify('x'," update mangadex_user_transactions_v2 set user_id = (SELECT user_id FROM mangadex_user_paypal WHERE paypal LIKE ? LIMIT 1) WHERE transaction_id = ? LIMIT 1
$joined_timestamp=$sql->query_read('x'," SELECT joined_timestamp FROM mangadex_users WHERE joined_timestamp >= 1597622400 ",'fetchAll',PDO::FETCH_COLUMN,-1);
$last_timestamp=$sql->query('last_timestamp'," SELECT visit_timestamp FROM mangadex_logs_visits ORDER BY visit_timestamp ASC LIMIT 1 ",'fetchColumn','',-1)+3600;
$views_guests=$sql->query('views_guests'," SELECT count(*) FROM mangadex_logs_visits WHERE visit_timestamp >= ($i - 3600) AND visit_timestamp < $i AND visit_user_id = 0 ",'fetchColumn','',-1);
$views_logged_in=$sql->query('views_logged_in'," SELECT count(*) FROM mangadex_logs_visits WHERE visit_timestamp >= ($i - 3600) AND visit_timestamp < $i AND visit_user_id > 0 ",'fetchColumn','',-1);
$users_guests=$sql->query('users_guests'," SELECT COUNT(*) FROM (SELECT `visit_user_id` FROM `mangadex_logs_visits` WHERE visit_timestamp >= ($i - 3600) AND visit_timestamp < $i AND visit_user_id = 0 GROUP BY `visit_ip`) AS `TABLE` ",'fetchColumn','',-1);
$users_logged_in=$sql->query('users_logged_in'," SELECT COUNT(*) FROM (SELECT `visit_user_id` FROM `mangadex_logs_visits` WHERE visit_timestamp >= ($i - 3600) AND visit_timestamp < $i AND visit_user_id > 0 GROUP BY `visit_user_id`) AS `TABLE` ",'fetchColumn','',-1);
$sql->modify('delete',' DELETE FROM `mangadex_logs_visits` WHERE visit_timestamp >= (? - 3600) AND visit_timestamp < ? ',[$i,$i]);
}
*/
/*
$results=$db->get_results(" SELECT mangadex_users.user_id, mangadex_users.level_id FROM `mangadex_forum_posts` LEFT JOIN mangadex_users ON mangadex_users.user_id = mangadex_forum_posts.user_id WHERE `thread_id` = 5654 and level_id < 4 ");
foreach($resultsas$row){
print"UPDATE mangadex_users SET level_id = 4 WHERE user_id = $row->user_id LIMIT 1; <br />";
}
*/
/*
$results=$db->get_results(" SELECT * FROM `mangadex_users` WHERE `level_id` = 2 and user_id >= 1100 and user_id < 1649 ");
$body="Thank you for creating an account on MangaDex. \n\nUsername: $row->username\n\nActivation code: $row->activation_key\n\nPlease visit https://mangadex.org/activation/$row->activation_key to activate your account. Unactivated accounts will be purged at some point in the future.";
send_email($to,$subject,$body);
print$row->user_id."<br />";
}
*/
/*
$results=$db->get_results(" SELECT mangadex_comments_manga.*, thread_id FROM `mangadex_comments_manga` LEFT JOIN mangadex_mangas ON mangadex_mangas.manga_id = mangadex_comments_manga.manga_id");
$results=$sql->query_read('x'," SELECT * FROM mangadex_users where level_id = 0 and user_id > 1900000 order by user_id desc ",'fetchAll',PDO::FETCH_ASSOC,-1);
foreach($resultsas$row){
$uid=$row['user_id'];
$sql->modify('m',"DELETE FROM mangadex_pm_threads WHERE sender_id = ?",[$uid]);
$sql->modify('m',"DELETE FROM mangadex_pm_msgs WHERE user_id = ?",[$uid]);
$sql->modify('x'," update mangadex_user_paypal set count = ? WHERE paypal like ? LIMIT 1 ",[$count,$tx['paypal']]);
}
$txs=$sql->query_read('x'," SELECT * FROM mangadex_user_paypal WHERE `paypal` NOT LIKE '%@%' AND count > 0 ",'fetchAll',PDO::FETCH_ASSOC,-1);
foreach($txsas$tx){
$sql->modify('x'," update mangadex_users set premium = 1 WHERE user_id LIKE ? LIMIT 1 ",[$tx['user_id']])
}*/
//$result = $sql->query_read('x', " SELECT chapters.*, users.level_id, users.user_id, users.username FROM `mangadex_chapters` as chapters left join mangadex_users as users on chapters.user_id = users.user_id where users.level_id = 0 and chapters.chapter_deleted = 1 and chapters.server = 0 ", 'fetchAll', PDO::FETCH_ASSOC, -1);
//$result = $sql->query_read('x', " SELECT chapters.*, users.level_id, users.user_id, users.username FROM `mangadex_chapters` as chapters left join mangadex_users as users on chapters.user_id = users.user_id where users.level_id = 0 and chapters.chapter_deleted = 1 and chapters.server = 0 ", 'fetchAll', PDO::FETCH_ASSOC, -1);
/*
$result=$sql->query_read('x'," SELECT * FROM `mangadex_chapters` WHERE `chapter_id` > 916000 and upload_timestamp <= UNIX_TIMESTAMP() AND chapter_deleted < 1 ",'fetchAll',PDO::FETCH_ASSOC,-1);
if($sql->modify('x'," update mangadex_user_paypal set count = 1 WHERE paypal like '019e07a6f653d0c417b5ee77d1c44a2540d14b85738994df19b1a5edce511aad' LIMIT ? ",[1]))
print'TRUE';
else
print'FALSE';
try{
$sql->modify('x'," update mangadex_user_paypal set count = 1 WHERE paypal like '019e07a6f653d0c417b5ee77d1c44a2540d14b85738994df19b1a5edce511aad' LIMIT ? ",[1]);
}catch(\PDOException$e){
$error=sprintf('error code %s',$e->getCode());
print$error;
}
$result=$sql->query_read('x'," SELECT * FROM `mangadex_user_paypal` WHERE `paypal` like '019e07a6f653d0c417b5ee77d1c44a2540d14b85738994df19b1a5edce511aad' ",'fetchAll',PDO::FETCH_ASSOC,-1);
$result=$sql->query_read('x'," SELECT COUNT(*) AS `Rows`, `user_id` FROM `mangadex_sessions` GROUP BY `user_id` ORDER BY `Rows` DESC ",'fetchAll',PDO::FETCH_ASSOC,-1);
foreach($resultas$row){
while($row['Rows']>10){
$sql->modify('x'," delete FROM `mangadex_sessions` WHERE `user_id` = ? ORDER BY `mangadex_sessions`.`created` ASC limit 1 ",[$row['user_id']]);