Deon Posted May 27, 2006 Share Posted May 27, 2006 Hi there,DW 8.0.2, PHP & mySQLI use this in my ASP VBScript pages which I got from a NG.[i] [b]<% if Session("MM_Username") <> "" then %>[/b] <Strong>Welcome <%= Session("MM_Username") %>< /strong><br> <A HREF="<%= MM_Logout %>">Log Out</A> [b]<%End If %>[/b] [b]<% if Session("MM_Username") = "" then %>[/b] <form name="form1" method="post" action="<%=MM_LoginAction%>"> <table width="150" border="0" cellspacing="0" cellpadding="3"> <tr> <td><b>Name:</b> <input type="text" name="txtName"> </td> </tr> <tr> <td><b>Password:</b> <input type="password" name="txtPassw"> <br> <font size="2"> <input type="checkbox" name="checkbox" checked> remember me<br></font></td> </tr> <tr> <td align="center"> <input type="submit" name="Submit" value="log in >>"> </td> </tr> </table> </form> </td> </tr> </table> [b] <%End If %>[/b][/i]This works perfectly well for me. What it does is to welcome a visitor with his/her registrated name once logged in together with a Log out link. The log out is done with DW.If the visitor is NOT logged in, it presents the visitor with the login form.How can I accomplich the same with PHP? I will REALLY appreciate your help.Regards,Deon Quote Link to comment https://forums.phpfreaks.com/topic/10591-php-login-sessions/ Share on other sites More sharing options...
poirot Posted May 27, 2006 Share Posted May 27, 2006 Perhaps something like:[code]<?php if ($_SESSION['MM_Username'] != "") { ?><Strong>Welcome <?= $_SESSION['MM_Username'] ?>< /strong><br><A HREF="<?= $MM_Logout ?>">Log Out</A><?php } else { ?><form name="form1" method="post" action="<?=$MM_LoginAction?>"><table width="150" border="0" cellspacing="0" cellpadding="3"><tr><td><b>Name:</b><input type="text" name="txtName"></td></tr><tr><td><b>Password:</b><input type="password" name="txtPassw"><br><font size="2"><input type="checkbox" name="checkbox" checked>remember me<br></font></td></tr><tr><td align="center"><input type="submit" name="Submit" value="log in >>"></td></tr></table></form></td></tr></table><?php } ?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/10591-php-login-sessions/#findComment-39503 Share on other sites More sharing options...
Deon Posted May 27, 2006 Author Share Posted May 27, 2006 Thank you so much!!! This is exactly 100% what I needed.Why do I get this message?Notice: Undefined index: MM_Username in c:\Inetpub\wwwroot\sincro\members\member-login.php on line 277when not logged in? Apart from this message, your suggestions work 100% and perfectly well.This is line 277: <?php if ($_SESSION['MM_Username'] != "") { ?>Regards,Deon Quote Link to comment https://forums.phpfreaks.com/topic/10591-php-login-sessions/#findComment-39513 Share on other sites More sharing options...
poirot Posted May 27, 2006 Share Posted May 27, 2006 This happens because $_SESSION['MM_Username'] is not defined.If you defined it indeed, maybe the session is not being passed correctly. Quote Link to comment https://forums.phpfreaks.com/topic/10591-php-login-sessions/#findComment-39519 Share on other sites More sharing options...
xbase Posted May 27, 2006 Share Posted May 27, 2006 I noticed that you are using a windows server, please note I have found a lot of severe issues regarding the use of php with IIS Quote Link to comment https://forums.phpfreaks.com/topic/10591-php-login-sessions/#findComment-39520 Share on other sites More sharing options...
Deon Posted May 27, 2006 Author Share Posted May 27, 2006 Thank you so much to the both of you.I have uploaded my test files to my server and it works perfectly well. Maybe there is something wrong with the settings/installation of PHP on my testing PC.Thank you again!Regards,Deon Quote Link to comment https://forums.phpfreaks.com/topic/10591-php-login-sessions/#findComment-39521 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.