|
Dr. Ayo
|
Kindly help pls. I have just built the login page for my site (I use drmwvr) and I discovered it's not taking me to the 'on success' page. It's not even leaving the login page and I think the codes are intact. The users are already registered on the DB and the database is communicating well. Other applications like record update is working fine. Where am I getting it wrong please.
|
|
|
|
|
|
yawa-ti-de (f)
|
paste your code 
|
|
|
|
|
|
biggjoe (m)
|
like yawa said, paste your code! But a quick advice i might give you is that authors of DW have somethings predefined. If you are to create a login system you must name your session 'MM_username' for it to work unless you know how to tweak their codes. It took me like six months to fathom that. 
|
|
|
|
|
|
|
|
jackkk
|
If you are to create a login system you must name your session 'MM_username' for it to work unless you know how to tweak their codes.
|
|
|
|
|
|
biggjoe (m)
|
I woulda done that but the problem here is that I dont know what his database USERS table and its fields were named. If I can can say for sure now that his username field in db is named 'username' and password field named 'password', I would simply 'clone' a DW code for a login page for him. But he is not even coming back. Just like most people here who come looking for help. They always bolt whenever help is about to come.
|
|
|
|
|
|
yawa-ti-de (f)
|
Well we can't say that biggjoe  Maybe he can't afford the credits to surf regularly or whatever. We can't really say. Let us give him some time. Having said that, a wise man once told me many years ago that many people don't need help, because they don't appreciate it.
|
|
|
|
|
|
inf8nity (m)
|
@ Dr. Ayo What version of dreamweaver ar u using?
|
|
|
|
|
|
biggjoe (m)
|
Well we can't say that biggjoe  Maybe he can't afford the credits to surf regularly or whatever. We can't really say. Let us give him some time. Having said that, a wise man once told me many years ago that many people don't need help, because they don't appreciate it.I cant agree less on that one. People appreciate things better when they pay for it.
|
|
|
|
|
|
Dr. Ayo
|
Sorry guys. I was only trying to see if I could figure it out. I am haveing problems with my connection at home for now(the modem is not communicating with the system) so I won't be able to paste the codes. Pls, where else do you think it could have stemmed from aside the session. (inf8nity)= I use vers. 8 I appreciate your time and concern, all. Thanks
|
|
|
|
|
|
Dr. Ayo
|
The Codes (I was able to get the connection going) <?php require_once('Connections/mysite.php'); ?> <?php // *** Validate request to login to this site. if (!isset($_SESSION)) { session_start(); } $loginFormAction = $_SERVER['PHP_SELF']; if (isset($_GET['accesscheck'])) { $_SESSION['PrevUrl'] = $_GET['accesscheck']; } if (isset($_POST['usrnametxt'])) { $loginUsername=$_POST['usrnametxt']; $password=$_POST['usrnametxt']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "login success.php"; $MM_redirectLoginFailed = "login fails.php"; $MM_redirecttoReferrer = true; mysql_select_db($database_mysite, $mysite); $LoginRS__query=sprintf("SELECT Username, Paasword FROM login WHERE Username='%s' AND Paasword='%s'", get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password)); $LoginRS = mysql_query($LoginRS__query, $mysite) or die(mysql_error()); $loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) { $loginStrGroup = ""; //declare two session variables and assign them $_SESSION['MM_Username'] = $loginUsername; $_SESSION['MM_UserGroup'] = $loginStrGroup; if (isset($_SESSION['PrevUrl']) && true) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns=" http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Login</title> <style type="text/css"> <!-- body,td,th { font-family: Georgia, Times New Roman, Times, serif; font-size: 14px; } --> </style></head> <body> <table width="100%" border="0" align="left" cellpadding="0" cellspacing="0"> <tr> <td><form ACTION="<?php echo $loginFormAction; ?>" id="usrnmeform" name="usrnmeform" method="POST"> <label>Username <input name="usrnametxt" type="text" id="usrnametxt" /> </label> </form></td> </tr> <tr> <td><form id="pswdform" name="pswdform" method="post" action=""> <label>Password <input name="pswdtxt" type="text" id="pswdtxt" /> </label> </form></td> </tr> <tr> <td><form id="submitform" name="submitform" method="post" action=""> <label> <input type="submit" name="Submit" value="Submit" /> </label> </form></td> </tr> </table> </body> </html> Expecting your usuall replies.
|
|
|
|
|
|
biggjoe (m)
|
I noticed two errors from your code: You declared your username field as your password field on line 15 below, I indicated the error line in red and the alternate code on it below. <?php require_once('Connections/mysite.php'); ?> <?php // *** Validate request to login to this site. if (!isset($_SESSION)) { session_start(); } $loginFormAction = $_SERVER['PHP_SELF']; if (isset($_GET['accesscheck'])) { $_SESSION['PrevUrl'] = $_GET['accesscheck']; } if (isset($_POST['usrnametxt'])) { $loginUsername=$_POST['usrnametxt']; 15. $password=$_POST['usrnametxt']; // use: $password=$_POST['pswdtxt']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "login success.php"; $MM_redirectLoginFailed = "login fails.php"; $MM_redirecttoReferrer = true; mysql_select_db($database_mysite, $mysite); $LoginRS__query=sprintf("SELECT Username, Paasword FROM login WHERE Username='%s' AND Paasword='%s'", get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password)); $LoginRS = mysql_query($LoginRS__query, $mysite) or die(mysql_error()); $loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) { $loginStrGroup = ""; //declare two session variables and assign them $_SESSION['MM_Username'] = $loginUsername; $_SESSION['MM_UserGroup'] = $loginStrGroup; if (isset($_SESSION['PrevUrl']) && true) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns=" http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Login</title> <style type="text/css"> <!-- body,td,th { font-family: Georgia, Times New Roman, Times, serif; font-size: 14px; } --> </style></head> <body> <table width="100%" border="0" align="left" cellpadding="0" cellspacing="0"> <tr> <td> <form ACTION="<?php echo $loginFormAction; ?>" id="usrnmeform" name="usrnmeform" method="POST"> <label>Username <input name="usrnametxt" type="text" id="usrnametxt" /> </label> </form></td> </tr> <tr> <td><form id="pswdform" name="pswdform" method="post" action=""> <label>Password <input name="pswdtxt" type="text" id="pswdtxt" /> </label> </form></td> </tr> <tr> <td><form id="submitform" name="submitform" method="post" action=""> <label> <input type="submit" name="Submit" value="Submit" /> </label> </form></td> </tr> </table> </body> </html> Again, the portion I colored red above is all wrong, you created separate forms for each of your form fields. All your form fields should be inside one form, ok? use the one below: <form ACTION="<?php echo $loginFormAction; ?>" id="usrnmeform" name="usrnmeform" method="POST"> Username <input name="usrnametxt" type="text" id="usrnametxt" /> Password <input name="pswdtxt" type="text" id="pswdtxt" /> <input type="submit" name="Submit" value="Submit" /> <br /> </form>
|
|
|
|
|
|
Dr. Ayo
|
Thanks so much, biggjoe. U took your time to point out those flaws. I'm grateful. I Will effect it and tell u how far.
|
|
|
|
|
|
yawa-ti-de (f)
|
Here is another (assuming you didn't type it that way on purpose). It is bolded for your convenience: $LoginRS__query=sprintf("SELECT Username, Paasword FROM login WHERE Username='%s' AND Paasword='%s'",
|
|
|
|
|
|
Afam (m)
|
The Codes (I was able to get the connection going)
<?php require_once('Connections/mysite.php'); ?> <?php // *** Validate request to login to this site. if (!isset($_SESSION)) { session_start(); }
$loginFormAction = $_SERVER['PHP_SELF']; if (isset($_GET['accesscheck'])) { $_SESSION['PrevUrl'] = $_GET['accesscheck']; }
if (isset($_POST['usrnametxt'])) { $loginUsername=$_POST['usrnametxt']; $password=$_POST['usrnametxt']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "login success.php"; $MM_redirectLoginFailed = "login fails.php"; $MM_redirecttoReferrer = true; mysql_select_db($database_mysite, $mysite);
Is login success.php a valid page name? Is login fails.php a valid page name?
|
|
|
|
|
|
biggjoe (m)
|
Is login success.php a valid page name?
Is login fails.php a valid page name?
As for valid, I will say Yes. Yes because the page will be available but the url will be encoded to 'login%20fails.php' Advisable? My answer is NO. Here is another (assuming you didn't type it that way on purpose). It is bolded for your convenience:
And that too.
|
|
|
|
|
|
Afam (m)
|
As for valid, I will say Yes. Yes because the page will be available but the url will be encoded to 'login%20fails.php' Advisable? My answer is NO.
Ok. Just wondering why someone will name pages that way.
|
|
|
|
|
|
nitation (m)
|
@ Poster,
Looking at your codes, I will suggest you learn the basics of Hyper Texture Markup Language before venturing into Server-side scripting language such as - php, Asp, Jsp, etc.
This will do you every good! If not, you will find yourself asking for help with everything you wanna do. Google beginners to HTML and I believe "Sir googs" will not disappoint.
- nitation
|
|
|
|
|
|
biggjoe (m)
|
@ Poster,
Looking at your codes, I will suggest you learn the basics of Hyper Texture Markup Language before venturing into Server-side scripting language such as - php, Asp, Jsp, etc.
This will do you every good! If not, you will find yourself asking for help with everything you wanna do. Google beginners to HTML and I believe "Sir googs" will not disappoint.
- nitation
if he can use dreamweaver, he has come to a stage where it will be easier for him to learn from codes generated by DW than online tutorials. Thats the way I see it though.
|
|
|
|
|
|
nitation (m)
|
@Biggjoe,
Picture yourself in an interview, and a question splashed that you must write 300 lines of HTML codes using a notepad. This is where the disadvantage comes in. Drag dropping TD's and TR's will not be available for you, and there will be no Drmwvr to generate codes also. More so, dreamweaver was not designed to secure your application from all known security hassles.
If you have learnt through this system, then I see why it took you six months to fix a line of code.
"Bad programming practice me brother"
Edited just now: by the look of things, this poster still lacks the basics of HTML!!!
- nitation
|
|
|
|
|
|
Afam (m)
|
Edited just now: by the look of things, this poster still lacks the basics of HTML!!!
- nitation
I agree with this. The thing about IT is that if you don't take the time to learn and understand it then be prepared to run into avoidable problems as issues would come up when you least expected and it becomes worse if you don't even understand what went wrong talk less of knowing how to fix it.
|
|
|
|
|
|
nitation (m)
|
@ Afam
Short corners to programming always end up in a disastrous output. I don't know where the dude got his training from, but the foundation matters a lot.
- nitation
|
|
|
|
|
|
yawa-ti-de (f)
|
nitation, afam: Thanks for bringing this up. When I do, I am often barraged with -ve posts and at some point, I am asked, "can i see your works?" In my neck of the woods, we had to code in Emacs (unix) and in pascal for our first programming class. Though we hated it as we knew we would never use either in the real world, the point made was that by getting our hands dirty, we would know what to do in the event that our beloved WYSIWYG editor decided to "misbehave". In the event that I organize a seminar in Nigeria, one thing I will stress up front is that there wil be no dream weaver. you will code from scratch. After that, should you choose to go buy dreamweaver, believe, u will thank me later 
|
|
|
|
|
|
biggjoe (m)
|
@Biggjoe, If you have learnt through this system, then I see why it took you six months to fix a line of code. -----------------------
Now I see where you are taking this whole thing to. But I wont be available there. I must also say here that Dreamweaver helped me to learn and I am not ashamed of it ok. That hasn't changed anything about the way I work now. Some of the best coders cant even use DW probably because they dont believe in it. Some might have also learnt with it. When you said: "Bad programming practice me brother", I wondered whether you still remember that you are talking about learning. Anyone can learn through any given method, thats why we are all different.
|
|
|
|
|
|
Afam (m)
|
I use Dreamweaver to handle simple straight forward tasks everyday but I am not limited by the inherent limitation of dreamweaver itself because I simple revert to writing raw codes and navigating through logic.
The most important thing is for the programmer to understand whatever underlying code he/she may come across.
As a matter of fact most authoring tools have problems that seasoned programmers end up tweaking themselves unless they intend to wait for the software maker to release updates.
If you want to know the extent of problems inherent in some of the popular tools out there just visit the software owners website and see the support or forum section (if they are even bold enough to setup one) and you will be shocked at the number of mistakes, errors and bugs that even the latest releases of popular tools come with.
|
|
|
|
|
|
yawa-ti-de (f)
|
biggjoe:
Not the point - that you can't or shouldn't use DW
The point - when all you have is a hammer, everything is a nail.
|
|
|
|
|
|
biggjoe (m)
|
biggjoe:
Not the point - that you can't or shouldn't use DW
The point - when all you have is a hammer, everything is a nail.
Ya it is absolutely true and its not like I didnt get the point. However, Nitation seemed to be trying to get personal when he tried to overstretch the issue by referring to a casual statement I made earlier.
|
|
|
|
|
|
Afam (m)
|
@biggjoe and nitation,
Abeg, make everybody hide hin sword for now make we make up. Minor issues if not resolved properly may create bigger problems and it may not be worth it.
Enjoy!
|
|
|
|
|
|
zenus (m)
|
i love DW especially from the code download
|
|
|
|
|
|
biggjoe (m)
|
@biggjoe and nitation,
Abeg, make everybody hide hin sword for now make we make up. Minor issues if not resolved properly may create bigger problems and it may not be worth it.
Enjoy!
That was why I said that I know where it is going and that I wont be available there. i love DW especially from the code download
whatever that means 
|
|
|
|
|
|
nitation (m)
|
OK, I am no longer emphasizing on this issue. I will watch from here
- nitation
|
|
|
|
|
|