本文整理汇总了PHP中student::getUser_name方法的典型用法代码示例。如果您正苦于以下问题:PHP student::getUser_name方法的具体用法?PHP student::getUser_name怎么用?PHP student::getUser_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类student
的用法示例。
在下文中一共展示了student::getUser_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login_student
public function login_student($student_id, $student_password)
{
if (empty($student_id) || empty($student_password)) {
echo "Username or Password is invalid";
return false;
}
$student_id = stripslashes($student_id);
$student_password = stripslashes($student_password);
$student_id = mysql_real_escape_string($student_id);
$student_password = mysql_real_escape_string($student_password);
$student_password = sha1($student_password);
$students_rec = mysql_query("SELECT * FROM " . $this->students_table . " where student_id = {$student_id};");
if (($obj = mysql_fetch_object($students_rec)) != NULL) {
$student = new student($obj->student_id, $obj->user_name, $obj->user_password, $obj->change_password);
if ($student->getUser_password() == $student_password) {
echo "welcome " . $student->getUser_name();
return true;
} else {
echo "Wrong password";
return false;
}
} else {
echo "No such user!";
return false;
}
}