0

Is there any redirect possibility to open login.php as a popup window?

<?PHP
require_once("./include/membersite_config.php");

if(!$fgmembersite->CheckLogin())
{
$fgmembersite->RedirectToURL("login.php");
exit;
}
?>
sanzuu
  • 192
  • 1
  • 4
  • 14

2 Answers2

0

It is not possible in php. You can try:

<a href="login.php" target="_blank">login</a>


Or in javascript:

<script type="text/javascript" language="Javascript">window.open('login.php');</script>

However this will most probably get blocked by popup blockers.

DunnoHowToCode
  • 531
  • 1
  • 4
  • 14
  • I think Its not redirect ,I need to click on login link. – sanzuu Jun 29 '16 at 08:03
  • The first one is a link to click on. The javascript one does not need to be clicked, you can put it inside your own code and call it. However it will almost confirm to be blocked by popup blockers. – DunnoHowToCode Jun 29 '16 at 08:07
  • If the new popup window is not a must in your requirement, you can try `header(Location: 'login.php');` instead – DunnoHowToCode Jun 29 '16 at 08:12
  • Yes ! I need not to popup if I have this solution http://stackoverflow.com/questions/38072386/how-to-go-back-to-previous-page-after-successful-login – sanzuu Jun 29 '16 at 08:19
0

The best thing to do, would be via JavaScript + HTML.

However, if you really want to do it this way, you can always write the javascript into the page using PHP.

echo "<script>window.open('http://www.yourwebsite.com/popup.php')</script>";

But look at other more standard options first.

More info on the window.open method here.

http://www.w3schools.com/jsref/met_win_open.asp

Benjamin
  • 347
  • 1
  • 12