
my.php
Code: Select all
<?php
$path="../";
// Includes
include($path . 'includes/data.php');
include($path . 'includes/date.php');
include($path . 'includes/pages/leftside.php');
include($path . 'includes/userinfo.php');
// Opens Template To $page
$filename=$path . "includes/layouts/other.tpl";
$page = implode("", @file($filename));
/////////////////
$where="<a href='my.php'>My Account Home</a> >";
if(! empty($_GET['id'])){
$id=$_GET['id'];
}
$content[]=implode("\n",file('my_menu.php'));
if(isset($id)){
switch($id){
case 1:
$where.=" Acount Settings";
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
include('my_settings.php');
function show() {
$line['pi_namef']=$_POST['pi_namef'];
$line['pi_namel']=$_POST['pi_namel'];
$line['pi_address']=$_POST['pi_address'];
$line['pi_city']=$_POST['pi_city'];
$line['pi_state']=$_POST['pi_state'];
$line['pi_zip']=$_POST['pi_zip'];
$line['pi_phone']=$_POST['pi_phone'];
$line['pi_fax']=$_POST['pi_fax'];
$line['pi_email']=$_POST['pi_email'];
$line['pi_school']=$_POST['pi_school'];
$line['cc_cardtype']=$_POST['cc_cardtype'];
$line['cc_number']=$_POST['cc_number'];
$line['cc_sn']=$_POST['cc_sn'];
$line['cc_date1']=$_POST['cc_date1'];
$line['cc_date2']=$_POST['cc_date2'];
$line['cc_name']=$_POST['cc_name'];
$line['si_name']=$_POST['si_name'];
$line['si_address']=$_POST['si_address'];
$line['si_city']=$_POST['si_city'];
$line['si_state']=$_POST['si_state'];
$line['si_zip']=$_POST['si_zip'];
$line['si_phone']=$_POST['si_phone'];
$line['si_fax']=$_POST['si_fax'];
$line['si_email']=$_POST['si_email'];
$line['si_same']=$_POST['si_same'];
include('my_settings.php');
}
function check() {
if($_POST['pi_namef']==''){
$error[ ]='Please Enter Your First Name';
}
if($_POST['pi_namel']==''){
$error[ ]='Please Enter Your Last Name';
}
if($_POST['pi_namef']==''){
$error[ ]='Please Enter Your First, and Last Name';
}
if($_POST['pi_school']==''){
$error[ ]='Please enter the School, where you participate in BPA.';
}
if($_POST['pi_address']==''){
$error[ ]='Please Enter your personal address';
}
if($_POST['pi_city']==''){
$error[ ]='Please Enter the city which you currently live in.';
}
if(preg_match('/\d{5}/', $_POST['pi_zip'])){
}else{
$error[ ]='Please Enter Your 5 digit zip code.';
}
if(preg_match('/\d{1}-\d{3}-\d{3}-\d{4}/', $_POST['pi_phone'])){
}else{
$error[ ]='Please Enter 11 your digit phone number.';
}
if($error){
foreach($error as $errors){
$content[] = $errors;
$content[] = '<br>';
}
show();
}else{
postem();
}
}
function postem() {
$id=$_SESSION['user'];
$pi_namef=$_POST['pi_namef'];
$pi_namel=$_POST['pi_namel'];
$pi_address=$_POST['pi_address'];
$pi_city=$_POST['pi_city'];
$pi_state=$_POST['pi_state'];
$pi_zip=$_POST['pi_zip'];
$pi_phone=$_POST['pi_phone'];
$pi_fax=$_POST['pi_fax'];
$pi_email=$_POST['pi_email'];
$pi_school=$_POST['pi_school'];
$cc_cardtype=$_POST['cc_cardtype'];
$cc_number=$_POST['cc_number'];
$cc_sn=$_POST['cc_sn'];
$cc_date1=$_POST['cc_date1'];
$cc_date2=$_POST['cc_date2'];
$cc_name=$_POST['cc_name'];
$si_name=$_POST['si_name'];
$si_address=$_POST['si_address'];
$si_city=$_POST['si_city'];
$si_state=$_POST['si_state'];
$si_zip=$_POST['si_zip'];
$si_phone=$_POST['si_phone'];
$si_fax=$_POST['si_fax'];
$si_email=$_POST['si_email'];
$si_same=$_POST['si_same'];
$query = "UPDATE users SET
pi_namef='$pi_namef',
pi_namel='$pi_namel',
pi_address='$pi_address',
pi_city='$pi_city',
pi_state='$pi_state',
pi_zip='$pi_zip',
pi_phone='$pi_phone',
pi_fax='$pi_fax',
pi_email='$pi_email',
pi_school='$pi_school',
cc_cardtype='$cc_cardtype',
cc_number='$cc_number',
cc_sn='$cc_sn',
cc_date1='$cc_date1',
cc_date2='$cc_date2',
cc_name='$cc_name',
si_name='$si_name',
si_address='$si_address',
si_city='$si_city',
si_state='$si_state',
si_zip='$si_zip',
si_phone='$si_phone',
si_fax='$si_fax',
si_email='$si_email',
si_same='$si_same'
WHERE id=$id";
/* print '<br>';
print $query;
print '<br>'; */
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
if($result == 1) {
$content[] = ' <strong>You have Successfully updated your prefrences.</strong>';
$content[] = '<br><br><br><br><br><br>';
}else{
$conent[] = 'Update Failed, click <a href="/NTS_am/my.php?id=1">here</a> to try again,<br>/n but we are sorry for this inconvience.';
}
}
if(isset($_POST['Submit'])){
check();
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
break;
case 2:
$where.=" Order Info";
break;
case 3:
$where.=" Shopping Info";
break;
}
}
$content = implode("\n",$content);
// Replace Everyting in Template
$content=preg_replace("/{Name}/",$line['u_name'],$content);
$content=preg_replace("/{Date}/",$date,$content);
$content=preg_replace("/{Where}/",$where,$content);
$menu = implode("",file('../includes/pages/main_menu.php'));
$page=preg_replace("/{Menu}/",$menu, $page);
$page=preg_replace("/{Image_thing}/",$imagething,$page);
$page=preg_replace("/{Admin}/",$admin,$page);
$page=preg_replace("/{Path}/",$path,$page);
$page=preg_replace("/{Page}/",'My Account Settings',$page);
$page=preg_replace("/{Content}/",$content,$page);
$page=preg_replace("/{Quick_links}/",$qlinks,$page);
$page=preg_replace("/{My}/",$account,$page);
$page=preg_replace("/{Cart}/",$cart,$page);
// Prints Template, with replaced stuff
print $page;
?>my_settings.php
Code: Select all
<?php
if(isset($line['si_same'])){
switch($line['si_same']){
case "yes":
$first="Checked";
break;
case "no";
$second="Checked";
break;
}
}
if(isset($line['pi_state'])){
switch ($line['pi_state']) {
case "AK":
$ak="Selected";
break;
case "AL":
$al="";
break;
case "AZ":
$az="Selected";
break;
case "CA":
$ca="Selected";
break;
case "CO":
$co="Selected";
break;
case "CT":
$ct="Selected";
break;
case "DC":
$dc="Selected";
break;
case "DE":
$de="Selected";
break;
case "FL":
$fl="Selected";
break;
case "GA":
$ga="Selected";
break;
case "HI":
$hi="Selected";
break;
case "IA":
$ia="Selected";
break;
case "ID":
$id="Selected";
break;
case "IL";
$il="Selected";
break;
case "IN":
$in="Selected";
break;
case "KS":
$ks="Selected";
break;
case "KY":
$ky="Selected";
break;
case "LA":
$la="Selected";
break;
case "MA":
$ma="Selected";
break;
case "MD":
$md="Selected";
break;
case "ME":
$md="Selected";
break;
case "MI":
$mi="Selected";
break;
case "MN":
$mn="Selected";
break;
case "MO":
$mo="Selected";
break;
case "MS":
$ms="Selected";
break;
case "MT":
$mt="Selected";
break;
case "NC":
$nc="Selected";
break;
case "ND":
$nd="Selected";
break;
case "NE":
$ne="Selected";
break;
case "NH";
$nh="Selected";
break;
case "NJ":
$nj="Selected";
break;
case "NM":
$nm="Selected";
break;
case "NV":
$nv="Selected";
break;
case "OH":
$oh="Selected";
break;
case "OK":
$ok="Selected";
break;
case "OR":
$or="Selected";
break;
case "PA":
$pa="Selected";
break;
case "PR":
$pr="Selected";
break;
case "RI":
$ri="Selected";
break;
case "SC":
$sc="Selected";
break;
case "SD":
$sd="Selected";
break;
case "TN":
$tn="Selected";
break;
case "TX":
$tx="Selected";
break;
case "UT":
$ut="Selected";
break;
case "VA":
$vs="Selected";
break;
case "VT":
$vt="Selected";
break;
case "WA":
$wa="Selected";
break;
case "WI":
$wi="Selected";
break;
case "WV":
$wv="Selected";
break;
case "WY":
$wy="Selected";
break;
}
}
if(isset($line['cc_date1'])){
switch ($line['cc_date1']) {
case "01":
$n01="Selected";
break;
case "02":
$n02="Selected";
break;
case "03":
$n03="Selected";
break;
case "04":
$n04="Selected";
break;
case "05":
$n05="Selected";
break;
case "06":
$n06="Selected";
break;
case "07":
$n07="Selected";
break;
case "08":
$n08="Selected";
break;
case "09":
$n09="Selected";
break;
case "10":
$n10="Selected";
break;
case "11":
$n11="Selected";
break;
case "12":
$n12="Selected";
break;
}
}
if(isset($line['cc_date2'])){
switch ($line['cc_date2']) {
case "005":
$n005="Selected";
break;
case "006":
$n006="Selected";
break;
case "007":
$n007="Selected";
break;
case "008":
$n008="Selected";
break;
case "009":
$n009="Selected";
break;
case "010":
$n010="Selected";
break;
case "011":
$n011="Selected";
break;
case "012":
$n012="Selected";
break;
case "013":
$n013="Selected";
break;
case "014":
$n014="Selected";
break;
case "015":
$n015="Selected";
break;
case "016":
$n016="Selected";
break;
case "017":
$n017="Selected";
break;
case "018":
$n018="Selected";
break;
}
}
if(isset($line['cc_cardtype'])){
switch($line['cc_cardtype']){
case "":
$blank='Selected';
break;
case "Visa":
$visa='Selected';
break;
case "Discover":
$dis='Selected';
break;
case "Mastercard":
$mast='Selected';
break;
case "American Express":
$ae='Selected';
break;
}
}
$content[]="<form action='my.php?id=1' method='post'>";
$content[]="<table width='401' border='0'>";
$content[]=" <tr>";
$content[]=" <td height='40' colspan='2'><strong>Personal Info</strong></td>";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td width='17'></td>";
$content[]=" <td width='105'>First Name:</td>";
$content[]="";
$content[]="<td width='265'><input name='pi_namef' type='text' id='pi_namef' value='$line[pi_namef]'></td>";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>Last Name:</td>";
$content[]="";
$content[]=" <td><input name='pi_namel' type='text' id='pi_namel' value='$line[pi_namel]'></td>";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>Address:</td>";
$content[]=" <td><input name='pi_address' type='text' id='pi_address' value='$line[pi_address]'></td>";
$content[]="";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>City:</td>";
$content[]="";
$content[]=" <td><input name='pi_city' type='text' id='pi_city' value='$line[pi_city]'></td>";
$content[]="";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>State:</td>";
$content[]="";
$content[]="<td><select name='pi_state' size='1' >";
$content[]="<option value='AK' $ak>ALASKA</option>";
$content[]="<option value='AL' $al>ALABAMA</option>";
$content[]="<option value='AR' $ar>ARKANSAS</option>";
$content[]="<option value='AZ' $az>ARIZONA</option>";
$content[]="<option value='CA' $ca>CALIFORNIA</option>";
$content[]="<option value='CO' $co>COLORADO</option>";
$content[]="<option value='CT' $ct>CONNECTICUT</option>";
$content[]="<option value='DC' $dc>DISTRICT OF COLUMBIA</option>";
$content[]="<option value='DE' $de>DELAWARE</option>";
$content[]="<option value='FL' $fl>FLORIDA</option>";
$content[]="<option value='GA' $ga>GEORGIA</option>";
$content[]="<option value='HI' $hi>HAWAII</option>";
$content[]="<option value='IA' $ia>IOWA</option>";
$content[]="<option value='ID' $id>IDAHO</option>";
$content[]="<option value='IL' $il>ILLINOIS</option>";
$content[]="<option value='IN' $in>INDIANA</option>";
$content[]="<option value='KS' $ks>KANSAS</option>";
$content[]="<option value='KY' $ky>KENTUCKY</option>";
$content[]="<option value='LA' $la>LOUISIANA</option>";
$content[]="<option value='MA' $ma>MASSACHUSETTS</option>";
$content[]="<option value='MD' $md>MARYLAND</option>";
$content[]="<option value='ME' $me>MAINE</option>";
$content[]="<option value='MI' $mi>MICHIGAN</option>";
$content[]="<option value='MN' $mn>MINNESOTA</option>";
$content[]="<option value='MO' $mo>MISSOURI</option>";
$content[]="<option value='MS' $ms>MISSISSIPPI</option>";
$content[]="<option value='MT' $mt>MONTANA</option>";
$content[]="<option value='NC' $nc>NORTH CAROLINA</option>";
$content[]="<option value='ND' $nd>NORTH DAKOTA</option>";
$content[]="<option value='NE' $ne>NEBRASKA</option>";
$content[]="<option value='NH' $hn>NEW HAMPSHIRE</option>";
$content[]="<option value='NJ' $nj>NEW JERSEY</option>";
$content[]="<option value='NM' $nm>NEW MEXICO</option>";
$content[]="<option value='NV' $nv>NEVADA</option>";
$content[]="<option value='NY' $ny>NEW YORK</option>";
$content[]="<option value='OH' $oh>OHIO</option>";
$content[]="<option value='OK' $ok>OKLAHOMA</option>";
$content[]="<option value='OR' $or>OREGON</option>";
$content[]="<option value='PA' $pa>PENNSYLVANIA</option>";
$content[]="<option value='PR' $pr>PUERTO RICO</option>";
$content[]="<option value='RI' $ri>RHODE ISLAND</option>";
$content[]="<option value='SC' $sc>SOUTH CAROLINA</option>";
$content[]="<option value='SD' $sd>SOUTH DAKOTA</option>";
$content[]="<option value='TN' $tn>TENNESSEE</option>";
$content[]="<option value='TX' $tx>TEXAS</option>";
$content[]="<option value='UT' $ut>UTAH</option>";
$content[]="<option value='VA' $va>VIRGINIA</option>";
$content[]="<option value='VT' $vt>VERMONT</option>";
$content[]="<option value='WA' $wa>WASHINGTON</option>";
$content[]="<option value='WI' $wi>WISCONSIN</option>";
$content[]="<option value='WV' $wv>WEST VIRGINIA</option>";
$content[]="<option value='WY' $wy>WYOMING</option>";
$content[]="";
$content[]=" </select></td>";
$content[]="";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>Zip:</td>";
$content[]="";
$content[]=" <td><input name='pi_zip' type='text' id='pi_zip' value='$line[pi_zip]' size='5' maxlength='5'></td>";
$content[]="";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>Phone:</td>";
$content[]="";
$content[]=" <td><input name='pi_phone' type='text' id='pi_phone' value='$line[pi_phone]' ><font size='2'>Ex. 1-517-222-5555</font></td>";
$content[]="";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>Fax:</td>";
$content[]="";
$content[]=" <td><input type='text' name='pi_fax' id='pi_fax' value='$line[pi_fax]'><font size='2'>Ex. 1-517-222-5556</font></td>";
$content[]="";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>E-mail:</td>";
$content[]="";
$content[]=" <td><input name='pi_email' type='text' id='pi_email' value='$line[pi_email]'></td>";
$content[]="";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>School:</td>";
$content[]=" <td><input name='pi_school' type='text' id='pi_school' value='$line[pi_school]'></td>";
$content[]="";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td height='40' colspan='2'><strong>Credit Card Info </strong></td>";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>Card Type:</td>";
$content[]="";
$content[]=" <td>";
$content[]="<select name='cc_cardtype' size='1'>";
$content[]="<option value='' $blank></option>";
$content[]="<option value='Visa' $visa>Visa</option>";
$content[]="<option value='Discover' $dis>Discover</option>";
$content[]="<option value='Mastercard' $mast>Mastercard</option>";
$content[]="<option value='American Express' $ae>American Express</option>";
$content[]="";
$content[]="</select>";
$content[]="</td>";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>Number:</td>";
$content[]="";
$content[]=" <td><input name='cc_number' type='text' id='cc_number' value='$line[cc_number]'></td>";
$content[]="";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>Secuity Number: </td>";
$content[]="";
$content[]=" <td><input name='cc_sn' type='text' id='cc_sn' value='$line[cc_sn]'></td>";
$content[]="";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>Expiration Date </td>";
$content[]="";
$content[]="";
$content[]="<td><select name='cc_date1' size='1'>";
$content[]="<option value='01' $n01>01</option>";
$content[]="<option value='02' $n02>02</option>";
$content[]="<option value='03' $n03>03</option>";
$content[]="<option value='04' $n04>04</option>";
$content[]="<option value='05' $n05>05</option>";
$content[]="<option value='06' $n06>06</option>";
$content[]="<option value='07' $n07>07</option>";
$content[]="<option value='08' $n08>08</option>";
$content[]="<option value='09' $n09>09</option>";
$content[]="<option value='10' $n10>10</option>";
$content[]="<option value='11' $n11>11</option>";
$content[]="<option value='12' $n12>12</option>";
$content[]="</select>";
$content[]="";
$content[]="<select name='cc_date2' size='1'>";
$content[]="<option value='005' $n005>2005</option>";
$content[]="<option value='006' $n006>2006</option>";
$content[]="<option value='007' $n007>2007</option>";
$content[]="<option value='008' $n008>2008</option>";
$content[]="<option value='009' $n009>2009</option>";
$content[]="<option value='010' $n010>2010</option>";
$content[]="<option value='011' $n011>2011</option>";
$content[]="<option value='012' $n012>2012</option>";
$content[]="<option value='013' $n013>2013</option>";
$content[]="<option value='014' $n014>2014</option>";
$content[]="<option value='015' $n015>2015</option>";
$content[]="<option value='016' $n016>2016</option>";
$content[]="<option value='017' $n017>2017</option>";
$content[]="<option value='018' $n018>2018</option>";
$content[]="</select>";
$content[]="";
$content[]="</td>";
$content[]="";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>Card Holders Name</td>";
$content[]="";
$content[]=" <td><input name='cc_name' type='text' id='cc_name' value='$line[cc_name]'></td>";
$content[]="";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td height='40' colspan='2'><strong>Shipping Info </strong></td>";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>Same As Personal Info? </td>";
$content[]="";
$content[]=" <td> <input name='si_same' type='radio' value='yes' $first>Yes<br><input name='si_same' type='radio' value='no' $second> No</td>";
$content[]="";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>Name:</td>";
$content[]="";
$content[]=" <td><input name='si_name' type='text' id='si_name' value='$line[si_name]'></td>";
$content[]="";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>Address:</td>";
$content[]="";
$content[]=" <td><input name='si_address' type='text' id='si_address' value='$line[si_address]'></td>";
$content[]="";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>City:</td>";
$content[]="";
$content[]=" <td><input name='si_city' type='text' id='si_city' value='$line[si_city]'></td>";
$content[]="";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>State:</td>";
$content[]="";
$content[]=" <td><input name='si_state' type='text' id='si_state' value='$line[si_state]'></td>";
$content[]="";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>Zip:</td>";
$content[]="";
$content[]=" <td><input name='si_zip' type='text' id='si_zip' value='$line[si_zip]'></td>";
$content[]="";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>Phone:</td>";
$content[]="";
$content[]=" <td><input name='si_phone' type='text' id='si_phone' value='$line[si_phone]'></td>";
$content[]="";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>Fax:</td>";
$content[]="";
$content[]=" <td><input name='si_fax' type='text' id='si_fax' value='$line[si_fax]'></td>";
$content[]="";
$content[]=" </tr>";
$content[]=" <tr>";
$content[]=" <td></td>";
$content[]=" <td>E-mail:</td>";
$content[]="<td><input name='si_email' type='text' id='si_email' value='$line[si_email]'></td>";
$content[]="";
$content[]=" </tr>";
$content[]="</table>";
$content[]="<blockquote>";
$content[]=" <p>";
$content[]=" <input type='submit' name='Submit' value='Save'>";
$content[]=" </p>";
$content[]="</blockquote>";
$content[]="</form>";
?>