boy |
Subject: "re: headers
already sent!!
Problem"
Posted: @ 9:26 pm on May 05 2008
|
|
|
Member #: Rank: - () Since: 01/01/70 Posts:
|
If I just make
a main.php page
like,
<body>
<p>This
is the main
page</p><
br />
</body>
And, set the
headers to the
main.php page
like,
header("L
ocation:
http://localhos
t/main.php&quo
t ; in
line 6
header("L
ocation:
http://localhos
t/main.php&quo
t ; in
line 34
---------------
--
but still have
the same
warning.
|
Viewed: 3,748 Times | |  |
David1159 |
Subject: "re: headers
already sent!!
Problem"
Posted: @ 1:19 am on May 06 2008
|
|
|
 Member #: 526 Rank: user - (81) Since: 12/27/07 Posts: 81 From: usa
|
hey boy, I just
copied the
exact code you
gave me on my
system, just
changed the
db_connection
to mine, it
worked fine.
Your redirect
will not work
if any HTML
code is before
the
"header(l
ocation...&quo
t;
if you have
any, remove any
echo's and
place all html
code under the
php code.
try it than.
it works for
me, exactly
what you have.
Coding is
simply CST...
Combining $hit
Together. We
make different
$hit to run in
unison
correctly. |
Viewed: 3,737 Times | |  |
boy |
Subject: "registration
problem"
Posted: @ 1:03 am on May 08 2008
|
|
|
Member #: Rank: - () Since: 01/01/70 Posts:
|
I've got this
error and can
not insert to
the table when
I register a
new user.
Warning:
mysql_fetch_obj
ect(): supplied
argument is not
a valid MySQL
result resource
in
C:\...\regist
ration.php on
line 41
Table
'test.members
' doesn't
exist
Can anyone tell
me where should
I look at for
this problem
ASAP??
registration.ph
p as
follows;
<head>
<style
type="tex
t/css">
;
.style1 {
text-align:
right;
}
</style><
br />
</head>
<?
require_once($_
SERVER['DOCUME
NT_ROOT'].'/d
b_connect.php'
);
//SEE IF
ALREADY LOGGED
IN
if($_SESSION[
'logged_in']
== 1)
{
//REDIRECT
TO HOMEPAGE
header('Locati
on: http://' .
$_SERVER['HTTP
_HOST'] .
'');
} else {
if(isset($HTTP
_POST_VARS['su
bmit']))
{
//BEGIN
CHECKING
USERNAME...
if(!$_POST['us
ername'])
die('Alert:
username field
was
blank.');
//array of
invalid
characters
$junk =
array('.' ,
',' , '/' ,
'`' , ';' ,
'[' , ']'
, '-',
'*',
'&',
'^', '%',
'$', '#',
'@', '!',
'~', '+',
'(', ')',
'|',
'{', '}',
'<',
'>',
'?', ':',
'"',
'=');
//starting
lenght of
username
$len =
strlen($_POST[
'username']);<
br />
//replace
invalid
characters
$_POST['userna
me'] =
str_replace($ju
nk, '',
$_POST['userna
me']);
$test =
$_POST['userna
me'];
//if lenghts
are different
($len smaller),
invalid
characters
found, so
prompt
error.
if(strlen($test
) != $len) {
die('Username
Error: Username
contained
invalid
characters. You
can only use
A-Z, 0-9 and
the
underscore
(_).');
}
//Check if
username
already
exists...
$q2 =
mysql_query(&q
uot;SELECT *
FROM `members`
WHERE
`username` =
'".$_POS
T['username']
."'&quo
t ;
$q3 =
mysql_fetch_obj
ect($q2);
if($q3->user
name ==
$_POST['userna
me']) {
die('<BR&g
t;<BR>Sor
ry, but the
username
"'.$q3-&
gt;username.'
" is
taken, please
choose
another.');
}
//PASSWORD
if(!$_POST['pa
ssword']) {
die('Error:
Password field
was
blank');
}
if(!$_POST['ve
rify_password'
]) {
die('Error:
Verify Password
field was
blank.');
}
if($_POST['pas
sword'] !=
$_POST['verify
_password']) {
die('Error:
The passwords
do not
match.');
}
if(strlen($_POS
T['password']
) < 6 ) {
die('Error:
Your password
is too short.
Must be 6 or
more characters
in
length.');
}
//ADD NEW
MEMBER
$insert
="INSERT
INTO ` members
` (username,
user_password,
user_email)
VALUES
('".$_PO
ST['username'
]."',
'".md5($
_POST['passwor
d'])."'
,
'".$_POS
T['email'].&
quot;')"
;
$insert2 =
mysql_query($in
sert);
if(!$insert2)
die(mysql_error
());
echo('Registra
tion
Successful,
Welcome new
member! You can
now login to
your new
account.');
} else {
?>
<table>
<form
name="sig
nup"
action="&
lt;?
$_SERVER['PHP_
SELF'];
?>"
method="P
OST"><
br />
<tbody
class="st
yle1">
<tr>
<td>Usern
ame: <BR>
(only A-Z, 0-9
and _
Allowed)<BR&
gt;</td><
br />
<td><i
nput
type="tex
t" id
="usernam
e"
name="use
rname"
value="&
quot;
maxlength=&quo
t;30">
<BR></
td>
</tr>
<tr>
<td>Passw
ord:</td>
<td><i
nput
type="pas
sword"
id="passw
ord"
name="pas
sword"
value="&
quot;
maxlength=&quo
t;30">
<BR>
(minimum 6
characters)<
/td>
</tr>
<tr>
<td>Verif
y
Pass:</td>
;
<td><i
nput
type="pas
sword"
id="verif
y_password&quo
t;
name="ver
ify_password&q
uot;
value="&
quot;
maxlength=&quo
t;30">
<BR>
</td>
</tr>
<tr>
<td>Email
:</td>
<td><i
nput
type="tex
t"
id="email
"
name="ema
il"
value="&
quot;
size="30
"><b
r></td>
;
</tr>
<tr>
<td>Click
to Complete
Signup:</td&
gt;
<td><i
nput
type="sub
mit"
id="submi
t"
name="sub
mit"
value="su
bmit">
</td>
</tr>
</form><
br />
</table>
<?
} //end not
logged in
} //end submit
not pressed
?>
|
Viewed: 3,727 Times | |  |
Genius |
Subject: "re: headers
already sent!!
Problem"
Posted: @ 8:21 pm on May 08 2008
|
|
|
 Member #: 582 Rank: user - (77) Since: 02/18/08 Posts: 76 From: kmmk
|
boy
said... <
i>Warning:
mysql_fetch_obj
ect(): supplied
argument is not
a valid MySQL
result resource
in
C:\...\regist
ration.php on
line 41
Table
'test.members
' doesn't
exist
Are you
connecting to
the right
database? Mysql
cannot
connect/find
table
"test&qu
ot;. Use this
to create
table:
Code:
-- Table
structure for
table
`members`--
CREATE TABLE
`members` (
`user_id`
mediumint(8)
NOT NULL
auto_increment,
`username`
varchar(25) NOT
NULL default
'',
`user_password`
varchar(32) NOT
NULL default
'',
`user_email`
varchar(255)
NOT NULL
default '',
PRIMARY KEY
(`user_id`)
) TYPE=MyISAM
AUTO_INCREMENT=
60 ;
Edited at 08:35:35 pm on 05/08/08
|
Viewed: 3,704 Times | |  |
roym |
Subject: "re: headers
already sent!!
Problem"
Posted: @ 9:14 am on Sep 14 2008
|
|
|
 Member #: 752 Rank: user - (9) Since: 09/12/08 Posts: 9
|
i have this
error in my
logout. would i
add ob start to
the logout as
well?
<?
$_SESSION['log
ged_in'] =
0;
setcookie('log
in_cookie',
"",
time() - 60,
'/',
'http://con-ma
g.com');
session_destroy
();
header("L
ocation:
http://www.con-
mag.com"
?>
|
Viewed: 3,407 Times | |  |
roym |
Subject: "re: headers
already sent!!
Problem"
Posted: @ 9:16 am on Sep 14 2008
|
|
|
 Member #: 752 Rank: user - (9) Since: 09/12/08 Posts: 9
|
i like how it
added the wink
at the end.
here is my
error. with the
correct path to
my file.
Warning:
session_destroy
()
[function.sessi
on-destroy]:
Trying to
destroy
uninitialized
session in
/home/logout.ph
p on line 6
Warning: Cannot
modify header
information -
headers already
sent by (output
started at
/home/logout.ph
p:6) in
/home/logout.ph
p on line 7
|
Viewed: 3,406 Times | |  |
roym |
Subject: "re: headers
already sent!!
Problem"
Posted: @ 9:31 am on Sep 14 2008
|
|
|
 Member #: 752 Rank: user - (9) Since: 09/12/08 Posts: 9
|
roym
said...
<
i>
i like how it
added the wink
at the end.
here is my
error. with the
correct path to
my file.
Warning:
session_destroy
()
[function.sessi
on-destroy]:
Trying to
destroy
uninitialized
session in
/home/logout.ph
p on line 6
Warning: Cannot
modify header
information -
headers already
sent by (output
started at
/home/logout.ph
p:6) in
/home/logout.ph
p on line 7
---------------
---------------
---------------
----
corrected it. i
didnt close the
php correctly
kinda like
this. yaddada
mean...
<?
ob start
<? logout
?>
|
Viewed: 3,403 Times | |  |
bs0d |
Subject: "re: headers
already sent!!
Problem"
Posted: @ 4:25 pm on Sep 14 2008
|
|
|
 Member #: 1 Rank: Admin. - (1,510) Since: 02/06/05 Posts: 604 From: USA
|
roym
said...
<
i>
i like how it
added the wink
at the end.
here is my
error. with the
correct path to
my file.
Thats why we
have a
"Disable
Smilies -
Recommended if
posting
code"
button when you
reply.
Glad you fixed
it-
|
Viewed: 3,397 Times | |  |
roym |
Subject: "re: headers
already sent!!
Problem"
Posted: @ 10:02 pm on Sep 14 2008
|
|
|
 Member #: 752 Rank: user - (9) Since: 09/12/08 Posts: 9
|
ok i have
everything
runnign perfect
now. i just
have a question
about login in
iframe. i want
me redirect to
open in the
main page
//REDIRECT TO
USERS
PROFILE...
header("h
ttp://con-mag.c
om/connectmagaz
ine.co.cc/news.
php target=
_blank");
} //end if
logged in
i tried several
ways but none
seemed to work
|
Viewed: 3,392 Times | |  |
bs0d |
Subject: "re: headers
already sent!!
Problem"
Posted: @ 12:50 am on Sep 15 2008
|
|
|
 Member #: 1 Rank: Admin. - (1,510) Since: 02/06/05 Posts: 604 From: USA
|
So the
re-direct
doesn't work
at all, or not
in the right
frame?
On the code you
pasted, try
separating the
quotes like
this:
header("h
ttp://con-mag.c
om/connectmagaz
ine.co.cc/news.
php"
"target=
_blank");
|
Viewed: 3,385 Times | |  |
roym |
Subject: "re: headers
already sent!!
Problem"
Posted: @ 5:12 am on Sep 15 2008
|
|
|
 Member #: 752 Rank: user - (9) Since: 09/12/08 Posts: 9
|
the redirect is
working
correctly just
not the correct
frame.
yeah i've
tried coding it
like that and i
get this error
on that line.
T_CONSTANT_ENCA
PSED_STRING
Edited at 05:13:55 am on 09/15/08
|
Viewed: 3,381 Times | |  |
misterhaan |
Subject: "re: headers
already sent!!
Problem"
Posted: @ 3:07 pm on Sep 15 2008
|
|
|
 Member #: 5 Rank: Contributor - (214) Since: 02/11/05 Posts: 149 From: chair
|
two things
wrong with that
header()
call:
1. it doesn
please note
that the above
post is likely
made up in its
entirety. |
Viewed: 3,375 Times | |  |
Viewing Page: 2 of 2 |