0810
08-23-2002, 02:51 AM
I try to run this script but it is not working
my php editor says"You don't have permission to access /<br /><b>Notice</b>: Undefined variable: PHP_SELF in <b>c:/itohideo/copy.php</b> on line <b>5</b><br /> on this server."
Why it comes this message!
my php is 4.2 latest varsion
Here is code
<?php
if ( !isset($submitteduser) ):
?>
<form action="<?=$PHP_SELF?>" method="get">
<table width="40%" border="0">
<tr>
<td width="25%">Username:</td>
<td width="75%"><input name="submitteduser" type="text" size="30" maxlength="30"></td>
</tr>
<tr>
<td>Password:</td>
<td><input name="submittedpassword" type="password" size="30" maxlength="30"></td>
</tr>
</table>
<input name="submit" type="submit" value="Logon">
</form>
<br>
<?php
$choice = 0;
else:
// Connect to the database server
$dbcnx = @mysql_connect("localhost", "itohideo", "1234");
if (!$dbcnx)
{
echo( "<p>Unable to connect to the database server at this time.</p>" );
exit();
}
// Select the database
if (! @mysql_select_db("itohideo") )
{
echo( "<p>Unable to locate the database at this time.</p>" );
exit();
}
//Select the account table
$result = @mysql_query("SELECT * FROM kk");
if (!$result)
{
echo("<p>Error performing query: " . mysql_error() . "</p>");
exit();
}
$allcorrect = 0;
$usercorrect = 0;
while ( $row = mysql_fetch_array($result))
{
$dbuser = $row["itohideo"];
$dbpass = $row["1234"];
if ( $dbuser == $submitteduser )
{
$usercorrect = 1;
if ( $dbpass == $submittedpassword )
{
$finaluser = $row["itohideo"];
$allcorrect = 1;
}
}
}
if ( $allcorrect == 1 ):?>
Whats up <?=$finaluser?> , What would you like to do today?..<br>
<table width="50%" border="0">
<tr>
<td>
<ol>
<li>
<a href="addnews.php?username=<?=$user?>&password=<?=$pass?>">
Add News Post</a>
</li>
<li>
<a href="deletenews.php?username=<?=$user?>&password=<?=$pass?>">
Delete A News Post</a>
</li>
<li>
<a href="addshow.php?username=<?=$user?>&password=<?=$pass?>">
Add Show</a>
</li>
<li>
<a href="deleteshow.php?username=<?=$user?>&password=<?=$pass?>">
Delete Show</a>
</li>
<li>
<a href="editnewsflash.php?username=<?=$user?>&password=<?=$pass?>">
Edit The News Flash</a>
</li>
</ol>
</td>
</tr>
</table>
<?php
else:
if ( $usercorrect = 1 )
echo("Invalid Password");
else
echo("Invalid user");
endif;
endif;
?>
my php editor says"You don't have permission to access /<br /><b>Notice</b>: Undefined variable: PHP_SELF in <b>c:/itohideo/copy.php</b> on line <b>5</b><br /> on this server."
Why it comes this message!
my php is 4.2 latest varsion
Here is code
<?php
if ( !isset($submitteduser) ):
?>
<form action="<?=$PHP_SELF?>" method="get">
<table width="40%" border="0">
<tr>
<td width="25%">Username:</td>
<td width="75%"><input name="submitteduser" type="text" size="30" maxlength="30"></td>
</tr>
<tr>
<td>Password:</td>
<td><input name="submittedpassword" type="password" size="30" maxlength="30"></td>
</tr>
</table>
<input name="submit" type="submit" value="Logon">
</form>
<br>
<?php
$choice = 0;
else:
// Connect to the database server
$dbcnx = @mysql_connect("localhost", "itohideo", "1234");
if (!$dbcnx)
{
echo( "<p>Unable to connect to the database server at this time.</p>" );
exit();
}
// Select the database
if (! @mysql_select_db("itohideo") )
{
echo( "<p>Unable to locate the database at this time.</p>" );
exit();
}
//Select the account table
$result = @mysql_query("SELECT * FROM kk");
if (!$result)
{
echo("<p>Error performing query: " . mysql_error() . "</p>");
exit();
}
$allcorrect = 0;
$usercorrect = 0;
while ( $row = mysql_fetch_array($result))
{
$dbuser = $row["itohideo"];
$dbpass = $row["1234"];
if ( $dbuser == $submitteduser )
{
$usercorrect = 1;
if ( $dbpass == $submittedpassword )
{
$finaluser = $row["itohideo"];
$allcorrect = 1;
}
}
}
if ( $allcorrect == 1 ):?>
Whats up <?=$finaluser?> , What would you like to do today?..<br>
<table width="50%" border="0">
<tr>
<td>
<ol>
<li>
<a href="addnews.php?username=<?=$user?>&password=<?=$pass?>">
Add News Post</a>
</li>
<li>
<a href="deletenews.php?username=<?=$user?>&password=<?=$pass?>">
Delete A News Post</a>
</li>
<li>
<a href="addshow.php?username=<?=$user?>&password=<?=$pass?>">
Add Show</a>
</li>
<li>
<a href="deleteshow.php?username=<?=$user?>&password=<?=$pass?>">
Delete Show</a>
</li>
<li>
<a href="editnewsflash.php?username=<?=$user?>&password=<?=$pass?>">
Edit The News Flash</a>
</li>
</ol>
</td>
</tr>
</table>
<?php
else:
if ( $usercorrect = 1 )
echo("Invalid Password");
else
echo("Invalid user");
endif;
endif;
?>