Docstoc

coding

Document Sample
coding Powered By Docstoc
					                        CYBER INTELLIGENCE

CODING:

                             st
Registration & Login: (1 module)

Register:
<script type="text/javascript" language="javascript">
var num = /(^-?\d\d*$)/; // only numbers
var vemail=/^(\w+\.)*\w+@(\w+\.)+([A-Za-z]+)$/; //for email
var objRegExp = /(^-?\d\d*$)/; // for mobile

function validForm()
{

       var a=document.getElementById("pwd").value;
       var b=document.getElementById("rpwd").value;
       if(document.form1.fnam.value=="")
       {
          alert("Enter First name!");
                document.form1.fnam.focus();
                               return false;
       }
       if(document.form1.lnam.value=="")
       {
          alert("Enter Last Name!");
                document.form1.lnam.focus();
                return false;
       }

       if(document.form1.theDate.value=="")
       {
              alert("Select Date!");
              document.form1.theDate.focus();
              return false;
       }

       if(document.form1.login.value=="")
       {
       alert("Pls prvide ur login id!");
       document.form1.login.focus();
       return false;
       }

       if(document.form1.pwd.value=="")
{
alert("Enter Password!");
document.form1.pwd.focus();
return false;
}


if(document.form1.pwd.value!="")
{
if(a.length<6)
{
alert("Pass should contain atleast 6 characters!");
document.form1.pwd.focus();
return false;
}
}

if(document.form1.rpwd.value=="")
{
alert("Retype the password!");
document.form1.rpwd.focus();
return false;
}

if(document.form1.rpwd.value!="")
{
if(a!=b)
{
alert("Password and retype password should be same!");
document.form1.rpwd.focus();
return false;
}
}

if(document.form1.ques.value== "0")
{
alert("Select the question!");
document.form1.ques.focus();
return false;
}

if(document.form1.ans.value=="")
{
alert("Enter the answer!");
document.form1.ans.focus();
return false;
       }

      if(document.getElementById("secure_id").value == "")
      {
        alert("Enter the security number");
        return false;
      }
      if(document.getElementById("secure_id").value != "")
      {
               if(document.getElementById("secure_code").value !=
document.getElementById("secure_id").value)
               {
               alert("Enter the security code in the given text box");
               return false;
               }
               else
               secureval = document.getElementById("secure_id").value;
      }
}

function chk_available()
{
username=document.getElementById("login").value;
clientSideInclude("chk","checkavailability1.php?user="+username);
}
</script>

       <?php
          function password()
          {
          $chars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789abcdefghijklmnopgrstuvwxyz";
          srand((double)microtime()*1000000);
          $i = 0;
          $pass = '' ;
          while ($i <= 5) {
          $num = rand() % 33;
          $tmp = substr($chars, $num, 1);
          $pass = $pass . $tmp;
          $i++;
          }
          return $pass;
          }

       ?>
<form name="form1" method="post" action="register1.php">
<table align="center">

<tr>
<td colspan="3" align="center" height="20" ><h2>Registeration Form</h2></td>
</tr>

 <tr>
 <td valign="top" nowrap="nowrap"><font size="-1" face="Arial, sans-serif"><b>First
Name</b></font><b>&nbsp;</b></td>
 <td>:</td>
 <td><input type="text" name="fnam" id="fnam" /></td>
 <td><div id="fn"></div></td>
 </tr>

  <tr>
  <td>&nbsp;</td>
  </tr>

  <tr>
  <td valign="top" nowrap="nowrap"><font size="-1" face="Arial, sans-serif"><b>Last
Name</b></font></td>
  <td>:</td>
  <td><input type="text" name="lnam" id="lnam" /></td>
  <td><div id=lastname_error></div></td>
  </tr>

  <tr>
   <td>&nbsp;</td>
  </tr>

  <tr>

   <td valign="top" nowrap="nowrap"><font size="-1" face="Arial, sans-
serif"><b>DOB</b></td>
   <td >:</td>
   <td><input value="" name="theDate" type="text" class="wid1" id="theDate"
/>&nbsp;&nbsp;<img src="images/calender.png" border="0"
onClick="displayCalendar(document.forms[0].theDate,'dd/mm/yyyy',this)"></td>

  <div id="d"> </div></td>
  </tr>


   <tr>
   <td>&nbsp;</td>
    </tr>

     <tr>
     <td valign="top" nowrap="nowrap"><font size="-1" face="Arial, sans-
