Making a Function-Activated Link Appear Without Having to Refresh Browser
Posted
by John
on Stack Overflow
See other posts from Stack Overflow
or by John
Published on 2010-06-09T21:50:30Z
Indexed on
2010/06/09
21:52 UTC
Read the original article
Hit count: 219
php
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();
}
?>
© Stack Overflow or respective owner