420 lines
20 KiB
PHP
420 lines
20 KiB
PHP
<?PHP
|
|
|
|
include("config.php");
|
|
|
|
if(!is_admin($user)){
|
|
header('Location:'.$site_url.'/');
|
|
}
|
|
|
|
if(!is_logged_in($user)){
|
|
header('Location: '.$site_url);
|
|
exit();
|
|
}
|
|
|
|
$useruid = base64_decode($_SESSION['user_id']);
|
|
|
|
// set the page title
|
|
$pagetitle = "Create Advertiser Account";
|
|
|
|
// set meta tags
|
|
$meta_keywords = "create advertiser account";
|
|
$meta_description = "create advertiser account for slowtwitch advertising.";
|
|
|
|
if($_POST[edit_account] == true){
|
|
include("advertiser_edit_X.php");
|
|
} elseif ($_POST[returning_to_edit] == true) {
|
|
$account_id = $_POST[account_id];
|
|
} elseif (isset($_GET[account_id])) {
|
|
$account_id = $_GET[account_id];
|
|
$sql = "SELECT * FROM io_account WHERE account_id = \"".$account_id."\" LIMIT 1";
|
|
$fetch = mysql_fetch_array(mysql_query($sql)) OR die(mysql_error());
|
|
//var_dump($fetch);
|
|
$_POST = $fetch;
|
|
} elseif (isset($_POST[account_id])) {
|
|
$account_id = $_POST[account_id];
|
|
$sql = "SELECT * FROM io_account WHERE account_id = \"".$account_id."\" LIMIT 1";
|
|
//var_dump($fetch);
|
|
$fetch = mysql_fetch_array(mysql_query($sql)) OR die(mysql_error());
|
|
$_POST = $fetch;
|
|
} else {
|
|
header('Location:'.$site_url.'?error=no_account_id_for_edit/');
|
|
}
|
|
|
|
/*
|
|
|
|
account_id
|
|
account_user_id_fk
|
|
account_advertiser
|
|
account_contact
|
|
account_phone
|
|
account_email
|
|
account_other
|
|
account_invoice
|
|
account_notes
|
|
|
|
*/
|
|
|
|
?>
|
|
|
|
<? include("include_common_head.php"); ?>
|
|
|
|
<?
|
|
|
|
if($_POST[edit_account] == true){
|
|
include("advertiser_edit_X.php");
|
|
}
|
|
|
|
?>
|
|
|
|
<body class="listings">
|
|
<? include($common_path . "/ads/ad_wallpaper.html"); ?>
|
|
|
|
<div class="container">
|
|
<? include($common_path . "/templates/include_header.php"); ?>
|
|
<div class="main">
|
|
<div class="contentwrapper clearfix">
|
|
<? include("include_breadcrumb.php"); ?>
|
|
|
|
<section class="section listings section-has-widgets section-static remove-sidebar">
|
|
<div class="sidebar-b">
|
|
<? include("include_sidebar.php"); ?>
|
|
</div>
|
|
|
|
<div class="content content-has-widgets">
|
|
<div class="grid">
|
|
|
|
<div class="clearfix">
|
|
|
|
<?
|
|
if( $insert_success == true || $_GET[confirmed] == "yes" ) { ?>
|
|
<h1 class="content-title"><strong>Thank you</strong></h1>
|
|
<p class="cont">Thank you. The advertiser account information for <? echo ("$advertiser"); ?> has been entered. You will now be redirected to the IO Insertion Order Add page.</p>
|
|
<?
|
|
$jump_sql = "SELECT * FROM io_account WHERE account_id = \"".$advertiser."\" LIMIT 1";
|
|
$jump_fetch = mysql_fetch_array(mysql_query($jump_sql)) OR die(mysql_error());
|
|
$account_id = $jump_fetch[account_id];
|
|
?>
|
|
<? $meta_jump = "<META HTTP-EQUIV=Refresh CONTENT=\"4; URL=add.php?account_id=".$account_id."\"";
|
|
echo $meta_jump;
|
|
unset($insert_success);
|
|
unset($confirm_account);
|
|
?>
|
|
<? } else if( $confirm_account == true ) { ?>
|
|
<h1 class="content-title"><strong>Admin: Edit Advertiser Account: Step 2 of 2</strong></h1>
|
|
<? }else if( ($confirm_account != true) || ($_POST[edit_account] != true) ){ ?>
|
|
<h1 class="content-title"><strong>Admin: Edit Advertiser Account: Step 1 of 2</strong></h1>
|
|
<? if (!$errmsg) { ?>
|
|
<p class="cont">This is for editing advertiser accounts. <span style="color: red;">You will then be prompted to confirm your information before the information is sent to us.</span></p>
|
|
<? } else { ?>
|
|
<p class="cont"><span style="color: red;"><? echo $errmsg; ?></span></p>
|
|
<? } ?>
|
|
<? }
|
|
|
|
// begin insert form
|
|
if( (($_POST[edit_account] != true) || ($errmsg) || (($confirm_account != true) && ($_POST[insert_account] != true))) && $_GET[confirmed] != "yes") {
|
|
|
|
?>
|
|
|
|
<form enctype="multipart/form-data" action="advertiser_edit.php" method="post">
|
|
<input type="hidden" name="account_id" value="<? echo $_POST[account_id]; ?>">
|
|
<? var_dump($_POST); ?>
|
|
<div class="dtable form">
|
|
<div class="drow">
|
|
<div class="dcell name">Company/Advertiser Name</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<input value="<? echo stripslashes($_POST[account_advertiser]); ?>" type="text" name="account_advertiser" class="txt lngtext" maxlength="80">
|
|
</div>
|
|
</div>
|
|
<div class="drow">
|
|
<div class="dcell name">Contact Name</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<input value="<? echo stripslashes(htmlspecialchars($_POST[account_contact])); ?>" type="text" name="account_contact" class="txt lngtext">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="drow">
|
|
<div class="dcell name">Forum User ID (<a href="http://forum.slowtwitch.com/cgi-bin/admin/db.cgi?db=User;do=search_form">Numerical</a>)</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<input value="<? echo stripslashes($_POST[account_user_id_fk]); ?>" type="text" name="account_user_id_fk" class="txt shotext">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="drow">
|
|
<div class="dcell name">Address</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<input type="text" name="account_address" value="<? echo stripslashes(htmlspecialchars($_POST[account_address])); ?>" class="txt lngtext" />
|
|
</div>
|
|
</div>
|
|
<div class="drow">
|
|
<div class="dcell name">Address 2</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<input type="text" name="account_address_two" value="<? echo stripslashes(htmlspecialchars($_POST[account_address_two])); ?>" class="txt lngtext" />
|
|
</div>
|
|
</div>
|
|
<div class="drow">
|
|
<div class="dcell name">City</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<input type="text" name="account_city" value="<? echo stripslashes(htmlspecialchars($_POST[account_city])); ?>" class="txt shotext" />
|
|
</div>
|
|
</div>
|
|
<div class="drow">
|
|
<div class="dcell name">State</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<select name="account_state">
|
|
<option value="0">Choose a State/Province</option>
|
|
<?
|
|
foreach($state_list as $key=>$value) {
|
|
if(strcmp($_POST[account_state], $value) == 0){
|
|
$str = " selected=\"selected\"";
|
|
}
|
|
echo "<option value=\"$value\"$str>$value</option>";
|
|
$str = "";
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="drow">
|
|
<div class="dcell name">Zip/Postal Code</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<input type="text" name="account_zip" value="<? echo stripslashes(htmlspecialchars($_POST[account_zip])); ?>" class="txt shotext" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="drow">
|
|
<div class="dcell name">Phone</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<input value="<? echo stripslashes(htmlspecialchars($_POST[account_phone])); ?>" type="text" name="account_phone" class="txt shotext">
|
|
</div>
|
|
</div>
|
|
<div class="drow">
|
|
<div class="dcell name">E-mail</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<input value="<? echo stripslashes(htmlspecialchars($_POST[account_email])); ?>" type="text" name="account_email" class="txt midtext">
|
|
</div>
|
|
</div>
|
|
<div class="drow">
|
|
<div class="dcell name">Other Contacts</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<input value="<? echo $_POST[account_other]; ?>" type="text" name="account_other" class="txt lngtext">
|
|
</div>
|
|
</div>
|
|
<script language="JavaScript">
|
|
function toggle(source) {
|
|
checkboxes = document.getElementsByName('account_invoice[]');
|
|
for(var i=0, n=checkboxes.length;i<n;i++) {
|
|
checkboxes[i].checked = source.checked;
|
|
}
|
|
}
|
|
</script>
|
|
<div class="drow">
|
|
<div class="dcell name">Invoice Via</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<? if(isset($_POST[account_invoice]) && !is_array($_POST[account_invoice])) { $_POST[account_invoice] = explode(",", $_POST[account_invoice]); }?>
|
|
<input type="checkbox" name="account_invoice[]" value="0" <? if(in_array("0", $_POST[account_invoice])) {echo "checked";} ?>>Snail
|
|
<input type="checkbox" name="account_invoice[]" value="1" <? if(in_array("1", $_POST[account_invoice])) {echo "checked";} ?>>Email
|
|
<input type="checkbox" onClick="toggle(this)" <? if(in_array("0", $_POST[account_invoice]) && in_array("1", $_POST[account_invoice])) {echo "checked";} ?>>Both
|
|
<? /* need to insert checking in case of edit here on the value side */ ?>
|
|
</div>
|
|
</div>
|
|
<div class="drow">
|
|
<div class="dcell name">Notes</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<textarea name="account_notes" rows="7" class="txt lngtext" placeholder="Any additional notes go here."><? if($_POST[account_notes]){ echo strip_tags(stripslashes($_POST[account_notes])); } ?></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="drow actions">
|
|
<div class="dcell name"></div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<input type="submit" value="Submit" class="btn">
|
|
<input type="hidden" name="edit_account" value="true">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<? }
|
|
// end insert form
|
|
|
|
// begin confirmation form
|
|
if($confirm_account == true){
|
|
|
|
?>
|
|
Please confirm your information. If everything is correct, click the submit button. Otherwise, you may click the edit button to change your information before submitting.</div>
|
|
<br />
|
|
|
|
<div class="dtable form">
|
|
<div class="drow">
|
|
<div class="dcell name">Company/Advertiser Name</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<? echo stripslashes($_POST[account_advertiser]); ?>
|
|
</div>
|
|
</div>
|
|
<div class="drow">
|
|
<div class="dcell name">Contact Name</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<? echo stripslashes(htmlspecialchars($_POST[account_contact])); ?>
|
|
</div>
|
|
</div>
|
|
<div class="drow">
|
|
<div class="dcell name">Forum ID</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<? echo stripslashes(htmlspecialchars($_POST[account_user_id_fk])); ?>
|
|
</div>
|
|
</div>
|
|
<div class="drow">
|
|
<div class="dcell name">Address </div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value"><? echo stripslashes(htmlspecialchars($_POST[account_address])); ?></div>
|
|
</div>
|
|
<div class="drow">
|
|
<div class="dcell name">Address 2</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value"><? echo stripslashes(htmlspecialchars($_POST[account_address_two])); ?></div>
|
|
</div>
|
|
<div class="drow">
|
|
<div class="dcell name">City</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value"><? echo stripslashes(htmlspecialchars($_POST[account_city])); ?></div>
|
|
</div>
|
|
<div class="drow">
|
|
<div class="dcell name">State</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value"><? echo stripslashes(htmlspecialchars($_POST[account_state])); ?></div>
|
|
</div>
|
|
<div class="drow">
|
|
<div class="dcell name">Zip</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value"><? echo stripslashes(htmlspecialchars($_POST[account_zip])); ?></div>
|
|
</div>
|
|
<div class="drow">
|
|
<div class="dcell name">Phone</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<? echo stripslashes(htmlspecialchars($_POST[account_phone])); ?>
|
|
</div>
|
|
</div>
|
|
<div class="drow">
|
|
<div class="dcell name">Email</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<? echo stripslashes(htmlspecialchars($_POST[account_email])); ?>
|
|
</div>
|
|
</div>
|
|
<div class="drow">
|
|
<div class="dcell name">Other Contacts</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<? echo $_POST[account_other]; ?>
|
|
</div>
|
|
</div>
|
|
<div class="drow">
|
|
<div class="dcell name">Invoice Via</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<?
|
|
|
|
$certification_list = "";
|
|
foreach($_POST[account_invoice] as $value) {
|
|
if ($value == "0") $certification_list = $certification_list."Snail, ";
|
|
if ($value == "1") $certification_list = $certification_list."Email";
|
|
};
|
|
|
|
$certification_list = rtrim($certification_list, ', ');
|
|
|
|
echo $certification_list;
|
|
|
|
?>
|
|
</div>
|
|
</div>
|
|
<div class="drow">
|
|
<div class="dcell name">General Info</div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<? echo strip_tags(stripslashes($_POST[account_notes])) ?>
|
|
</div>
|
|
</div>
|
|
<div class="drow actions">
|
|
<div class="dcell name"></div>
|
|
<div class="dcell divider"></div>
|
|
<div class="dcell value">
|
|
<form action="advertiser_edit.php" method="post">
|
|
<input type="hidden" name="account_id" value="<? echo stripslashes(htmlspecialchars($_POST[account_id])); ?>">
|
|
<input type="hidden" name="account_advertiser" value="<? echo stripslashes(htmlspecialchars($_POST[account_advertiser])); ?>">
|
|
<input type="hidden" name="account_contact" value="<? echo stripslashes(htmlspecialchars($_POST[account_contact])); ?>">
|
|
<input type="hidden" name="account_user_id_fk" value="<? echo $_POST[account_user_id_fk]; ?>">
|
|
<input type="hidden" name="account_address" value="<? echo stripslashes(htmlspecialchars($_POST[account_address])); ?>">
|
|
<input type="hidden" name="account_address_two" value="<? echo stripslashes(htmlspecialchars($_POST[account_address_two])); ?>">
|
|
<input type="hidden" name="account_city" value="<? echo stripslashes(htmlspecialchars($_POST[account_city])); ?>">
|
|
<input type="hidden" name="account_state" value="<? echo $_POST[account_state]; ?>">
|
|
<input type="hidden" name="account_zip" value="<? echo $_POST[account_zip]; ?>">
|
|
<input type="hidden" name="account_phone" value="<? echo $_POST[account_phone]; ?>">
|
|
<input type="hidden" name="account_email" value="<? echo $_POST[account_email]; ?>">
|
|
<input type="hidden" name="account_other" value="<? echo $_POST[account_other]; ?>">
|
|
<input type="hidden" name="account_invoice" value="<? echo(implode(',', $_POST[account_invoice])); ?>">
|
|
<input type="hidden" name="account_notes" value="<? echo stripslashes(htmlspecialchars($_POST[account_notes])); ?>">
|
|
<input type="hidden" name="edit_account" value="true">
|
|
<input type="hidden" name="insert_account" value="true">
|
|
<input type="submit" name="submit" value="Submit Info" class="btn float-left" style="margin-right: 5px;"/>
|
|
</form>
|
|
<form action="advertiser_edit.php" method="post">
|
|
<input type="hidden" name="account_id" value="<? echo stripslashes(htmlspecialchars($_POST[account_id])); ?>">
|
|
<input type="hidden" name="account_advertiser" value="<? echo stripslashes(htmlspecialchars($_POST[account_advertiser])); ?>">
|
|
<input type="hidden" name="account_contact" value="<? echo stripslashes(htmlspecialchars($_POST[account_contact])); ?>">
|
|
<input type="hidden" name="account_user_id_fk" value="<? echo $_POST[account_user_id_fk]; ?>">
|
|
<input type="hidden" name="account_address" value="<? echo stripslashes(htmlspecialchars($_POST[account_address])); ?>">
|
|
<input type="hidden" name="account_address_two" value="<? echo stripslashes(htmlspecialchars($_POST[account_address_two])); ?>">
|
|
<input type="hidden" name="account_city" value="<? echo stripslashes(htmlspecialchars($_POST[account_city])); ?>">
|
|
<input type="hidden" name="account_state" value="<? echo $_POST[account_state]; ?>">
|
|
<input type="hidden" name="account_zip" value="<? echo $_POST[account_zip]; ?>">
|
|
<input type="hidden" name="account_phone" value="<? echo $_POST[account_phone]; ?>">
|
|
<input type="hidden" name="account_email" value="<? echo $_POST[account_email]; ?>">
|
|
<input type="hidden" name="account_other" value="<? echo $_POST[account_other]; ?>">
|
|
<input type="hidden" name="account_invoice" value="<? echo(implode(',', $_POST[account_invoice])); ?>">
|
|
<input type="hidden" name="account_notes" value="<? echo stripslashes(htmlspecialchars($_POST[account_notes])); ?>">
|
|
<input type="hidden" name="confirm_account" value="0">
|
|
<input type="hidden" name="returning_to_edit" value="1">
|
|
<input type="submit" name="submit" value="Edit Information" class="btn float-left" />
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?
|
|
}
|
|
//end confirmation form
|
|
?>
|
|
|
|
</div><!-- end col-2/3 -->
|
|
|
|
</div><!-- end grid -->
|
|
</div><!-- end content -->
|
|
</section>
|
|
|
|
|
|
</div><!-- end contentwrapper -->
|
|
</div> <!-- end main -->
|
|
|
|
<? include($common_path . "/templates/include_footer.php") ?>
|
|
</div> <!-- container -->
|
|
</body>
|
|
<? include($common_path . "/templates/include_global_js.php") ?>
|
|
</html>
|