serif"><b>Desired Login Name</b></font></td>
     <td>:</td>
     <td><input type="text" name="login" id="login" />
      @mail.com</td>
     <td><div id=email_error></div></td>
     </tr>

     <tr>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td><div style="display:block;" align="left"> <font size="-1" face="Arial, sans-
serif" color="#6f6f6f"> Examples: JSmith, John.Smith </font> </div></td>
     </tr>

   <tr>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
   <td><div id="chk"></div>
   <input type="button" name="check" id="check" value="Check Availability"
onClick="return chk_available();" /></td>
    </tr>

    <tr>
    <td>&nbsp;</td>
    </tr>

      <tr>
      <td valign="top" nowrap="nowrap"><font size="-1" face="Arial, sans-
serif"><b>Choose Password</b></font></td>
      <td>:</td>
      <td><input type="password" name="pwd" id="pwd" /></td>
      <td><div id=pwd_error></div></td>
      </tr>

    <tr>
    <td>&nbsp;</td>
    </tr>



   <tr>
    <td valign="top" nowrap="nowrap"><font size="-1" face="Arial, sans-
serif"><b>Reenter Password</b></font></td>
    <td>:</td>
    <td><input type="password" name="rpwd" id="rpwd" /></td>
    <td><div id=rpwd_error></div></td>
   </tr>

  <tr>
  <td>&nbsp;</td>
  </tr>

  <tr>
   <td>&nbsp;</td>
  </tr>

   <tr>
   <td valign="top" nowrap="nowrap"><font size="-1" face="Arial, sans-
serif"><b>Security Question</b></font></td>
    <td>:</td>
    <td><select name="ques" id="ques" onChange="return ajax();" >
           <option value="0">Choose a Question</option>
           <option value="What is your library card number">What is your library card
number</option>
           <option value="what is your first phone number">what is your first phone
number</option>
           <option value="What was your first teacher's name">What was your first
teacher's name</option>
           <option value="write my own question">write my own question</option>
           </select></td>
      <td><div id="ques_own"></div></td>
      <td><div id=ques_error></div></td>
      </tr>

    <tr>
    <td>&nbsp;</td>
    </tr>

      <tr>
      <td valign="top" nowrap="nowrap"><font size="-1" face="Arial, sans-
serif"><b>Answer</b></font></td>
      <td>:</td>
      <td><input type="text" name="ans" id="ans" onKeyPress="empty('ans_error')"
/></td>
      <td><div id=ans_error></div></td>
      </tr>
    <tr>
   <td>&nbsp;</td>
   </tr>

    <tr>
    <td><strong>Location</strong></td>
    <td>:</td>
    <td><select name="loc" id="loc">
         <option value="0">--Select--</option>

              <?php

              $sql=mysql_query("select * from locations order by country asc");
              while($row=mysql_fetch_array($sql))
              {
              echo '<option value="'.$row['id'].'">'.$row['country'].'</option>';
              }

              ?>

             </select></td>
    <td><div id=loc_error></div></td>
    </tr>

    <tr>
    <td>&nbsp;</td>
    </tr>

     <tr>
     <td><strong>Word Verification</strong></td>
     <td>:</td>
     <td><input type="text" name="secure_code" id="secure_code" size="6"
value="<?php echo $pass=password();?>"/> </td>
      </tr>

      <tr>
      <td>&nbsp;</td>
      </tr>

       <tr>
       <td>&nbsp;</td>
       <td>&nbsp;</td>
       <td> <input type="text" name="secure_id" id="secure_id" size="10"/></td>
       <td><div id=sec_error></div></td>
       </tr>

       <tr>
       <td>&nbsp;</td>
       </tr>

       <tr>
       <td>&nbsp;</td>
       <td>&nbsp;</td>
       <td><input type="submit" name="upload_image" value="Submit"
onClick="return validForm();" /></td>
       </tr>

 </table>
</form>

               <?php

                       include("db.php");
                       $fname = $_REQUEST['fnam'];
                       $lname = $_REQUEST['lnam'];
                       $dob=trim($_REQUEST['theDate']);
                       $log=$_REQUEST['login'];
                       $log_new=$log.'@mail.com';
                       $pass = $_REQUEST['pwd'];
                       $que=$_REQUEST['ques'];
                       $answer=$_REQUEST['ans'];
                       $ltn=$_REQUEST['loc'];
                       $secure = trim($_REQUEST['secure_id']);

                      $query="INSERT INTO register_detail (first_name, last_name,
