Yii Framework Forum: Can You Help Me To Convert The Following Code To Yii - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Can You Help Me To Convert The Following Code To Yii Rate Topic: -----

#1 User is offline   jewelhuq 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 02-October 13

Posted 02 October 2013 - 05:59 PM

$submit = $_POST["submit"];
$user = $_POST["username"];
$pass = $_POST["password"];





$user = htmlspecialchars($user,ENT_QUOTES);
$pass = htmlspecialchars($pass,ENT_QUOTES);





session_start();
$_SESSION=array();






if($submit=="Submit")
{

include"dbconnect.php";
$saltpass = $server_salt.$pass;




$login_track=query("select *from login_track where user_id='$user'");
if(mysql_num_rows($login_track)>3)
{
echo "<br><br><h1 align='center'><font color='red'>Your Computer is block for illegal activities.
For unlock contact with administrator. </font></h1><br><br>";
exit;
}

$query=query("select *from user where user='$user' and pass=md5('$saltpass') and active='1' and pin_code='$server_admin_id'");




if(mysql_num_rows($query)>0)
{



$row = mysql_fetch_object($query);
$us_id = $row->id;
$username = $row->user;
$myadmin = $username;
$level = $row->level;
$sess_uservalid = md5($username.$GLOBALS[REMOTE_ADDR].session_id());



$_SESSION[myadmin] = $myadmin;
$_SESSION[us_id] = $us_id;
$_SESSION[level] = $level;
$_SESSION[sess_uservalid] = $sess_uservalid;
$_SESSION[created_by] = $row->created_by;
$r5 = $row->level5;
$_SESSION[r5] = $r5;


$jewel = query("select *from website where user_id='$r5' or user_id='$us_id'");
$jewel_r = mysql_fetch_object($jewel);

$_SESSION[website_title] = $jewel_r->title;
$_SESSION[website_logo] = $jewel_r->logo;
$_SESSION[website_url] = $jewel_r->address;




URL_forward("reseller/dashboard.php",0);



}
else
{
$error = "Invalid username or password";
$ip = $_SERVER["REMOTE_ADDR"];
$browser = $_SERVER['HTTP_USER_AGENT'];

query("insert into login_track values('','$user','$pass',NOW(),'$ip','$browser')");
}

}
?>

Besides could you please tell me how to check session in yii
0

#2 User is offline   yugene 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 488
  • Joined: 08-August 09
  • Location:World is Wide

Posted 03 October 2013 - 02:42 AM

Welcome to forum.
Please take a look at these guidelines first.
CHttpSession class docs

If you're new to Yii you will probably need start with Yii guide
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users