Unstoppable Domains

Need quick fix ''SQL''

Spaceship Spaceship
Watch

wordtubepress

Account Closed
Impact
1
ok so i made a pornstars add on for my adult site but when i fill all informations and click ''submit'' got a mesage saying Pornstar Successfuly added! Problem is there's nothing showing up

Here's the sql code

PHP:
CREATE TABLE IF NOT EXISTS `pornstar` (
  `PSID` bigint(20) NOT NULL auto_increment,
  `name` varchar(120) NOT NULL default '',
  `website` text NOT NULL,
  `views` int(11) NOT NULL,
  `height` text NOT NULL,
  `hair` text NOT NULL,
  `born` text NOT NULL,
  `measurements` text NOT NULL,
  `performer` text NOT NULL,
  `astrology` text NOT NULL,
  `birthplace` text NOT NULL,
  `years` text NOT NULL,
  `weight` text NOT NULL,
  `brazzers` text NOT NULL,
  `ethnic` text NOT NULL,
  `related` text NOT NULL,
  `total_videos` bigint(20) NOT NULL default '0',
  `about` text NOT NULL,
  `images` text NOT NULL,
  `rate` float NOT NULL default '0',
  `ratedby` int(11) NOT NULL default '0',
  PRIMARY KEY  (`PSID`),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=0 ;

ALTER TABLE  `video` ADD  `pornstar` INT( 11 ) NOT NULL AFTER  `hd`

And here's the add.php file

PHP:
  <div id="rightcontent">
        {include file="errmsg.tpl"}
        <div id="right">
        <div align="center">
        <div id="simpleForm">
        <form name="add_pornstar" method="POST" enctype="multipart/form-data" action="pornstars.php?m=add">
        <fieldset>
        <legend>Add a New Pornstar</legend>
            <label for="name">Pornstar Name: </label>
            <input type="text" name="name" value="{$pornstar.name}" class="large"><br>
			<label for="name">Performer AKA: </label>
			<input type="text" name="performer" value="{$pornstar[0].performer}" class="large"><br>
			<label for="name">Pornstar Born: </label>
			<input type="text" name="born" value="{$pornstar[0].born}" class="large"><br>
			<label for="name">Pornstar Astrology: </label>
			<input type="text" name="astrology" value="{$pornstar[0].astrology}" class="large"><br>
			<label for="name">Birthplace: </label>
			<input type="text" name="birthplace" value="{$pornstar[0].birthplace}" class="large"><br>
			<label for="name">Years Active: </label>
			<input type="text" name="years" value="{$pornstar[0].years}" class="large"><br>
			<label for="name">Pornstar Height: </label>
            <input type="text" name="height" value="{$pornstar[0].height}" class="large"><br>
            <label for="name">Pornstar Weight: </label>
            <input type="text" name="weight" value="{$pornstar[0].weight}" class="large"><br>
            <label for="name">Pornstar Hair: </label>
            <input type="text" name="hair" value="{$pornstar[0].hair}" class="large"><br>
            <label for="name">Pornstar Measurements: </label>
            <input type="text" name="measurements" value="{$pornstar[0].measurements}" class="large"><br>
            <label for="name">Pornstar Ethnicity: </label>
            <input type="text" name="ethnic" value="{$pornstar[0].ethnic}" class="large"><br>
            <label for="name">Pornstar Website: </label>
            <input type="text" name="website" value="{$pornstar[0].website}" class="large"><br>
            <label for="name">About: </label>
            <textarea name="about" style="width:420px; height:260px;">{$pornstar[0].about}</textarea><br>
            <input name="picture" type="file"><br>
        </fieldset>
        <div style="text-align: center;">
            <input type="submit" name="add_pornstar" value="Add Category" class="button">
        </div>
        </form>
        </div>
        </div>
        </div>
     </div>

Any idea what's wrong ? i don't mind spending on this if someone can fix it.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
The SQL creates a table if it doesn't exist and alters another.

Where do you actually insert the data? Where's "pornstars.php?m=add" ?
Or am I crazy?
 
0
•••
ok i found the file that cause the problem but i don't know why

Working file but missing some option

PHP:
<?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);
?>

Not working modified file

PHP:
<?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);
?>
 
Last edited:
0
•••
You have a spelling misake in your modified file, this line:

"','" .mysql_real_escape_string($etnich).

should be :

"','" .mysql_real_escape_string($ethnic).
 
0
•••
Still need help? PHP developer with 8+ years experience. I'll fix it for free if you can give me a few hard links to some of my adult sites from yours.

Cheers, :)
 
Last edited:
0
•••
was it the spelling mistake?
 
0
•••
Unstoppable Domains
Domain Recover
DomainEasy โ€” Live Options
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back