IPB

Welcome Guest ( Log In | Register )



Tags
This content has not been tagged yet
 
Reply to this topicStart new topic

Help With Php Log-in Form

, my PHP forum log-in form aint working


odomike
no avatar
Core2Q-QX6800
***********
Group: [HOSTED]
Posts: 1,093
Joined: 3-August 04
From: Nigeria
Member No.: 569



Post #1 post Oct 15 2004, 12:46 AM
Ok .... I have this log-in form on my HomePage. It was designed with PHP scripting, but it aint working. It simply doesnt respond to your log-in command.

Can someone please help me with the exact code to make it work?

Here is the code for the log-in form...
QUOTE
                      <TD align=middle colSpan=2 style="font-family: Arial, Helvetica, sans-serif" bgcolor="#CCCCCC">
                      <font face="System" size="2">Forum Log-in</font></TD></TR>
                    <TR>
                      <TD align=right width="45%" style="font-family: Arial, Helvetica, sans-serif" bgcolor="#CCCCCC"><SPAN
                        class=gen><font face="Tahoma" size="2" color="#000000">
                      Username:</font></SPAN></TD>
                      <TD style="font-family: Arial, Helvetica, sans-serif" bgcolor="#CCCCCC">
                      <INPUT maxLength=40 size=20 name=username style="text-indent: 2px; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; font-family: Arial, Helvetica, sans-serif; color: #1a2640; border-color: #ffffff"> </TD></TR>
                    <TR>
                      <TD align=right style="font-family: Arial, Helvetica, sans-serif" bgcolor="#CCCCCC"><SPAN class=gen>
                      <font size="2" face="Tahoma" color="#000000">Password:</font></SPAN></TD>
                      <TD style="font-family: Arial, Helvetica, sans-serif" bgcolor="#CCCCCC">
                      <INPUT type=password maxLength=32 size=20
                        name=password style="text-indent: 2px; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; font-family: Arial, Helvetica, sans-serif; color: #1a2640; border-color: #ffffff"> </TD></TR>
                    <TR align=middle>
                      <TD colSpan=2 style="font-family: Arial, Helvetica, sans-serif" bgcolor="#CCCCCC" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF"><SPAN class=gen>
                      <font color="#000000" size="2" face="Tahoma">Auto-Log me
                      on each visit:</font><font color="#000000">
                      <INPUT type=checkbox
                      name=autologin value="ON" style="text-indent: 2px; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; font-family: Arial, Helvetica, sans-serif; border-color: #ffffff"></font></SPAN></TD></TR>
                    <TR align=middle>
                      <TD colSpan=2 style="font-family: Arial, Helvetica, sans-serif" bgcolor="#CCCCCC">
                      <INPUT class=mainoption type=submit value="Log in" name=login style="font-family: Tahoma; font-size: 10pt"></TD></TR>
                    <TR align=middle>
                      <TD colSpan=2 style="font-family: Arial, Helvetica, sans-serif" bgcolor="#CCCCCC"><SPAN class=gensmall><A class=gensmall
                        href="http://www.odowebdesigns.uni.cc/forums/profile.php?mode=sendpassword">
                      <font color="#003C5E" face="Tahoma"><u>I forgot my
                      password</u></font></A></SPAN></TD>


If there is a way you can help me make that work, I will be most grateful to you. Or alternatively, if you know about any other php log-in scripting that can log-in into a forum and how to make that work, I will gladly accept it.

Thanks in advance. I am anxiously waiting for your replies.
Go to the top of the page
+Quote Post
rowita
no avatar
Unknown Member
******
Group: Members
Posts: 90
Joined: 27-September 04
From: this f**king world
Member No.: 1,293



Post #2 post Oct 15 2004, 07:41 AM
Wher is <FORM> TAG ???

Your INPUT TAGs should be in <FORM> TAG :
CODE
<FORM method="POST" action="<? echo $_SERVER['PHP_SELF']; ?>">[/br]

If you want to process in the current file.
or[br]
CODE
<FORM method="POST" action="http://www.odowebdesigns.uni.cc/forums/login.php">[/br]
[br]If you want it on another file like "login.php"

