Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,155,625 members, 7,827,334 topics. Date: Tuesday, 14 May 2024 at 10:43 AM

The Login Page (in Drmwvr) - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / The Login Page (in Drmwvr) (1324 Views)

I Want To Create Front Page In My Smf Forum / How To Design A Free Php Login Page / How To Design A Php Login Page (2) (3) (4)

(1) (Reply) (Go Down)

The Login Page (in Drmwvr) by DrAyo1(m): 4:53pm On Sep 09, 2009
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.
Re: The Login Page (in Drmwvr) by yawatide(f): 6:21pm On Sep 09, 2009
paste your code wink
Re: The Login Page (in Drmwvr) by biggjoe(m): 6:33pm On Sep 09, 2009
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. grin
Re: The Login Page (in Drmwvr) by yawatide(f): 7:24pm On Sep 09, 2009
wow bigjoe. I wonder how long it would have taken if you opened up notepad and came up with the code yourself grin grin tongue cool undecided grin grin
Re: The Login Page (in Drmwvr) by jackkk: 7:34pm On Sep 09, 2009
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.
Re: The Login Page (in Drmwvr) by biggjoe(m): 8:09am On Sep 10, 2009
yawa-ti-de:

wow bigjoe. I wonder how long it would have taken if you opened up notepad and came up with the code yourself grin grin tongue cool undecided grin grin

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.
Re: The Login Page (in Drmwvr) by yawatide(f): 9:51am On Sep 10, 2009
Well we can't say that biggjoe smiley

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.
Re: The Login Page (in Drmwvr) by inf8nity(m): 11:11am On Sep 10, 2009
@ Dr. Ayo What version of dreamweaver ar u using?
Re: The Login Page (in Drmwvr) by biggjoe(m): 12:58pm On Sep 10, 2009
yawa-ti-de:

Well we can't say that biggjoe smiley

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.
Re: The Login Page (in Drmwvr) by DrAyo1(m): 2:26pm On Sep 11, 2009
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
Re: The Login Page (in Drmwvr) by DrAyo1(m): 12:29pm On Sep 12, 2009
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&nbsp;
<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.
Re: The Login Page (in Drmwvr) by biggjoe(m): 3:14pm On Sep 12, 2009
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&nbsp;
        <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" />
       

       
    </form>
Re: The Login Page (in Drmwvr) by DrAyo1(m): 3:54pm On Sep 12, 2009
Thanks so much, biggjoe.
U took ur time to point out those flaws. I'm grateful.
I Will effect it and tell u how far.
Re: The Login Page (in Drmwvr) by yawatide(f): 5:10pm On Sep 12, 2009
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'",
Re: The Login Page (in Drmwvr) by Afam(m): 6:15pm On Sep 12, 2009
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);


Is login success.php a valid page name?

Is login fails.php a valid page name?
Re: The Login Page (in Drmwvr) by biggjoe(m): 6:43pm On Sep 12, 2009
Afam:

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.

yawa-ti-de:

Here is another (assuming you didn't type it that way on purpose). It is bolded for your convenience:


And that too.
Re: The Login Page (in Drmwvr) by Afam(m): 7:34pm On Sep 12, 2009
biggjoe:

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.
Re: The Login Page (in Drmwvr) by nitation(m): 10:51am On Sep 13, 2009
@ 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
Re: The Login Page (in Drmwvr) by biggjoe(m): 11:26am On Sep 14, 2009
nitation:

@ 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.
Re: The Login Page (in Drmwvr) by nitation(m): 4:15pm On Sep 14, 2009
@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
Re: The Login Page (in Drmwvr) by Afam(m): 4:41pm On Sep 14, 2009
nitation:


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.
Re: The Login Page (in Drmwvr) by nitation(m): 4:58pm On Sep 14, 2009
@ 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
Re: The Login Page (in Drmwvr) by yawatide(f): 5:06pm On Sep 14, 2009
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 cool
Re: The Login Page (in Drmwvr) by biggjoe(m): 6:26pm On Sep 14, 2009
nitation:

@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.
Re: The Login Page (in Drmwvr) by Afam(m): 6:56pm On Sep 14, 2009
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.
Re: The Login Page (in Drmwvr) by yawatide(f): 6:59pm On Sep 14, 2009
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.
Re: The Login Page (in Drmwvr) by biggjoe(m): 7:15pm On Sep 14, 2009
yawa-ti-de:

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.
Re: The Login Page (in Drmwvr) by Afam(m): 7:22pm On Sep 14, 2009
@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!
Re: The Login Page (in Drmwvr) by zenus(m): 7:36pm On Sep 14, 2009
i love DW especially from the code download
Re: The Login Page (in Drmwvr) by biggjoe(m): 7:41pm On Sep 14, 2009
Afam:

@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.

zenus:

i love DW especially from the code download
whatever that means
Re: The Login Page (in Drmwvr) by nitation(m): 6:05am On Sep 15, 2009
OK, I am no longer emphasizing on this issue. I will watch from here

- nitation

(1) (Reply)

Seun: Why Nigerian Newspapers Fail / Selling Templates / Help! Yawatide, Dual Core, DHTML- Nairaland Webmasters!

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 57
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.