[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.8

php login script using database fileds to login

Asked by pjcrooks2000 in PHP Scripting Language


Hi all I am using a php script to allow me to login to an admin area and the password is stored in a mysql database

can anyone please assist me with this as I am receiving an error::

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/user/public_html/adminonly/index.php on line 49 THIS LINE:-

AND Password = PASSWORD('".$pass"')");

Here is the full script including html ... please not this is using a session and that is declared at the start of the page.  I wanto actually arrive at a form if the user is not logged in and then be bale to input the username and password to able me to login.

Many thanks for the help....

BY the way this page is being posted back to itself "index.php"

********THE HTML AND SCRIPT*************************************************


<? session_start(); ?>
<html>
<head>
<title>Administration only</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>
<body>
<? require ("/home/user/public_html/hiddenscripts/myVariables.php");
        
      $pagelinks = "<A HREF = 'modrides.php'>Modify the rides</a><br><br>";
      $pagelinks .= "<A HREF = 'newride.php'>Add a new ride</a><br><br>";
      $pagelinks .= "<A HREF = 'logout.php'>Log out</a><br><br>";
            
      if($username && $pass){
      if ($username == $admin){
            echo $username.", you are already logged in.<br>";
            echo $pagelinks;
            exit;
            }
//Connect and select database
     $connect or die ("Could not connect to the database, please check your script variables!");
     $use_db or die ("Unable to connect to the database");
      
//Fetch all items from login table and look for a positive match for uservame and password and store in result       
       $result = mysql_query("SELECT * FROM login where loginname = '".$username"'
                         AND Password = PASSWORD('".$pass"')");
                        
//If result does not match the display message and exit script                        
                        if(!$result){
                        echo "<h2>WHOOPS It looks as though your username or password is wrong</h2><br>";
                        exit;
                        }
//If result returns more than 1 row set test $admin to same as $username, in other words a positive match means
//that the password is correct and i can set my test condition above to allow entry to admin area
                        if(mysql_num_rows($result) > 0){
                        $admin = $username;
                        session_register("admin"); //Register the session variable to post back to this script
                                                            //Session already started at top of page
                        echo "<h3>Welcome $username it is nice to see you again<br><br>";
                        echo $links;
                        exit;
                        }
// on invalid login, show user HTML form to login again
             else {
                  echo "Invalid login. Please try again.<BR><BR>";
                        }
                        }
                        
                  ?>

  <form name="letmein" method="post" action="index.php">  
  <table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr> <td colspan="5"><h5><font face="Arial, Helvetica, sans-serif">Username:</font></h5></td>
      <td colspan="2"><input name="username" type="text" id="username"></td>
    </tr>
<tr><td colspan="5"></td><td height="5" colspan="2"></td></tr>
<tr> <br><td colspan="5"><h5><font face="Arial, Helvetica, sans-serif">Password</font></h5></td>
      <td width="164"><input name="pass" type="password" id="password"></td>
      <td width="491"><input type="submit" name="Submit" value="Login"></td>
    </tr>
  </table>
</form>
  </body>
</html>


 
Related Solutions
 
Loading Advertisement...
 
[+][-]11/23/04 07:39 PM, ID: 12661686Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/23/04 07:40 PM, ID: 12661690Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: PHP Scripting Language
Sign Up Now!
Solution Provided By: Diablo84
Participating Experts: 1
Solution Grade: A
 
[+][-]11/23/04 07:46 PM, ID: 12661723Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/23/04 07:50 PM, ID: 12661810Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/23/04 07:56 PM, ID: 12661859Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/23/04 08:05 PM, ID: 12661894Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/23/04 08:08 PM, ID: 12661903Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/24/04 08:25 AM, ID: 12667073Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/24/04 08:51 AM, ID: 12667402Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/24/04 09:31 AM, ID: 12667825Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/24/04 09:44 AM, ID: 12667933Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/24/04 09:57 AM, ID: 12668072Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/24/04 10:11 AM, ID: 12668210Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/24/04 11:03 AM, ID: 12668759Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/24/04 11:19 AM, ID: 12668897Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/24/04 12:29 PM, ID: 12669510Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89