Wednesday, March 12, 2014

One of my Student on Saturday Feb 8, 2014 at Night

10 messages
________________________________________
Jeewanthi Marasinghe <j-------------@gmail.com> Sat, Feb 8, 2014 at 9:33 AM
To: Rukshan Edirisinghe <rukshan.edirisinghe@gmail.com>

sir here i cn't get the desired output. when i enter username, password and type only i need to redirect the page to profile.php. Can u help me to correct this code.



login.zip
3K



________________________________________
Rukshan Edirisinghe <rukshan.edirisinghe@gmail.com> Sat, Feb 8, 2014 at 9:45 AM
To: Jeewanthi Marasinghe <j-------------@gmail.com>
OK I will chk. Pls send me the Database also.



Thanks and Regards.

Rukshan Edirisinghe <rukshan.edirisinghe@gmail.com> Sat, Feb 8, 2014 at 9:54 AM
To: Jeewanthi Marasinghe <j-------------@gmail.com>
Found the sql.
No need to resend.



Thanks and Regards.

Rukshan Edirisinghe

Jeewanthi Marasinghe <j-------------@gmail.com> Sat, Feb 8, 2014 at 10:03 AM
To: Rukshan Edirisinghe <rukshan.edirisinghe@gmail.com>
yes sir i snt u everything
________________________________________
Rukshan Edirisinghe <rukshan.edirisinghe@gmail.com> Sat, Feb 8, 2014 at 10:25 AM
To: Jeewanthi Marasinghe <j-------------@gmail.com>
Found one error in index file.
Two forms.
Both has action and methods.
But last one has submit button. so that form will submit. But that form will not have user name ,pass .. etc.


Thanks and Regards.
________________________________________
Rukshan Edirisinghe <rukshan.edirisinghe@gmail.com> Sat, Feb 8, 2014 at 10:33 AM
To: Jeewanthi Marasinghe <j-------------@gmail.com>
<body>
    <form id="myform" action="login.php" method="POST">
     Username: <input name="username" type="text" id="username" value="Jeewa"></br>
        Password: <input name="password" type="password" id="password" value="jeewa123"></br>

        Login Type:
        <select name="type">
   <option value="admin">admin</option>
   <option value="Staff">Staff</option>
   <option value="Student">Student</option>
   <option value="Parent">Parent</option>
</select>
    <div id="ack"></div>      
        <button id="submit">Login</button>
    </form>

Thanks and Regards.
________________________________________
Rukshan Edirisinghe <rukshan.edirisinghe@gmail.com> Sat, Feb 8, 2014 at 10:37 AM
To: Jeewanthi Marasinghe <j-------------@gmail.com>
Again the logic should changed as follows.

check if already a logged user
otherwise
check the post values first with db
 and then set sessions
 then redirect to required page.

E.g.:

else{
$sql = "SELECT * FROM users WHERE (username= '$username' AND password = '$password' AND type = '$type')";
$log = mysql_query($sql);
$rows = mysql_num_rows($log);
echo $sql;
if($rows>0){
$_SESSION['user'] = $username;
$_SESSION['type'] = $password;
header("Location: profile.php");
/* Make sure that code below does not get executed when we redirect. */
exit;
}
else
echo "You have no access";

Thanks and Regards.
________________________________________
Jeewanthi Marasinghe <j-------------@gmail.com> Sun, Feb 9, 2014 at 7:39 AM
To: Rukshan Edirisinghe <rukshan.edirisinghe@gmail.com>
sir still it's not working da thing is jeewa can't b da default value for username. It shud vary according to da way of inserting values. I modified da code. didn't gt any meaningful output. It shows Username, Password and Type Are Mandotory
________________________________________
Jeewanthi Marasinghe <j-------------@gmail.com> Sun, Feb 9, 2014 at 7:45 AM
To: Rukshan Edirisinghe <rukshan.edirisinghe@gmail.com>
No sir it's working. Thank u sir :))
________________________________________
Rukshan Edirisinghe <rukshan.edirisinghe@gmail.com> Sun, Feb 9, 2014 at 10:09 PM
To: Jeewanthi Marasinghe <j-------------@gmail.com>
OK. don't put more time on php. focus on semester 5.
After that we may have a time to deal with this.



Thanks and Regards.

Rukshan Edirisinghe
Senior Trainer,
Intel® Teach Program,
P.O.Box. 35, Kandana, Sri Lanka.
Phone & Fax : 11-2242504 Mobile : 77-7597015
www.intel.com/education/lk |www.iteach.schoolnet.lk | www.dnrlk.com

No comments:

Post a Comment