Home > Back-end >  Redirect link is not working after loggin in in php
Redirect link is not working after loggin in in php

Time:06-01

I want to make that after logging in to website(default7test.php), it has to open the default8 link. But it is not opening and still default7test.php link is still remaining. What I want to make is If I open the default7.test.php, it has to open default8.html link automatically.

<?php
    $loginname = '';
    $stsiteuser = '';
    $email = '';
    $usrgrp = '';
    $stldap = '';
    session_set_cookie_params(0, '/', 'sgewsweb.amk.st.com');
    
    session_start(['read_and_close' => true]);
    
    if (isset($_SESSION["loginname"])) { 
        $loginname = $_SESSION["loginname"];
        $email = $_SESSION["email"];
        $stsiteuser = $_SESSION["stsiteuser"];
        $usrgrp = $_SESSION["usrgrp"];
        $badgeno = $_SESSION["badgeno"];
        //echo "LDAP: ".$ldapbadge;
    }
    //session_write_close();
    
    if ($usrgrp == "999998") {
        echo "<tr><td class=\"left_padding\"><a class=info href=\"http://sgewsweb.amk.st.com:8080/web/sgews/default8.html\" target=\"_blank\"></a></td></tr>";
    }
        
    $imgnm = Array();
    $count = 0;

    echo "<html>\n";
    echo "<head><title>SGEWS Homepage</title>\n";
    echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"\web/css/apewsmain.css\"/>\n";
    echo "<script src=\"\web/js/apews/apewsjs.js\" type=\"text/javascript\"></script>";
    
    //for instant search on main page --- isaac
    echo "<script type=\"text/javascript\" src=\"\web/js/apews/jquery/jquery-1.3.2.js\"></script>";
    echo "<script type=\"text/javascript\" src=\"\web/js/apews/search.js\"></script>";
    
    //for slideshow --- isaac
    echo "<script type=\"text/javascript\" src=\"\web/js/apews/jquery.cycle.js\"></script>";
    echo "<script type=\"text/javascript\" src=\"\web/js/apews/slideshow.js\"></script>";
    
    //for instant search on main page --- isaac
    echo "<script type=\"text/javascript\" src=\"\web/js/apews/main.js\"></script>";
    
    //include( "//sgewsnant21.amk.st.com/ewsweb/wwwroot/library/common7/apewsheader_main.php");
    include( "//sgewsnant21.amk.st.com/ewsweb/wwwroot/library/common7/apewsheader_mainnew.php");
    
    include ("ip_control7.php");
    
?>

Above page is default7test.php.

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <title></title>
</head>

<body>
    <div>Redirecting SGEWS Page to Microsoft Edge</div>
    <script type="text/javascript">
        function detectbrowser() {
            var ua = window.navigator.userAgent;
            if (ua.indexOf("Edg") > 0) { //Edge
                window.location = "http://sgewsweb.amk.st.com:8080/web/sgews/default8.cgi";
            } elseif (ua.indexOf("Trident") > 0 || ua.indexOf("Chrome") > 0) { //IE or Chrome
                window.location = ("microsoft-edge:http://sgewsweb.amk.st.com:8080/web/sgews/default8.cgi");
                window.location.replace(
                    "http://sgewsweb.amk.st.com:8080/web/sgews/default8.cgi?welcome2sgews=20211109100035")
            }
        }
        detectbrowser();
    </script>
</body>

</html>

Above page is default8.html that I made for redirect.

CodePudding user response:

<a> tag will not redirect unless you click it, you should try header('Location:http://sgewsweb.amk.st.com:8080/web/sgews/default8.html'); in your php code in default7test.php to make redirect to 8.

  • Related