cbrunsdonza I really do appreciate your help!.
Thanks I'm going to give this a try.
I also have some questions regarding variables.
In php you dont have to declare them you just use them and on the first time of the variable being used it
registers , if you know what i trying to say.
Lets say i have 2 pages, index.php and in index.php i have a form with 2 text boxes 'txtUsername ,txtPassword' with username input type set to 'text and password input type set to 'password' and a submit button called 'Login'. Linking to another page called welcome.php.
in welcome.php iretrieve the values from the 2 text boxes on index.php
Code: Select all
$User_Username=$_POST["txtUsername"];
$User_Password=$_POST["txtPassword"];
$EncryptedPassword=crypt("$User_Password",736358903544);
I then connect to a MySql database using the root and blank password (Wamp defaults)
and retrieve the username field and password field from the database and match
the 2 usernames if they match i have another if statements that matches
$EncryptedPassword with the encrypted password saved in the MySQL database.
if they match then it retrieves other info about the user and displays it on the very same page (welcome.php)
This is the example i followed.
http://www.w3schools.com/PHP/php_forms.asp
All good and well i can log in using the username and password if correct if in-correct it directs you to a page telling you 'Incorrect username and password'
Ive never coded in php before so i dont even know if this is secure or not. (Anyway this is just for learning...)
Now lets say i want to update info of the currently logged in user, lets say the user's surname.
How do i re connect to the SQL server with the credentials sent by index.php cus the variables will be blank, is isnt there a global place where this can be stored in memory ? or should i store it in the URL
somehow ? Encrypted obviously ?