Login problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MissElegant
    New Member
    • May 2008
    • 17

    #1

    Login problem

    Hi everyBody,

    Iam having a problem in the login..Tell me please what is the wrong. Is it in DB or PHP code?

    DB:[code=sql]
    -- Host: localhost
    -- Generation Time: May 10, 2008 at 08:50 PM
    -- Server version: 3.23.52
    -- PHP Version: 4.2.3
    --
    -- Database: `school`
    --
    -- --------------------------------------------------------
    --
    -- Table structure for table `users`
    --
    CREATE TABLE `users` (
    `user` varchar(20) NOT NULL default '',
    `password` varchar(30) NOT NULL default '',
    PRIMARY KEY (`user`)
    ) TYPE=MyISAM;
    --
    -- Dumping data for table `users`
    --
    INSERT INTO `users` VALUES ('sh', '123456');
    INSERT INTO `users` VALUES ('Fatima', '123456');[/code]
    [php]<html>
    <body>
    <?
    $con = mysql_connect(" localhost","", "");
    if (!$con) {
    die('Could not connect ');
    }
    mysql_select_db ("school", $con);
    $sql="SELECT user,password FROM users WHERE user='$_POST[username]' AND password = '$_POST[password]'";
    $result = mysql_query($sq l);
    $row=mysql_fetc h_array($result );
    if($row[0] == "") {
    die('<h1>Wrong username or password..Pleas e insert the correct one..');

    } else{
    session_start() ;
    $_SESSION['username'] = $_POST['username'];
    $_SESSION['passward'] = $row[0];
    header("Locatio n:Teacher buttons.htm");
    }

    mysql_close($co n);
    ?>
    </body>
    </html>[/php]please Can you help me??
    Last edited by ronverdonk; May 10 '08, 10:28 PM. Reason: use code tags!!
  • realin
    Contributor
    • Feb 2007
    • 254

    #2
    hiya MissElegant,

    Welcome to bytes !!

    what is the error this script is showing, and i believe your database has a default username and password which should be supplies while connecting and that should be more likely ::

    [PHP]mysql_connect(" localhost","roo t","")[/PHP]

    Rest if you can paste the error then it would be easier to help you out..
    And please use proper tags (BBCODE) to enclose your code :)

    thanks & Cheers !!

    Comment

    • MissElegant
      New Member
      • May 2008
      • 17

      #3
      Originally posted by realin
      hiya MissElegant,

      Welcome to bytes !!

      what is the error this script is showing, and i believe your database has a default username and password which should be supplies while connecting and that should be more likely ::

      [PHP]mysql_connect(" localhost","roo t","")[/PHP]

      Rest if you can paste the error then it would be easier to help you out..
      And please use proper tags (BBCODE) to enclose your code :)

      thanks & Cheers !!
      Thanks for welcoming :)
      this is the error:

      Warning: Cannot send session cookie - headers already sent by (output started at C:\www\e-school2\login.p hp:3) in C:\www\e-school2\login.p hp on line 25

      Warning: Cannot send session cache limiter - headers already sent (output started at C:\www\e-school2\login.p hp:3) in C:\www\e-school2\login.p hp on line 25

      Warning: open(/tmp\sess_98c641 9df10071ce3f3d7 6284f45e79b, O_RDWR) failed: No such file or directory (2) in C:\www\e-school2\login.p hp on line 25

      Warning: Cannot add header information - headers already sent by (output started at C:\www\e-school2\login.p hp:3) in C:\www\e-school2\login.p hp on line 28

      Warning: open(/tmp\sess_98c641 9df10071ce3f3d7 6284f45e79b, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

      Warning: Failed to write session data (files). Please verify that the current setting of session.save_pa th is correct (/tmp) in Unknown on line 0

      I don't know what is wrong about the code, I think the code is correct!!
      What do you think..

      Thanks

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        WARNING:
        Please enclose your posted code in [code] tags (See How to Ask a Question).

        This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

        Please use [code] tags in future.

        MODERATOR

        Comment

        • realin
          Contributor
          • Feb 2007
          • 254

          #5
          Originally posted by MissElegant
          Thanks for welcoming :)
          this is the error:

          Warning: Cannot send session cookie - headers already sent by (output started at C:\www\e-school2\login.p hp:3) in C:\www\e-school2\login.p hp on line 25

          Warning: Cannot send session cache limiter - headers already sent (output started at C:\www\e-school2\login.p hp:3) in C:\www\e-school2\login.p hp on line 25

          Warning: open(/tmp\sess_98c641 9df10071ce3f3d7 6284f45e79b, O_RDWR) failed: No such file or directory (2) in C:\www\e-school2\login.p hp on line 25

          Warning: Cannot add header information - headers already sent by (output started at C:\www\e-school2\login.p hp:3) in C:\www\e-school2\login.p hp on line 28

          Warning: open(/tmp\sess_98c641 9df10071ce3f3d7 6284f45e79b, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

          Warning: Failed to write session data (files). Please verify that the current setting of session.save_pa th is correct (/tmp) in Unknown on line 0

          I don't know what is wrong about the code, I think the code is correct!!
          What do you think..

          Thanks
          hi can you paste your code here..
          Seems like you have given path to store session, also you can use output buffer to overcome the first error ..

          Read more about ob_start here

          Comment

          • MissElegant
            New Member
            • May 2008
            • 17

            #6
            I am sorry I did not get the point!! Sorry again
            ....

            Comment

            • Markus
              Recognized Expert Expert
              • Jun 2007
              • 6092

              #7
              Originally posted by MissElegant
              I am sorry I did not get the point!! Sorry again
              ....
              Have you rectified your problem then?

              Comment

              • realin
                Contributor
                • Feb 2007
                • 254

                #8
                Originally posted by MissElegant
                I am sorry I did not get the point!! Sorry again
                ....
                i meant, please post your code here ..
                And dont forget to paste it into Php tags..

                Comment

                • MissElegant
                  New Member
                  • May 2008
                  • 17

                  #9
                  I will next time..

                  regarding my login problem..,,, mmmm, I did not solve it yet, but iam trying

                  Comment

                  • TheServant
                    Recognized Expert Top Contributor
                    • Feb 2008
                    • 1168

                    #10
                    Originally posted by MissElegant
                    I will next time..

                    regarding my login problem..,,, mmmm, I did not solve it yet, but iam trying
                    Well when you have tried what you can, and have a question, we need to see your code (in tags) and I'm sure we can help.

                    Comment

                    • MissElegant
                      New Member
                      • May 2008
                      • 17

                      #11
                      you know guys, I solved the login problem ... FINALY..
                      but iam having another problem..:(

                      the login page is located in a frame, and when I login to the target page, this page doesn't appear in the same frame in frontpage.. I think the problem with secifing that in PHP code.. right?? i don't new

                      Comment

                      • hsriat
                        Recognized Expert Top Contributor
                        • Jan 2008
                        • 1653

                        #12
                        Originally posted by MissElegant
                        you know guys, I solved the login problem ... FINALY..
                        but iam having another problem..:(

                        the login page is located in a frame, and when I login to the target page, this page doesn't appear in the same frame in frontpage.. I think the problem with secifing that in PHP code.. right?? i don't new
                        Use target attribute for that.

                        Comment

                        • TheServant
                          Recognized Expert Top Contributor
                          • Feb 2008
                          • 1168

                          #13
                          Originally posted by MissElegant
                          you know guys, I solved the login problem ... FINALY..
                          but iam having another problem..:(

                          the login page is located in a frame, and when I login to the target page, this page doesn't appear in the same frame in frontpage.. I think the problem with secifing that in PHP code.. right?? i don't new
                          Can you post your solution so others can learn from this post. Cheers.

                          Comment

                          • MissElegant
                            New Member
                            • May 2008
                            • 17

                            #14
                            This is the index page:
                            -------------------------------------------

                            [HTML]

                            <html dir="rtl">

                            <head>
                            <meta http-equiv="Content-Language" content="en-us">
                            <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

                            <title>New Page 2</title>
                            </head>

                            <frameset framespacing="0 " border="0" frameborder="0" rows="220,*">
                            <frame name="banner" scrolling="no" noresize target="content s" src="up.htm">
                            <frameset cols="777,*">

                            <frame name="contents" target="main" src="WelcomingP age.htm" scrolling="auto " noresize>
                            <frame name="main" scrolling="auto " src="new_page_1 .htm" target="_self" noresize>
                            </frameset>
                            <noframes>
                            <body>
                            </body>
                            </noframes>
                            </frameset>

                            </html>

                            [/HTML]

                            ----------------------------------

                            This is the login page that will occurs in the contant frame after pressing on a button (that is in the index page)

                            -------------
                            [HTML]

                            <html dir="rtl">

                            <head>
                            <meta http-equiv="Content-Language" content="en-us">
                            <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

                            <title>New Page 2</title>
                            </head>

                            <frameset framespacing="0 " border="0" frameborder="0" rows="220,*">
                            <frame name="banner" scrolling="no" noresize target="content s" src="up.htm">
                            <frameset cols="777,*">

                            <frame name="contents" target="main" src="WelcomingP age.htm" scrolling="auto " noresize>
                            <frame name="main" scrolling="auto " src="new_page_1 .htm" target="_self" noresize>
                            </frameset>
                            <noframes>
                            <body>
                            </body>
                            </noframes>
                            </frameset>

                            </html>
                            [/HTML]
                            --------------------------------

                            I want after the login of the user, showing a new page which is the teacher page in the same frame of the login page not in a new page(new window)...I do not know what is the problem...

                            This is the teacher page:
                            ----------------------------

                            [HTML]

                            <html dir="rtl">

                            <head>
                            <meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
                            <title>New Page 3</title>

                            <base target="_self">
                            </head>

                            <body>

                            <form method="POST" action="logoutF .php" onSubmit="locat ion.href='_deri ved/nortbots.htm';r eturn false;" webbot-onSubmit>

                            <div align="center">
                            <div align="right">
                            <table border="0" width="587" height="1" dir="rtl" id="table1">
                            <tr>
                            <td height="161" width="581">
                            <a target="content s" href="logoutF.p hp">
                            <img border="0" src="images/logout.jpg" width="38" height="60" action= "logoutF.ph p" align="left"></a><p>&nbsp;</p>
                            <p>&nbsp;</p>
                            <p>&nbsp;</p>
                            <p><b><span lang="ar-ae"><font size="6" color="#FF0000" >اختاري
                            معلمتي أحد الخيارات الآتية:</font></span></b></p>
                            <table border="1" width="100%" id="table2">
                            <tr>
                            <td>
                            <p align="center">
                            <a href="(Teacher) _Announcement_f orm.html">
                            <img border="0" src="announceme nt.jpg" width="159" height="116"></a></td>
                            <td>
                            <p align="center">
                            <img border="0" src="grade%20co py.jpg" width="159" height="116"></td>
                            </tr>
                            </table>
                            </td>
                            </tr>
                            </table></div>
                            <p align="center"> &nbsp;</div>
                            </form>

                            <p>&nbsp;</p>
                            <p></p>

                            </body>

                            </html>
                            [/HTML]

                            Thanx .. hope you help me

                            Comment

                            Working...