dob, login_id, pasword, sec_ques, sec_ans, location, security_code)
VALUES('$fname','$lname','$dob','$log_new','$pass','$que','$answer','$ltn','$secure')";

                       $res=mysql_query($query);

                       if($res)
                       {

                                  header("Location:mydetail.php");
                       }


               ?>




Mydetail.php:
         <?php

                 include("db.php");

                 $sel="SELECT * FROM register_detail ORDER BY id DESC LIMIT 1";
                 $res=mysql_query($sel);
                 $row=mysql_fetch_array($res);

                 $uname=$row['login_id'];
                 $pass=$row['pasword'];

              echo '<h5 style="color:blue">Thank You.You are Successfully
Registerd</h5>';
              echo '<h5 style="color:blue">Your Username is: '.$uname.' </h5>' ;

                 echo '<h5 style="color:blue">Your Password is: '.$pass.' </h5>' ;

              echo '<h4 style="color:green">Please <a href="index.php">Click Here
</a>To Login.</h4>';

         ?>

Login:

<form id="form1" name="form1" method="post" action="login.php" >
<table border="0">

<tr><td>UserName:</td>
<td><input type="text" name="username" id="username" /> </td>
<td><div id="un"></div></td>
</tr>

<tr>
<td height="15" colspan="3"></td>
</tr>

<tr>
<td align="right">Password :</td>
<td align="left"><input type="password" name="password" id="password" /> </td>
<td><div id="pwd"></div></td>
</tr>

<tr>
<td align="left" > <input type="image" src="images/submit.jpg" name="submit"
id="submit" onClick="return validate();"/> </td>
</tr>

<tr>
<td> Member Login</td><td><a href="index.php">Sign In</a></td>
</tr>

<tr>
<td>New User</td><td><a href="register.php">Sign Up</a></td>
</tr>

</table>
</form>

<?php

session_start();
include("db.php");
$username=$_POST['username'];
$username1=$username.'@mail.com';
$password=$_POST['password'];

