//// index.php
///////////////////////////////////////////////////////////////////////////////////////////////////
<h2 align="center" style="color:#CC33FF"> Login Verification IMS</h2>
<form id="myform" action="#" method="post" onSubmit="return checkvalidate()">
<table align="center" style="color:#FF99FF">
<tr>
<td><strong>Email</strong></td>
<td><input type="text" id="useremail" name="useremail" maxlength="17" /></td>
<td><span style="color:#FF0000" id="usernameerr"></span></td>
</tr>
<tr>
<td><strong>Password</strong></td>
<td><input type="password" id="userpassword" name="userpassword" maxlength="8" /></td>
<td><span style="color:#FF0000" id="userpassworderr"></span></td>
</tr>
<tr>
<td><input type="hidden" name="action" value="trans" /></td>
<td colspan="2"><img src="img/sub.png" height="25" width="80" id="sub" name="sub" onclick="javascript:doSubmit()"/></td>
</tr>
</table>
</form>
<?php
include("db.php");
$obj=new DB;
session_start();
if(isset($_REQUEST['logout'])){
unset($_SESSION['username']);
unset($_SESSION['userid']);
header("Location:index.php");
}
if(isset($_REQUEST['action'])){
$useremail=$_REQUEST['useremail'];
$userpassword=$_REQUEST['userpassword'];
$sql="select * from userlogin where useremail='$useremail' and password='$userpassword'";
$results=$obj->getTable($sql);
echo'<pre>';
$emailid=$results[0]['useremail'];
$name=strstr($emailid,"@",true);
ucfirst($name);
$_SESSION['username']=$name;
$_SESSION['userid']=$results[0]['id'];
header("Location:dashboard.php");
}
?>
<script>
function doSubmit(){
alert("hi");
var form=document.forms[0];
if(form.onsubmit){
var flag=form.onsubmit.call(form);
if(flag==true){
form.submit();
}
}
}
function checkvalidate(){
var userpass=document.getElementById("userpassword").value;
var useremail=document.getElementById("useremail").value;
var passerr=document.getElementById("userpassworderr");
var emailerr=document.getElementById("usernameerr");
var validation =true;
var emailvalida=false;
//email validation
for(var i=0; i<useremail.length; i++){
if(useremail.charAt(i)=="@"){
emailvalida=true;
}
}
if(emailvalida==false || useremail==""||useremail.length<8){ //if anyone is true
emailerr.innerHTML="<font color=red size=2>Enter Proper Email</font>";
validation =false
}
//name validation
if(userpass==""||userpass.length<4){ //if anyone is true
passerr.innerHTML="<font color=red size=2>Enter Proper Name</font>";
validation =false;
}
alert(validation);
return validation;
//return false;
}
</script>
///////////////////////////////////////////////////////////////////////////////////////////////////
//// End index.php
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
//// inbox.php
///////////////////////////////////////////////////////////////////////////////////////////////////
<?php
$leftTop="Muna Inbox";
include("afterloginheader.php");
include("db.php");
$obj=new DB;
//$sql="select * from userlogin where useremail='$useremail' and password='$userpassword'";
//$results=$obj->getTable($sql);
?>
<form action="#" method="post">
<table border="1" width="65%" align="center" style="background-color:#FFCCCC">
<tr>
<th><strong><input type="checkbox" id="selectAll" onclick="chkall()"/></strong></th>
<th><strong>Froom</strong></th>
<th><strong>Subject</strong></th>
<th><strong>Date</strong></th>
<th><strong>Action</strong></th>
</tr>
<?php $sql="select * from email_tbl where `To`=".$_SESSION['userid']."";
$results=$obj->GetTable($sql);
foreach($results as $result){
?>
<tr>
<td>
<input type="checkbox" id="checkbox[]" name="checkbox[]" value="<?php echo $result['id'];?>" />
</td>
<td>
<?php echo $result['From'];?>
</td>
<td>
<?php echo $result['Subject'];?>
</td>
<td>
<?php echo $result['Date'];?>
</td>
<td>
<img src="img/del1.jpg" height="25" width="80" align="left" onclick=del(<?php echo $result['id'];?>)/>
</td>
</tr>
<?php
}
?>
<tr>
<td><input type="submit" value="Delete Sel" id="sub" name="sub" /></td>
</tr>
</table>
</form>
<div align="center" style="display:block">
<form action="#" method="post">
<table>
<tr>
<td>
User List
</td>
<td>
<select id="userlist">
<?php $sql="select * from userlogin";
$results=$obj->GetTable($sql);
foreach($results as $result){?>
<option value="<?php echo $result['useremail'] ?>"><?php echo $result['useremail'] ?></option>
<?php }?>
</select>
</td>
</tr>
<tr>
<td>Subject</td><td><input type="text" id="subj" name="subj" placeholder="Enter Subject here"/></td>
</tr>
<tr>
<td>Message</td><td><textarea id="msg" name="msg" rows="4" cols="50" placeholder="Enter Content here"></textarea> </td>
</tr>
<tr>
<td><input type="hidden" value="trans" name="action" /></td>
<td><img src="img/send2.jpg" width="80" height="25" align="left" onclick="submitform()"/>
<img src="img/save.jpg" width="80" height="25" align="left" onclick="saveEmail()"/></td>
</tr>
</table>
</form>
</div>
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script>
//setInterval("saveEmail()",30000);
function saveEmail(){
var id=document.getElementById("userlist").value;
var subject=document.getElementById("subj").value;
var msg=document.getElementById("msg").value;
$.ajax({
type:"POST",
url:"savemsg.php",
data:{"id":id,"subject":subject,"msg":msg},
success:function(data){
alert(data);
$("#display").html(data);
}
});
}
function submitform() {
var form = document.forms[0];
if (form.onsubmit) {
var result = form.onsubmit.call(form);
}
if (result !== false) {
form.submit();
}
}
</script>
<?php
if(isset($_REQUEST['action'])){
echo "comming here";
}
?>
</tr>
</table>
///////////////////////////////////////////////////////////////////////////////////////////////////
//// End inbox.php
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
//// savemsg.php
///////////////////////////////////////////////////////////////////////////////////////////////////
<?php
//{"id":id,"subject":subject,"msg":msg},
session_start();
/*$id=$_REQUEST['id'];
$msg=$_REQUEST['msg'];
$subject=$_REQUEST['subject'];*/
$id=$_REQUEST['id']=2;
$msg=$_REQUEST['msg']="doooo how are you today plz call any time you are free want to talk imo to you";
$subject="call me";
$_SESSION['userid']=1;
include("db.php");
$obj=new DB;
//$sql="select * from category";
//$cats=$obj->getTable($sql);
echo $inssql="insert into email_tbl set `To`='".$id."',`From`=".$_SESSION['userid'].", Subject='".$subject."' ,Content='".$msg."',Date=Now(),published='0'";
echo $results=$obj->insertdelSql($inssql);
///////////////////////////////////////////////////////////////////////////////////////////////////
//// End savemsg.php
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
//// sent.php
///////////////////////////////////////////////////////////////////////////////////////////////////
<?php
$leftTop="Muna Sent List";
include("afterloginheader.php");
include("db.php");
$obj=new DB;
//$sql="select * from userlogin where useremail='$useremail' and password='$userpassword'";
//$results=$obj->getTable($sql);
?>
<form action="#" method="post">
<table border="1" width="65%" align="center" style="background-color:#FFCCCC">
<tr>
<th><strong><input type="checkbox" id="selectAll" onclick="chkall()"/></strong></th>
<th><strong>To</strong></th>
<th><strong>Subject</strong></th>
<th><strong>Date</strong></th>
<th><strong>Action</strong></th>
</tr>
<?php $sql="select * from email_tbl where `From`=".$_SESSION['userid']."";
$results=$obj->GetTable($sql);
foreach($results as $result){
?>
<tr>
<td>
<input type="checkbox" id="checkbox[]" name="checkbox[]" value="<?php echo $result['id'];?>" />
</td>
<td>
<?php echo $result['To'];?>
</td>
<td>
<?php echo $result['Subject'];?>
</td>
<td>
<?php echo $result['Date'];?>
</td>
<td>
<img src="img/del1.jpg" height="25" width="80" align="left" onclick=del(<?php echo $result['id'];?>)/>
</td>
</tr>
<?php
}
?>
</tr>
</table>
///////////////////////////////////////////////////////////////////////////////////////////////////
//// End sent.php
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
//// draft.php
///////////////////////////////////////////////////////////////////////////////////////////////////
<?php
$leftTop="Muna Draft List";
include("afterloginheader.php");
include("db.php");
$obj=new DB;
//$sql="select * from userlogin where useremail='$useremail' and password='$userpassword'";
//$results=$obj->getTable($sql);
?>
<form action="#" method="post">
<table border="1" width="65%" align="center" style="background-color:#FFCCCC">
<tr>
<th><strong><input type="checkbox" id="selectAll" onclick="chkall()"/></strong></th>
<th><strong>To</strong></th>
<th><strong>Subject</strong></th>
<th><strong>Date</strong></th>
<th><strong>Action</strong></th>
</tr>
<?php $sql="select * from email_tbl where `From`=".$_SESSION['userid']." and published='0'";
$results=$obj->GetTable($sql);
foreach($results as $result){
?>
<tr>
<td>
<input type="checkbox" id="checkbox[]" name="checkbox[]" value="<?php echo $result['id'];?>" />
</td>
<td>
<?php echo $result['To'];?>
</td>
<td>
<?php echo $result['Subject'];?>
</td>
<td>
<?php echo $result['Date'];?>
</td>
<td>
<img src="img/del1.jpg" height="25" width="80" align="left" onclick=del(<?php echo $result['id'];?>)/>
</td>
</tr>
<?php
}
?>
</tr>
</table>
///////////////////////////////////////////////////////////////////////////////////////////////////
//// End draft.php
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
//// trash.php
///////////////////////////////////////////////////////////////////////////////////////////////////
<?php
$leftTop="Muna Sent List";
include("afterloginheader.php");
include("db.php");
$obj=new DB;
//$sql="select * from userlogin where useremail='$useremail' and password='$userpassword'";
//$results=$obj->getTable($sql);
?>
<form action="#" method="post">
<table border="1" width="65%" align="center" style="background-color:#FFCCCC">
<tr>
<th><strong><input type="checkbox" id="selectAll" onclick="chkall()"/></strong></th>
<th><strong>From</strong></th>
<th><strong>Subject</strong></th>
<th><strong>Date</strong></th>
<th><strong>Action</strong></th>
</tr>
<?php $sql="select * from email_tbl where `To`=".$_SESSION['userid']." and status='delete'";
$results=$obj->GetTable($sql);
foreach($results as $result){
?>
<tr>
<td>
<input type="checkbox" id="checkbox[]" name="checkbox[]" value="<?php echo $result['id'];?>" />
</td>
<td>
<?php echo $result['From'];?>
</td>
<td>
<?php echo $result['Subject'];?>
</td>
<td>
<?php echo $result['Date'];?>
</td>
<td>
<img src="img/del1.jpg" height="25" width="80" align="left" onclick=del(<?php echo $result['id'];?>)/>
</td>
</tr>
<?php
}
?>
</tr>
</table>
///////////////////////////////////////////////////////////////////////////////////////////////////
//// End trash.php
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
//// db.php
///////////////////////////////////////////////////////////////////////////////////////////////////
<?php
class DB{
private $dbhost="localhost";
private $dbuser="root";
private $dbpass="";
private $dbname="email";
//The mysql_query function in php returns TRUE on success and FALSE on failure.
public function insertdelSql($sql){
$result=mysql_query($sql,$this->getCon());
return $result;
}
public function hc($sql,$ch){
$result=mysql_query($sql,$this->getCon());
while($res=mysql_fetch_assoc($result)){
if($res['name']==$ch){
$resarr[]=array('name'=>$res['name'],'y'=>$res['amount'],'sliced'=>"true",'selected'=>"true");
}
else{
$resarr[]=array('name'=>$res['name'],'y'=>$res['amount']);
}
}
//$res=json_encode($resarr, JSON_NUMERIC_CHECK);
return $resarr;
}
public function getTable($sql){
$result=mysql_query($sql,$this->getCon());
while($row=mysql_fetch_array($result)){
$resarr[]=$row;
}
return $resarr;
}
public function getCon(){
$con=mysql_connect($this->dbhost,$this->dbuser,$this->dbpass);
mysql_select_db($this->dbname,$con)or
die(mysql_error("can't connect db"));
return $con;
}
}//class end
//// End db.php
///////////////////////////////////////////////////////////////////////////////////////////////////



No comments:
Post a Comment