6 Replies - 617 Views - Last Post: 29 November 2010 - 08:23 PM Rate Topic: -----

#1 rsant100  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 19-June 09

Adding A Script to My PHP Script

Posted 29 November 2010 - 06:54 PM

I have been working on this for over a week with no luck. I have a traffic exchange site, which send solo emails to its
members. What I am trying to add to this small script
 http://www.maximize2share.com/images/hedar.jpg 

to my traffic exchange script,so this small code shows up on there email. This code is for like Google adsense. Like text ads
Here is the php file that I am trying to add it too.
I appreciate anyones help.
Rob
<?php



include "../header.php";

include "../config.php";

include "../style.php";



//pick a random number and make sure it is not allready in the database....

do

{

    $random = rand(10000, 1000000);

    $query = "select * from links where number=".$random;

    $result = mysql_query ($query)

            or die ("Query failed");

    $numrows = @ mysql_num_rows($result);

} while (numrows == 1);



//get the next ad to send out....

$query3 = "select * from solos where approved=1 and sent=0 limit 1";

$result3 = mysql_query ($query3)

        or die ("Query failed");

    $numrows2 = @ mysql_num_rows($result3);

    if ($numrows2 == 0) {

       echo "<p>No soloads to send.</p>";

       exit;

    } //end if ($numrows == 0)

	$line3 = mysql_fetch_array($result3);

    $subject = $line3["subject"];

    $adbody = $line3["adbody"];

    $id = $line3["id"];



//update the links table with the new random number.

$query2 = "insert into links set number=".$random.", adid=".$id;

$result2 = mysql_query ($query2)

    or die ("Query failed");

    

//set the 'sent' in the database to 1

$query5 = "update solos set sent=1 where id=".$id;

$result5 = mysql_query ($query5)

        or die ("Query failed");    

		

		

$query1 = "SELECT * FROM pages WHERE name='Solo footer ad'";

$result1 = mysql_query ($query1);



$line1 = mysql_fetch_array($result1);

$htmlcode = $line1["htmlcode"];

if($htmlcode) $htmlcode = "<br>$htmlcode<br><br>";	



//get all members details....

$query4 = "select * from members where status=1 and verified=1 and vacation=0";

$result4 = mysql_query ($query4)

        or die ("Query failed");

while ($line4 = mysql_fetch_array($result4)) {



    $email = $line4["subscribed_email"];

    $memtypeq = $line4["memtype"];

    $useridq = $line4["userid"];

	$nameq = $line4["name"];

    $passwordq = $line4["pword"];

	

//now we've got all we need, so blast the ad out!



    $Subject = "(Solo) ".$subject;

    $Message = $adbody;

    $Message .= "<br><br>--------------------------------------------------------------<br><br>";

    if ($memtypeq == "FREE") {

        $Message .= "Click the link to receive ".$freeclickearn." credits<br><br>";

    }

    else {

         $Message .= "Click the link to receive ".$proclickearn." credits<br><br>";

    }

    $Message .= "<a href=\"".$domain."/clicks.php?userid=".$useridq."&seed=".$random."&id=".$id."\">".$domain."/clicks.php?userid=".$useridq."&seed=".$random."&id=".$id."</a>";

    $Message .= ".<br><br>";

    $Message .= "--------------------------------------------------------------<br>$htmlcode<br>";

    $Message .= "This is a solo ad advertisement from a member of ".$sitename.". You are receiving this because you are a member of '$sitename'.<br>";

    $Message .= "You can opt out of receiving emails only by deleting your account, click here to delete your account.<br><br><a href=\"$domain/delete.php?userid=$useridq&code=".md5($passwordq)."\">$domain/delete.php?userid=$useridq&code=".md5($passwordq)."</a>.<br><br>";

	$Message .= "$adminname, $sitename, $adminaddress<br>";

	

    $headers = "From: $sitename<$adminemail>\n";

        $headers .= "Reply-To: <$adminemail>\n";

        $headers .= "X-Sender: <$adminemail>\n";

        $headers .= "X-Mailer: PHP4\n";

        $headers .= "X-Priority: 3\n";

        $headers .= "Return-Path: <$adminemail>\nContent-type: text/html; charset=iso-8859-1\n";

		

	

	$nameq = trim($nameq);

	$firstnameq = substr($nameq , 0, strpos($nameq, " "));



	

	$Message = str_replace("~userid~",$useridq,$Message);

	$Message = str_replace("~fname~",$firstnameq,$Message);

	$Subject = str_replace("~userid~",$useridq,$Subject);

	$Subject = str_replace("~fname~",$firstnameq,$Subject);



    @mail($email, $Subject, wordwrap(stripslashes($Message)),$headers);



    $counter=$counter+1;



} // end while ($line4 = mysql_fetch_array($result))



