|
|
|
|
|
|
IT Security and Insecurity Portal |
|
|
Need help, decode this php script |
|
Posted: Mon Aug 10, 2009 2:01 am |
|
|
slimboy |
Regular user |
|
|
Joined: Apr 06, 2009 |
Posts: 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Posted: Mon Aug 10, 2009 2:51 am |
|
|
Barney |
Regular user |
|
|
Joined: Jul 16, 2009 |
Posts: 7 |
|
|
|
|
|
|
|
getmovies.php
Code: | <?php
require('../wp-config.php');
function get_match($regex,$content)
{
preg_match($regex,$content,$matches);
return $matches[1];
}
//curl function
function get_data($url)
{
$ch = curl_init();
$timeout = 25;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$queryul="SELECT * FROM ".$wpdb->prefix."movieautomator";
$film = $wpdb->get_row("$queryul");
if($film!=NULL)
{
$link=$film->url;
$link=trim($link);
$data=$film->data;
$queryul2="DELETE FROM ".$wpdb->prefix."movieautomator WHERE url='$link'";
$wpdb->query($queryul2);
$data=trim($data);
$category=$film->category;
$category=trim($category);
$imdb_content = get_data($link);
$pos=strpos($imdb_content,'<a name="poster"');
if($pos!=0)
{
$pos1=strpos($imdb_content,'src="',$pos);
$pos2=strpos($imdb_content,'"',$pos1+5);
$poster=substr($imdb_content,$pos1+5,$pos2-$pos1-5);
$sx=strpos($poster,"V1._SX");
$poster=substr($poster,0,$sx)."V1._SX150.jpg";
srand((float) microtime() * 10000000);
$indice=rand(1000,9999);
$where="posters/".$data."-".$indice.".jpg";
copy($poster,$where);
$where=get_option('home')."/movieautomator/".$where;
}
else
{
$where=get_option('home')."/movieautomator/posters/no-poster.jpg";
}
$name = get_match('/<title>(.*)<\/title>/isU',$imdb_content);
$director = strip_tags(get_match('/<h5[^>]*>Director:<\/h5>(.*)<\/div>/isU',$imdb_content));
$release_date = get_match('/<h5[^>]*>Release Date:<\/h5>(.*)<\/div>/isU',$imdb_content);
$release_date=substr($release_date,0,strpos($release_date,'<a'));
$mpaa = get_match('/<a href="\/mpaa">MPAA<\/a>:<\/h5>(.*)<\/div>/isU',$imdb_content);
$run_time = get_match('/Runtime:<\/h5>(.*)<\/div>/isU',$imdb_content);
$genre = strip_tags(get_match('/<h5[^>]*>Genre:<\/h5>(.*)<\/div>/isU',$imdb_content));
$genre=str_replace(" more","",$genre);
$genre=str_replace("|",",",$genre);
$tagline = strip_tags(get_match('/<h5[^>]*>Tagline:<\/h5>(.*)<\/div>/isU',$imdb_content));
$tagline=str_replace(" more","",$tagline);
$country = strip_tags(get_match('/<h5[^>]*>Country:<\/h5>(.*)<\/div>/isU',$imdb_content));
$country=str_replace("<br \/>","",$country);
$country=str_replace("|",",",$country);
$country=str_replace("\n","",$country);
$trivia = strip_tags(get_match('/<h5[^>]*>Trivia:<\/h5>(.*)<\/div>/isU',$imdb_content));
$trivia=str_replace("more","",$trivia);
$goofs = strip_tags(get_match('/<h5[^>]*>Goofs:<\/h5>(.*)<\/div>/isU',$imdb_content));
$goofs=str_replace("more","",$goofs);
$imdb_content = get_data($link."plotsummary");
$plot = strip_tags(get_match('/<p class="plotpar">(.*)<\/p>/isU',$imdb_content));
$plot=str_replace("\n","",$plot);
//terminat de citit datele de pe imdb, acum cream datele pentru post
$post_title=trim($name);
$post_date=gmdate('Y-m-d H:i:s',$data);
$post_date_gmt=$post_date;
$post_author=1;
$post_status = 'publish';
$post_category = array($category);
$post_content='<p>Movie: <strong>'.$name.'</strong></p>';
$post_content=$post_content.'<p><img align="left" style="margin-top: 5px; margin-bottom: 5px; margin-left: 3px; margin-right: 10px;" src="'.$where.'" width="150">';
$post_content=$post_content.'"'.$plot.'"</p>';
$post_content=$post_content.'<ul>'."\n";
if($director!="")
{
$post_content=$post_content.'<li>Director: '.trim($director).'</li>'."\n";
}
if($release_date!="")
{
$post_content=$post_content.'<li>Release Date: '.trim($release_date).'</li>'."\n";
}
if($run_time!="")
{
$post_content=$post_content.'<li>Run Time: '.trim($run_time).'</li>'."\n";
}
if($country!="")
{
$post_content=$post_content.'<li>Country: '.trim($country).'</li>'."\n";
}
if($genre!="")
{
$post_content=$post_content.'<li>Genre: '.trim($genre).'</li>'."\n";
}
if($mpaa!="")
{
$post_content=$post_content.'<li>MPAA: '.trim($mpaa).'</li>'."\n";
}
$post_content=$post_content.'</ul>'."\n";
if($tagline!="")
{
$post_content=$post_content.'<p>Tagline: '.trim($tagline)."</p>";
}
if($trivia!="")
{
$post_content=$post_content.'<p>Trivia: '.trim($trivia)."</p>";
}
if($goofs!="")
{
$post_content=$post_content.'<p>Goofs: '.trim($goofs)."</p>";
}
$post_content=str_replace("<br>","",$post_content);
//cream postul in wordpress
$post_data = compact('post_content','post_title','post_date','post_date_gmt','post_author','post_category', 'post_status');
$post_data = add_magic_quotes($post_data);
$post_ID = wp_insert_post($post_data);
if ( is_wp_error( $post_ID ) )
echo "\n" . $post_ID->get_error_message();
do_action('publish_phone', $post_ID);
echo "<p>Done blog post for: <strong>$name</strong> scheduled on $post_date</p><p><strong>";
echo '<script>location.href="getmovies.php"</script>';
}
else
{
echo "Done. All movies imported succesfully.";
}
?> |
index.php
Code: | <?php
require('../wp-config.php');
echo'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
Movie Automator
</title>
<!-- Meta Tags -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- CSS -->
<link rel="stylesheet" href="css/structure.css" type="text/css" />
<link rel="stylesheet" href="css/form.css" type="text/css" />
<link rel="stylesheet" href="css/theme.css" type="text/css" />
<!-- JavaScript -->
<script type="text/javascript" src="scripts/wufoo.js"></script>
</head>
<body id="public">
<img id="top" src="images/top.png" alt="" />
<div id="container">
<h1 id="logo"><a>Wufoo</a></h1>
<form id="form1" class="wufoo topLabel" autocomplete="off" enctype="multipart/form-data" method="POST" action="postmovie.php">
<div class="info">
<h2>Movie Automator</h2>
<p>Please enter the form below to start the movie automation process:</p>
</div>
<ul>
<li id="fo1li16"
class=" ">
<label class="desc" id="title16" for="Field16">
IMDB Movies Links
</label>
<div>
<textarea id="Field16"
class="field textarea medium"
name="Field16"
rows="10" cols="50"> |
postmovie.php
Code: | <?php
include('config.php');
require('../wp-config.php');
$linkuri=$_POST['Field16'];
$categorie=$_POST['Field10'];
$timp=$_POST['Field5'];
$admin_check_pass=$_POST['Field8'];
if(($linkuri!="")&&($categorie!="")&&($timp!="")&&($admin_check_pass=$admin_pass))
{
$linkuri=explode("\n",$linkuri);
$table_name = $wpdb->prefix . "movieautomator";
if($wpdb->get_var("show tables like '$table_name'") != $table_name)
{
$sql = "CREATE TABLE " . $table_name . " (
id mediumint(9) NOT NULL AUTO_INCREMENT,
url tinytext NOT NULL,
data text NOT NULL,
category text NOT NULL,
UNIQUE KEY id (id)
);";
$results = $wpdb->query($sql);
}
$data=time();
$timp_seconds=$timp*60;
for($i=0;$i<sizeof($linkuri);$i++)
{
if(strlen($linkuri[$i])>10)
{
$linkul=trim($linkuri[$i]);
$data=$data+$timp_seconds;
$insert = "INSERT INTO ".$wpdb->prefix."movieautomator (url, data, category) " ."VALUES ('" . $linkul . "','" . $data . "','" . $categorie . "')";
$results = $wpdb->query($insert);
}
}
Header("Location: getmovies.php");
}
else
{
echo 'Your password is incorrect or wrong information provided!';
}
?> |
|
|
|
|
|
|
|
|
|
Posted: Wed Aug 12, 2009 9:06 am |
|
|
slimboy |
Regular user |
|
|
Joined: Apr 06, 2009 |
Posts: 6 |
|
|
|
|
|
|
|
|
|
|
|
Posted: Mon Aug 17, 2009 6:03 pm |
|
|
rada |
Regular user |
|
|
Joined: Aug 17, 2009 |
Posts: 5 |
|
|
|
|
|
|
|
what? how do you do? |
|
|
|
|
www.waraxe.us Forum Index -> PHP script decode requests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
All times are GMT
Page 1 of 1
|
|
|
Powered by phpBB © 2001-2008 phpBB Group
|
|
|
|
|