forked from mahdiyari/steemauto
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdash.php
More file actions
916 lines (882 loc) · 26.2 KB
/
dash.php
File metadata and controls
916 lines (882 loc) · 26.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
<?php
require_once('func.php');
date_default_timezone_set('UTC');
$a = 0;
$active = 1;
if(isset($_GET['i'])){
$i = $_GET['i'];
if($i == 1){ //// Curation Trail
$a =1;
$active = 2;
}elseif($i ==2){ //// Fan Base
$a =2;
$active = 3;
}elseif($i ==3){// Following a Trailer
$a =3;
}elseif($i ==4){// Unfollowing a Trailer
$a =4;
}elseif($i ==5){// Settings For a Trailer
$a =5;
}elseif($i ==6){ // Becoming a Trailer
$a =6;
}elseif($i ==7){// Following a Fan
$a =7;
}elseif($i ==8){// Unfollowing a Fan
$a =8;
}elseif($i ==9){// Following a Fan by submitting form
$a =9;
}elseif($i ==10){// Settings For a Fan.
$a =10;
}elseif($i ==11){ //// Add Scheduled Posts
$a =11;
$active = 4;
}elseif($i ==12){ // Delete Scheduled Posts
$a =12;
}elseif($i ==13){ // Comment Auto Upvote
$a =13;
$active = 5;
}elseif($i ==14){ // Comment Auto Upvote settings
$a =14;
}elseif($i ==15){ // list of trailers and fanbase
$a =15;
}elseif($i ==133){ // Remove from comment list
$a =133;
}elseif($i ==16){ // Claim Rewards
$a =16;
$active = 6;
}else{
$a = 0;
$active = 1;
}
}
if($a == 3 && isset($_POST['user'])){
$userr =$_POST['user'];
if(isset($_COOKIE['luser']) && isset($_COOKIE['lpw'])){ // Following a Trailer
require_once('d_b.php');
$stmt = $conn->prepare("SELECT * FROM `users` WHERE `user` = ?");
$stmt->bind_param('s', $name);
$name = $_COOKIE['luser'];
$pw = $_COOKIE['lpw'];
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();
if($row['pw'] == $pw){
$log = 1;
}else{
$log = 0;
}
if($log == 1){
if($userr == $name){
echo 0;exit();
}
$result = $conn->query("SELECT EXISTS(SELECT * FROM `followers` WHERE `trailer`='$userr' AND `follower`='$name')");
foreach($result as $c){
foreach($c as $c){}
}
if($c == 0){
$result = $conn->query("INSERT INTO `followers`(`trailer`, `follower`, `weight`) VALUES ('$userr','$name','5000')");
$result = $conn->query("UPDATE `trailers` SET `followers`=`followers`+1 WHERE `user`='$userr'");
echo 1;
exit();
}else{
echo 2;
exit();
}
}else{
echo 0;
exit();
}
}else{
exit();
}
}
if($a == 4 && isset($_POST['user'])){ // Unfollowing a Trailer
$userr =$_POST['user'];
if(isset($_COOKIE['luser']) && isset($_COOKIE['lpw'])){
require_once('d_b.php');
$stmt = $conn->prepare("SELECT * FROM `users` WHERE `user` = ?");
$stmt->bind_param('s', $name);
$name = $_COOKIE['luser'];
$pw = $_COOKIE['lpw'];
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();
if($row['pw'] == $pw){
$log = 1;
}else{
$log = 0;
}
if($log == 1){
if($userr == $name){
echo 0;exit();
}
$result = $conn->query("SELECT EXISTS(SELECT * FROM `followers` WHERE `trailer`='$userr' AND `follower`='$name')");
foreach($result as $c){
foreach($c as $c){}
}
if($c == 1){
$result = $conn->query("DELETE FROM `followers` WHERE `followers`.`trailer`='$userr' AND `followers`.`follower`='$name'");
$result = $conn->query("UPDATE `trailers` SET `followers`=`followers`-1 WHERE `user`='$userr'");
echo 1;
exit();
}else{
echo 2;
exit();
}
}else{
echo 0;
exit();
}
}else{
exit();
}
}
if($a == 5 && isset($_POST['user']) && isset($_POST['weight']) && isset($_POST['minute']) && isset($_POST['enable']) && isset($_POST['votingway'])){ // Settings For a Trailer
$userr =$_POST['user'];
$minute =$_POST['minute'];
$weight =$_POST['weight'];
$votingway =$_POST['votingway'];
$enable =$_POST['enable'];
if($votingway == 1){
$votingway = 1; //scale weight
}else{
$votingway = 2; //fixed weight
}
if($enable == 1){
$enable = 1;
}else{
$enable = 0;
}
if(!is_numeric($minute) || !is_numeric($weight)){
echo 0;
exit();
}
if($minute > 30 || $minute < 0 || $weight < 0.01 || $weight > 100){
echo 0;
exit();
}
$weight = 100*$weight;
if(isset($_COOKIE['luser']) && isset($_COOKIE['lpw'])){
require_once('d_b.php');
$stmt = $conn->prepare("SELECT * FROM `users` WHERE `user` = ?");
$stmt->bind_param('s', $name);
$name = $_COOKIE['luser'];
$pw = $_COOKIE['lpw'];
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();
if($row['pw'] == $pw){
$log = 1;
}else{
$log = 0;
}
if($log == 1){
$result = $conn->query("SELECT EXISTS(SELECT * FROM `followers` WHERE `trailer`='$userr' AND `follower`='$name')");
foreach($result as $c){
foreach($c as $c){}
}
if($c == 1){
$result = $conn->query("UPDATE `followers` SET `weight`='$weight' , `aftermin`='$minute',`votingway`='$votingway',`enable`='$enable' WHERE `trailer`='$userr' AND `follower`='$name'");
echo 1;
exit();
}else{
echo 2;
exit();
}
}else{
echo 0;
exit();
}
}else{
echo 3;
exit();
}
}
if($a == 6 && isset($_POST['desc'])){ // Becoming a Trailer
$desc =$_POST['desc'];
if(isset($_COOKIE['luser']) && isset($_COOKIE['lpw'])){
require_once('d_b.php');
$stmt = $conn->prepare("SELECT * FROM `users` WHERE `user` = ?");
$stmt->bind_param('s', $name);
$name = $_COOKIE['luser'];
$pw = $_COOKIE['lpw'];
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();
if($row['pw'] == $pw){
$log = 1;
}else{
$log = 0;
}
if($log == 1){
$result = $conn->query("SELECT EXISTS(SELECT * FROM `trailers` WHERE `user`='$name')");
foreach($result as $c){
foreach($c as $c){}
}
if($c == 1){
$stmt = $conn->prepare("UPDATE `trailers` SET `description`=? WHERE `user`='$name'");
$stmt->bind_param('s', $desc);
$stmt->execute();
echo 1;
exit();
}else{
$stmt = $conn->prepare("INSERT INTO `trailers`(`user`, `description`) VALUES (?,?)");
$stmt->bind_param('ss', $name,$desc);
$stmt->execute();
echo 1;
exit();
}
}else{
echo 0;
exit();
}
}else{echo 3;exit();}
}
if($a == 7 && isset($_POST['user'])){ // Following a Fan
$userr =$_POST['user'];
if(isset($_COOKIE['luser']) && isset($_COOKIE['lpw'])){
require_once('d_b.php');
$stmt = $conn->prepare("SELECT * FROM `users` WHERE `user` = ?");
$stmt->bind_param('s', $name);
$name = $_COOKIE['luser'];
$pw = $_COOKIE['lpw'];
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();
if($row['pw'] == $pw){
$log = 1;
}else{
$log = 0;
}
if($log == 1){
if($userr == $name){
echo 0;exit();
}
$result = $conn->query("SELECT EXISTS(SELECT * FROM `fans` WHERE `fan`='$userr')");
foreach($result as $c){
foreach($c as $c){}
}
if($c == 1){
$result = $conn->query("SELECT EXISTS(SELECT * FROM `fanbase` WHERE `fan`='$userr' AND `follower`='$name')");
foreach($result as $c){
foreach($c as $c){}
}
if($c == 1){
echo 2; exit();
}else{
$stmt = $conn->prepare("INSERT INTO `fanbase`(`fan`, `follower`,`weight`) VALUES (?,?,'10000')");
$stmt->bind_param('ss', $userr ,$name);
$stmt->execute();
$result = $conn->query("UPDATE `fans` SET `followers`=`followers`+1 WHERE `fan`='$userr'");
echo 1;
exit();
}
}else{
$stmt = $conn->prepare("INSERT INTO `fans`(`fan`) VALUES (?)");
$stmt->bind_param('s', $userr);
$stmt->execute();
$stmt = $conn->prepare("INSERT INTO `fanbase`(`fan`, `follower`,`weight`) VALUES (?,?,'10000')");
$stmt->bind_param('ss', $userr,$name);
$stmt->execute();
$result = $conn->query("UPDATE `fans` SET `followers`=`followers`+1 WHERE `fan`='$userr'");
echo 1;
exit();
}
}else{echo 0;exit();}
}else{echo 3;exit();}
}
if($a == 8 && isset($_POST['user'])){ // Unfollowing a Fan
$userr =$_POST['user'];
if(isset($_COOKIE['luser']) && isset($_COOKIE['lpw'])){
require_once('d_b.php');
$stmt = $conn->prepare("SELECT * FROM `users` WHERE `user` = ?");
$stmt->bind_param('s', $name);
$name = $_COOKIE['luser'];
$pw = $_COOKIE['lpw'];
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();
if($row['pw'] == $pw){
$log = 1;
}else{
$log = 0;
}
if($log == 1){
if($userr == $name){
echo 0;exit();
}
$result = $conn->query("SELECT EXISTS(SELECT * FROM `fans` WHERE `fan`='$userr')");
foreach($result as $c){
foreach($c as $c){}
}
if($c == 1){
$result = $conn->query("SELECT EXISTS(SELECT * FROM `fanbase` WHERE `fan`='$userr' AND `follower`='$name')");
foreach($result as $c){
foreach($c as $c){}
}
if($c == 1){
$result = $conn->query("UPDATE `fans` SET `followers`=`followers`-1 WHERE `fan`='$userr'");
$result = $conn->query("DELETE FROM `fanbase` WHERE `fanbase`.`fan`='$userr' AND `fanbase`.`follower`='$name'");
echo 1;
exit();
}else{
echo 2;
exit();
}
}else{
echo 3;
exit();
}
}else{echo 0;exit();}
}else{echo 4;exit();}
}
if($a == 9 && isset($_POST['user'])){ // Following a Fan by submitting form
$userr =$_POST['user'];
if(!call('get_accounts','["'.$userr.'"]')){
echo 4; exit();
}
if(isset($_COOKIE['luser']) && isset($_COOKIE['lpw'])){
require_once('d_b.php');
$stmt = $conn->prepare("SELECT * FROM `users` WHERE `user` = ?");
$stmt->bind_param('s', $name);
$name = $_COOKIE['luser'];
$pw = $_COOKIE['lpw'];
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();
if($row['pw'] == $pw){
$log = 1;
}else{
$log = 0;
}
if($log == 1){
if($userr == $name){
echo 0;exit();
}
$result = $conn->query("SELECT EXISTS(SELECT * FROM `fans` WHERE `fan`='$userr')");
foreach($result as $c){
foreach($c as $c){}
}
if($c == 1){
$result = $conn->query("SELECT EXISTS(SELECT * FROM `fanbase` WHERE `fan`='$userr' AND `follower`='$name')");
foreach($result as $c){
foreach($c as $c){}
}
if($c == 1){
echo 2; exit();
}else{
$userr =$_POST['user'];
$stmt = $conn->prepare("INSERT INTO `fanbase`(`fan`, `follower`,`weight`) VALUES (?,?,'10000')");
$stmt->bind_param('ss', $userr,$name);
$stmt->execute();
$result = $conn->query("UPDATE `fans` SET `followers`=`followers`+1 WHERE `fan`='$userr'");
echo 1;
exit();
}
}else{
$stmt = $conn->prepare("INSERT INTO `fans`(`fan`) VALUES (?)");
$stmt->bind_param('s', $userr);
$stmt->execute();
$stmt = $conn->prepare("INSERT INTO `fanbase`(`fan`, `follower`,`weight`) VALUES (?,?,'10000')");
$stmt->bind_param('ss', $userr,$name);
$stmt->execute();
$result = $conn->query("UPDATE `fans` SET `followers`=`followers`+1 WHERE `fan`='$userr'");
echo 1;
exit();
}
}else{echo 0;exit();}
}else{echo 3;exit();}
}
if($a == 10 && isset($_POST['user']) && isset($_POST['weight']) && isset($_POST['minute']) && isset($_POST['enable'])){ // Settings For a Fan.
$userr =$_POST['user'];
$minute =$_POST['minute'];
$weight =$_POST['weight'];
$enable =$_POST['enable'];
if($enable == 1){
$enable = 1;
}else{
$enable = 0;
}
if(!is_numeric($minute) || !is_numeric($weight)){
echo 0;
exit();
}
if($minute > 30 || $minute < 0 || $weight < 0.01 || $weight > 100){
echo 0;
exit();
}
$weight = 100*$weight;
if(isset($_COOKIE['luser']) && isset($_COOKIE['lpw'])){
require_once('d_b.php');
$stmt = $conn->prepare("SELECT * FROM `users` WHERE `user` = ?");
$stmt->bind_param('s', $name);
$name = $_COOKIE['luser'];
$pw = $_COOKIE['lpw'];
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();
if($row['pw'] == $pw){
$log = 1;
}else{
$log = 0;
}
if($log == 1){
$result = $conn->query("SELECT EXISTS(SELECT * FROM `fanbase` WHERE `fan`='$userr' AND `follower`='$name')");
foreach($result as $c){
foreach($c as $c){}
}
if($c == 1){
$result = $conn->query("UPDATE `fanbase` SET `weight`='$weight' , `aftermin`='$minute',`enable`='$enable' WHERE `fan`='$userr' AND `follower`='$name'");
echo 1;
exit();
}else{
echo 2;
exit();
}
}else{
echo 0;
exit();
}
}else{
echo 3;
exit();
}
}
if($a == 11 && isset($_POST['date']) && is_numeric($_POST['date']) && isset($_POST['title']) && isset($_POST['content']) && isset($_POST['tags'])){ // Submit Post for Schedule
$date =$_POST['date'];
$title =$_POST['title'];
$content =$_POST['content'];
$tags =$_POST['tags'];
if($date <1 || $date >100){
echo 0;
exit();
}
$tagss = explode(" ", $tags); //converting tags to array
if(sizeof($tagss) >5){
echo 2;
exit();
}
$main = $tagss[0];
function clean($string) {
$string = strtolower($string);
$string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens.
$string = preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars.
return preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
}
$tag = implode('","',$tagss);
$tags = "[\"$tag\"]"; //converting tags to array inside string
$json = '{"tags":'.$tags.',"links":[],"app":"steemauto/0.01","format":"markdown"}';
$perm = clean($title);
$time= strtotime('now');
$permlink = $perm.'-'.$time;
$date = $time + $date*3600;
if(isset($_COOKIE['luser']) && isset($_COOKIE['lpw'])){
require_once('d_b.php');
$stmt = $conn->prepare("SELECT * FROM `users` WHERE `user` = ?");
$stmt->bind_param('s', $name);
$name = $_COOKIE['luser'];
$pw = $_COOKIE['lpw'];
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();
if($row['pw'] == $pw){
$log = 1;
}else{
$log = 0;
}
if($log == 1){
$stmt = $conn->prepare("INSERT INTO `posts`(`user`, `title`, `content`, `date`,`maintag`, `json`, `permlink`) VALUES (?,?,?,?,?,?,?)");
$stmt->bind_param('sssssss', $name,$title,$content,$date,$main,$json,$permlink);
$stmt->execute();
echo 1;
exit();
}else{
echo 0;
exit();
}
}else{
echo 3;
exit();
}
}
if($a == 12 && isset($_POST['id']) && is_numeric($_POST['id'])){ // Delete Post from Schedule
$id =$_POST['id'];
if($id < 1){
echo 0;
exit();
}
if(isset($_COOKIE['luser']) && isset($_COOKIE['lpw'])){
require_once('d_b.php');
$stmt = $conn->prepare("SELECT * FROM `users` WHERE `user` = ?");
$stmt->bind_param('s', $name);
$name = $_COOKIE['luser'];
$pw = $_COOKIE['lpw'];
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();
if($row['pw'] == $pw){
$log = 1;
}else{
$log = 0;
}
if($log == 1){
$result = $conn->query("SELECT EXISTS(SELECT * FROM `posts` WHERE `user`='$name' AND `id`='$id')");
foreach($result as $x){
foreach($x as $x){}
}
if($x == 1){
$result = $conn->query("DELETE FROM `posts` WHERE `posts`.`id` = '$id'");
echo 1;
exit();
}else{
echo 0;
exit();
}
}else{
echo 0;
exit();
}
}else{
echo 3;
exit();
}
}
if($a == 13 && isset($_POST['user']) && isset($_POST['weight']) && isset($_POST['minute'])){ // Adding a user to Comment Upvote
$userr =$_POST['user'];
$weight =$_POST['weight']*100;
$minute =$_POST['minute'];
if(!call('get_accounts','["'.$userr.'"]')){
echo 4; exit();
}
if(!is_numeric($weight) || !is_numeric($minute) || $weight <= 0 || $weight > 10000 || $minute < 0 || $minute > 30){
echo 0;
exit();
}
if(isset($_COOKIE['luser']) && isset($_COOKIE['lpw'])){
require_once('d_b.php');
$stmt = $conn->prepare("SELECT * FROM `users` WHERE `user` = ?");
$stmt->bind_param('s', $name);
$name = $_COOKIE['luser'];
$pw = $_COOKIE['lpw'];
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();
if($row['pw'] == $pw){
$log = 1;
}else{
$log = 0;
}
if($userr == $name){echo 0; exit();}
if($log == 1){
$stmt = $conn->prepare("SELECT EXISTS(SELECT * FROM `commentupvote` WHERE `user`=? AND `commenter`=?)");
$stmt->bind_param('ss', $name,$userr);
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();
foreach($row as $x){}
if($x == 1){
echo 2;
exit();
}else{
$stmt = $conn->prepare("INSERT INTO `commentupvote`(`user`, `commenter`, `weight`, `aftermin`) VALUES (?,?,?,?)");
$stmt->bind_param('ssss', $name,$userr,$weight,$minute);
$stmt->execute();
echo 1;
exit();
}
}else{
echo 0;
exit();
}
}else{
echo 3;
exit();
}
}
if($a == 133 && isset($_POST['user'])){ // Removing a user from comment upvote list
$userr =$_POST['user'];
if(!call('get_accounts','["'.$userr.'"]')){
echo 4; exit();
}
if(isset($_COOKIE['luser']) && isset($_COOKIE['lpw'])){
require_once('d_b.php');
$stmt = $conn->prepare("SELECT * FROM `users` WHERE `user` = ?");
$stmt->bind_param('s', $name);
$name = $_COOKIE['luser'];
$pw = $_COOKIE['lpw'];
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();
if($row['pw'] == $pw){
$log = 1;
}else{
$log = 0;
}
if($userr == $name){echo 0; exit();}
if($log == 1){
$stmt = $conn->prepare("SELECT EXISTS(SELECT * FROM `commentupvote` WHERE `user`=? AND `commenter`=?)");
$stmt->bind_param('ss', $name,$userr);
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();
foreach($row as $x){}
if($x == 0){
echo 2;
exit();
}else{
$stmt = $conn->prepare("DELETE FROM `commentupvote` WHERE `commentupvote`.`user` =? AND `commenter`=?");
$stmt->bind_param('ss', $name,$userr);
$stmt->execute();
echo 1;
exit();
}
}else{
echo 0;
exit();
}
}else{
echo 3;
exit();
}
}
if($a == 14 && isset($_POST['user']) && isset($_POST['weight']) && isset($_POST['minute']) && isset($_POST['enable'])){ // Changing Settings for Comment Upvote
$userr =$_POST['user'];
$weight =$_POST['weight']*100;
$minute =$_POST['minute'];
$enable =$_POST['enable'];
if($enable == 1){
$enable = 1;
}else{
$enable=0;
}
if(!call('get_accounts','["'.$userr.'"]')){
echo 4; exit();
}
if(!is_numeric($weight) || !is_numeric($minute) || $weight <= 0 || $weight > 10000 || $minute < 0 || $minute > 30){
echo 9;
exit();
}
if(isset($_COOKIE['luser']) && isset($_COOKIE['lpw'])){
require_once('d_b.php');
$stmt = $conn->prepare("SELECT * FROM `users` WHERE `user` = ?");
$stmt->bind_param('s', $name);
$name = $_COOKIE['luser'];
$pw = $_COOKIE['lpw'];
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();
if($row['pw'] == $pw){
$log = 1;
}else{
$log = 0;
}
if($userr == $name){echo 0; exit();}
if($log == 1){
$stmt = $conn->prepare("SELECT EXISTS(SELECT * FROM `commentupvote` WHERE `user`=? AND `commenter`=?)");
$stmt->bind_param('ss', $name,$userr);
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();
foreach($row as $x){}
if($x == 0){
echo 2;
exit();
}else{
$stmt = $conn->prepare("UPDATE `commentupvote` SET `weight`=?,`aftermin`=?,`enable`=? WHERE `user`=? AND `commenter`=?");
$stmt->bind_param('sssss', $weight,$minute,$enable,$name,$userr);
$stmt->execute();
echo 1;
exit();
}
}else{
echo 8;
exit();
}
}else{
echo 3;
exit();
}
}
if($a == 16 && isset($_POST['enable'])){ // Enablig claim rewards
if(isset($_COOKIE['luser']) && isset($_COOKIE['lpw'])){
require_once('d_b.php');
$stmt = $conn->prepare("SELECT * FROM `users` WHERE `user` = ?");
$stmt->bind_param('s', $name);
$name = $_COOKIE['luser'];
$pw = $_COOKIE['lpw'];
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();
if($row['pw'] == $pw){
$log = 1;
}else{
$log = 0;
}
if($log == 1){
$stmt = $conn->prepare("UPDATE `users` SET `claimreward`=1 WHERE `user`=?");
$stmt->bind_param('s', $name);
$stmt->execute();
echo 1;
exit();
}else{
echo 8;
exit();
}
}else{
echo 3;
exit();
}
}
if($a == 16 && isset($_POST['disable'])){ // Disabling claim rewards
if(isset($_COOKIE['luser']) && isset($_COOKIE['lpw'])){
require_once('d_b.php');
$stmt = $conn->prepare("SELECT * FROM `users` WHERE `user` = ?");
$stmt->bind_param('s', $name);
$name = $_COOKIE['luser'];
$pw = $_COOKIE['lpw'];
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();
if($row['pw'] == $pw){
$log = 1;
}else{
$log = 0;
}
if($log == 1){
$stmt = $conn->prepare("UPDATE `users` SET `claimreward`=0 WHERE `user`=?");
$stmt->bind_param('s', $name);
$stmt->execute();
echo 1;
exit();
}else{
echo 8;
exit();
}
}else{
echo 3;
exit();
}
}
require_once('he_ad.php');
require_once('func.php');
if($log == 0){
echo 'You should login.<script type="text/javascript">window.location.href = "/register";</script>';
header("Location: /");
exit();
}
$x = json_decode(call('get_accounts','["'.$name.'"]'));
$y = $x->result[0]->posting->account_auths;
$auth = 0;
foreach($y as $y){
if($y[0] == 'steemauto'){
$auth = 1;
break;
}
}
//changing power limit
if(isset($_POST['powerlimit']) && is_numeric($_POST['powerlimit']) && $_POST['powerlimit'] >= 1 && $_POST['powerlimit'] <= 99){
$submittedpowerlimit = $_POST['powerlimit'];
$stmt = $conn->prepare("UPDATE `users` SET `limit_power`=? WHERE `user`=?");
$stmt->bind_param('ss', $submittedpowerlimit,$name);
$stmt->execute();
echo '<script>setTimeout(function(){$.notify({icon: "pe-7s-check",message: "Successfully saved."},{type: "success",timer: 6000});},1000);</script>';
}
include('inc/js.php'); // some css + js functions
if($auth == 0){ ?>
<div class="content">
<div class="card">
<div class="content">
<center>
<h5 style="color:red;">Please leave Steemauto if you don't understand how it works or what it does. You could harm your Steem account if you change settings that you do not understand.</h5>
<h3>Welcome <? echo $name; ?>,</h3>
<br>Please add @steemauto to your account's posting auths using one of following apps:<br>
<br><a class="btn btn-success" href="https://steemconnect.com/authorize/@steemauto/?redirect_uri=https://steemauto.com/dash.php">SteemConnect (recommended)</a> or <a class="btn btn-success" href="https://steemauto.com/auth/">SteemAuto</a>
<br><br>Both are secure.
<br>If you don't add @steemauto to your posting auths you will not be able to use our site.
</center>
</div>
</div>
</div>
<? }else{ ?>
<? if($a ==0){ //Dashboard
$result = $conn->query("SELECT `current_power`, `limit_power` FROM `users` WHERE `user`='$name'");
foreach($result as $x){
$powernow = $x['current_power'];
$powerlimit = $x['limit_power'];
if($powernow == 0){
$powernow1 = 'Updating... (can take 5 minutes)';
}
}
?>
<!-- dashboard menu -->
<div class="content">
<div class="col-md-3"></div>
<center>
<div class="col-md-6">
<div class="content">
<div class="card">
<div class="content">
<h5 style="color:red;">Please leave Steemauto if you don't understand how it works or what it does. You could harm your Steem account if you change settings that you do not understand.</h5>
<h3>Welcome <? echo $name; ?>,</h3>
<br>Please choose an option:<br>
<a href="dash.php?i=1" class="btn btn-primary">Curation Trail</a>
<a href="dash.php?i=2" class="btn btn-primary">Fan Base</a><br>
<a style="margin-top:5px;" href="dash.php?i=13" class="btn btn-primary">Upvote Comments</a>
<a style="margin-top:5px;" href="dash.php?i=11" class="btn btn-primary">Schedule Posts</a><br>
<a style="margin-top:5px;" href="dash.php?i=16" class="btn btn-primary">Claim Rewards</a><br><hr>
<p>You can remove SteemAuto's access from your account by using SteemConnect</p>
<a href="https://steemconnect.com/revoke/@steemauto" class="btn btn-danger">Unauthorize (Leave SteemAuto)</a>
</div>
</div>
</div>
</div>
</center>
<div class="col-md-3"></div>
</div>
<!-- settings -->
<div class="content" style="margin-bottom:5px; padding-bottom:5px;">
<div class="col-md-3"></div>
<div class="col-md-6">
<div class="content">
<div class="card">
<div class="content">
<center>
<h4 style="border-bottom:1px solid #000; padding-bottom:10px;">Settings</h4>
</center>
<strong>Upvoting status:</strong><? if($powernow<$powerlimit){echo '<span style="color:red;"> Paused</span>';}else{echo '<span style="color:green;"> Normal</span>';} ?><br>
<strong>Voting power:</strong><span> <? if(!$powernow){echo $powernow1; }else{echo $powernow;} ?>%</span><br>
<strong>Limit on voting power:</strong><span> <? echo $powerlimit; ?>% <a onclick="$('#limitpower').toggle(500)">(Click to edit)</a></span><br>
<form id="limitpower" style="display:none;" onsubmit="if(!confirm('Are you sure?')) return false;" method="post">
<label for="powerlimit">Voting power limit (%):</label>
<input id="powerlimit" name="powerlimit" class="form-control" type="number" min="1" max="99" step="0.01" required>
<input style="margin-top:5px;" type="submit" value="submit" class="btn btn-primary">
</form><br>
<p>All your upvotes will be paused if your voting power is lower than the voting power limit.</p>
<p>Your voting power will updated every 5 minutes.</p>
<p>Read more about voting power in the Steemit FAQ.</p>
<p>You can check your voting power here: <a href="https://steemd.com/@<? echo $name; ?>">https://steemd.com/@<? echo $name; ?></a></p>
</div>
</div>
</div>
</div>
<div class="col-md-3"></div>
</div>
<?
}elseif($a == 1){ //Curation Trail
include('inc/trail.php');
}elseif($a == 2){ //Fanbase
include('inc/fanbase.php');
}elseif($a == 11){ // Schedule Posts
include('inc/scheduled.php');
}elseif($a == 13){ // Comment upvotes
include('inc/commentupvote.php');
}elseif($a == 15){ // List of trailers and fanbase followers
include('inc/list.php');
}elseif($a == 16){ // Claim Rewards
include('inc/claimreward.php');
}else{
header("Location: /");
}
}
require('fo_oter.php');
?>