0

Hello,

I am new to PHP and I would like to do the following: In my website, the user can add a blog but I would like the blog to go to admin first before it gets published ( The admin has the authority to publish or un-publish a blog).
At the moment, the blog appears on the website and in the admin view it shows that it has not been published yet.

this is my code now:

<pre lang="PHP">

header("Location: http://www.arabrecycling.org/user/blogger/");

</pre>

I would like it to do something like //redirect('admin/addBlogs',$data) but still refresh the page. Is that possible?

3
Contributors
2
Replies
20
Views
3 Years
Discussion Span
Last Post by Fernando_4
0

I don't see logic with your question.
You post like user so you are redirecting to admin, user isn't same as admin so he can't do what admin can...

Hmm, you can do it in this way:
Make a table in database for BlogPost with fileds like createdBy, text, subject, published, etc...
Make a page for user to create a blog, when he add new blog it will add it in to database.
Next make page for admin that will go to database and search for all unpublished posts, executeQuerry that will find every blog where published is false...
Then add button or select when you press publish to make all of them published and the visitor of your website will see only published posts.

Or you can use Wordpress, he have allready implemented that. Bunch of users and admins, you can add restriction what they can do, and so many things...

0

I think you want to use the contents of 'admin/addBlogs' script within the 'user/blogger' script before content is published to the user.

The problem I see is, once a php script finishes execution and sends output to the user the only way to run another php script would be through client/browser action to run that other script. You could trigger that through javascript's on window load event and do the redirect. But it would be wierd seeing two page loads.

Try thinking about including the admin/addBlogs script at the beggining of the user/blogger script to make all your tests before the output.

If there's a certain condition where you don't want any of the following to execute, just type exit(); and nothing else is done, everything up to that statement is what will be sent to the browser.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.