PHP Classes

File: getcode.php

Recommend this page to a friend!
  Classes of Muhammad Faryad   PHP Key Generation System   getcode.php   Download  
File: getcode.php
Role: Example script
Content type: text/plain
Description: Gets Code from PC
Class: PHP Key Generation System
Generate and validate keys attached to MAC address
Author: By
Last change:
Date: 9 years ago
Size: 2,299 bytes
 

Contents

Class file image Download
<html>
<head>
<title> Code Generation Page</title>
<style type="text/css">
body{
      display: block;
    margin: 0 auto;
    width: 60%;
    text-align: center;
    margin-top: 2%;
}
.box{
    display: block;
    margin: 0 auto;
    width: 450px;
    border: 1px solid #D6D6D6;
    background-color: #F3F3F3;
    height: auto;
    padding: 20px;
  
    }
h1{
font-family: sans-serif;
font-size: 20px;
color: olive;
}
.code{
    font-family: sans-serif;
    font-size: 50px;
    color: green;
}
.textbox {
    display:block;
    padding: 5px;
    width: 320px;
    float:left;
     margin-right: 10px;
     font-weight: bold;
}
.btn {
    display:block;
    width: 100px;
    float:left;
    border: solid 1px #ECEAE8;
    padding: 4px;
}
.success {
    display:block;
    width: 300px;
    border: solid 1px #ECEAE8;
    padding: 4px;
    background-color: green;
    color: white;
    font-size: 15px;
    margin-top: 10px;
        font-weight: bold;
}
.error {
    display:block;
    width: 300px;
    border: solid 1px #ECEAE8;
    padding: 4px;
    background-color:red;
    color: white;
    font-size: 15px;
    margin-top: 10px;
        font-weight: bold;
}
</style>
</head>
<body>
<?php
include "my_class.php";
?>
<h1>Your Code for this Computer is : - </h1>
<?php
$get_code
= new my_keys();
?>
<div class="code"> <?php echo $get_code->getCode(); ?></div>
<?php
?>
<h4>Please send above code to the developer of this software. He will send you another key. You should add that key into below textbox.</h4>
<div class="box">
<form action="getcode.php?action=addkey" method="post">
<input name="code" type="text" class="textbox" />
<input type="submit" class="btn" value="Save Key" />
</form>
<?php
if(isset($_GET['action'])=='addkey'){
$key = $_POST['code'];
if(
$key==''){echo "<br><div class='error'>Sorry blank records can't be added.</div>";} else {

$chk = $get_code->chkkey($key);
if(
$chk=='ok'){
  
$get_code->addkey($key);
    echo
"<br><div class='success'>Key has been added successfully. Please click <a href='index.php'>HERE</a></div>";
    }
    else {echo
"<br><div class='error'>Sorry key is not macthing.</div>";}


}}
else {
echo
"";
}
?>
</div>
</body>
</html>