discourse-legacysite-perl/site/slowtwitch.com/www/adio/create.php
2024-06-17 22:30:36 +10:00

422 lines
19 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.";
/*
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[add_account] == true){
include("create_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: Create Advertiser Account: Step 2 of 2</strong></h1>
<? }else if( ($confirm_account != true) || ($_POST[add_account] != true) ){ ?>
<h1 class="content-title"><strong>Admin: Create Advertiser Account: Step 1 of 2</strong></h1>
<? if (!$errmsg) { ?>
<p class="cont">In order to make advertisement insertion order requests, you need to create an advertiser account which will be tagged to your forum user profile. Simply fill out the form below. Be sure to fill out every field. After filling out each field, click submit. <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[add_account] != true) || ($errmsg) || (($confirm_account != true) && ($_POST[insert_account] != true))) && $_GET[confirmed] != "yes") {
?>
<form enctype="multipart/form-data" action="create.php" method="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[advertiser]); ?>" type="text" name="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[contact])); ?>" type="text" name="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[forumid]); ?>" type="text" name="forumid" 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="address" value="<? echo stripslashes(htmlspecialchars($_POST[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="address_two" value="<? echo stripslashes(htmlspecialchars($_POST[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="city" value="<? echo stripslashes(htmlspecialchars($_POST[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="state">
<option value="0">Choose a State/Province</option>
<?
foreach($state_list as $key=>$value) {
if(strcmp($_POST[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="zip" value="<? echo stripslashes(htmlspecialchars($_POST[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[phone])); ?>" type="text" name="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[email])); ?>" type="text" name="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[other]; ?>" type="text" name="other" class="txt lngtext">
</div>
</div>
<script language="JavaScript">
function toggle(source) {
checkboxes = document.getElementsByName('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[invoice])) { $_POST[invoice] = explode(",", $_POST[invoice]); }?>
<input type="checkbox" name="invoice[]" value="0" <? if(in_array("0", $_POST[invoice])) {echo "checked";} ?>>Snail
<input type="checkbox" name="invoice[]" value="1" <? if(in_array("1", $_POST[invoice])) {echo "checked";} ?>>Email
<input type="checkbox" onClick="toggle(this)" <? if(in_array("0", $_POST[invoice]) && in_array("1", $_POST[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="notes" rows="7" class="txt lngtext" placeholder="Any additional notes go here."><? if($_POST[notes]){ echo strip_tags(stripslashes($_POST[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="add_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[advertiser]); ?>
</div>
</div>
<? // check the db for similar matches
$name_tag = strtolower(str_replace(" ","", $_POST['advertiser']));
$name_superstart = substr($name_tag, 0, 4);
$name_superend = substr($name_tag, -4, 4);
$name_supermid = substr($name_tag, ((strlen($name_tag))/2 - 2), 4);
//echo $name_supermid;
$match_sql = "SELECT * FROM io_account WHERE (account_advertiser LIKE '%".$name_superstart."%' OR account_advertiser LIKE '%".$name_superend."%' OR account_advertiser LIKE '%".$name_supermid."%')";
//echo $match_sql;
$match_fetch = mysql_query($match_sql) OR die(mysql_error());
$i = false;
while ($match_row = mysql_fetch_array($match_fetch)) {
similar_text($match_row['account_name'], $_POST['name'], $percent);
if ($percent >= 50) {
if ($i == false) {
echo ("<tr><td align=\"right\">Duplicate Alert:</td><td>");
}
if ($i == true) {echo ("<br />");}
echo ($match_row['account_name']."(Similarity: ".(round($percent, 0))."%)");
$i = true;
}
}
if ($i == true) { echo("</td></tr>"); }
?>
<div class="drow">
<div class="dcell name">Contact Name</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[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[forumid])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Address </div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo stripslashes(htmlspecialchars($_POST[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[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[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[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[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[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[email])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Other Contacts</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo $_POST[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[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[notes])) ?>
</div>
</div>
<div class="drow actions">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<form action="create.php" method="post">
<input type="hidden" name="advertiser" value="<? echo stripslashes(htmlspecialchars($_POST[advertiser])); ?>">
<input type="hidden" name="contact" value="<? echo stripslashes(htmlspecialchars($_POST[contact])); ?>">
<input type="hidden" name="forumid" value="<? echo $_POST[forumid]; ?>">
<input type="hidden" name="address" value="<? echo stripslashes(htmlspecialchars($_POST[address])); ?>">
<input type="hidden" name="address_two" value="<? echo stripslashes(htmlspecialchars($_POST[address_two])); ?>">
<input type="hidden" name="city" value="<? echo stripslashes(htmlspecialchars($_POST[city])); ?>">
<input type="hidden" name="state" value="<? echo $_POST[state]; ?>">
<input type="hidden" name="zip" value="<? echo $_POST[zip]; ?>">
<input type="hidden" name="phone" value="<? echo $_POST[phone]; ?>">
<input type="hidden" name="email" value="<? echo $_POST[email]; ?>">
<input type="hidden" name="other" value="<? echo $_POST[other]; ?>">
<input type="hidden" name="invoice" value="<? echo(implode(',', $_POST[invoice])); ?>">
<input type="hidden" name="notes" value="<? echo stripslashes(htmlspecialchars($_POST[notes])); ?>">
<input type="hidden" name="add_account" value="true">
<input type="hidden" name="insert_account" value="true">
<input type="hidden" name="submitted_by" value="<? echo $useruid; ?>" >
<input type="submit" name="submit" value="Submit Info" class="btn float-left" style="margin-right: 5px;"/>
</form>
<form action="create.php" method="post">
<input type="hidden" name="advertiser" value="<? echo stripslashes(htmlspecialchars($_POST[advertiser])); ?>">
<input type="hidden" name="contact" value="<? echo stripslashes(htmlspecialchars($_POST[contact])); ?>">
<input type="hidden" name="forumid" value="<? echo $_POST[forumid]; ?>">
<input type="hidden" name="address" value="<? echo stripslashes(htmlspecialchars($_POST[address])); ?>">
<input type="hidden" name="address_two" value="<? echo stripslashes(htmlspecialchars($_POST[address_two])); ?>">
<input type="hidden" name="city" value="<? echo stripslashes(htmlspecialchars($_POST[city])); ?>">
<input type="hidden" name="state" value="<? echo $_POST[state]; ?>">
<input type="hidden" name="zip" value="<? echo $_POST[zip]; ?>">
<input type="hidden" name="phone" value="<? echo $_POST[phone]; ?>">
<input type="hidden" name="email" value="<? echo $_POST[email]; ?>">
<input type="hidden" name="other" value="<? echo $_POST[other]; ?>">
<input type="hidden" name="invoice" value="<? echo(implode(',', $_POST[invoice])); ?>">
<input type="hidden" name="notes" value="<? echo stripslashes(htmlspecialchars($_POST[notes])); ?>">
<input type="hidden" name="confirm_account" value="0">
<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>