Copy link to clipboard
Copied
ok i have got the user creating a username, password and id. once they logged i want to be able to send them to a page containing information from their inputted information in the database. I was thinking of session varialble to load the information in from the database based on the user id so this is what i done
here is the code
login check page php
<?
$userid=mysql_real_escape_string($userid);
$password=mysql_real_escape_string($password);
if($rec=mysql_fetch_array(mysql_query("SELECT * FROM Hdatabase WHERE userid='$userid' AND password = '$password'"))){
if(($rec['userid']==$userid)&&($rec['password']==$password)){
include "include/newsession.php";
echo "<p class="data"> <center>Successfully,Logged in<br><br><a href='logout.php'> Log OUT </a><br><br><a href=welcome.php>Click here if your browser is not redirecting automatically or you don't want to wait.</a><br></center>";
print "<script>";
print " self.location='welcome.php';"; // Comment this line if you don't want to redirect
print "</script>";
}
}
else {
session_unset();
echo "<font face='Verdana' size='2' color=red>Wrong Login. Use your correct Userid and Password and Try <br><center><input type='button' value='Retry' onClick='history.go(-1)'></center>";
}
?>
this is the newsessions php
<?php
//error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR);
$session['id']=session_id();
$session['userid']=$userid;
$session['name']=$name; this is one i have added
//echo $session['userid'];
?>
this is where i though i added new sessions then place them into the welcome page?
add this is a new session i have added from the welcome.php
<?
echo "$session[name]";
?>
i hope you can help
Create a new page with a form and 2 text fields, then go to "Server Behaviours" ==> "User Authentication" ==> "Login User" and follow instructions to create a login page.
Copy link to clipboard
Copied
This is how I do it:
Then use the filter dropdown menu to select the column name "user_email" (Note: The column you are using to store the users email in)
Make it "="
"Session Variable" and in the text field next to this type this: MM_Username
So it should look in the recordset menu sort of like this:
Name: | Recordset Name |
|
Connections: |
|
|
Table: |
|
|
Columns: | All Selected
|
|
Filter: |
|
|
|
| |
Sort: |
|
|
Then click "OK"
Now make the page restricted. Go to the panel Server Behaviors--> User Authentication--> Restrict Access to Page
And then go to the panel Server Behaviors--> User Authentication--> Log Out User
Next go to the "Bindings Panel" click on the "+"symbol and then highlight the field you want to display. Click the insert button at the bottom of the "Bindings Panel". You can only insert one field at a time.
And there you go. A "Profile Page" is created.
For the "Update Page" follow the same steps as above but eliminate the "Bindings Panel" step. Instead use the "Update Record Wizard" to make the profile update page.
(Remember to create the recordset the same as I described above. This is mandatory to for restricted pages to be user profile related)
Explanation of the above process is that when you create a login page with the DreamWeaver function "Log In User", DreamWeaver creates in the code view this:
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
Copy link to clipboard
Copied
hi, i tried that but it come back with unknown user? should i be rebuilding my who login syste, if i am using the code you provided? will it clash with the code i am currently using? the code above i got from a tutorial. If i scrap this code is there any code out there to make a signup / login / logout / forgot passoword using the way you use?
thanks in advance
Copy link to clipboard
Copied
You should scrap your code and create a login page with the DreamWeaver function "Log In User".
Once you have created the login page then you can use my code.
Copy link to clipboard
Copied
Create a new page with a form and 2 text fields, then go to "Server Behaviours" ==> "User Authentication" ==> "Login User" and follow instructions to create a login page.
Copy link to clipboard
Copied
ok thanks i will give that a go and see how i get on
Copy link to clipboard
Copied
thanks very much that seems to have done the trick. once again thanks very much
Copy link to clipboard
Copied
I'm always happy to help.
Copy link to clipboard
Copied
hello, i am pulling my hair out on this one. the above code works brilliantly to get information from one table however i wonder if you could help me massivly. i am trying to get information from two tables now,. i have created a join the works when you test it but not when i try and run it. with the above information you provided it give me the following SQL code
SELECT *
FROM tenant_signup
WHERE userid = colname
and the session variable information
but what i need to for the from statement to include
where tenant_signup.prop_id = name_editprop.prop_id
so i have a colum in the tenant_signup called prop_id the matches the name_editprop prop_id
so the from statement would be FROM tenant_signup, name_editprop
currently if i try this it just gives me the information of the forst record of the database
i really hope someone can help
thanks
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more