Preview: pinuser_set.php
Size: 8.93 KB
/home/jambtst2015/public_html/giraffeng.com/admin/pinuser_set.php
<?php include("includes/head.php"); ?>
<?php include("includes/header.php");
include "includes/libmail.php";?>
<?php
/*---For Add---*/
$user_id = $_REQUEST['id'];
$pin_type1=mysql_fetch_array(mysql_query("select * from user where id='".$user_id."'"));
if(empty($_POST['submit'])){ $_POST['submit']=''; }
if($_POST['submit'] == 'Save'){
$scratch_id=$_POST['scratch_id'];
$scratch_password=$_POST['scratch_password'];
$content = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>User Added</title>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0" bordercolor="#000000" style="border-collapse:collapse; margin:0 auto; border:#C4C4C4 1px solid;">
<tr>
<td colspan="5" style=" background:#DCDBDB; border-bottom: 1px solid #C4C4C4; height: 100px;">
<img width="205" height="59" style="padding:10px 0 10px 20px;" src="http://' . $_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/images/logo.png">
</td>
</tr>
<tr>
<td colspan="2">
<p style=" background-color: #7AAAF5; color: #FFFFFF; font: bold 13px Arial,Helvetica,sans-serif; padding: 10px 0; margin:4px 0 0 0; text-align: center;">Login Detail</p>
</td>
</tr>
<tr style="background:#fff;">
<td colspan="2" valign="top" height="5"></td>
</tr>
<tr style="background:#fff;">
<td colspan="2" valign="top" style=" color: #666666; font-family: Verdana,Geneva,sans-serif; font-size: 12px; padding: 0px 0px 0 5px;">Hi,<br /><br />Welcome to Giraffeng! Please login using following information.</td>
</tr>
<tr style="background:#fff;">
<td colspan="2" valign="top" height="8"></td>
</tr>
<tr style="background:#fff;">
<td colspan="2" valign="top" height="8"></td>
</tr>
<tr style="background:#fff;">
<td colspan="3" valign="top" height="8"></td>
</tr>
<tr style="background:#fff;">
<td valign="top" style=" color: #094A66; font-family: Verdana,Geneva,sans-serif; font-size: 12px; font-weight: normal; padding: 0px 0 0 10px;">Scratch ID: </td>
<td valign="top" style=" color: #666666; font-family: Verdana,Geneva,sans-serif; font-size: 12px; padding: 0px 0px 0 5px;">'.$scratch_id.'</td>
</tr>
<tr style="background:#fff;">
<td valign="top" style=" color: #094A66; font-family: Verdana,Geneva,sans-serif; font-size: 12px; font-weight: normal; padding: 0px 0 0 10px;">Scratch Password: </td>
<td valign="top" style=" color: #666666; font-family: Verdana,Geneva,sans-serif; font-size: 12px; padding: 0px 0px 0 5px;">'.$scratch_password.'</td>
</tr>
<tr style="background:#fff;">
<td colspan="2" valign="top" height="8"></td>
</tr>
<tr style="background:#fff;">
<td colspan="2" valign="top" height="8"></td>
</tr>
<tr style="background:#fff;">
<td colspan="2" valign="top" style=" color: #666666; font-family: Verdana,Geneva,sans-serif; font-size: 12px; padding: 0px 0px 0 5px;">Thanks,<br />Giraffeng</td>
</tr>
<tr style="background:#fff;">
<td colspan="2" valign="top" height="5"></td>
</tr>
<tr>
<td colspan="5" style="background:#094A66;"><p style="color: #2597C9; font-family: Arial,Helvetica,sans-serif; font-size: 11px; padding: 6px 0;
text-align: center;">© 2015 <a href="http://' . $_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/" style=" color: #ffffff; font-family: Arial,Helvetica,sans-serif; font-size: 11px;
text-decoration: none;">Giraffeng</a>. All rights reserved.</p></td>
</tr>
<td width="92"></tr>
</table>
</body>
</html>';
/*----mail-----*/
$from_address = 'Support@giraffeng.com';
//$to="Giraffeng<".$email.">";
$to=$pin_type1['email_id'];
$subject = 'user exam - Giraffeng';
$m= new Mail;
$m->From($from_address);
$m->To($to);
$m->Subject($subject);
$m->Body($content);
$m->Send();
$insSql = "insert into `pin_master` set ";
//$insSql .= "id='"."', ";
$insSql .= "`pin_type`='".$pin_type1['pin_type_id']."', ";
$insSql .= "`user_scratch_id`='".$_POST['scratch_id']."', ";
$insSql .= "`user_scratch_password`='".$_POST['scratch_password']."', ";
$insSql .= "`post_date`=now()";
//echo $insSql;
mysql_query($insSql);
$upSql = "UPDATE `user` set ";
//$insSql .= "id='"."', ";
$upSql .= "`pin_id`='".mysql_insert_id()."' ";
$upSql .= "WHERE id='".$user_id."'";
//echo $upSql;
mysql_query($upSql);
mysql_query("delete from user_payments where user_id='".$user_id."'");
header('location:pinuser.php?success=3');
exit();
/*----check username----*/
$chksql = "select `user_scratch_id` from `pin_master` where `user_scratch_id`='".$_POST['user_id']."' and id != '".$user_id."'";
$chkqry = mysql_query($chksql);
$getRow = mysql_num_rows($chkqry);
/*----end username check-*/
if($getRow > 0){
$error = 'User ID already exists.';
}
else{
if($_POST['user_id'] == ''){
$error = 'Please enter user id.';
}
else{
$insSql = "update `pin_master` set ";
$insSql .= "user_scratch_id='".mysql_real_escape_string($_POST['name'])."', ";
$insSql .= "user_scratch_password='".mysql_real_escape_string($_POST['no_of_subject'])."', ";
/* $insSql .= "full_name='".mysql_real_escape_string($_POST['full_name'])."', ";
if($_FILES['filename']['name']!=''){
$insSql .= "logo='".mysql_real_escape_string($dest_subscription_form)."', ";
}
$insSql .= "status='".$_POST['status']."', ";
$insSql .= "modify_date=now() where id = '".$exam_board_id."' "; */
//echo $insSql;exit;
mysql_query($insSql);
//include("mailuser.php");
header('location:pinuser.php?success=2&page='.$_REQUEST['page'].'');
exit();
}
}
}
else{
$_POST['name']='';
}
/*---End Add---*/
?>
<script>
function formSub(){
//alert(11111111);
document.formID.submit();
return true;
}
jQuery.noConflict();
(function($) {jQuery(document).ready(function(){
// binds form submission and fields to the validation engine
jQuery("#formID").validationEngine('attach', {
onValidationComplete: function(form, status){
//alert("The form status is: " +status+", it will never submit");
if(status == true){
//$('input[type="submit"]').attr('disabled','disabled');
return formSub();
}
}
});
});})(jQuery);
</script>
<div class="container_bottom_section tbl_cls_new">
<form name="formID" action="" method="post" id="formID" enctype="multipart/form-data">
<?php
$sql_data = mysql_fetch_array(mysql_query("SELECT * FROM exam_board_master WHERE id = '".$exam_board_id."'"));
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?php if(empty($error)){$error='';}
if($error!=''){
?>
<tr>
<td colspan="5">
<div class="error"><?php echo $error; ?></div>
</td>
</tr>
<?php } ?>
<tr>
<td valign="top">
<div class="tbl-out">
<p class="client_table">
<i class="fa fa-edit"></i> Set User Pin
</p>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="center-tbl new-tbl">
<tr>
<td align="right" valign="top" class="left_head_form">*Scratch ID</td>
<td><input name="scratch_id" type="title" class="validate[required] textfield require_field" value="<?php echo $sql_data['name']; ?>"/></td>
</tr>
<tr>
<td align="right" valign="top" class="left_head_form">*Scratch Password</td>
<td><input name="scratch_password" type="title" class="validate[required] textfield require_field" value="<?php echo $sql_data['name']; ?>"/></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
<td width="2%" valign="top"> </td>
<td width="34%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="5" align="center">
<input name="submit" type="submit" value="Save" class="require float-none org" style=" margin-bottom:10px;" onclick="return Checkfiles();" />
<input type="button" name="back" id="back" class="require float-none" value="Cancel" style=" margin-bottom:10px;" onclick="window.history.back();" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<div class="clear"></div>
</div>
<?php include("includes/footer.php"); ?>
Directory Contents
Dirs: 17 × Files: 180