Jump to content

Recommended Posts

Hi,

 

I have the following code:

 

<?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();

?>

 

But then I get the following error:

 

Fatal error: Cannot re-assign $this

 

But I don't know what I am doing wrong, it worked a while ago!

 

Can somebody help me? Thanks

Link to comment
https://forums.phpfreaks.com/topic/243524-cannot-re-assign-this-error/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.