Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

advance login

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

advance login

Postby robertbond » Sat Jan 12, 2013 1:50 pm

Hello I RobertBond, I want to ask how to make the user can specify the page you want to view, for example, a user can access 1.php & 2.php, while user B can access 3.php

Thank you and I'm sorry if my question is has been asked
robertbond
New php-forum User
New php-forum User
 
Posts: 5
Joined: Sat Jan 12, 2013 1:37 pm

Re: advance login

Postby simplypixie » Sat Jan 12, 2013 11:54 pm

Sorry but I have no idea what you mean or what you are trying to do. Can you try and explain a bit more please.
User avatar
simplypixie
php-forum Active User
php-forum Active User
 
Posts: 300
Joined: Sun Dec 11, 2011 12:51 am
Location: Shrewsbury, Shropshire

Re: advance login

Postby robertbond » Sun Jan 13, 2013 3:44 am

generally in making a login system in php, we have determined that the page can be opened by the user, such

admin.php

Code: Select all
<?php
$__akses_config = array(
   'login.php',
   'logout.php',
   'admin/index.php',
   'admin/list-user.php',
   'admin/add-user.php',
   'admin/edit-user.php',
   'admin/delete-user.php',
   'admin/add-artikel.php',
   'admin/edit-artikel.php',
   'admin/list-artikel.php',
   'admin/delete-artikel.php',
   'index.php',
   'view-artikel.php'
);


but what if the user can be different each page to be him access like this, when there is a form like this

Code: Select all
<form id="form3" name="form3" method="post" action="">
<table width="200" border="0">
  <tr>
    <td>Full Name </td>
    <td>
      <input type="text" name="textfield" />
    </td>
  </tr>
  <tr>
    <td>Username</td>
    <td>
      <input type="text" name="textfield2" />
    </td>
  </tr>
  <tr>
    <td>Password</td>
    <td>
      <input type="text" name="textfield3" />
    </td>
  </tr>
  <tr>
    <td>Page  </td>
    <td>
      <p>
        <input type="checkbox" name="checkbox" value="checkbox" />
        All Page </p>
      <p>       
        <input type="checkbox" name="checkbox2" value="checkbox" />
        Index.php</p>
      <p>
        <input type="checkbox" name="checkbox3" value="checkbox" />
       Register.php</p>
      <p>
        <input type="checkbox" name="checkbox4" value="checkbox" />
        Search.php</p>
      <p>
        <input type="checkbox" name="checkbox5" value="checkbox" />
        Login.php
</p>
    </td>
  </tr>
</table>
  <input type="submit" name="Submit2" value="Submit" />
  <input type="reset" name="Submit" value="Cancel" />
</form>


example :

1. robert can access all pages

2. tom can only access index.php

3. bond can only access search.php

provision of access rights granted by the admin to register them as their level

thank you
robertbond
New php-forum User
New php-forum User
 
Posts: 5
Joined: Sat Jan 12, 2013 1:37 pm

Re: advance login

Postby simplypixie » Sun Jan 13, 2013 10:18 pm

Set up user levels/groups in your users table and assign to each user. Then in the header of each page add in a check as to what level the user is who is logged in and trying to access the page and if not the correct level redirect them to another page.
User avatar
simplypixie
php-forum Active User
php-forum Active User
 
Posts: 300
Joined: Sun Dec 11, 2011 12:51 am
Location: Shrewsbury, Shropshire

Re: advance login

Postby robertbond » Mon Jan 14, 2013 6:19 am

so I do not need a table in the database contains links to php?

sorry i still do not understand, can give examples or there may be a tutorial?
robertbond
New php-forum User
New php-forum User
 
Posts: 5
Joined: Sat Jan 12, 2013 1:37 pm

Re: advance login

Postby simplypixie » Mon Jan 14, 2013 10:31 am

No you do not need a table that contains links unless that is how you want to set things up.

Presumably you are using sessions to store data when someone logs in?
User avatar
simplypixie
php-forum Active User
php-forum Active User
 
Posts: 300
Joined: Sun Dec 11, 2011 12:51 am
Location: Shrewsbury, Shropshire

Re: advance login

Postby robertbond » Mon Jan 14, 2013 12:34 pm

Are you sure?

More example really help me
robertbond
New php-forum User
New php-forum User
 
Posts: 5
Joined: Sat Jan 12, 2013 1:37 pm

Re: advance login

Postby simplypixie » Mon Jan 14, 2013 1:32 pm

Yes I am sure, if you specify user group or level in your user's table as I said then you can just use that information set in sessions when they login.

I cannot give you an example without know the code and database structure you already have in place for people to login. I suggest you Google php sessions and see how they work.
User avatar
simplypixie
php-forum Active User
php-forum Active User
 
Posts: 300
Joined: Sun Dec 11, 2011 12:51 am
Location: Shrewsbury, Shropshire

Re: advance login

Postby robertbond » Tue Jan 15, 2013 8:27 am

What if I have a table like this


User_type
1. Id
2. Type_user

Action
1. Id
2. Url
3. Description

User
1.id
2.name
3.password
4.id_type_user

Type_user_action
1. Id
2. Id_type_user
3.id_action

How about this?
I found this on google, but did not explain how to login, can you help me?
robertbond
New php-forum User
New php-forum User
 
Posts: 5
Joined: Sat Jan 12, 2013 1:37 pm


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 9 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron