Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function wp_posts_sender()
- {
- if (!session_id())
- {
- echo "<div style=\"display:none;\">";
- session_start();
- echo "</div>";
- }
- include ("form.php");
- global $current_user;
- if ($_POST["secCode"] != $_SESSION["secCode"])
- {
- $step["capcha"] = false;
- }
- else
- {
- $_SESSION["secCode"] = rand(100000, 999999);
- $step["capcha"] = true;
- }
- if ($_POST["name_author"])
- {
- $step["auhtor"] = true;
- }
- if ($_POST["email_auhtor"])
- {
- $step["email"] = true;
- }
- if ($_POST["site_author"])
- {
- $step["site"] = true;
- }
- if ($_POST["post_name"])
- {
- $step["title"] = true;
- }
- if ($_POST["post_content"])
- {
- $step["content"] = true;
- }
- if (isset($_POST["send_post"]))
- {
- if (($step["capcha"] && $step["title"] && $step["content"]) == true)
- {
- $all_separator = array(",",".",",","+","-","_"," ","?");
- $standars_separator = array(",",",",",",",",",",",",",",",");
- $final_tags = str_replace($all_separator, $standars_separator, $_POST["post_tags"]);
- if (is_user_logged_in())
- {
- $get_userid = $current_user->ID;
- }
- else
- {
- $get_userid = "1";
- }
- $new_post = array("ID" => "","post_author" => $get_userid,"post_category" => array($_POST["cat"]),"post_content" => $_POST["post_content"],"post_title" => $_POST["post_name"],"tags_input" => $final_tags,"post_status" => get_option("type_publish"));
- $post_id = wp_insert_post($new_post);
- if ($_POST["name_author"])
- {
- add_post_meta($post_id, "name", $_POST["name_author"]);
- }
- if ($_POST["email_auhtor"])
- {
- add_post_meta($post_id, "email", $_POST["email_auhtor"]);
- }
- if ($_POST["site_author"])
- {
- add_post_meta($post_id, "site", $_POST["site_author"]);
- }
- for ($i = 1; $i <= get_option("sum_custom_field"); $i++)
- {
- $cfn[$i] = $_POST["cn_$i"];
- $cfv[$i] = $_POST["cv_$i"];
- add_post_meta($post_id, $cfn[$i], $cfv[$i]);
- }
- //==========================================================PAYMENT=================================================================//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement