Thursday, 31 July 2014

UploadSwitchs



 This is code is uploadSwitch


 <?php
include('../Includes/Header.php');





$con=mysqli_connect("localhost","user","pw","dbname");
// Check connection
if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
}


htmlspecialchars_decode();
get_html_translation_table();


// escape variables for security
$username = mysqli_real_escape_string($con, $_POST['username']);
$name = mysqli_real_escape_string($con, $_POST['name']);
$email = mysqli_real_escape_string($con, $_POST['email']);
$CEmail = mysqli_real_escape_string($con, $_POST['CEmail']);
$SubscribeButton = mysqli_real_escape_string($con, $_POST['SubscribeButton']);
$ChannelName = mysqli_real_escape_string($con, $_POST['ChannelName']);
$ChannelLink = mysqli_real_escape_string($con, $_POST['ChannelLink']);
$TitlePage = mysqli_real_escape_string($con, $_POST['TitlePage']);
$VideoSRC = mysqli_real_escape_string($con, $_POST['VideoURL']);
$Section = mysqli_real_escape_string($con, $_POST['Section']);
$Location = mysqli_real_escape_string($con, $_POST['Location']);
$country = mysqli_real_escape_string($con, $_POST['country']);
$Description = mysqli_real_escape_string($con, $_POST['Description']);
$TCInfo = mysqli_real_escape_string($con, $_POST['Gender2']);








if(isset($_GET['Location']))
{
$Location = $_GET['Location'];
}
switch($Location)
{
        // Alphabetic
       
    case 'AMV Naruto';
        $TBL_Name = 'AMVS_Naruto';
        $URL_Link = '../AMVs-And-ASMVs/Naruto-AMVs.php';
        $AMV_Section = 'Naruto AMVs';
        break;
   
    case 'AMV Bleach';
        $TBL_Name = 'AMVS_Bleach';
        $URL_Link = '../AMVs-And-ASMVs/Bleach-AMVs.php';
        $AMV_Section = 'Bleach AMVs';
        break;
   
    case 'AMV One Piece';
        $TBL_Name = 'AMVS_OnePiece';
        $URL_Link = '../AMVs-And-ASMVs/One-Piece-AMVs.php';
        $AMV_Section = 'One Piece AMVs';
        break;
       
    case 'AMV Fairy Tail';
        $TBL_Name = 'AMVS_FairyTail';
        $URL_Link = '../AMVs-And-ASMVs/Fairy-Tail-AMVs.php';
        $AMV_Section = 'Fairy Tail AMVs';
        break;
       
    case 'AMV Dragon Ball';
        $TBL_Name = 'AMVS_DragonBall';
        $URL_Link = '../AMVs-And-ASMVs/Dragon-Ball-AMVs.php';
        $AMV_Section = 'Dragon Ball AMVs';
        break;   
       
    case 'AMV Anime Mixed';
        $TBL_Name = 'AMVS_AnimeMixedWorld';
        $URL_Link = '../AMVs-And-ASMVs/Anime-Mixed-AMVs.php';
        $AMV_Section = 'Anime Mixed AMVs';
        break;   
       
                   
    default:
        $TBL_Name = 'AMVS_AnimeMixedWorld';
        $URL_Link = '../AMVs-And-ASMVs/Anime-Mixed-AMVs.php';
        $AMV_Section = 'Anime Mixed AMVs';
    break;   
   

}








$sql="INSERT INTO ".$TBL_Name." (username, name, email, CEmail, SubscribeButton, ChannelName, ChannelLink, TitlePage, VideoSRC, Section, Location, country,  Description, TCInfo)
VALUES ('$username', '$name', '$email', '$CEmail', '$SubscribeButton', '$ChannelName', '$ChannelLink', '$TitlePage', '$VideoSRC', '$Section', '$Location', '$country',  '$Description', '$TCInfo')";


if (!mysqli_query($con,$sql)) {
  die('Error: ' . mysqli_error($con));
 
}
 



// Keep insert of stuff at top

$connect2 = mysql_connect("localhost","user","pw",true);
mysql_select_db("dbname", $connect2);
$User = $_SESSION['username'];
$res2 = mysql_query("UPDATE users SET points = points + 20 WHERE name = '".$User."'",$connect2); 



echo '


<!--- Replace Every Page START-->


<!--- TITLE-SECTION OF THE PAGE START --> 
<title>Anime Mixed World | '.$AMV_Section.' Uploaded successfully</title><br />
<!--- TITLE-SECTION OF THE PAGE Ends-->                 

                

<!--- TITLE-SECTION OF THE PAGE START -->
<DIV ID="Title-Section" NAME="Title-Section" CLASS="Title-Section">






                        <!--- SUBTITLE & TITLE [TOP]START -->
                        <div ID="Subtitle" NAME="Subtitle" CLASS="Subtitle" Style="margin-left: 0%;">Anime Mixed World</div><br/>
                        <div ID="Title" NAME="Title" CLASS="Title">Uploaded</div>       
                        <!--- SUBTITLE & TITLE [TOP]END -->   
                       
                               
</div>   
<!--- TITLE-SECTION OF THE PAGE ENDS-->



<DIV ID="Paragraph-Layout" CLASS="Paragraph-Layout">';



// Showing different content for logged user and visitors
if(isset($_SESSION['username'])) {
 
echo '<a href="/users.php?usr='.$_SESSION['username'].'" ALIGN="LEFT" ID="Left-Button" CLASS="Left-Button"><< Back</a>';
}
else{
echo '<a href="../index.php" ALIGN="LEFT" ID="Left-Button" CLASS="Left-Button"><< Back</a>';
}


echo '


<!--- Replace Every Page ENDS-->


<P ID="Text-Container" CLASS="Text-Container">







<!--- HEADER-TEXT START--->
<center>
<DIV ID="Title-Page" NAME="Title-Page" CLASS="Title-Page" ALIGN="MIDDLE">
<h1 ID="Title-Header" NAME="Title-Header" CLASS="Title-Header" ALIGN="MIDDLE">Uploaded succesfully</h1>
</DIV>

<!--- HEADER-TEXT ENDS--->


       

</BR>
</BR>
</BR>


<!--- PARAGRAPHS START--->
<p ID="Paragraph" CLASS="Paragraph" NAME="Paragraph">
<span>


<center>Thanks, '.$_SESSION['username'].' Your`re awesome! '.$TitlePage.' - '.$AMV_Section.' Upload has been successfully. Please feel free to check it out at last page of <a href="'.$URL_Link.'">'.$AMV_Section.'</a>.</center>

</BR>
</BR>
</BR>
</BR>
</BR>
</BR>

</span>
</p>';



echo include ('../Includes/Footer.php');


mysqli_close($con);

?>

No comments:

Post a Comment