How To Update Mysql If the scenario is this..

Status
Not open for further replies.

chibib0

New Member
Messages
46
Reaction score
0
Points
0
How To Update Mysql If the scenario is this:

A user logs in and I want him to redirect in the user control panel and from there is the users registered informations and the user wants to update it.

Probably, I need codes.. Y_Y im a php noob..
 

marshian

New Member
Messages
526
Reaction score
9
Points
0
what are you trying to do?
do you have the cp?
do you have a login script?
do you have a database?
i don't think the database has to update if the user logs in and sees his control panel...
 

mattura

Member
Messages
570
Reaction score
2
Points
18
I have done this sort of thing a few times before.
What you will need is a front page (index.php) login script (login.php), which takes account of all the security implications (google 'php secure login', XSS, 'SQL injection' etc), and a control panel (cp.php). The control panel should have at the very top of the code a check to see that the person who visits the page is logged in. If not, it should redirect them to index.php (using the header command - see docs.php.net and search 'header'). Otherwise, the page should display the necessary forms for changing password/editing other info etc.
Look up php sessions and have each page start with 'session_start();' Then when the user logs in successfully (within login.php) you can set a session variable thus: '$_SESSION['logged_in']=true;', and redirect the user to cp.php. Then at the top of cp.php, just after 'session_start()', put your login check: 'if (!$_SESSION['logged_in']) {header("Location: index.php");}'
All the information you need is out there - just take the time to read it!
Good luck!
 

chibib0

New Member
Messages
46
Reaction score
0
Points
0
I do have

A database already with a lots of stored users..
A do have the registration page..
The Login page...

What I need is a sample code for the CP... coz im having a hard time developing my own.. Y_Y
 

woiwky

New Member
Messages
390
Reaction score
0
Points
0
If you've made a registration page, this shouldn't be too hard. A user cp is similar to a registration page in functionality except that it uses an update query instead of an insert. You should have variables getting and validating POST data, and then just update the db with the new information.
 
Status
Not open for further replies.
Top