echo "<p><b><center>email successfully posted to ".$counter." members.</p></b></center>";



mysql_close($dblink);



include "../footer.php";



?>

This post has been edited by CTphpnwb: 29 November 2010 - 07:02 PM
Reason for edit:: Added Code Tags!


Is This A Good Question/Topic? 0
  • +

Replies To: Adding A Script to My PHP Script

#2 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3001
  • View blog
  • Posts: 10,393
  • Joined: 08-August 08

Re: Adding A Script to My PHP Script

Posted 29 November 2010 - 07:06 PM

What errors are you getting? Are you expecting a jpeg file to contain a php script? Please explain in great detail what you are trying to do and what you have tried. Please also remember to use code tags when posting code.
Was This Post Helpful? 0
  • +
  • -

#3 rsant100  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 19-June 09

Re: Adding A Script to My PHP Script

Posted 29 November 2010 - 07:18 PM

Hello and Thank You
What I am trying to do is to get [attachment=21050:email.JPG]
If you look at this image.This would be the final results.
This code would add the text ads.
My link
Just trying to add it to this php file.
I got many errors.Mostly saying error on line 91.Probably due to my coding.
that was show

Attached image(s)

  • Attached Image

This post has been edited by CTphpnwb: 29 November 2010 - 07:26 PM
Reason for edit:: Removed full quote: Please only quote relevant text/code for clarity.

Was This Post Helpful? 0
  • +
  • -

#4 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3001
  • View blog
  • Posts: 10,393
  • Joined: 08-August 08

Re: Adding A Script to My PHP Script

Posted 29 November 2010 - 07:36 PM

I have the feeling that this may be too far beyond your skill set at the moment. My guess is that there are problems with one or more of the included files. You need to be able to tell us which one and show us that code.
Was This Post Helpful? 0
  • +
  • -

#5 rsant100  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 19-June 09

Re: Adding A Script to My PHP Script

Posted 29 November 2010 - 08:01 PM

Maybe you are right. I just saw this type of script working.And thought \
that maybe it would be just adding the simple code.To my sites script.
Was This Post Helpful? 0
  • +
  • -

#6 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3001
  • View blog
  • Posts: 10,393
  • Joined: 08-August 08

Re: Adding A Script to My PHP Script

Posted 29 November 2010 - 08:17 PM

Well organized, modular code can be easy to incorporate with other well organized, modular code. Procedural code is neither modular nor organized, so it is rarely easy to add to/on.

That said, if you learn some more you may narrow it down to something small enough to post here and get help with!
Was This Post Helpful? 0
  • +
  • -

#7 rsant100  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 19-June 09

Re: Adding A Script to My PHP Script

Posted 29 November 2010 - 08:23 PM

View PostCTphpnwb, on 29 November 2010 - 07:17 PM, said:

Well organized, modular code can be easy to incorporate with other well organized, modular code. Procedural code is neither modular nor organized, so it is rarely easy to add to/on.

That said, if you learn some more you may narrow it down to something small enough to post here and get help with!


Thanks for your time,I will work on it.I am determined to get it to work.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1