Jump to content

Making a Function-Activated Link Appear Without Having to Refresh Browser


ArizonaJohn

Recommended Posts

Hello,

 

I'm trying to use the code below to make the <a href='http://www...com/.../footervote.php'>Vote</a> link appear if a user logs in and a user shows up in the function getEditorsList(). The vote link only appears if the browser is refreshed.

 

Any idea how I could make the vote link appear without having to refresh the browser?

 

Thanks in advance,

 

John

 

index.php:

 

<?php 

require_once "header.php"; 
//content
include "login.php";
// more content
require_once "footer.php";

?>

 

In header.php:

 

<?php
error_reporting(0); 
session_start();
require_once ('db_connect.inc.php'); 
require_once ("function.inc.php"); 
$seed="0dAfghRqSTgx"; 
$domain =  "...com"; 

            $editors = getEditorsList();
            foreach($editors as $editor)
            {
            $editorids[] = $editor['loginid'];
            }

            if(in_array($_SESSION['loginid'], $editorids))
            {
            echo "<div class='footervote'><a href='http://www...com/.../footervote.php'>Vote</a></div>";
            } 


?>

 

login.php:

 

<?php
if (!isLoggedIn())
{

    if (isset($_POST['cmdlogin']))
    {

        if (checkLogin($_POST['username'], $_POST['password']))
        {
            show_userbox();


        } else
        {
            echo "Incorrect Login information !";
            show_loginform();
        }
    } else
    {

        show_loginform();
    }

} else
{

    show_userbox();

}



?>

So your login code, is it re-directing the browser after logging the user in? Or if you try and refresh, does the browser alert you to say that you are sending POST data again?

 

You'll need to re-direct the browser to the same page you are on, basically refreshing the page but the user won't notice a thing.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.