Addpages.php

<?phpclass DivineAddPages {  private function DBString($string) {        return str_replace(array("''", "\\"), array("''", "\\\\"), $string);    }           public function Add($link, $title, $content, $comments = true) {        $result = mysql_query("SELECT ID FROM wp_posts WHERE post_name = '{$this->DBString($link)}' LIMIT 1");                if ($result) {            list($post_id) = mysql_fetch_row($result);        } else {            $post_id = 0;        }                $comment_status = $comments ? 'open' : 'closed';                if(!$post_id) {         mysql_query("               INSERT wp_posts             SET                 post_name = '{$this->DBString($link)}',                 post_title = '{$this->DBString($title)}',                   post_content = '{$this->DBString($content)}',                   post_status = 'publish',                    comment_status = '{$comment_status}',                   post_author = 1,                    post_date = NOW(),                  post_date_gmt = NOW(),                  post_modified = NOW(),                  post_modified_gmt = NOW(),                  post_type = 'page'          ");     } else {            mysql_query("               UPDATE wp_posts             SET                 post_name = '{$this->DBString($link)}',                 post_title = '{$this->DBString($title)}',                   post_content = '{$this->DBString($content)}',                   post_status = 'publish',                    comment_status = '{$comment_status}',                   post_author = 1,                    post_date = NOW(),                  post_date_gmt = NOW(),                  post_modified = NOW(),                  post_modified_gmt = NOW(),                  post_type = 'page'              WHERE                   ID = {$post_id}         ");     }   }       public function Link($link) {       if(in_array('mod_rewrite', apache_get_modules())) {         return get_bloginfo('url').'/'.$link;       } else {            list($post_id) = mysql_fetch_row(mysql_query("SELECT ID FROM wp_posts WHERE post_name = '{$this->DBString($link)}' LIMIT 1"));          return get_bloginfo('url').'/?p='.$post_id;     }   }       public function SetPermalinksOption() {         mysql_query("UPDATE wp_options SET option_value = '/%post_id%' WHERE option_name = 'permalink_structure'"); }           public function DivineAddPages() {  }}$div_ap = new DivineAddPages();?>

i need hep ASAP

Recommended Answers

All 6 Replies

Member Avatar for LastMitch

i need hep ASAP

If you want someone to help you then you need to fix your code. I don't think anyone can read it.

Please repost your code with line breaks. Thanks.

give space between <?php and class and arrange your code otherwise you get so many errors

I have not the faintest idea of whether that is a code fragment, or a bunch of letters dumped ...

"A man's ability is shown in how he handles his tools"

ok ill work on it but that is the way it was created through the program

Member Avatar for diafol

What program?? Is this your code or not?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.