colonel Posted March 26, 2009 Share Posted March 26, 2009 <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 https://forums.phpfreaks.com/topic/151289-how-to-add-a-new-category-to-this-script/ Share on other sites More sharing options...
phant0m Posted March 26, 2009 Share Posted March 26, 2009 you need to close the if statement with a "}" Just insert this at the very end of your code. Link to comment https://forums.phpfreaks.com/topic/151289-how-to-add-a-new-category-to-this-script/#findComment-794719 Share on other sites More sharing options...
colonel Posted March 27, 2009 Author Share Posted March 27, 2009 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): This is the script submitting to a directory with (($atype==2) However, this is the script submitting to a directory with (($atype==3) Here is a screenshot of phpmyadmin showing the differetn atype's: 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 https://forums.phpfreaks.com/topic/151289-how-to-add-a-new-category-to-this-script/#findComment-794922 Share on other sites More sharing options...
colonel Posted March 27, 2009 Author Share Posted March 27, 2009 Can anyone help me with this ? Thanks Link to comment https://forums.phpfreaks.com/topic/151289-how-to-add-a-new-category-to-this-script/#findComment-795403 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.