Avatar billede tras Juniormester
05. oktober 2005 - 11:15 Der er 1 kommentar og
1 løsning

Hent data fra databasen

Har bare et problem nemlig hvordan får jeg den til at sende til den brugers mail

<?php
include("func.php");
DB::Conn("open");
$query = mysql_query("select `*` from `db_users` where `username`='" . $_POST['username'] . "'") or die (mysql_error());
if (!empty($_POST['username']))
{
$headers = "From: gamersloot@typonatic.dk\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$boundary = uniqid("HTMLDEMO");
$headers .= "Content-Type: multipart/mixed; boundary = $boundary\r\n\r\n";
$body = "--$boundary\r\n" .
  "Content-Type: text/plain; charset=ISO-8859-1\r\n" .
  "Content-Transfer-Encoding: base64\r\n\r\n";
$body .= chunk_split(base64_encode("ababababa!"));
$body .= "--$boundary\r\n" .
  "Content-Type: text/html; charset=ISO-8859-1\r\n" .
  "Content-Transfer-Encoding: base64\r\n\r\n";
$body .= chunk_split(base64_encode("This the <b>HTML</b> version!"));
mail("'"$Get->email;"'", "An HTML Message", $body, $headers);

Java::GoToURL("index.php?menu=account&page=account_lost");
} else { ?>
<table>
    <tr>
        <td>&nbsp;

        </td>
    </tr>
</table>
<table bgcolor="#FFFF00" align="center" style="border: 1px gray solid;">
    <tr>
        <td align="center">
            Warning
        </td>
    </tr>
    <? if($_POST['username'] == ""){ ?>
    <tr>
        <td>
            The <strong>Username</strong> field is empty?
        </td>
    </tr>
    <? } ?>
</table>
<table align="center">
    <tr>
        <td>
            <a href="java script:history.go(-1)">Go Back</a>
        </td>
    </tr>
</table>
<? }?>
Avatar billede tras Juniormester
05. oktober 2005 - 11:33 #1
<?php
include("func.php");
DB::Conn("open");
$query = mysql_query("select `*` from `db_users` where `username`='" . $_POST['username'] . "'") or die (mysql_error());
if (!empty($_POST['username']))
{
$headers = "From: Admin@typonatic.dk\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$boundary = uniqid("HTMLDEMO");
$headers .= "Content-Type: multipart/mixed; boundary = $boundary\r\n\r\n";
$body = "--$boundary\r\n" .
  "Content-Type: text/plain; charset=ISO-8859-1\r\n" .
  "Content-Transfer-Encoding: base64\r\n\r\n";

$SQL = "SELECT * FROM db_users WHERE username = '" . $_POST['username'] . "'";
$loadin = mysql_query($SQL) or die("There is an Error in the database");
while ($Get = mysql_fetch_object($loadin)){

$body .= chunk_split(base64_encode("Hallo $Get->username here is you Private code"));
$body .= chunk_split(base64_encode("$Get->code"));
$body .= "--$boundary\r\n" .
  "Content-Type: text/html; charset=ISO-8859-1\r\n" .
  "Content-Transfer-Encoding: base64\r\n\r\n";
mail("$Get->email", "Private Code", $body, $headers);

}

Java::GoToURL("index.php?menu=account&page=account_lost");
} else { ?>
<table>
    <tr>
        <td>&nbsp;

        </td>
    </tr>
</table>
<table bgcolor="#FFFF00" align="center" style="border: 1px gray solid;">
    <tr>
        <td align="center">
            Warning
        </td>
    </tr>
    <? if($_POST['username'] == ""){ ?>
    <tr>
        <td>
            The <strong>Username</strong> field is empty? <?=$email?>
        </td>
    </tr>
    <? } ?>
</table>
<table align="center">
    <tr>
        <td>
            <a href="java script:history.go(-1)">Go Back</a>
        </td>
    </tr>
</table>
<? }?>
Avatar billede tras Juniormester
05. oktober 2005 - 11:33 #2
Fandt ud af det
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester