C:\xampp\htdocs\kptv2\admin\modules\top20plus\act_top20plusaddFrm.php


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
<?php

    
require_once($BASEPATH."common/database.php");
    require_once(
$BASEPATH."common/SimpleImage.php");
    
    function 
saveImage($mImage$target) {
        
$image = new SimpleImage();
        
        
$name rand(0,10000).date('Ymd',time())."-".str_replace(array("\"","'""-"), "_",$mImage['name']);
                        
        if(
getimagesize($mImage['tmp_name'])){
            
$image->load($mImage['tmp_name']);                                    
            
$image->resizeToHeight($height 150);                    
            
$image->save($target.$name);
            
            return 
$name;
        }
        
        return 
"";
    }
    
    function 
uploadMusic($music$target){
        
$name rand(0,10000).date('Ymd',time())."-".str_replace(array("\"","'""-"), "_",$music['name']);
        
        
$tmp_name $music['tmp_name'];
        if(
move_uploaded_file($tmp_name,$target.$name)) {
            return 
$name;
        }
        return 
"";
    }
    
    
$fileName saveImage($_FILES['coverimg'], '../ro/images/top20/');
    
$mp3FileName uploadMusic($_FILES['mp3'], '../ro/music/');
    
    
$_POST['coverimg']  = $fileName;
    
$_POST['mp3']        = $mp3FileName;    

    if(!isset(
$_POST['active'])) {
        
$_POST['active'] = 0;
    }
    
    
$db = new Database($db_host$db_name$db_usrName$db_password);
    
$db->insert($table "top20plus"$data $_POST$ignore = array('hdadded_date''Submit'));
    
    
//redirect to the expected page
    //echo "<script>window.location.href='".$ADMINPATH."index.php?cnt_=top20plus'</script>";
    
header('Location:index.php?cnt_=top20plus&type_of_list='.$_POST['type_of_list']);
?>
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586