query (”SET NAMES ‘utf8'”); //$thisid=utf8_encode($thisid); require ("./include/folio_config.php"); $dbprefix=$globalConfig['dbprefix']; $dbname=$globalConfig['dbname']; require ("./include/connect_db.php"); mysql_select_db($dbname, $link) or die("couldn't select database"); $query=mysql_query("SELECT * FROM ".$dbprefix."$f WHERE id=$thisid"); $resultrow=mysql_fetch_array($query); $thisvalue=$resultrow['public']; if ($thisvalue==0){ $newvalue=1; } else { $newvalue=0; } mysql_query("UPDATE ".$dbprefix."$f SET public=$newvalue WHERE id='$thisid' "); print_r($_GET); echo "updated $newvalue"; //LOG THIS if($newvalue=="1"){ $type="show"; }else{ $type="hide"; } require ("./include/connect_db.php"); mysql_select_db($dbname, $link) or die("couldn't select database"); //table record sessionid amount type userid mysql_query("UPDATE ".$dbprefix."log SET userid='$userid' WHERE sessionid='$sessionid' AND userid=''"); $logquery=mysql_query("SELECT * FROM ".$dbprefix."log WHERE userid='$userid' AND sessionid='$sessionid' AND table1='$f' AND record1='$thisid' AND type='$type' "); if (mysql_num_rows($logquery)<1){ mysql_query("INSERT INTO ".$dbprefix."log VALUES (NULL,NOW(),'','1', '$f','$thisid', '$sessionid', '1', '$type' ,'$userid')"); } else { mysql_query("UPDATE ".$dbprefix."log SET amount=amount+1 WHERE sessionid='$sessionid' AND table1='$f' AND record1='$thisid' AND type='$type'"); } ?>