Buying $10 to whoever can fix this problem!

Discussion in 'Programming' started by ptiteconne, May 24, 2011.

  1. #1
    ok i need to modified a file and add more option to it the original file work great but there's some option missing and when i try to modified it to add want i want to it it's not working

    Original file

    <?php
    defined('_VALID') or die('Restricted Access!');
    
    Auth::checkAdmin();
    
    $psimg = $config['BASE_DIR']. '/media/pornstars';
    if ( !file_exists($psimg) or !is_dir($psimg) or !is_writable($psimg) ) {
        $errors[] = 'Pornstar image directory \'' .$psimg. '\' is not writable!';
    }
    
    $pornstar = array('name' => '', 'desc' => '');
    if ( isset($_POST['add_pornstar']) ) {
        $name   = trim($_POST['name']);
        $about   = trim($_POST['about']);
        $website   = trim($_POST['website']);
    	$height   = trim($_POST['height']);
    	$hair   = trim($_POST['hair']);
    	$born   = trim($_POST['born']);
    	$measurements   = trim($_POST['measurements']);
    	$brazzers   = trim($_POST['brazzers']);
        if ( $name == '' ) {
            $errors[] = 'Pornstar name field cannot be blank!';
        } else {
            $sql        = "SELECT PSID FROM pornstar WHERE name = '" .mysql_real_escape_string($name). "' LIMIT 1";
            $conn->execute($sql);
            if ( $conn->Affected_Rows() > 0 ) {
                $errors[]   = 'Pornstar name \'' .htmlspecialchars($name, ENT_QUOTES, 'UTF-8'). ' is already used. Please choose another name!';
            } else {
                $pornstar['name'] = $name;
                $pornstar['about'] = $about;
            }
        }
        
        if ( $_FILES['picture']['tmp_name'] == '' )
            $errors[] = 'Please provide a Pornstar image!';
        
        if ( !$errors ) {
            $sql = "INSERT INTO pornstar (name, about, website, height, hair, born, measurements, brazzers) VALUES ('" .mysql_real_escape_string($name). "','" .mysql_real_escape_string($about). "','" .mysql_real_escape_string($website). "','" .mysql_real_escape_string($height). "','" .mysql_real_escape_string($hair). "','" .mysql_real_escape_string($born). "','" .mysql_real_escape_string($measurements). "','" .mysql_real_escape_string($brazzers). "')";
            $conn->execute($sql);
            $psid = $conn->Insert_ID();
            require $config['BASE_DIR']. '/classes/image.class.php';
            $image = new VImageConv();
            $image->process($_FILES['picture']['tmp_name'], $psimg. '/' .$psid. '.jpg', 'EXACT', 200, 270);
            $image->canvas(200, 270, '000000', true);
    
            if ( $errors ) {
                $sql = "DELETE FROM pornstar WHERE PSID = '" .mysql_real_escape_string($psid). "' LIMIT 1";
                $conn->execute($sql);
            }
        }
        
        if ( !$errors ) {
            $msg = 'Pornstar Successfuly added!';
    	VRedirect::go('pornstars.php?msg=' .$msg);
        }
    }
    
    $smarty->assign('pornstar', $pornstar);
    ?>
    
    PHP:
    Modified file ''not working''

    <?php
    defined('_VALID') or die('Restricted Access!');
    
    Auth::checkAdmin();
    
    $psimg = $config['BASE_DIR']. '/media/pornstars';
    if ( !file_exists($psimg) or !is_dir($psimg) or !is_writable($psimg) ) {
        $errors[] = 'Pornstar image directory \'' .$psimg. '\' is not writable!';
    }
    
    $pornstar = array('name' => '', 'desc' => '');
    if ( isset($_POST['add_pornstar']) ) {
        $name         = trim($_POST['name']);
        $about        = trim($_POST['about']);
        $website      = trim($_POST['website']);
    	$height       = trim($_POST['height']);
    	$hair         = trim($_POST['hair']);
    	$born         = trim($_POST['born']);
    	$measurements = trim($_POST['measurements']);
    	$brazzers     = trim($_POST['brazzers']);
    	$performer   = trim($_POST['performer']);
    	$born        = trim($_POST['born']);
    	$astrology   = trim($_POST['astrology']);
    	$birthplace  = trim($_POST['birthplace']);
    	$years       = trim($_POST['years']);
    	$weight      = trim($_POST['weight']);
    	$ethnic      = trim($_POST['ethnic']);    
       if ( $name == '' ) {
            $errors[] = 'Pornstar name field cannot be blank!';
        } else {
            $sql        = "SELECT PSID FROM pornstar WHERE name = '" .mysql_real_escape_string($name). "' LIMIT 1";
            $conn->execute($sql);
            if ( $conn->Affected_Rows() > 0 ) {
                $errors[]   = 'Pornstar name \'' .htmlspecialchars($name, ENT_QUOTES, 'UTF-8'). ' is already used. Please choose another name!';
            } else {
                $pornstar['name'] = $name;
                $pornstar['about'] = $about;
            }
        }
        
        if ( $_FILES['picture']['tmp_name'] == '' )
            $errors[] = 'Please provide a Pornstar image!';
        
        if ( !$errors ) {
            $sql = "INSERT INTO pornstar (name, about, website, height, hair, born, measurements, brazzers, performer, born, astrology, birthplace, years, weight, ethnic) VALUES ('" .mysql_real_escape_string($name). 
    
    "','" .mysql_real_escape_string($about). 
    
    "','" .mysql_real_escape_string($website). 
    
    "','" .mysql_real_escape_string($height). 
    
    "','" .mysql_real_escape_string($hair). 
    
    "','" .mysql_real_escape_string($born). 
    
    "','" .mysql_real_escape_string($measurements). 
    
    "','" .mysql_real_escape_string($brazzers).
    "','" .mysql_real_escape_string($performer).
    "','" .mysql_real_escape_string($born).
    "','" .mysql_real_escape_string($astrology).
    "','" .mysql_real_escape_string($birthplace).
    "','" .mysql_real_escape_string($years).
    "','" .mysql_real_escape_string($weight).
    "','" .mysql_real_escape_string($etnich).
    
    
    
    
    
    
    
     "')";
            $conn->execute($sql);
            $psid = $conn->Insert_ID();
            require $config['BASE_DIR']. '/classes/image.class.php';
            $image = new VImageConv();
            $image->process($_FILES['picture']['tmp_name'], $psimg. '/' .$psid. '.jpg', 'EXACT', 200, 270);
            $image->canvas(200, 270, '000000', true);
    
            if ( $errors ) {
                $sql = "DELETE FROM pornstar WHERE PSID = '" .mysql_real_escape_string($psid). "' LIMIT 1";
                $conn->execute($sql);
            }
        }
        
        if ( !$errors ) {
            $msg = 'Pornstar Successfuly added!';
    	VRedirect::go('pornstars.php?msg=' .$msg);
        }
    }
    
    $smarty->assign('pornstar', $pornstar);
    ?>
    
    PHP:
    I need to add this to the first file and make it work

     $name         = trim($_POST['name']);
        $about        = trim($_POST['about']);
        $website      = trim($_POST['website']);
    	$height       = trim($_POST['height']);
    	$hair         = trim($_POST['hair']);
    	$born         = trim($_POST['born']);
    	$measurements = trim($_POST['measurements']);
    	$brazzers     = trim($_POST['brazzers']);
    	$performer   = trim($_POST['performer']);
    	$born        = trim($_POST['born']);
    	$astrology   = trim($_POST['astrology']);
    	$birthplace  = trim($_POST['birthplace']);
    	$years       = trim($_POST['years']);
    	$weight      = trim($_POST['weight']);
    	$ethnic      = trim($_POST['ethnic']);   
    PHP:
     
    ptiteconne, May 24, 2011 IP
  2. Cucumba123

    Cucumba123 Well-Known Member

    Messages:
    1,403
    Likes Received:
    34
    Best Answers:
    3
    Trophy Points:
    150
    As Seller:
    100% - 1
    As Buyer:
    100% - 1
    #2
    What's the error message saying?
     
    Cucumba123, May 24, 2011 IP
  3. ptiteconne

    ptiteconne Active Member

    Messages:
    248
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    55
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    Done! please don't contact me anymore :)
     
    ptiteconne, May 24, 2011 IP