Jump to content

PHP CODING HELP - CLIENT LOGIN SYSTEM


michael1291

Recommended Posts

I am currently working on a client login system, up to now it allows users to register and then it looks up the database and redirects them to their own are upon successful login. after they arrive there it displays their personal details and allows them to change them, now  how can i redirect users based on their username for example if a normal user logs in it takes them to their area and if an admin logs in  it takes them to their area. also i am wondering if it is possible to create an on/ off button by this i mean if the buttons state is on then enter value in database if its off enter a different value in database.

 

i would like to thank you in advance and appreciate any help, michael. :)

Link to comment
Share on other sites

Confusing how you said it, can that be done.. yes.

It sounds like (from what you have posted) that you are doing a lot of things that you are not sure are possible.

I would recommend looking at PHP tutorials and MySQL tutorials in order to see what functions can be used where.

Its like creative yet logical problem solving.

Good luck, we are here to help you once you are on your way, hence the forum category PHP Coding Help.

Link to comment
Share on other sites

sorry for being confusing did not read the post before submitting it. I have worked it out, i was already using $_SESSION['member_id'] so i just wrote if the member id = to that of the admin then redirect to the admin area else redirect to the client area.  Does any one know how to create a button that will send a value to the database for example if a user presses the button on it will send a value to the database and if they press it again it will then update with a different value. I' am guessing i may need to use javascript.

Link to comment
Share on other sites

sorry for being confusing did not read the post before submitting it. I have worked it out, i was already using $_SESSION['member_id'] so i just wrote if the member id = to that of the admin then redirect to the admin area else redirect to the client area.  Does any one know how to create a button that will send a value to the database for example if a user presses the button on it will send a value to the database and if they press it again it will then update with a different value. I' am guessing i may need to use javascript.

 

You can easily do this with jQuery. Have a look at http://api.jquery.com/jQuery.post/

Link to comment
Share on other sites

what i am trying to do

 

" if the user turns the button off they will stop receiving information into their private members area but when they turn the button back on again they will then start receiving the information when it is available."

 

by the way i appreciate the help and have found that you guys reply quickly compared to forums i have used in the past!!!

Link to comment
Share on other sites

Something on the idea of this

 

function update()
{
$.post('update.php',function(data){
	$('#info').html(data);
});

var timeout = setTimeout('update', '1000');
}

$('#button-on').click(function(){
$('#button-on').val('Turn Off');
$('#button-on').attr('id','button-off');

update();
});

$('#button-off').click(functon(){
$('#button-off').val('Turn On');
$('#button-off').attr('id','button-on');

clearTimeout(timeout);
});

 

<div id="info"></div>
<input type="button" id="button-on" value="Turn On" />

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.