<?
include('def.php');

$USER = $_SERVER['SCRIPT_FILENAME'];
$USER = str_replace('/home', '', $USER);
$USER = strtok($USER, '/');
//echo $USER;
// Load API class
$wrenchboard_class = 'wrenchboard_api_' . $USER . '\\WrenchBoard';
$wrenchboard = new $wrenchboard_class();

echo "TEST - SEND OFFER<br>";
define('WRENCHBOARD_JOB_OFFER_INDVI',13030);      
define('WRENCHBOARD_JOB_OFFER_GROUP',13031);    

//#define WRENCHBOARD_JOB_OFFER_INDVI     13030
//#define WRENCHBOARD_JOB_OFFER_GROUP     13031
define('WRENCHBOARD_JOB_OFFER_CONCLUDE',13035);

if ($_POST) {
        $data["offer_code"] = $_POST['offer_code'];
        $data["offer_result"] = 100;
        $data['action'] = WRENCHBOARD_JOB_OFFER_CONCLUDE;  // test EMAIL
        $data["member_id"]=3;
      
        
    
    $ret = $wrenchboard->wrenchboard_api($data, $out);
    var_dump($out);
}

//$data['email'] = "ameye+".rand(100,999)."@chiefsoft.com";
 $data['offer_code'] = "2R89783R2B";  
// $data['ses66181+2@gmail.com'] = "ses66181+2@gmail.com";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
    <head>
        <title>Offer Test Page</title>

        <style type="text/css">
            body {
                padding-left: 11em;
                font-family: Georgia, "Times New Roman",
                    Times, serif;
                color: purple;
                background-color: #d8da3d }
            ul.navbar {
                list-style-type: none;
                padding: 0;
                margin: 0;
                position: absolute;
                top: 2em;
                left: 1em;
                width: 9em }
            h1 {
                font-family: Helvetica, Geneva, Arial,
                    SunSans-Regular, sans-serif }
            ul.navbar li {
                background: white;
                margin: 0.5em 0;
                padding: 0.3em;
                border-right: 1em solid black }
            ul.navbar a {
                text-decoration: none }
            a:link {
                color: blue }
            a:visited {
                color: purple }
            address {
                margin-top: 1em;
                padding-top: 1em;
                border-top: thin dotted }
            </style>

        </head>

        <body>

            <!-- Site navigation menu -->
            <ul class="navbar">
            <li><a href="#">Home page</a>  
        </ul>

        <!-- Main content -->
        <h1>Manage Offer Test Page</h1>

        <p>Welcome to my test page!
        <form  action="#" method="POST">
            <div>
                <input type="text" name="offer_code" value="<?echo $data["offer_code"]?>" style="width: 300px;">
                <input type="submit" name="submit" value="Submit">     
            </div>

        </form>
        <p>
            <!-- Sign and date the page, it's only polite! -->
        <address>Made 5 March 2017<br>
            by myself.</address>

    </body>
</html>


