![]() |
Admin page redirect
Hi all,
here I come with new project and however I am using old scrip ;). my new project requirement is . 1) If admin login he should go to admin_main.php. 2) If normal user login he should go to main.php. I know I should create data based field for usergroup and fill it with 1 or 0. I should need your help making above conditions work on below code. Code:
<?php session_start(); ?> |
Quote:
PHP Code:
|
Quote:
To make it more specific to your case: PHP Code:
|
Quote:
As per your suggestion I will get this altered and post the update..... |
Redcoder,
what about SQl command, Is there anything I need to change ??? Regards, nani |
You should change this:
Quote:
PHP Code:
|
Quote:
As you suggested i have change my login script as below, Code:
<?php session_start(); ?>More over, I see preg_match("/^\w{8,12}$/", $myusername, $matches) doesn't work for me ?? . Any suggestion....even i am thinking about Sql injection will get some what over leaded by implementing preg_match(). Regards, nani |
Quote:
PHP Code:
Just some advice: change to the mysqli or PDO database driver. The mysql driver is deprecated and slow too. Mysqli(mysql improved) is an easy transition from the mysql extension. Check out this comparison of PDO and mysqli. To really check the SQL injection stuff, look into Prepared Statements. Also check out : http://25yearsofprogramming.com/blog/2011/20110205.htm , it's relevant to your code. It just reiterates what i've told ya. 69 post haha. |
Quote:
As above comment still I see this default redirection for normal user any clue ??? Also, If you can help me on the below threads would be great phase & help for my learning. Code:
http://www.codingforums.com/showthread.php?t=275718Regards, Nani |
Quote:
Also it could be just a simple case of /MYM/main.php has code that redirects to admin/index.html everytime. Try checking your main.php code and whether the file itself exsists. |
Quote:
With Your support I have change the above code as below, But now problem is when a normal user login in to his account he is successfully getting redirected to main.php now, if the same user enter the admin folder path he is successfully able to see all the admin features so, Now I want to block him go in to admin privilege. I know that my model is typically old model of thinking but as I am learner I have just started with this....so help me with any framework for this issues if you think I am still thinking wrong. Code:
<?php session_start(); ?> |
Redcoder,
it would be great if you can suggest me on the below post. http://www.codingforums.com/showthread.php?t=276288 Regards, Nani |
Quote:
Like this PHP Code:
PHP Code:
PHP Code:
|
Quote:
by the way any comments on the way I am planning to learn? |
Quote:
Applying your knowledge in a vast array of real-life projects is the best way to learn. It gives you skills like speed and also reinforces what you know making programming in the future :thumbsup: for you. |
| All times are GMT +1. The time now is 04:12 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.