You can get the values with:
CODE
$_POST['name']);
Go to the top of the page
+Quote Post
rowita
no avatar
Unknown Member
******
Group: Members
Posts: 90
Joined: 27-September 04
From: this f**king world
Member No.: 1,293



odomike
no avatar
Core2Q-QX6800
***********
Group: [HOSTED]
Posts: 1,093
Joined: 3-August 04
From: Nigeria
Member No.: 569



Post #4 post Oct 15 2004, 11:30 PM
QUOTE (rowita @ Oct 15 2004, 07:49 AM)

Thanks for the links rowita. I will try and see whether i can do every other thing myself. If i get stuck, i will holla back in this thread.

Thanks once again.
Go to the top of the page
+Quote Post
filipc
no avatar
Member [Level 2]
*****
Group: Members
Posts: 75
Joined: 20-October 04
Member No.: 1,847



Post #5 post Oct 23 2004, 05:03 AM
This codee will help...it work.

CODE
[br]<?php [/br]//You must INCLUDE file config.php , in config.php user and pass[br]@include('config.php');[/br]//Administration Panel[br]session_start(); [br][/br]//Username and pass[/br]$_Username = "$adminusername"; [br]$_Password = "$adminpass"; [br][/br]// If the form was submitted [/br]if ($_POST['Submitted'] == "True") { [br][/br]    // If the username and password match up, then continue... [br]    if ($_POST['Username'] == $_Username && $_POST['Password'] == $_Password) { [br][/br]        // Username and password matched, set them as logged in and set the [/br]        // Username to a session variable. [br]        $_SESSION['Logged_In'] = "True"; [/br]        $_SESSION['Username'] = $_Username; [br]    } [/br]} [br][/br]// If they are NOT logged in then show the form to login... [br]if ($_SESSION['Logged_In'] != "True") { [br][/br]    echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\"> [/br]        Username: <input type=\"textbox\" name=\"Username\"><br /> [br]        Password: <input type=\"textbox\" name=\"Password\"><br /> [/br]        <input type=\"hidden\" name=\"Submitted\" value=\"True\"> [br]  <br>[/br]        <input type=\"Submit\" name=\"Submit\" value=\"Go to admin\"> [br]    </form>"; [/br]} [br]else [/br]{ [br]    echo "You are logged in as: <b>" . $_SESSION['Username'] . "</b> [/br]    <br /><a href=\"" . $_SERVER['PHP_SELF'] . "?mode=logout\">Logout</a><br>"; [br]    echo "----------------------------------------------------------------------------------<br>";[/br]    //here code of page!![br]    echo "<br>";[/br]    echo "<br>";[br]     echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\"> [br][/br][/br]        [br]        <input type=\"hidden\" name=\"Submitted\" value=\"True\"> [br]  <br>[/br]        <input type=\"Submit\" name=\"Submit\" value=\"Save\"> [br]    </form>"; [/br]} [br][/br]// If they want to logout then [/br]if ($_GET['mode'] == "logout") { [br]    // Start the session [/br]    session_start(); [br][/br]    // Put all the session variables into an array [br]    $_SESSION = array(); [br][/br]    // and finally remove all the session variables [/br]    session_destroy(); [br][/br]    // Redirect to show results.. [br]    echo "<META HTTP-EQUIV=\"refresh\" content=\"1; URL=" . $_SERVER['PHP_SELF'] . "\">"; [br]} [/br]?> [/br]
Go to the top of the page
+Quote Post
odomike
no avatar
Core2Q-QX6800
***********
Group: [HOSTED]
Posts: 1,093
Joined: 3-August 04
From: Nigeria
Member No.: 569



Post #6 post Oct 27 2004, 02:29 AM
QUOTE (filipc @ Oct 23 2004, 05:03 AM)
This codee will help...it work.

