Login re-direct Issue in post comment area in php

If someone wishes to comment on any item e.g. and article or forum item etc in my site,It prompts them to login/create account. Is it possible to make sure that when the client logs in it takes them back to the comment they wanted to make?. But now its going not like this flow. User not login that re-direct to login page..but i want after login this section user automatically re-direct current post comment area. is there a way ?

 <?php if ($sessionUser == 1 || $sessionSeller == 1 || $sessionadmin == 1) { ?>
<form class="cp_form" action="article_comments_db.php" method="post" name="frm_comment" id="frm_comment">

  <div id="div_req_comment" class="cp_infopanel_off">
    <span><?= $_Reviews ?></span>:<span class="red">*</span>

    <textarea class="cp_textarea" id="req_comment" name="req_comment" onBlur="do_blur(this.id)" onFocus="do_focus(this.id)"></textarea>
    <div id="infobox_req_comment" class="cp_infobox"></div>
  <input type="button" id="btn_submit" class="rp_button" value="<?= $_Submit ?>" onClick="validate_form('frm_comment')" />    
  <input type="hidden" name="id" value="<?php echo $id ?>" />
<?php } else {
?><br /><br /><div align="right"><input type="button" id="btn_submit" class="rp_button" value=" <?= $_Post_comment ?> " onClick="window.location.href='login.php?event=Account'" /></div><?php


You could call your login.php?event=Account with an ID or the url (urlencode) of the current page visited by the user.


In the loginform you could fetch the ID/url with $_GET and put it in a hidden input.

<input type="hidden" name="visitedpage" value="<?php echo $_GET['visitedpageid']; ?>">

If login was correct, you then redirect by using the POST-value of that hidden input.


Please make sure you check if the get-parameter is set (isset) and matches to an existing page.

I can give you the idea of How it can be achieved. 1. While redirecting to your login page. check if $_SERVER['HTTP_REFERER'] is empty or not. If not empty then save it in to a session.

  1. After successful login check whether the user came from the another page or not using the value you saved into your session.

If not empty then redirect the user to the same page as defined into your session variable. And before redirecting, hold the session value in a variable and destroy this session variable.

Need Your Help

how to work on with email alias in odoo 8?

odoo odoo-8 openerp-8

Anybody please help me with Odoo mailing aliases for a corporate domain. I have been behind this two to three days and failing to get the work done. I am pretty much confused between the email to b...