i have this mobile xhtml php script site
the way it works is as follows
core.php = all funtions
genproc.php = update any funtions
config.php = sql details
i mean if there's action than that action is passed or
if negative ! session expired error
if (($action != ""))
{
$uid = getuid_sid($sid);
if((islogged($sid)==false)||($uid==0))
{
echo "<head>";
echo "<title>Error!!!</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
echo "You are not logged in<br/>";
echo "Or Your session has been expired<br/><br/>";
echo "<a href=\"index.php\">Login</a>";
echo "</p>";
echo "</body>";
echo "</html>";
exit();
}
}
<a href=\"index.php?action=sitethms&sid=$sid\">themes</a><br/>
i have added 1 row as visible varchar 10 default off
this is the action i created
in index.php
else if($action=="visible")
{
echo "<head>";
echo "<title>visible</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
$uid = getuid_sid($sid);
echo "<form action=\"genproc.php?action=upvisible&sid=$sid\" method=\"post\">";
echo "<select name=\"visible\">";
echo "<option value=\"off\">no</option>";
echo "<option value=\"on\">yes</option>";
echo "</select>";
echo "<input type=\"Submit\" name=\"submit\" Value=\"Save\"></form>";
echo "<p align=\"center\">";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"\"/>Home</a>";
echo "</p>";
echo "</body>";
}
in genproc.php
else if($action=="upvisible")
{
$visible = $_POST["visible"];
echo "<head>";
echo "<title>Ghost Mode</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
$ghost = mysql_query("UPDATE ibwf_users SET visible='".$visible."' WHERE id='".$uid."'");
if($ghost)
{
echo "<img src=\"images/ok.gif\" alt=\"o\"/>Ghost Mode updated successfully<br/>";
}else{
echo "<img src=\"images/notok.gif\" alt=\"x\"/>Can't update your Ghost Mode<br/>";
}
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"\"/>Home</a>";
echo "</p>";
echo "</body>";
}
in core.php
function addonline($uid, $place, $plclink)
{
// ///delete inactive users
$tm = time() ;
$timeout = $tm - 420; //time out = 5 minutes
$deloff = mysql_query("DELETE FROM ibwf_online WHERE actvtime <'" . $timeout . "'");
// /now try to add user to online list and add total time online
$lastactive = mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id='" . $uid . "'"));
$tolsla = time() - $lastactive[0];
$totaltimeonline = mysql_fetch_array(mysql_query("SELECT tottimeonl FROM ibwf_users WHERE id='" . $uid . "'"));
$totaltimeonline = $totaltimeonline[0] + $tolsla;
$res = mysql_query("UPDATE ibwf_users SET tottimeonl='" . $totaltimeonline . "' WHERE id='" . $uid . "'");
$ttime = time();
$ghost = mysql_fetch_array(mysql_query("SELECT visible FROM ibwf_users WHERE id='".$uid."'"));
if($ghost[0]=="on")
{
$res = mysql_query("UPDATE ibwf_users SET lastact='" . $ttime . "' WHERE id='" . $uid . "'");
$res = mysql_query("INSERT INTO ibwf_online SET userid='" . $uid . "', actvtime='" . $ttime . "', place='" . $place . "', placedet='" . $plclink . "'");
if(!$res)
{
// most probably userid already in the online list
// so just update the place and time
$res = mysql_query("UPDATE ibwf_online SET actvtime='" . $ttime . "', place='" . $place . "', placedet='" . $plclink . "' WHERE userid='" . $uid . "'");
}
$maxmem = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE id='2'"));
$result = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online"));
if($result[0] >= $maxmem[0])
{
$tnow = date("D d M Y - H:i", time());
mysql_query("UPDATE ibwf_settings set name='" . $tnow . "', value='" . $result[0] . "' WHERE id='2'");
}
$maxtoday = mysql_fetch_array(mysql_query("SELECT ppl FROM ibwf_mpot WHERE ddt='" . date("d m y") . "'"));
if($maxtoday[0] == 0 || $maxtoday == "")
{
mysql_query("INSERT INTO ibwf_mpot SET ddt='" . date("d m y") . "', ppl='1', dtm='" . date("H:i:s") . "'");
$maxtoday[0] = 1;
}
if($result[0] >= $maxtoday[0])
{
mysql_query("UPDATE ibwf_mpot SET ppl='" . $result[0] . "', dtm='" . date("H:i:s") . "' WHERE ddt='" . date("d m y") . "'");
}
}
}
the problem i am facing is
i updated visible mode to on using visible action
but
when i checked mySQL users table
there's no value in visible row
i mean no on/off in visible row in my id
default value i have kept to off (varchar 10) characters = 10
i have added link to change mode in login page
also after i updated visible mode to on
after entering the forum in main menu
i can only see time no other links to forum / inbox etc...
i tried changing mode to on / off
still i can only see time no other links to forum / inbox etc...