CODE
[br]<?php [/br]//You must INCLUDE file config.php , in config.php user and pass[br]@include('config.php');[/br]//Administration Panel[br]session_start(); [br][/br]//Username and pass[/br]$_Username = "$adminusername"; [br]$_Password = "$adminpass"; [br][/br]// If the form was submitted [/br]if ($_POST['Submitted'] == "True") { [br][/br]    // If the username and password match up, then continue... [br]    if ($_POST['Username'] == $_Username && $_POST['Password'] == $_Password) { [br][/br]        // Username and password matched, set them as logged in and set the [/br]        // Username to a session variable. [br]        $_SESSION['Logged_In'] = "True"; [/br]        $_SESSION['Username'] = $_Username; [br]    } [/br]} [br][/br]// If they are NOT logged in then show the form to login... [br]if ($_SESSION['Logged_In'] != "True") { [br][/br]    echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\"> [/br]        Username: <input type=\"textbox\" name=\"Username\"><br /> [br]        Password: <input type=\"textbox\" name=\"Password\"><br /> [/br]        <input type=\"hidden\" name=\"Submitted\" value=\"True\"> [br]  <br>[/br]        <input type=\"Submit\" name=\"Submit\" value=\"Go to admin\"> [br]    </form>"; [/br]} [br]else [/br]{ [br]    echo "You are logged in as: <b>" . $_SESSION['Username'] . "</b> [/br]    <br /><a href=\"" . $_SERVER['PHP_SELF'] . "?mode=logout\">Logout</a><br>"; [br]    echo "----------------------------------------------------------------------------------<br>";[/br]    //here code of page!![br]    echo "<br>";[/br]    echo "<br>";[br]     echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\"> [br][/br][/br]        [br]        <input type=\"hidden\" name=\"Submitted\" value=\"True\"> [br]  <br>[/br]        <input type=\"Submit\" name=\"Submit\" value=\"Save\"> [br]    </form>"; [/br]} [br][/br]// If they want to logout then [/br]if ($_GET['mode'] == "logout") { [br]    // Start the session [/br]    session_start(); [br][/br]    // Put all the session variables into an array [br]    $_SESSION = array(); [br][/br]    // and finally remove all the session variables [/br]    session_destroy(); [br][/br]    // Redirect to show results.. [br]    echo "<META HTTP-EQUIV=\"refresh\" content=\"1; URL=" . $_SERVER['PHP_SELF'] . "\">"; [br]} [/br]?> [/br]

Now, i dont reallly know what to do with that code filipc. I dont really know how to make that work. Does anyone have a pre-scripted php log-in form? please help me with it.

I will be most grateful to you.

Thanks in advance.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   6 LuciferStar 11,475 7th November 2004 - 12:40 PM
Last post by: eldeo
No New Posts   6 wild20 1,432 8th June 2006 - 10:04 PM
Last post by: wild20
No New Posts   7 cragllo 5,559 14th December 2004 - 01:51 AM
Last post by: khmerneed
No New Posts   0 thablkpanda 4,947 7th December 2004 - 01:25 AM
Last post by: thablkpanda
No New Posts   2 s243a 3,568 8th December 2004 - 03:24 AM
Last post by: thablkpanda
No New Posts   2 FaLgoR 4,122 4th January 2005 - 06:30 PM
Last post by: FaLgoR
No New Posts   1 kkrizka 1,405 21st September 2007 - 07:21 PM
Last post by: delivi
No New Posts   12 Neutrality 5,793 31st August 2006 - 10:49 AM
Last post by: goldrain
No New Posts   0 RGPHNX 3,878 27th February 2005 - 08:38 PM
Last post by: RGPHNX
No New Posts   0 nancmu 3,509 4th March 2005 - 03:04 PM
Last post by: nancmu
No New Posts   3 Benz1435 6,279 27th June 2005 - 09:35 PM
Last post by: snlildude87
No New Posts   0 OpaQue 2,256 15th March 2005 - 05:51 AM
Last post by: OpaQue
No New Posts 3 JewelzyGrl 979 4th June 2006 - 05:08 AM
Last post by: JewelzyGrl
No New Posts   5 Amezis 2,651 22nd March 2005 - 08:36 AM
Last post by: Amezis
No New Posts   0 kvarnerexpress 2,044 20th March 2005 - 11:16 PM
Last post by: kvarnerexpress


 



RSS Open Discussion Time is now: 22nd November 2009 - 05:07 AM

Web Hosting Powered by ComputingHost.com.