Location: PHPKode > projects > Slashster > slashster/html/verify.php
<?

# Slashster: Open Source Friend of a Friend Software
# Copyright 2004 Mark El-Wakil
# Contact: hide@address.com
# http://seventhcycle.net
#
# This file is part of Slashster.
#
# Slashster is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Slashster is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Slashster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

    import_request_variables("gPc");

    require_once("PageClass.php");
    $mpage = new PageClass();


    $errmsg = "";


    if ($verify)
    {
        $sql = "select * from UserTable where Id = \"$id\" ";
        $r = $mpage->DoQuery($sql,1);

        if (sizeof($r))
        {
            $r = $r[0];
            $hash = md5($r[Id] . "-" . $r[Salt]);

            if ($hash == $verify)
            {
                $sql = "update UserTable set Verified=1 where Id = \"$r[Id]\" ";
                $mpage->DoQuery($sql,1);

                $eml = $mpage->user[Email];

                $sql = "select * from InviteEmail where Email=\"$eml\" ";
                $ase = $mpage->DoQuery($sql,1);

                foreach ($ase as $asee)
                {
                   $mpage->FriendRequest($asee[UserId],$mpage->IdNum);
                }

                $sql = "delete from InviteEmail where Email=\"$eml\" ";
                $mpage->DoQuery($sql);

                $_SESSION[userid] = $r[Id];


            ?>
<span class="title1">Thank You</span>
<BR>Your email address has been verified.
<P>If you have forgotten your password, you are currently logged in,
and can change it.

<P><a href="<?= $mpage->stdurl ?>main.php">Proceed to the main page</a>

            <?
            }
            else
            {
            ?>
<span class="title1">Sorry</span>
<BR>The verification code you provided was incorrect.
<P>Please <a href="verify.php">Try Again</a>.        

            <?
            }
        }
        else
        {
            ?>
<span class="title1">Sorry</span>
<BR>The user you are trying to verify does not exist.
<P>Please <a href="verify.php">Try Again</a>.        

            <?
        }
         
        $mpage->ClosePage();
    }


    if ($submit)
    {
        $sql = "select * from UserTable where Email = \"$Login\" ";
        $r = $mpage->DoQuery($sql,1);

        if (sizeof($r))
        {
             $r = $r[0]; 

             $verify = md5($r[Id] . "-" . $r[Salt]);

             $txt .= "$r[Fname],\n\n";

             $txt .= "You have either submitted a request to verify your email ";
             $txt .= "or have forgotten your password.  To continue the process, go to\n\n";
             $txt .= $mpage->sys[sitedomain].", and scroll to the bottom of the screen.  You'll see ";
             $txt .= "an option to Verify your email.  Click it.  Enter in your information:\n\n";

             $txt .= "Id: $r[Id]\n";
             $txt .= "Confirmation Code: $verify\n\n";

             $txt .= "Thanks!";

             $mpage->MailSchedule($r[Id], $r[Id], $mpage->sys[sitename].": Verify Your Email Address", 
                                  $txt, 1, 1, 0);

?>
<span class="title1">Thank You</span>
<BR>A confirmation email is on its way.
<?
             $mpage->ClosePage();

        }
        else
        {
           $errmsg = "No such user / email";
        }
    }

    if (!$Login && $mpage->LoggedIn) $Login = $mpage->user[Email];


?>

<? if ($warn) { ?>
     

<P><BR><BR>
<table border=4 bordercolor=red cellspacing=0 cellpadding=5px>
<tr><td style="font: bold 16px arial; color:red;">
The page you wish to visit requires your email be validated.  Please do so now.
</td></tr>
</table>
<P>

<? } ?>



<form method="post">

<P><BR>
<span class="title1">
Verify Your Email / Forgotten Password
</span>

<? if ($errmsg) { ?>


<P>
<table border=4 bordercolor=red cellspacing=0 cellpadding=5px>
<tr><td style="font: bold 16px arial; color:red;">
Error: <?= $errmsg ?>
</td></tr>
</table>
<P>

<? } ?>

<BR><BR>
<table cellpadding=0 cellspacing=0 width=300>
<tr>
<td class="stdtable" width=150><B>Login (Your Email)</b></td>
<td class="stdfilling" width=150><input name="Login"
    class="input" value="<?= htmlentities($Login) ?>"></td>
</tr>    

<tr><td colspan=2><BR><B>Note</b>:
    Some ISP's falsely recognise your verification letter as spam.  If you
        do not find a verify letter in your normal box, please check your spam filter.
        Thanks!</td>
</tr>

</table>

<BR>
<input class="submit" name = "submit" type = "submit" value ="Submit">
<br>
</form>


<form method=get>
<P class="title1">Enter in your Id / Verification Code</p>

<table border=0 cellspacing=0>
  <tr>
    <td class=stdtable>Id</td>
    <td class=stdfilling><input name="id" value="<?= htmlentities($id) ?>">
  </tr>

  <tr> 
    <td class=stdtable><B>Verification Code</b></td>
    <td class=stdfilling><input name="verify" value="<?= htmlentities($verify) ?>">
  </tr>
</table>

<BR><BR>
<input class="submit" type="submit" value="Verify Your Email Address">

</form>



<BR>

<P>Note: If you've been having trouble receiving email from <?= $mpage->sys[sitename] ?>, please
send in a <a href="<?= $mpage->stdurl ?>bugreport.php">bug report</a>.

</center>
</form>



<?
    $mpage->ClosePage();

Return current item: Slashster