Jump to content

How to add a new category to this script ?


colonel

Recommended Posts

<h1>Step 2: Submit to directories</h1>

<input id="marticle" type="hidden" value="<?=$userarticle?>" />

<?php
if (isset($skip)){
$_SESSION["skipped"][$dirid]=1;
}

if (isset($sendit)){
$eredm = mysql_query("SELECT * FROM articles WHERE aid=$userarticle") or die(mysql_error());
extract(mysql_fetch_array($eredm));
$eredm = mysql_query("SELECT * FROM article_dirs WHERE adid=$dirid") or die(mysql_error());
extract(mysql_fetch_array($eredm));
$article = nl2br($article);
include("./article/Curl.class.php");
$curl =& new Curl();

if (($atype==0) && ($cat)){
  // logging in
  $page = $curl->post("$aurl/signin.php", array('used'   => $aemail,	'part' => $apassword,'sbmSubmit' => 'Sign In'));

  // posting
    $page = $curl->get("$aurl/member/newarticle.php");
  	$dom = new DOMDocument();
    @$dom->loadHTML($page);

$xpath = new DOMXPath($dom);
    $inputs = $xpath->evaluate("/html/body//input");


for ($i = 0; $i < $inputs->length; $i++) {
 $input = $inputs->item($i);
 $tid = $input->getAttribute('id');
 if ($tid=='userInput') $thisid = $input->getAttribute('value');
}



  $page = $curl->post("$aurl/goarticle.php", array(
	'mode'=>'add',
	'cmbCategory'   => $cat,	
	'txtTitle' => $atitle,
	'txtKeyword' => $akeywords,
	'txtAbstract' => $aabstract,
	'txtAuthorResource' => $aresource,
	'txtArticle' => $article,
	'userInput' => $thisid,
	'smbSubmit' => 'Submit'));


   $page = $curl->get("$aurl/member/newarticle.php");
   if (substr_count($page,"Can not add new Article")>0){
    
    print("<center>Something went wrong<br /></center>");


   } else {
    // adding submit to database
    $eredm = mysql_query("INSERT INTO article_submits(aaid,adid) VALUES($userarticle,$dirid)") or die(mysql_error());
   }
}
if (($atype==1) && ($cat)){
  	$page = $curl->post("$aurl/?a=submit", array(
	'articlecategory'   => $cat,	
	'articletitle' => "$atitle",
	'articlekeywords' => "$akeywords",
	'articlesummary' => "$aabstract",
	'articleabout' => "$aresource",
	'articletext' => "$article",
	'submit' => 'Submit')) or die("error");

if (!substr_count($page,"successfully")>0) {
    print("<center>Something went wrong<br /></center>");
} else {
    // adding submit to database
    $eredm = mysql_query("INSERT INTO article_submits(aaid,adid) VALUES($userarticle,$dirid)") or die(mysql_error());
    }
}

if (($atype==2) && ($cat)){
   $page = $curl->post("$aurl/index.php?page=userarticles",array(
    'article_title' => $atitle,
'article_author' => "$afirstname $alastname",
'article_category_id' => $cat,
'article_snippet' => $aabstract,
'article_summary' => $article,
'submitarticle' => "Submit Article",
'article' => 1
   ));


    // adding submit to database
    $eredm = mysql_query("INSERT INTO article_submits(aaid,adid) VALUES($userarticle,$dirid)") or die(mysql_error());
  
   
}

}
?>

<div id="mainarea" style="width: 100%; text-align: center;" >

</div>

<script>
ajaxRequest('getnew_article.php', 'site=<?php echo $userarticle; ?>');
</script>

 

I want to add $atype==3 to this code which enables login and post to the same script used on this site:

 

http://www.article-4-content.info/

 

I thought that this would work:

 

 // logging in
  
if (($atype==3) && ($cat)){

   $page = $curl->post("$aurl/index.php?page=login", array('used'   => $aemail,	'part' => $apassword,'sbmSubmit' => 'Sign In'));

   $page = $curl->post("$aurl/index.php?page=submitarticle",array(
    'article_title' => $atitle,
'article_author' => "$afirstname $alastname",
'article_category_id' => $cat,
'article_snippet' => $aabstract,
'article_summary' => $article,
'submitarticle' => "Submit Article",
'article' => 1
   ));

 

However, this does not work....any thoughts ?

 

The $atype selection is managed by the backend mysql database.

 

Link to comment
Share on other sites

Hi,

 

Thanks for the reply....however, this still does not work !  When the script comes to a directory URL with an (($atype==3), the script hangs with no errors ?

 

Example:

 

This is the script submitting to a directory with (($atype==0):

 

type0.jpg

 

This is the script submitting to a directory with (($atype==2)

 

type2.jpg

 

However, this is the script submitting to a directory with (($atype==3)

 

type3.jpg

 

Here is a screenshot of phpmyadmin showing the differetn atype's:

 

pmya.jpg

 

So the question comes down to, is it this piece of code which is causing the script to hang on a type3 ?

 

Article-submitter_2.php:

 

<h1>Step 2: Submit to directories</h1>

<input id="marticle" type="hidden" value="<?=$userarticle?>" />

<?php
if (isset($skip)){
$_SESSION["skipped"][$dirid]=1;
}

if (isset($sendit)){
$eredm = mysql_query("SELECT * FROM articles WHERE aid=$userarticle") or die(mysql_error());
extract(mysql_fetch_array($eredm));
$eredm = mysql_query("SELECT * FROM article_dirs WHERE adid=$dirid") or die(mysql_error());
extract(mysql_fetch_array($eredm));
$article = nl2br($article);
include("./article/Curl.class.php");
$curl =& new Curl();

if (($atype==0) && ($cat)){
  // logging in
  $page = $curl->post("$aurl/signin.php", array('used'   => $aemail,	'part' => $apassword,'sbmSubmit' => 'Sign In'));

  // posting
    $page = $curl->get("$aurl/member/newarticle.php");
  	$dom = new DOMDocument();
    @$dom->loadHTML($page);

$xpath = new DOMXPath($dom);
    $inputs = $xpath->evaluate("/html/body//input");


for ($i = 0; $i < $inputs->length; $i++) {
 $input = $inputs->item($i);
 $tid = $input->getAttribute('id');
 if ($tid=='userInput') $thisid = $input->getAttribute('value');
}



  $page = $curl->post("$aurl/goarticle.php", array(
	'mode'=>'add',
	'cmbCategory'   => $cat,	
	'txtTitle' => $atitle,
	'txtKeyword' => $akeywords,
	'txtAbstract' => $aabstract,
	'txtAuthorResource' => $aresource,
	'txtArticle' => $article,
	'userInput' => $thisid,
	'smbSubmit' => 'Submit'));


   $page = $curl->get("$aurl/member/newarticle.php");
   if (substr_count($page,"Can not add new Article")>0){
    
    print("<center>Something went wrong<br /></center>");


   } else {
    // adding submit to database
    $eredm = mysql_query("INSERT INTO article_submits(aaid,adid) VALUES($userarticle,$dirid)") or die(mysql_error());
   }
}
if (($atype==1) && ($cat)){
  	$page = $curl->post("$aurl/?a=submit", array(
	'articlecategory'   => $cat,	
	'articletitle' => "$atitle",
	'articlekeywords' => "$akeywords",
	'articlesummary' => "$aabstract",
	'articleabout' => "$aresource",
	'articletext' => "$article",
	'submit' => 'Submit')) or die("error");

if (!substr_count($page,"successfully")>0) {
    print("<center>Something went wrong<br /></center>");
} else {
    // adding submit to database
    $eredm = mysql_query("INSERT INTO article_submits(aaid,adid) VALUES($userarticle,$dirid)") or die(mysql_error());
    }
}

if (($atype==2) && ($cat)){
   $page = $curl->post("$aurl/index.php?page=userarticles",array(
    'article_title' => $atitle,
'article_author' => "$afirstname $alastname",
'article_category_id' => $cat,
'article_snippet' => $aabstract,
'article_summary' => $article,
'submitarticle' => "Submit Article",
'article' => 1
   ));


    // adding submit to database
    $eredm = mysql_query("INSERT INTO article_submits(aaid,adid) VALUES($userarticle,$dirid)") or die(mysql_error());
  
   
}

}

// logging in

if (($atype==3) && ($cat)){

   $page = $curl->post("$aurl/index.php?page=login", array('used'   => $aemail,   'part' => $apassword,'sbmSubmit' => 'Sign In'));

   $page = $curl->post("$aurl/index.php?page=submitarticle",array(
    'article_title' => $atitle,
   'article_author' => "$afirstname $alastname",
   'article_category_id' => $cat,
   'article_snippet' => $aabstract,
   'article_summary' => $article,
   'submitarticle' => "Submit Article",
   'article' => 1
   ));
  
   
}

?>

<div id="mainarea" style="width: 100%; text-align: center;" >

</div>

<script>
ajaxRequest('getnew_article.php', 'site=<?php echo $userarticle; ?>');
</script>

 

Thanks for looking and I hope you can help !!!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.