header already sent probleem
Warning: Cannot modify header information - headers already sent by (output started at /home/****/domains/****.com/public_html/includes/style_top.php:3) in /home/****/domains/****.com/public_html/search.php on line 115
of
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/****/domains/****.com/public_html/includes/bbcode_parser.php:1) in /home/****/domains/****.com/public_html/s-t_a-f_f-_-o-n_l-y/staff_brain_file.php on line 2
is er iemand die me hiermee kan helpen aub
Kan je eens het stukje code laten zien?
Code (php)
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
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
<?php
/* ------------includes-------------- */
include ('./includes/connections.php');
include ('./includes/brain_file.php');
include ('./includes/style_top.php');
/* ------------includes-------------- */
echo "<center><main>Search</main><hr width = '75%'>
<table width = '75%' class = 'rounded'>
<tr><td align = 'center'>";
if (!$_POST['srch'])
{
echo "Search by name
<form action='search.php' method='post'>
<input type='hidden' name='type' value='username'>
<input type='text' name='name' size='20'><br/>
<input type='submit' name = 'srch' value='Search'>
</form>
Search by player ID
<form action='search.php' method='post'>
<input type='hidden' name='type' value='id'>
<input type='text' name='userid' size='20'><br/>
<input type='submit' name = 'srch' value='Search'>
</form>";
}
else
{
if ($_POST['type'] == "username")
{
if ($_POST['name'] == "" || $_POST['name'] == " ")
{
echo "Error, Invalid username.";
}
else
{
$_POST['name'] = "%" . $_POST['name'] . "%";
$q_ry = array();
$q_ry = "SELECT `playerid`,`playername`,`my_gender`,`my_level`,`laston`
FROM `members`
WHERE `playername` LIKE '" . mysql_real_escape_string($_POST['name']) . "'
|| `player_login_name` LIKE '" . mysql_real_escape_string($_POST['name']) . "'
LIMIT 0 , 30";
$displayem = array();
$displayem = mysql_query($q_ry);
if (!mysql_num_rows($displayem))
{
echo "No users were found.";
}
else
{
echo "<table width = '100%'>
<tr bgcolor = '#E3E3E3'>
<td align = 'center' colspan = '4'>" . mysql_num_rows($displayem) . " players found!<br/>
There is a limit of 30 users found.</td>
</tr>
<tr bgcolor = '#999999' style = 'font-weight:800;'>
<td align = 'left'></td>
<td align = 'left'>User</td>
<td align = 'left'>Gender</td>
<td align = 'left'>Level</td>
</tr>";
$d = array();
$i = 0;
while ($d = mysql_fetch_array($displayem))
{
$i++;
if ($i % 2)
{
$color = "#e3e3e3";
}
else
{
$color = "#D8D8D8";
}
echo "<tr bgcolor = $color>
<td align = 'center' width = '1%'>";
if ($d['laston'] >= time() - 15 * 60)
{
echo "<img src='images/online.png' title='Online'/> ";
}
else
{
echo "<img src='images/offline.png' title='Offline'/> ";
}
echo "</td>
<td align = 'left'>
<a href='profile.php?XID=" . $d['playerid'] . "'>" . htmlentities($d['playername']) . "</a>[" . $d['playerid'] . "]
</td>
<td align = 'center'>
" . $d['my_gender'] . "
</td>
<td align = 'center' width = '1%'>
<a href='newspaper.php?page=hof&type=level'>" . $d['my_level'] . "</a>
</td>";
}
echo "</table>";
}
}
}
else if ($_POST['type'] == "id")
{
$_POST['userid'] = abs(intval($_POST['userid']));
if (!$_POST['userid'])
{
echo "Error, Invalid userid.";
}
else
{
$q_ry = array();
$q_ry = "SELECT `playerid`
FROM `members`
WHERE `playerid` = '" . mysql_real_escape_string($_POST['userid']) . "'
LIMIT 1";
$displayem = array();
$displayem = mysql_query($q_ry);
if (!mysql_num_rows($displayem))
{
echo "User not found.";
}
else
{
header('location:profile.php?XID=' . $_POST['userid'] . '');
}
}
}
else
{
echo "Error, Invalid search!";
}
}
echo "</td></tr></table><hr width = '75%'>><a href=\"javascript:history.back()\">Back</a><hr width = '75%'>";
include ('./includes/style_bottom.php');
?>
/* ------------includes-------------- */
include ('./includes/connections.php');
include ('./includes/brain_file.php');
include ('./includes/style_top.php');
/* ------------includes-------------- */
echo "<center><main>Search</main><hr width = '75%'>
<table width = '75%' class = 'rounded'>
<tr><td align = 'center'>";
if (!$_POST['srch'])
{
echo "Search by name
<form action='search.php' method='post'>
<input type='hidden' name='type' value='username'>
<input type='text' name='name' size='20'><br/>
<input type='submit' name = 'srch' value='Search'>
</form>
Search by player ID
<form action='search.php' method='post'>
<input type='hidden' name='type' value='id'>
<input type='text' name='userid' size='20'><br/>
<input type='submit' name = 'srch' value='Search'>
</form>";
}
else
{
if ($_POST['type'] == "username")
{
if ($_POST['name'] == "" || $_POST['name'] == " ")
{
echo "Error, Invalid username.";
}
else
{
$_POST['name'] = "%" . $_POST['name'] . "%";
$q_ry = array();
$q_ry = "SELECT `playerid`,`playername`,`my_gender`,`my_level`,`laston`
FROM `members`
WHERE `playername` LIKE '" . mysql_real_escape_string($_POST['name']) . "'
|| `player_login_name` LIKE '" . mysql_real_escape_string($_POST['name']) . "'
LIMIT 0 , 30";
$displayem = array();
$displayem = mysql_query($q_ry);
if (!mysql_num_rows($displayem))
{
echo "No users were found.";
}
else
{
echo "<table width = '100%'>
<tr bgcolor = '#E3E3E3'>
<td align = 'center' colspan = '4'>" . mysql_num_rows($displayem) . " players found!<br/>
There is a limit of 30 users found.</td>
</tr>
<tr bgcolor = '#999999' style = 'font-weight:800;'>
<td align = 'left'></td>
<td align = 'left'>User</td>
<td align = 'left'>Gender</td>
<td align = 'left'>Level</td>
</tr>";
$d = array();
$i = 0;
while ($d = mysql_fetch_array($displayem))
{
$i++;
if ($i % 2)
{
$color = "#e3e3e3";
}
else
{
$color = "#D8D8D8";
}
echo "<tr bgcolor = $color>
<td align = 'center' width = '1%'>";
if ($d['laston'] >= time() - 15 * 60)
{
echo "<img src='images/online.png' title='Online'/> ";
}
else
{
echo "<img src='images/offline.png' title='Offline'/> ";
}
echo "</td>
<td align = 'left'>
<a href='profile.php?XID=" . $d['playerid'] . "'>" . htmlentities($d['playername']) . "</a>[" . $d['playerid'] . "]
</td>
<td align = 'center'>
" . $d['my_gender'] . "
</td>
<td align = 'center' width = '1%'>
<a href='newspaper.php?page=hof&type=level'>" . $d['my_level'] . "</a>
</td>";
}
echo "</table>";
}
}
}
else if ($_POST['type'] == "id")
{
$_POST['userid'] = abs(intval($_POST['userid']));
if (!$_POST['userid'])
{
echo "Error, Invalid userid.";
}
else
{
$q_ry = array();
$q_ry = "SELECT `playerid`
FROM `members`
WHERE `playerid` = '" . mysql_real_escape_string($_POST['userid']) . "'
LIMIT 1";
$displayem = array();
$displayem = mysql_query($q_ry);
if (!mysql_num_rows($displayem))
{
echo "User not found.";
}
else
{
header('location:profile.php?XID=' . $_POST['userid'] . '');
}
}
}
else
{
echo "Error, Invalid search!";
}
}
echo "</td></tr></table><hr width = '75%'>><a href=\"javascript:history.back()\">Back</a><hr width = '75%'>";
include ('./includes/style_bottom.php');
?>
Heb de irrelevante code weggehaald. Graag volgende keer alleen de relevante code plaatsen![/modedit]
Gewijzigd op 27/04/2013 17:26:02 door Nick Dijkstra
lees dit eens door: http://www.phphulp.nl/php/tutorial/php-algemeen/header-already-sent/738/
in ieder geval ik zal het nog eventjes bekijken.
Er mag geen enkele output boven de header staan. Dus geen tekst en zelfs geen spaties.
nu krijg ik geen foutmelding enkel de tekst user not found
Dries d op 27/04/2013 17:05:07:
ik heb lijn 111 en lijn 115 verwisseld in de search
nu krijg ik geen foutmelding enkel de tekst user not found
nu krijg ik geen foutmelding enkel de tekst user not found
Bovenaan je script echo je ook nog een tabel.
En je style_top.php staat ook allemaal boven de header.
Gewijzigd op 27/04/2013 17:24:38 door Nick Dijkstra
maar ik krijg user not found terwijl het wel zou moeten lukken
Dries d op 27/04/2013 17:23:27:
ok
maar ik krijg user not found terwijl het wel zou moeten lukken
maar ik krijg user not found terwijl het wel zou moeten lukken
Ja, dat komt dan omdat je het net hebt omgedraaid.
Zie mijn vorige post
Toevoeging op 27/04/2013 17:35:47:
Nog even wat tips:
regel 31 - kan worden:
- Beter in je queries OR gebruiken ipv ||
- Gebruik geen backticks (`) in je queries
- Gebruik mysql_fetch_assoc ipv mysql_fetch_array
- Gebruik ' voor php en " voor html, dus:
- Gebruik geen inline CSS
Gewijzigd op 27/04/2013 17:36:05 door Nick Dijkstra
sorry ik begrijp het echt niet
Wat begrijp je precies niet?
ik heb trouwens ook hetzelfde probleem op een andere plaats terwijl in dat script geen header('location staat
Gewijzigd op 27/04/2013 19:46:00 door Jason van der Zeeuw
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at**********
ik ken mensen met hetzelfde script en die hebben deze errors niet
zou dit aan mijn hosting kunnen liggen (versio) ook gebruiken zij cpanel en ik directadmin
Gewijzigd op 27/04/2013 19:53:45 door dries d
Die hebben waarschijnlijk de display_errors uit staan, en dan worden de errors niet weer gegeven