// Only set username if it's not already saved if ( !isset( $_SESSION['username'] ) ) $_SESSION['username'] = isset( $_GET['username'] ) ? $_GET['username'] : '';
if(!session_is_registered(myusername)){
header("location:mlogin.php");
}
include "db.php";
//Now serails
//username for welcome
//mean panel page
if($_GET['act'] == 'idx'){
include "theme/login.htm";
}
//add new S/N for a simple program but not active
if($_GET['act'] == 'newsn'){
include "theme/addsn.htm";
}
if($_GET['act'] == 'addnewsn'){
$sql="SELECT * FROM users WHERE username='$username' LIMIT 1";
$result=mysql_query($sql);
while ($user = mysql_fetch_array($result)){
$rate = $user['rate'];
}
$sid = '';
$swname = $_POST['swname'];
$swsn = $_POST['swsn'];
if($rate >= 25){
$act = 'YES';
mysql_query("INSERT INTO `swsn` (
`sid` ,
`swname` ,
`swsn` ,
`act` ,
`username`
)
VALUES (
'', '$swname', '$swsn', 'YES', '$username'
);");
include "theme/addsn_yes.htm";
}else{
$act = 'NO';
mysql_query("INSERT INTO `swsn` (
`sid` ,
`swname` ,
`swsn` ,
`act` ,
`username`
)
VALUES (
'', '$swname', '$swsn', 'NO', '$username'
);");
include "theme/addsn_no.htm";
}
}
//make finder
if($_GET['act'] == 'find'){
include "theme/find.htm";
}
if($_GET['act'] == 'finder'){
$keyword = $_POST['keyword'];
$sql = "SELECT *
FROM `swsn`
WHERE `swname` LIKE CONVERT( _utf8 '$keyword'
USING latin1 )
COLLATE latin1_general_ci
AND `act` = CONVERT( _utf8 'YES'
USING latin1 )
COLLATE latin1_general_ci";
$swfind=mysql_query($sql);
$count=mysql_num_rows($swfind);
if($count==0){
include "theme/nore.htm";
}else{
include "theme/head.htm";
while ($finds = mysql_fetch_array($swfind)){
$swname = $finds['swname'];
$swsn = $finds['swsn'];
$users = $finds['username'];
include "theme/findbit.htm";
}
include "theme/footer.htm";
}
}
// make alphabet list
if($_GET['act'] == 'list'){
include "theme/list.htm";
}
if($_GET['get']){
$letter = $_GET['get'];
$sqlruns = mysql_query("
SELECT *
FROM swsn
WHERE swname LIKE '$letter%'
AND `act` = CONVERT( _utf8 'YES'
USING latin1 )
COLLATE latin1_general_ci
ORDER BY swname
")or die (mysql_error());
$count=mysql_num_rows($sqlruns);
if($count==0){
include "theme/nore.htm";}else{
include "theme/head.htm";
while($sws = mysql_fetch_array($sqlruns)){
$swname = $sws['swname'];
$swsn = $sws['swsn'];
$users = $sws['username'];
include "theme/findbit.htm";
}
include "theme/footer.htm";
}
}
//now we make all as a list
if($_GET['act'] == 'lists'){
$sql = ("SELECT *
FROM `swsn`
WHERE `act` = CONVERT( _utf8 'YES'
USING latin1 )
COLLATE latin1_general_ci") or die (mysql_error());
$swfind=mysql_query($sql);
include "theme/head.htm";
while ($finds = mysql_fetch_array($swfind)){
$swname = $finds['swname'];
$swsn = $finds['swsn'];
$users = $finds['username'];
include "theme/findbit.htm";
}
include "theme/footer.htm";
}
//now we make what users post
if($_GET['act'] == 'ours'){
$usename = $_GET['username'];
$sql = ("SELECT *
FROM `swsn` WHERE username='$username'
AND `act` = CONVERT( _utf8 'YES'
USING latin1 )
COLLATE latin1_general_ci") or die (mysql_error());
$swfind=mysql_query($sql);
include "theme/head.htm";
while ($finds = mysql_fetch_array($swfind)){
$swname = $finds['swname'];
$swsn = $finds['swsn'];
$users = $finds['username'];
$sid = $finds['sid'];
include "theme/userbit.htm";
}
include "theme/footer.htm";
}
//make edit for user posts
if($_GET['act'] == 'edit'){
$sid = $_GET['sid'];
$sqls=mysql_query("SELECT * FROM swsn WHERE sid='$sid' LIMIT 1") or die (mysql_error());
while($rows=mysql_fetch_array($sqls)){
$swnamen = $rows['swname'];
$swsnn = $rows['swsn'];
$sids = $rows['sid'];
}
include "theme/editsn.htm";
}
if($_GET['act'] == 'editnewsn'){
$sql="SELECT * FROM users WHERE username='$username' LIMIT 1";
$result=mysql_query($sql);
while ($user = mysql_fetch_array($result)){
$rate = $user['rate'];
}
$swname = $_POST['swname'];
$sid = $_POST['sid'];
$swsn = $_POST['swsn'];
if($rate >= 25){
mysql_query("UPDATE `swsn` SET `swname` = '$swname',
`swsn` = '$swsn' , act = 'YES' WHERE `sid` = '$sid' LIMIT 1") or die (mysql_error());
include "theme/addsn_yes.htm";
}else{
mysql_query("UPDATE `swsn` SET `swname` = '$swname',
`swsn` = '$swsn' , act = 'NO' WHERE `sid` = '$sid' LIMIT 1") or die (mysql_error());
include "theme/addsn_no.htm";
}
}
The session_is_registered() function is depreciated, it only works when register globals are enabled, and should not be mixed with code using $_SESSION[...].
You need to rewrite your code using current coding standards.
One other possible reason why your code might not be working is that your mysql_ function calls might be failing, but there is no error checking and error reporting code to tell you if they worked or not. The php manual contains examples of error checking logic in the examples under each mysql function definition.
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???