Something still not quit right...
cookie error
undefined username
cant modify header..
( java part is not importent its just that on this machine i only debug and test the pages.. , server does have it. )
Notice: Undefined index: username in d:\apache\htdocs\upload.php on line 2
Warning: Cannot modify header information - headers already sent by (output started at d:\apache\htdocs\upload.php:2) in d:\apache\htdocs\upload.php on line 2
Warning: Cannot modify header information - headers already sent by (output started at d:\apache\htdocs\upload.php:2) in d:\apache\htdocs\upload.php on line 16
please advise

, my code ( parts of it)
login.php
Code: Select all
<form valign=middle align=center name="Sample" method="post" action="debug.php">
<table width="40%" border="0" cellpadding="0" cellspacing="0" bordercolor="#000000">
<tr>
<td colspan="2" background="../images/cellpic1.gif" valign="middle">
<div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="3"><b>USR - PWD</b></font></div>
</td>
</tr>
<tr> <!-- bg=6*c -->
<td width="32%" bgcolor="#ffffff" valign="middle"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Username</font></b></td>
<td width="68%" valign="middle"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">
<input type="text" name="username" size="15" maxlength="15">
</font></b></td>
</tr>
<tr> <!-- bg=6*c -->
</tr> <!-- bg =6*c -->
<tr valign="middle" bgcolor="#ffffff">
<td colspan="2">
<div align="center">
<input type="image" src="images/login.gif" value="Login">
<input type="image" src="images/clear.gif" value="Clear">
</div>
</td>
</tr>
</table>
</form>
debug.php ( upload.php on the server )
Code: Select all
<?
setcookie ("username", $_POST['username']);
if ($HTTP_COOKIE_VARS['username'] == 'c1')
{
setcookie ("mail", "c1@some.com",time()+1200);
}
if ($HTTP_COOKIE_VARS['username'] == 'c2')
{
setcookie ("mail", "c2@some.com",time()+1200);
}
if ($HTTP_COOKIE_VARS['username'] == 'c3')
{
setcookie ("mail", "c3@some.com",time()+1200);
}
if ($HTTP_COOKIE_VARS['username'] == 'c4')
{
setcookie ("mail", "c4@some.com",time()+1200);
}
if ($HTTP_COOKIE_VARS['username'] == 'c5')
{
setcookie ("mail", "c5@some.com",time()+1200);
}
?>
<html>
<head>
<SCRIPT language="JavaScript1.2">
function poponload()
{
popwindow= window.open ("readme.html", "popup",
"location=1,status=1,scrollbars=auto,width=400,height=400");
popwindow.moveTo(100,150);
}
function process()
{
popwindow= window.open ("mailit.php", "popwindow",
"location=1,status=1,scrollbars=auto,width=600,height=500");
popwindow.moveTo(100,150);
}
</SCRIPT>
// lots of other things which work and dont have anything to do with the cookie
<script language=javascript>
file = "<?php echo $uploaded; ?>";
alert("Validar Archivo: " +file);
</script>
<?
$txt = new Java('txtFile', "{$absolute_path}/{$uploaded}");
$answer = $txt->validar(True);
?>
<script language=javascript>
respuesta = "<?php echo $answer; ?>";
alert("Respuesta: " +respuesta);
</script>
<?
if (isset($_COOKIE['mail'])){
?>
<body onload="javascript: process()">
<?
}
break;
}
?>