Jump to content


Photo

mysql sharing?


  • Please log in to reply
9 replies to this topic

#1 techker

techker
  • Members
  • PipPipPip
  • Advanced Member
  • 748 posts

Posted 22 July 2006 - 07:39 PM


hey guys i have a login script that records emails when you register.there is a fonction in the admin panel to send emails.but it does not work.(sever does not support it)

so i installed a newsletter script.is it possible to link the msql file that saves the emails to my newsletter sql?

so when the register the email goes to both scripts.

thx
Edit/Delete Message

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 22 July 2006 - 08:57 PM

I don't know what you mean by "goes to both scripts".  Why not simply have a single script that does both?
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 techker

techker
  • Members
  • PipPipPip
  • Advanced Member
  • 748 posts

Posted 22 July 2006 - 09:01 PM

well i have one but the sever is to slow to process the newsletter sit give me  a proxy error all the time .so i have a very good newsletter script that i use .but i would like to take the info from my login script for the newsletter script.


#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 23 July 2006 - 12:31 PM

It's going to be cumbersome to pass data via scripts... if it makes it's way into a DB, you'd be much better off.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#5 techker

techker
  • Members
  • PipPipPip
  • Advanced Member
  • 748 posts

Posted 23 July 2006 - 01:03 PM

sorry i don't get what your saying?

#6 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 23 July 2006 - 06:29 PM

Well, you said your login script "records" e-mails... I assumed this was to a DB.  If so, your second script can simply pull from there.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#7 techker

techker
  • Members
  • PipPipPip
  • Advanced Member
  • 748 posts

Posted 23 July 2006 - 11:44 PM

here is the list email page from the newsletter

 
<?php
    session_start();
    include "connect.php";
    ?>
    <link rel="stylesheet" href="style.css" type="text/css">
    <center><table border='0'><tr><td valign='top' width=30%>
    <?php
    if(isset($_SESSION['mailadmin']))
    {
       $numentries=20;
       include "left.php";
       print "</td>";
       print "<td valign='top' width=70%>";
       print "<table class='maintable'><tr class='headline'><td><center>List email addresses in ABC order</center></td></tr>";
       print "<tr class='mainrow'><td>";
       if(!isset($_GET['start']))
       {
         $start=0;
       }
       else
       {
         $start=$_GET['start'];
       }   
       $order="SELECT * from m_list where validated=1 order by address ASC";
       $order2=mysql_query($order) or die(mysql_error());
       $d=0;
       $f=0;
       $g=1+$d/$numentries;
       $num=mysql_num_rows($order2);
       print "<font color='#$fontcolor'>Page:</font> ";
       $prev=$start-$numentries;
       $next=$start+$numentries;
       if($start>=$numentries)
       {
         print "<A href='list.php?start=$prev'><<</a> ";
       }
       while($order3=mysql_fetch_array($order2))
       {
         if($f>=$start-3*$numentries&&$f<=$start+7*$numentries)
         {
           if($f%$numentries==0)
           {
             print "<A href='list.php?start=$d'>$g</a> ";
           }
         }
         $d=$d+1;
         $g=1+$d/$numentries;
         $f++;
       }  
       if($start<=$num-$numentries)
       {
         print "<A href='list.php?start=$next'>>></a> ";
       }
       print "<center><table class='maintable'><tr class='headline'><td>Address</td><td>Delete</td></tr>";
       $getaddress="SELECT * from m_list where validated='1' order by address ASC limit $start, 20";
       $getaddress2=mysql_query($getaddress) or die("Could not get address");
        while($getaddress3=mysql_fetch_array($getaddress2)
    )
       {
          print "<tr class='mainrow'><td>$getaddress3[address]</td><td><A href='deleteadd.php?ID=$getaddress3[mailid]'>Delete</a></td></tr>";
       }
       print "</table>";
       print "</td></tr></table>";
    }
    ?>


and here is the page of members email

<?php
include 'config.php';


list($cookie, $tmpname) =
split("!", $_COOKIE[auth], 2);

if($cookie == "fook"){

$connection = mysql_connect($hostname, $user, $pass)
or die(mysql_error());
$db = mysql_select_db($database, $connection)
or die(mysql_error());

$sqlcheckaccount = "SELECT username FROM $userstable
WHERE username = '$tmpname'";

$resultcheckaccount = mysql_query($sqlcheckaccount)
or die ("Couldn't execute query.");
$numcheckaccount = mysql_num_rows($resultcheckaccount);
if($numcheckaccount == 0){
echo "Error, Username doesnt exist.";
die;
}

$sql = "SELECT * FROM $userstable ORDER BY username";

$result = mysql_query($sql)
or die ("Couldn't execute query.");

$num_rows = mysql_num_rows($result);
echo "<font face=\"Arial\" size=\"2\">Below is a list of members which have registered at letitring.info";
echo "<br> Total members: $num_rows";
echo "<br><table border=\"1\" cellspacing=\"1\" cellpadding=\"3\">";
echo "<tr> <th><font face=\"Arial\" size=\"2\">Username</th> <th><font face=\"Arial\" size=\"2\">Email</th> <th><font face=\"Arial\" size=\"2\">Profile</th> </font></tr>";
while($row = mysql_fetch_array( $result )) {

echo "<tr><td><font face=\"Arial\" size=\"2\">";
echo $row['username'];
echo "</td><td><font face=\"Arial\" size=\"2\">";
echo $row['email'];
echo "</td>";
echo "<td><a href=\"viewprofile.php?name=$row[username]\"><font face=\"Arial\" size=\"2\">View Profile</a></td>";
echo "</tr>";
}
echo "</table></font>";



} else {
echo "Error, You have to be logged in to view this page.";
echo "<br>Click <a href=\"login.php\">here!</a> to login.";
}
?>
were should i slide it in and what should i put ?
it is the newsletter script that i will use.

#8 crashmaster

crashmaster
  • Members
  • PipPipPip
  • Advanced Member
  • 169 posts
  • LocationCzech Republic, Prague

Posted 23 July 2006 - 11:47 PM

<?

include ('mysql.php');
$name = $_POST[name];
$text = $_POST[text];
$query = Mysql_query ("SELECT email FROM members");
$count = mysql_num_rows($query);
for ($i=0;$i<$count;$i++){

$to_all = MySQL_Result($query, $i, "email");
$mail = mail("$to_all", "Message to all members from $name",
"Od koho(nickname) : $name
Text              : $text ");
if ($mail){echo "Your massage to $to_all has been sent!<br>";}
elseif (!$mail){echo "Your massage to $to_all has NOT been sent!<br>";}
}
?>
I'll never be the same...

#9 techker

techker
  • Members
  • PipPipPip
  • Advanced Member
  • 748 posts

Posted 23 July 2006 - 11:50 PM

so i put this in the newsletter list email .shouldn't it have to be in the same database?

or it will know?

#10 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 24 July 2006 - 03:36 AM

Hopefully, someone else can help you with this... I can't wade though all that PHP code.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users