if($result = mysql_fetch_array (mysql_query ("SELECT * FROM register_detail
WHERE login_id='$username1' AND pasword='$password'")))
{       if(($result['login_id']==$username1)&&($result['pasword']==$password))
$fname=$result['first_name'];
$lname=$result['last_name'];
$from=$fname.$lname;
$_SESSION['from_name']=$from;
$_SESSION["username"]=$username1;


header("Location:inbox.php");
}

?>

Composing & hacking: (2nd & 3rd module)

Compose Mail:

<?php
include('db.php');
if(!isset($_SESSION['username']))
{
         header('location: index.php');
}
?>




<form name="emailz" method="POST" action="">

<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" style="font-
family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; padding-left:20px;">

<tr>
<td colspan="100%">
       <table>
       <tr><td><div id="err">
       <?php

              if(isset($_POST['send']))
              {

                      $from=trim($_SESSION["username"]);
                      $sub=$_POST['subject'];
                      $message=$_POST['content'];
                      $to=$_POST['to_mail'];
                      $date=date("d-m-Y");
                      $user=explode("," , $to );
                      $from_nam=$_SESSION['from_name'];
                      foreach($user as $user1)
                      {
                             $user1."<br>";

                                     Hacking Functionality:

                             $sql=mysql_query("select * from keywords where
word='$sub'");
                             $num=mysql_num_rows($sql);

                           if($num>0)
                           {
                                  mysql_query("insert into inbox(from_mail,
from_name, to_mail, sub, message, rec_date, read_status) values
('$from','$from_nam','invigilence@mail.com','$sub','$message','$date','0')");
                                    mysql_query("insert into `sent`(from_mail,
to_mail, sub, message, sent_date)
values('$from','invigilence@mail.com','$sub','$message','$date')");
                                  $ins_id=mysql_insert_id();
                                  if($ins_id==0)
                                  {
                                          print "<script>";
                                          print "self.location='inbox.php?fail";
                                          print "</script>";

                                    }

                                    else
                                    {
                                            print "<script>";
                                            print "self.location='inbox.php?suc'";
                                            print "</script>";

                                    }
                             }
                             else
                             {
                                 mysql_query("insert into inbox(from_mail,
from_name, to_mail, sub, message, rec_date, read_status)
values('$from','$from_nam','$user1','$sub','$message','$date','0')");

                                   mysql_query("insert into `sent`(from_mail,
to_mail, sub, message, sent_date)
values('$from','$user1','$sub','$message','$date')");
                                   $ins_id=mysql_insert_id();
                                   if($ins_id==0)
                                   {
                                           print "<script>";
                                           print "self.location='inbox.php?fail";
                                           print "</script>";

                                    }
                                    else
                                    {
                                            print "<script>";
                                            print "self.location='inbox.php?suc'";
                                            print "</script>";

                                    }
                             }
                      }
              }
       ?>
       </div></td></tr>
       </table>
       </td>
       </tr>


       <tr>
       <td colspan="4" id="admin" class="blueText"><h3>Compose Message
       </h3></td>
       </tr>

       <tr>
       <td align="center">
       <tr>
       <td class="blueText" align="left" >To</td>
       <td colspan="2" align="left" valign="middle"><textarea name="to_mail"
cols="50" class="textbox" rows="3" wrap="physical" id="to_mail"></textarea></td>
       </tr>

       <tr>
       <td class="blueText" align="left" >Subject </td>
       <td colspan="2" align="left" valign="middle" ><input name="subject"
class="textbox" type="text" id="subject" size="50"> </td>
       </tr>

       <tr>
       <td class="blueText" align="left">Message</td>
       <td colspan="2" align="left" valign="middle"><textarea name="content"
class="textbox" cols="60" rows="10" id="content"></textarea>
       </tr>

       <tr>
       <td class="Theme1" align="left">&nbsp;</td>
       <td class="Theme1" valign="middle" align="left"><input name="send"
type="submit" value="Send"/></td>
       <td class="Theme1" valign="middle" align="center">&nbsp;</td>
       </tr>
       </table>
       </td>
       </tr>
       </TABLE>

</form>
Adding Keywords:

<script type="text/javascript" language="javascript">
function valid()
{
        if(document.frm.cat.value=="")
        {
           alert("Enter Keyword!");
                 document.frm.cat.focus();
                 return false;
        }
}
</script>

<form name="frm" id="frm" method="post" action="" >
<table border="0" width="100%">
<tr>
<td align="center">Keyword :
<input type="text" name="cat" id="cat" /></td>
</tr>
<tr><td height="10"></td></tr>
<tr><td colspan="2" align="center"><input type="submit" name="submit"
value="Submit" onClick="return valid();"/></td></tr>
<tr><td height="10"></td></tr>
<tr>
<td colspan="2" align="center">

              <?php

                      if(isset($_REQUEST['submit']))
                      {
                               $cat = addslashes($_REQUEST['cat']);
                               mysql_query("insert into keywords(word) values('$cat')")
                               or die(mysql_error());
                               echo "Successfully Uploaded";
                      }


              ?>

</td>
</tr>
</table>
</form>

View Keywords:
<form name="frm" id="frm" method="post" action="">
<table align="center" >

<tr>
<td height="20" align="center" colspan="3"><h2>View Keywords</h2></td>
</tr>




<tr>
<td width="51%">
<b>Keywords</b></td><td width="23%">&nbsp;</td>
<td width="26%"><b>Option</b></td>
</tr>

             <?php

                        $sel=mysql_query("select * from keywords");
                        while($row=mysql_fetch_array($sel))
                             {
                                    $id=$row['id'];
                                   echo '<tr><td>'.$row['word'].'</td><td
                                   width="23%">&nbsp;</td><td width="26%"><a
                                   href="edit.php?id='.$id.'">EDIT</a>/<a href=#
                                   onclick="delfun('.$row['id'].');">DELETE</a></td>
                                   </tr>';


                             }

              ?>

</table>
</form>

View User:

<form action="#" id="frm" name="frm" method="post">
<table width="45%" align="center" cellpadding="0" cellspacing="0" border="0">

<tr>
<td colspan="2"></td>
<td height="20" >
</td>
</tr>

<tr>
<td colspan="3" align="center" height="20" ><h2>View User Details</h2></td>
</tr>

<tr>
<td   height="20" colspan="3"></td>
</tr>

<tr>
<td width="48%">
        <table align="center" style="border-color:#009966;" border="0" width="543">
        <tr>
              <td width="71" height="54"><b>FirstName</b></td>
              <td width="70"><b>LastName</b></td>
              <td width="35"><b>DOB</b></td>
              <td width="67"><b>Email</b></td>
              <td width="58"><b>Location</b></td>
        </tr>

              <?php

                      $sel=mysql_query("select * from register_detail");

                      while($row=mysql_fetch_array($sel))
                      {

                             $loc=$row['location'];
                              $sql=mysql_query("select * from locations where =$loc");

                             $fetch=mysql_fetch_array($sql);

                             $country=$fetch['country'];

                             echo '

                             <tr><td>'.$row['first_name'].'</td>

                             <td>'.$row['last_name'].'</td>

                             <td>'.$row['dob'].'</td>

                             <td>'.$row['login_id'].'</td>
                           <td>'.$country.'</td></tr>';

                           }

               ?>

               </table>


       </td>
       </tr>

       <tr>
       <td   height="20" colspan="3"></td>
       </tr>


       <tr>
       <td></td>
       <td>
       <div id="cat_div"></div></td></tr>
       <br />

       <tr>
       <td height="300" colspan="3"></td>
       </tr>

      </table>
</form>


Viewing the Hacked Mail:

<form id="frm1" name="frm1" method="post" action="">
<table width="100%" border="0" cellspacing="0" class="font">
<tr>
<td>&nbsp;</td>
</tr>

<tr>
<td>&nbsp;</td>
</tr>

<tr>
<td ><input type="checkbox" name="checkbox" id="checkbox" title="Select / deselect
all in this time period" onclick="checkedAll(frm1);" value="1"/>
<strong><span style="color:#006699;" align="left">Select All</span> </strong></td>
<td>&nbsp;</td>
<td><input name="delete" type="submit" id="delete" value="Delete"/></td>
<td >&nbsp;</td>
<td >&nbsp;</td>
</tr>




<tr>
<td >&nbsp;</td>
<td >&nbsp;</td>
</tr>

<tr>
<td width="10%" class="color">&nbsp;</td>
<td width="14%" class="color"><strong>Sl NO </strong></td>
<td width="27%" class="color"><strong>FROM</strong></td>
<td width="26%" class="color"><strong>SUBJECT</strong></td>
<td width="23%" class="color"><strong>DATE</strong></td>
</tr>

  <?php

              include("db.php");
              $name=$_SESSION["username"]; //exit();
              $rs=mysql_query("select * from `inbox` where `to_mail` =
'invigilence@mail.com'");
              $num=mysql_num_rows($rs);
              $i=0;
               if($num > 0)
               {
                       while($fetch=mysql_fetch_array($rs))
                       {

                             $status=$fetch['read_status'];
                            if($status==1)
                            {


 ?>

  <tr>
   <td class="b"><input name="checkbox[]" type="checkbox" id="checkbox[]"
value="<?php echo $fetch['id']; ?>" /></td>
   <td class="b"><?php echo $i + 1; ?></td>
   <td class="b"><?php echo $fetch['from_name']; ?></td>
   <td class="b"><input type="hidden" id="a" name="a" value="<?php echo $num; ?>"
/>
   <a href="inbox_ajax.php?id=<?php echo $fetch['id']; ?>"><?php echo $fetch['sub'];
?></a></td>
   <td class="b"><?php echo $fetch['rec_date']; ?></td>
   </tr>



        <tr>
        <td colspan="6" class="b">
        <div id='<?php echo $i + 1; ?>'></div>
        </td>
        </tr>

       <?php

               $i++;
               }
               else
               {
       ?>

        <tr>
        <td class="b"><input name="checkbox[]" type="checkbox" id="checkbox[]"
value="<?php echo $fetch['id']; ?>" /></td>
        <td class="b"><strong><font face="Verdana, Arial, Helvetica, sans-serif" size="-
1"><?php echo $i + 1; ?></font></strong></td>
        <td class="b"><strong><font face="Verdana, Arial, Helvetica, sans-serif" size="-
1"><?php echo $fetch['from_name']; ?></font></strong></td>
        <td class="b"><input type="hidden" id="a" name="a" value="<?php echo $num;
?>" />
        <a href="#" onclick="inbox('<?php echo $fetch['id']; ?>','<?php echo $i + 1;
?>');"><strong><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><?php echo
$fetch['sub']; ?></font></strong></a></td>
        <td class="b"><strong><font face="Verdana, Arial, Helvetica, sans-serif" size="-
1"><?php echo $fetch['rec_date']; ?></font></strong></td>
        </tr>

        <tr>
        <td colspan="6" class="b">
        <div id='<?php echo $i + 1; ?>'></div>
        </td>
        </tr>

        <?php
                $i++;
                }
                }
                }
                else
                {
        ?>

       <tr>
       <td class="border" align="center" colspan="6"><?php echo '<font color = red>
<strong>Your Inbox Is Empty</strong></font>'?></td>
       </tr>

        <?php

                }

        ?>

 </table>
 </form>

DB Connection:

<?php

$con = mysql_connect("localhost","root","");
mysql_select_db("cyber_crime");

?>

				
DOCUMENT INFO
Categories:
Tags:
Stats:
views:2
posted:11/21/2012
language:Latin
pages:20