[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

problem with a php_self login page....

Asked by aej1973 in PHP and Databases

Tags: PHP, 5

I have a php login page which does not seem to work. The index.php page redirects me to the admin_login.php form. This form uses $php_self variable. When the login fails the the php_self need to redirect me to 'login error' portion of the form but for some reason nothing seems to happen and I am still at the login page. If the user_ name and pw are accepted I need to be redirected to the index.php page but this does not happen too. Can someone take a look at this code and tell me what the problem could be? Thanks for the help.

A
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
**************LOGIN PAGE/index.php ********************
<?php include "admin_login.php"; ?>
 
<?
function is_numericc($n) {
    if (ereg("^[0-9]+", $n)) {
      return(1);
    } else {
      return(0);
    }
  }
?> 
 <?php include "header.php"; ?>
<table border="0" width="100%">
  <tr>
    <td width="100%">
      <hr color="#000080">
    </td>
  </tr>
  <tr>
    <td width="100%"><font color="#000080" size="3"><b>Login Successful!</b></font></td>
  </tr>
  <tr>
    <td width="100%">
      <hr color="#000080">
    </td>
  </tr>
</table>
 
***********admin_login.php******************
 
<?php 
 
if ($error_code == 1) {
        setcookie("userid");
        setcookie("userpassword");
		unset($useridin);
		unset($userpasswordin);
  }
  if (!isset($useridin)) {
     if ($error_code == 0) {
        if (isset($userid)) {
          $useridin = $userid;
		  $userpasswordin = $userpassword; 
		   //$useridin = arunj;
		   //$userpasswordin = almega;           
 
        } 
     }
  } else {
     if($error_code == 0) {
        setcookie("userid", $useridin, time()+7200);
        setcookie("userpassword", $userpasswordin, time()+7200); 
     } 	
  }
  
 
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-us">
<title></title>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>
 
<body>
<p>
<?php include "details.php";
if (!isset($useridin)) {
   if (isset($userid) AND !isset($action)) {
	  $useridin = $userid;
	  $userpasswordin = $userpassword;
	}
?>
 
<p align="center"><font color="#000000" size="4">Please Login<br>
</font>
<hr color="#000080">
<form method="post" action="<?php echo $PHP_SELF;?>">
 <DIV ALIGN="CENTER"><CENTER>
   <TABLE BORDER="1" WIDTH="200" CELLPADDING="2">
      <TR>
         <TH WIDTH="18%" ALIGN="RIGHT" NOWRAP><font color="#000000">ID</font></TH>
         <TD WIDTH="82%" NOWRAP>
            <INPUT TYPE="TEXT" NAME="useridin" SIZE="8">
         </TD>
      </TR>
      <TR>
 
         <TH WIDTH="18%" ALIGN="RIGHT" NOWRAP><font color="#000000">Password</font></TH>
         <TD WIDTH="82%" NOWRAP>
         <INPUT TYPE="PASSWORD" NAME="userpasswordin" SIZE="8">
         </TD>
      </TR>
      <TR>
         <TD WIDTH="100%" COLSPAN="2" ALIGN="CENTER" NOWRAP>
            <INPUT TYPE="SUBMIT" VALUE="LOGIN" NAME="Submit" style="font-family: Times New Roman; font-size: 12pt; color: #000080">
			<input type="hidden" name="error_code" value="<? echo $error_code; ?>">
         </TD>
      </TR>
   </TABLE>
   </CENTER></DIV>
</FORM>
 
<p align="left">
<?
  exit;
}
 
else {
 
   // Connect to the database server  
   $dbcnx = @mysql_connect("localhost", $username, $pwd);
   if (!$dbcnx) {
      echo( "<P align=center><b><font color=#FF0000>Error !<BR><BR>Please check your userid and password.</font></b></P>" );
      exit();
   }  
 
   // Select the database 
   if (!@mysql_select_db($dbname) ) {
      echo( "<P align=center><b><font color=#FF0000>Unable to locate your " .
       "database at this time.</font></b> </P>" );
      exit();
   }
 $userpasswordin = crypt($userpasswordin, '.v');
   $query = "SELECT userid FROM users  WHERE userid = '$useridin'  AND userpassword = '$userpasswordin'";
   $result = mysql_query($query);
   if(!mysql_num_rows($result)) {
  		unset($useridin);
		unset($userpasswordin);
		$error_code = 1;
?>
 
<form method="post" action="<?php echo $PHP_SELF;?>">
   <DIV ALIGN="CENTER"><CENTER>
   <TABLE BORDER="1" WIDTH="200" CELLPADDING="2">
    <TR>	
 
         <TD WIDTH="100%" ALIGN="CENTER" NOWRAP>
                  <p align="center">
      <b><font color="#000000">Unsuccessful Login !</font><br>
         <font color="#FF0000">Invalid username or password</font><br>
         <font color="#000000">Try again.</font><BR>
      </b>
         </TD>
      </TR>
	  <TR>
	           <TD WIDTH="100%" ALIGN="CENTER" NOWRAP>
            <INPUT TYPE="SUBMIT" VALUE="Try Again" NAME="Submit" style="font-family: Times New Roman; font-size: 12pt; color: #000080">
			<input type = "hidden" name="error_code" value="<? echo $error_code?>">
         </TD>
      </TR>
   </TABLE>
   </CENTER></DIV>
</FORM>  
 
<p align="left">
 
<?
      exit;
   } else {
   $userid = $useridin;
   $userpassword = $userpasswordin;
   $msg = "To perform maintenance, select a property type from menu at left";
   $error_code = 0;
   // Request the company environment variables
    $result = mysql_query("SELECT * FROM cart_env");
    $num    = mysql_numrows($result);
    if ($num == 0) {
         // Display no company variables message
         echo("<P align=center><B><font color=#FF0000>There are currently no Company Variables defined.</font></b></P>");
    }
    // Store variables for later use
    $row = mysql_fetch_array($result);
    $ce_logo_url  = $row["ce_logo_url"];
    $ce_recipient = $row["ce_recipient"];
    $ce_shipping = $row["ce_shipping"];	
   }
}       
 
?>
 
************details.php********
 
<?php
$username = "admin";
 $pwd      = "manager";
  $dbname   = "my_db";
 $sitename = "";
 $sitename = "http://$path_str";
 $companyname = "My_company.";
 $default_dir = "../images";
 $pic_dir = "../images/";
?>
[+][-]08/04/08 03:44 AM, ID: 22151338Expert 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.

 
[+][-]08/04/08 05:27 AM, ID: 22151807Author 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.

 
[+][-]08/04/08 12:14 PM, ID: 22155159Expert 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.

 
[+][-]08/04/08 12:24 PM, ID: 22155233Author 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.

 
[+][-]08/05/08 12:32 AM, ID: 22158815Expert 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.

 
[+][-]08/05/08 01:16 AM, ID: 22159000Expert 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.

 
[+][-]08/05/08 06:05 AM, ID: 22160464Author 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.

 
[+][-]08/05/08 07:51 AM, ID: 22161472Expert 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.

 
[+][-]08/05/08 08:20 AM, ID: 22161807Author 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.

 
[+][-]08/05/08 08:37 AM, ID: 22161985Expert 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.

 
[+][-]08/05/08 08:40 AM, ID: 22162029Expert 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.

 
[+][-]08/05/08 08:43 AM, ID: 22162063Author 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.

 
[+][-]08/05/08 08:50 AM, ID: 22162155Author 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.

 
[+][-]08/05/08 08:53 AM, ID: 22162181Expert 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.

 
[+][-]08/05/08 08:56 AM, ID: 22162212Expert 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.

 
[+][-]08/05/08 09:00 AM, ID: 22162266Author 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.

 
[+][-]08/05/08 09:17 AM, ID: 22162444Author 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.

 
[+][-]08/05/08 09:20 AM, ID: 22162473Expert 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.

 
[+][-]08/05/08 09:23 AM, ID: 22162505Author 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.

 
[+][-]08/06/08 01:13 AM, ID: 22168037Expert 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.

 
[+][-]08/06/08 01:21 AM, ID: 22168079Accepted 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 and Databases
Tags: PHP, 5
Sign Up Now!
Solution Provided By: fosiul01
Participating Experts: 1
Solution Grade: A
 
[+][-]08/06/08 01:23 AM, ID: 22168087Expert 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.

 
[+][-]08/06/08 05:20 AM, ID: 22169259Author 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...
20091021-EE-VQP-81 / EE_QW_2_20070628