cannot reassign $this error
Ik heb volgende code:
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
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
<?php
include("../include/include.php");
?>
<table border="1">
<tr>
<th>News letter</th>
</tr>
<tr>
<td><a href="newsletter.php?action=send">Send letter</a></td>
</tr>
</table><br><br><br>
<?php
if(isset($_GET['action']) && $_GET['action'] == "send"){
if(isset($_POST['message']) && isset($_POST['title'])){
$message = explode("[BLOCK]",$_POST['message']);
$newmessage = "";
for($i = 0; $i < count($message); $i++){
$message[$i] = stripslashes(ereg_replace("\n","<br>",$message[$i]));
$newmessage .= parse("rownewsletter",$message[$i]);
}
$message = $newmessage;
$query = "SELECT * FROM ".$_table['users']." WHERE 1 ".($_POST['test'] == 'test' ? 'AND (id=\'2\')' : '')." ORDER BY id ASC"; // OR id=\'6\' OR id=\'486358\' OR id=\'486359\'
$query = $_DBC->sql_query($query,0);
$i = 0;
$a = 0;
$this = 0;
while($row = $_DBC->sql_fetch_assoc($query)){
$ad = "";
/* $nthis = $this;
for($a = $a; $a < $nthis + 2; $a++){
$ad .= $ads[$a]."<hr width=\"50%\">";
$this++;
}
*/
for($a = 0; $a < count($ads); $a++){
$ad .= $ads[$a]."<hr width=\"50%\">";
}
$content = $message . parse("rownewsletterads",$ad);
if($a == count($ads)){
$a = 0;
$this = 2;
}
$content = ereg_replace("!mail!",$row['email'],$content);
$content = ereg_replace("!id!",$row['id'],$content);
$content = ereg_replace("!date!",date('d-m-Y',$row['time']),$content);
email($row['email'],$row['email'],$_POST['title'],$content,'','','','','newsletter');
$i++;
}
if($_POST['test'] != "test"){
$query = $_DBC->sql_query("INSERT INTO ".$_table['newsletter']." (subject,message,time) VALUES ('".$_POST['title']."','".addslashes($message)."','".dtime()."')",0);
}
echo("The newsletter is send to ".$i." users.");
}else{
?>
<table>
<form method="post">
<tr>
<td>Subject:</td>
<td><input type="text" name="title" value="<?php echo $_POST['title']; ?>" size="18"></td>
</tr>
<tr>
<td colspan="2">Message:</td>
</tr>
<tr>
<td colspan="2"><textarea name="message" rows="10" cols="40"><?php echo $_POST['message']; ?></textarea><br>You can use the follow code's:<br>* !mail! replace to the user's email<br>* !id! replace to the user's ID<br>* !date! replace to the signup date</td>
</tr>
<tr>
<td colspan="2"><input type="checkbox" name="test" value="test" checked> Tes only account #ID 1</td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" value="Send letter"></td>
</tr>
</form>
</table>
<?php
}
}
?>
<?php
$_DBC->sql_close();
?>
include("../include/include.php");
?>
<table border="1">
<tr>
<th>News letter</th>
</tr>
<tr>
<td><a href="newsletter.php?action=send">Send letter</a></td>
</tr>
</table><br><br><br>
<?php
if(isset($_GET['action']) && $_GET['action'] == "send"){
if(isset($_POST['message']) && isset($_POST['title'])){
$message = explode("[BLOCK]",$_POST['message']);
$newmessage = "";
for($i = 0; $i < count($message); $i++){
$message[$i] = stripslashes(ereg_replace("\n","<br>",$message[$i]));
$newmessage .= parse("rownewsletter",$message[$i]);
}
$message = $newmessage;
$query = "SELECT * FROM ".$_table['users']." WHERE 1 ".($_POST['test'] == 'test' ? 'AND (id=\'2\')' : '')." ORDER BY id ASC"; // OR id=\'6\' OR id=\'486358\' OR id=\'486359\'
$query = $_DBC->sql_query($query,0);
$i = 0;
$a = 0;
$this = 0;
while($row = $_DBC->sql_fetch_assoc($query)){
$ad = "";
/* $nthis = $this;
for($a = $a; $a < $nthis + 2; $a++){
$ad .= $ads[$a]."<hr width=\"50%\">";
$this++;
}
*/
for($a = 0; $a < count($ads); $a++){
$ad .= $ads[$a]."<hr width=\"50%\">";
}
$content = $message . parse("rownewsletterads",$ad);
if($a == count($ads)){
$a = 0;
$this = 2;
}
$content = ereg_replace("!mail!",$row['email'],$content);
$content = ereg_replace("!id!",$row['id'],$content);
$content = ereg_replace("!date!",date('d-m-Y',$row['time']),$content);
email($row['email'],$row['email'],$_POST['title'],$content,'','','','','newsletter');
$i++;
}
if($_POST['test'] != "test"){
$query = $_DBC->sql_query("INSERT INTO ".$_table['newsletter']." (subject,message,time) VALUES ('".$_POST['title']."','".addslashes($message)."','".dtime()."')",0);
}
echo("The newsletter is send to ".$i." users.");
}else{
?>
<table>
<form method="post">
<tr>
<td>Subject:</td>
<td><input type="text" name="title" value="<?php echo $_POST['title']; ?>" size="18"></td>
</tr>
<tr>
<td colspan="2">Message:</td>
</tr>
<tr>
<td colspan="2"><textarea name="message" rows="10" cols="40"><?php echo $_POST['message']; ?></textarea><br>You can use the follow code's:<br>* !mail! replace to the user's email<br>* !id! replace to the user's ID<br>* !date! replace to the signup date</td>
</tr>
<tr>
<td colspan="2"><input type="checkbox" name="test" value="test" checked> Tes only account #ID 1</td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" value="Send letter"></td>
</tr>
</form>
</table>
<?php
}
}
?>
<?php
$_DBC->sql_close();
?>
Maar wanneer ik deze file wil openen krijg ik onderstaande error:
Fatal error: Cannot re-assign $this
Nogthans heb ik dit bestand een tijd geleden geopend en werkte dit perfect!
Wat moet ik veranderen om het te doen marcheren of waar zit de fout?
Bedankt
Quote:
Warning
This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.
This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.
reserved word is. Hernoem $this naar bijvoorbeeld $deze en je probleem is opgelost.
De echte oorzaak is dat $this een