Your IP : 216.73.216.26


Current Path : /home2/wtmwscom/public_html/member/
Upload File :
Current File : /home2/wtmwscom/public_html/member/pin2.php

<?php
$title= "Pins";
include 'header.php';
include_once('lib/ps_pagination.php');
$pin_type =  array('a'=>10000,'b'=>20000,'c'=>40000,'d'=>60000,'e'=>80000,'f'=>100000,'g'=>200000,'h'=>400000,'i'=>600000,'j'=>1000000,'k'=>1500000,'l'=>2000000,'m'=>3000000,'n'=>4000000,'o'=>5000000,'p'=>7000000,'q'=>10000000);
$uid = $_SESSION['userid'];
?>
<script>
function show_type(type) {
    window.location='pin.php?type='+type;
}

function transfer(){
    var len = document.myform.list.length;
    var uid = document.getElementById("uid").value;
    var type = '<?php echo $_GET['type'];?>';
    var pin_id = "";
    for(var i=0; i<len; i++){
        if(document.myform.list[i].checked==true){
            pin_id+=document.myform.list[i].value+",";
        }
    }
    var location = "pin_transfer_model.php?pin_id="+pin_id+"&uid="+uid+"&type="+type;
    //alert(location);
    window.location = location;
}
</script>
<h1>Generate E-pins</h1>
<section id="comments">
    <h3>Wallet amount <?php
    echo mysqli_fetch_object(mysqli_query($connection, "SELECT uid, email, mobile, wallet FROM user WHERE uid='$uid'"))->wallet;
    ?></h3>
    <?php echo getMessage();?>
    <form name="form" id="form" action="pin_model.php" method="post">
        <p>
            <label for="pin">Select Pin Amount <span>*</span></label>
            <select name="type" id="type" onChange="show_type(this.value);" required="required">
                <?php
                foreach($pin_type as $key => $value){
                ?>
                <option value="<?php echo $key;?>" <?php if($key==$_GET['type']){echo "selected='selected'";}?>><?php echo $value;?> INR</option>
                <?php
                }
                ?>
            </select>
          </p>
       
        <p><br />
            <input type="hidden" value="<?php echo $_GET['type'];?>"  name="type"/>
            <input style="position: relative; left: 180px;" name="submit" type="submit" id="submit" value="Generate">
        </p>
    </form>
</section>
<section id="comments">
    <h1>Manage Pins</h1>
    <?php
    $type=$_GET['type'];
    if(!isset($_GET['page'])){$i=1;}else{$i=(($_GET['page']-1)*20)+1;}
    $query= "SELECT * FROM dynamicpinnumber WHERE type='$type' AND (  uid='$uid' OR transfer_uid='$uid' OR generated_by= '".$_SESSION['loginid']."' ) ORDER BY recid DESC";
    $pager = new PS_Pagination($link, $query, 20, 5, "type=".$type);
    $pager->setDebug(true);
    $rs = $pager->paginate();
    if($rs){
    ?>
    <form name="myform">
        <table>
            <thead>
                <tr>
                    <th>check</th>
                    <th>S.No</th>
                    <th>Date of Generate</th>
                    <th>Pin Number</th>
                    <th>Pin Type</th>
                    <th>Status</th>
                    <th>Generation</th>
                </tr>
            </thead>
            <tbody>
                <?php 
                while($row=  mysqli_fetch_object($rs)){
                    $transfer = get_user_detail($row->transfer_uid);
                    $user = get_user_detail($row->uid);
                ?>
                <tr <?php if($i%2){echo "class='light'";}else{echo "class='dark'";}?>>
                    <td><input type="checkbox" name="list" value="<?php echo $row->recid;?>" <?php if($row->status=="transfer" || $row->status=="used"){echo "disabled='disabled'";}?> style="width: auto;" /></td>
                    <td><?php echo $i; ?></td>
                    <td><?php echo date("d M, Y h:i A", strtotime($row->datetime));?></td>
                    <td><?php echo $row->pinumber;?></td>
                    <td><?php echo "Rs. ".$pin_type[$row->type]."/-";?></td>
                    <td><?php if($row->status=='transfer'){echo $row->status." (".$transfer->login_id.")";}elseif($row->status=='used'){echo $row->status." (".$user->login_id.")";}else{echo $row->status;}?></td>
                    <td><?php echo $row->generated_by;?></td>
                </tr>
                <?php $i++;}?>
            </tbody>
        </table>
            <?php echo $pager->renderFullNav();?>
        <br /><br />
        <h1>Transfer Pin to Users</h1>
        <p>
            <label for="uid">Enter User Id <span>*</span></label>
            <input type="text" name="uid" id="uid" required="required" maxlength="20">
        </p>
        <p><br />
            <input style="position: relative; left: 180px;" type="button" name="submit" id="submit" onClick="transfer();" value="Transfer">
        </p>
    </form>
    <?php }?>
</section>
<?php include('footer.php');?>