daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest May 30th, 2017 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.      
  2.       <div id="box4" class="box">
  3.                     <h1 id="heading4" class="heading"><center>Edit Account</center></h1>
  4.                     <div class="content"> <br />
  5.         <?php
  6. include ('login_check.php');
  7. if ($logged_in == 0) {
  8.     ?>
  9.         You are not allowed to view this page. Please <a href="/login.php">Log
  10.         In</a> or <a href="/register.php">Register</a>.
  11.         <?php
  12. }
  13.  
  14. else {
  15. ?>
  16. <?php
  17.                     require 'db_connect.php';
  18.  
  19. session_start();
  20.     $user = $_SESSION['username'];
  21. $article = $_GET['art'];
  22.  
  23. $qrybu = "SELECT * FROM users WHERE governor_name = '".$_SESSION['username']."'";
  24. $point = mysql_query($qrybu);
  25. $db = mysql_fetch_array ($point);
  26. $regdate = $db['regdate'];
  27. $date = date('m d, Y');
  28. $newdate = $date - $regdate;
  29. $reg_date = $db['reg_date'];
  30. $reg_month = $db['reg_month'];
  31. $date = date('d');
  32. $month = date('m');
  33. $article = $_SESSION['id'];
  34.  
  35.  
  36.  
  37. if($date >= $reg_date)
  38. {
  39.  
  40.      if($reg_month != $month)
  41.         {
  42.              $newedit = "11";
  43.        
  44.        }
  45.        else
  46.        {
  47.        
  48.        $newedit = $date - $reg_date;
  49.      
  50.        }
  51.  
  52. }
  53. else
  54. {
  55.      if($reg_month != $month)
  56.         {
  57.              if($date >= 11)
  58.              {
  59.               $newedit = "11";
  60.              }
  61.              else
  62.              {
  63.                  if($reg_date <= 20)
  64.                  {
  65.                  
  66.                   $newedit = "11";
  67.                   }
  68.                   else
  69.                   {
  70.                   $newedit = $date;
  71.                   }
  72.              
  73.              
  74.              }
  75.        
  76.        }
  77.        else
  78.        {
  79.        
  80.        $newedit = "1";
  81.  
  82.        }
  83.        
  84. }
  85. ?>
  86.   <script type="text/javascript">
  87.  
  88.  
  89.  
  90.  
  91. var myConfirm = {
  92.     type: "confirm",
  93.     title: "Confirm Account Deletion",
  94.     text: "Do you really want to delete your account and all your data?",
  95.     yes_button: "Yes",
  96.     no_button: "No",
  97.     yes: function() {
  98.         window.location.href="deleteaccount.php?art=<?php echo $article; ?>";
  99.    
  100.     },
  101.     no: function() {
  102.         window.location.href="index.php?id=edit_account&art=<?php echo $article; ?>";
  103.  
  104.     }
  105. };
  106.  
  107. </script>
  108.  
  109.  
  110. <?php
  111.  
  112.     require 'db_connect.php';
  113.    
  114.         $result = mysql_query("SELECT * FROM users WHERE governor_name = '".$_SESSION['username']."'");
  115.     $myrow = mysql_fetch_array($result);
  116.     $error = $_GET['error'];
  117.     $url = $myrow['url'];
  118.     $url_seal = $myrow['url_seal'];
  119.     $seal = $myrow['seal'];
  120. ?>
  121.         <center>
  122.           Current Insignia<br />
  123.           <a href="/index.php?id=update&art=<?php echo $_SESSION['id'];?>">
  124.           <?php
  125.           if($url_seal == '1') {
  126.               ?>
  127.               <img src="<?php if ($url == ""){
  128.     echo "seals/noseal.jpg";}
  129.     else{
  130. echo $url; } ?>" width="50%" height="50%" ALT="Seal" style="border:none;">
  131. <?php } else {
  132.     ?>
  133.              
  134.          
  135.           <img src="seals/<?php if ($myrow['seal'] == ""){
  136.     echo "noseal.jpg";}
  137.     else{
  138. echo $myrow['seal']; } ?>" width="50%" height="50%" ALT="Seal" style="border:none;">
  139. <?php
  140. }
  141. ?>
  142.  
  143. </a>
  144.           <br />
  145.           <br />
  146.           *Image name may only contain letters, numbers, spaces, and underscores.
  147.           <br />
  148.           <?php
  149.           if($error == 5) {
  150.    
  151.     echo "<br /><br /><font color='#FF0000'>There was an error while trying to upload your file.  Please try again.</font><br /><br /><br />";
  152.     }
  153.    
  154.    
  155.    
  156.    
  157.    
  158.     ?>
  159.           <br />
  160.           <form enctype="multipart/form-data" action="upload.php" method="POST">
  161.             <!-- MAX_FILE_SIZE must precede the file input field -->
  162.             <input type="hidden" name="MAX_FILE_SIZE" value="3000000" />
  163.             <!-- Name of input element determines name in $_FILES array -->
  164.             Upload Seal:
  165.             <input name="file" type="file" id="file" />
  166.             <input type="radio" name="upload" value="file"><br />
  167.             <br />
  168.             Use URL:
  169.             <input name="url" type="text" id="url" />
  170.             <input type="radio" name="upload" value="url"><br />
  171.             <br />
  172.             <input type="submit" value="Upload" />
  173.           </form>
  174.         </center>
  175.         <br />
  176.         <br />
  177.         <?php include("db_connect.php"); ?>
  178.         <?php
  179.          $result = mysql_query("SELECT * FROM users WHERE governor_name = '".$_SESSION['username']."'");
  180.     $myrow = mysql_fetch_array($result);
  181.     $decree = $myrow['city_decree'];
  182.     $current_tax = $myrow['tax_rate'];
  183.     $current_continent = $myrow['continent'];
  184.         $current_government = $myrow['government'];
  185.         $current_idealism = $myrow['idealism'];
  186.         $current_capital = $myrow['capital'];
  187.     $current_alliance = $myrow['alliance'];
  188.     $last_edit_date = $myrow['last_edit_date'];
  189. $last_edit_day = $myrow['last_edit_day'];
  190. $error = $_GET['error'];
  191. $idday = $myrow['idday'];
  192. $allow_admin = $myrow['admin_email'];
  193. $peace_mode = $myrow['peace_mode'];
  194. $peace_mode_day = $myrow['peace_mode_day'];
  195.  
  196. DATE_SUB(NOW(),INTERVAL 5 DAY) = $nowday;
  197.  
  198. if($nowday >= $idday) {
  199. $govbox = "<select name='government' id='government'>
  200.             <option value='Authoritarian'>Authoritarian</option>
  201.             <option value='Republic'>Republic</option>
  202.             <option value='Oligarchy'>Oligarchy</option>
  203.             <option value='Communism'>Communism</option>
  204.             <option value='Noocracy'>Noocracy</option>
  205.           </select>";
  206. } else {
  207. $govbox = "You have changed either your government or idealism preferences in the last 5 days.";
  208. }
  209.  
  210. $day = date('z');
  211.  
  212. $days_left = ($day - $peace_mode_day);
  213. $day_left = (5 - $days_left);
  214.  
  215. if($days_left <= 5) {
  216.  
  217. $peace = "<input type='hidden' value='".$peace_mode."' name='peace_mode'>You have changed your Peace Preferences within the past 5 days, you must wait ".$day_left." more days to change this preference.";
  218. } else {
  219.  
  220. if($peace_mode == 1) {
  221. $peace = "<select name='peace_mode'><option value='1'>Your planet is being protected by the Universal Federation.  No outside entities may assault your planet.</option>
  222. <option value='0'>Your planet has defenses, but is still susceptible to attack.</option></select>";
  223. } else {
  224.  
  225. $peace = "<select name='peace_mode'><option value='0'>Your planet has some defenses, but is still susceptible to attack.</option>
  226. <option value='1'>Your planet is being protected by the Universal Federation.  No outside entities may assault your planet.</option></select>";
  227. }
  228.  
  229. if($allow_admin == yes) {
  230. $checked = "checked";
  231. } else {
  232. $checked = "";
  233. }
  234.  
  235. }
  236. ?>
  237.         <center>
  238.           Last Edit Date: <?php echo $last_edit_date; ?>
  239.         </center>
  240.         <?php
  241.         if($error == 1) {
  242.    
  243.     echo "<font color='#FF0000'>Error - Your new passwords dont match.</font><br /><br /><br />";
  244.     }
  245.    
  246.     if($error == 2) {
  247.    
  248.     echo "<font color='#FF0000'>Error - Your old password does not match with your current password.</font><br /><br /><br />";
  249.     }
  250.      
  251.           if($error == 15) {
  252.    
  253.     echo "<br /><br /><font color='#FF0000'>You have changed your Peace Preferences within the past 5 days, you must wait ".$day_left." more days to change this preference.</font><br /><br /><br />";
  254.     }
  255.    
  256.    
  257.      if($error == 17) {
  258.    
  259.     echo "<br /><br /><font color='#FF0000'>You can not join the Admin affiliation.</font><br /><br /><br />";
  260.     }
  261.    
  262.     ?>
  263.     <table width="100%">
  264.      <form enctype="multipart/form-data" action="index.php?id=update_pass&art=<?php echo $_SESSION['id'];?>" method="post">
  265.        
  266.     <tr>
  267.               <td width="40%" align="left" valign="top">Old Password:</td>
  268.               <td width="" align="left" valign="top"><input type="password"  name="old_passwd" id="old_passwd"></td>
  269.             </tr>
  270.             <tr>
  271.               <td width="40%" align="left" valign="top">New Password:</td>
  272.               <td width="" align="left" valign="top"><input type="password" name="passwd" id="passwd"></td>
  273.             </tr>
  274.             <tr>
  275.               <td width="40%" align="left" valign="top">Confirm New Password:</td>
  276.               <td width="" align="left" valign="top"><input type="password" name="passwd_confirm" id="passwd_confirm"></td>
  277.             </tr>
  278.             <tr><td></td><td>    
  279.           <input type="hidden" value="<?php echo $myrow['id']; ?>" name="id" id="id">
  280.           <input type="submit" name="Edit" value="Save Password">
  281.           </td></tr>
  282.      </form>
  283.         </table>
  284.     <br />
  285.    
  286.     <table width="100%">
  287.      <form enctype="multipart/form-data" action="index.php?id=update_account&art=<?php echo $_SESSION['id'];?>" method="post">
  288.        
  289.             <tr>
  290.               <td width="40%" align="left" valign="top">Email:</td>
  291.               <td width="" align="left" valign="top"><input type="text" value="<?php echo $myrow['email']; ?>" name="email" id="email"></td>
  292.             </tr>
  293.             <tr>
  294.               <td width="40%" align="left" valign="top">Planet Description:</td>
  295.               <td width="" align="left" valign="top"><TEXTAREA NAME="decree" COLS=40 ROWS=6>
  296. <?php echo $decree; ?>
  297. </TEXTAREA></td>
  298.             </tr>
  299.             <tr>
  300.            
  301.            
  302.               <td width="40%" align="left" valign="top">Affiliation:</td>
  303.                 <?php
  304.                            
  305.                            
  306. $usersql = mysql_query("SELECT * FROM users");
  307.  
  308.     $alliancesql = "DELETE * FROM alliance";
  309.  
  310.     $query = mysql_query($alliancesql);
  311.    
  312.     while($row = mysql_fetch_array($usersql))
  313.                 {
  314.                
  315.                
  316.                
  317.     $alliance = $row['alliance'];
  318.                            
  319.                             $query = mysql_query("SELECT * FROM users WHERE alliance='".$alliance."'") or die(mysql_error());
  320. $row = mysql_num_rows($query);
  321.  
  322. $alliance_count = $row;
  323.  
  324.                                 $query = mysql_query("SELECT SUM(city_strength) as sum_total FROM users WHERE alliance='".$alliance."'") or die(mysql_error());
  325. $row = mysql_fetch_object($query);
  326.  
  327. $alliance_strength = $row->sum_total;
  328.  
  329. $alliance_score = round(($alliance_strength / 100000) + ($alliance_count / 10), 3);
  330.                                 $query = mysql_query("SELECT * FROM alliance WHERE alliance='".$alliance."'") or die(mysql_error());
  331. $number = mysql_num_rows($query);
  332.                                
  333.                                 $str = strlen($alliance_score);
  334.                                
  335.                                 if($str < 10) {
  336.                                 if($str == 9) {
  337.                                 $alliance_score = "0".$alliance_score;                             
  338.                                 } else {
  339.                                 if($str == 8) {
  340.                                 $alliance_score = "00".$alliance_score;                            
  341.                                 } else {
  342.                                 if($str == 7) {
  343.                                 $alliance_score = "000".$alliance_score;                               
  344.                                 } else {
  345.                                 if($str == 6) {
  346.                                 $alliance_score = "0000".$alliance_score;                      
  347.                                 } else {
  348.                                 if($str == 5) {
  349.                                 $alliance_score = "00000".$alliance_score;
  350.                                 } else {
  351.                                 $alliance_score = "000000".$alliance_score;
  352.                                 }}}}}
  353.                                 } else {
  354.                                 $alliance_score = $alliance_score;
  355.                                 }
  356.                                
  357.                                
  358.                             if($alliance != "Admin" && $alliance != "None" && $alliance != "") {
  359.                                
  360.                                 if($number == 0) {
  361.                                
  362.                                     $sqldd = "INSERT INTO alliance SET alliance='".$alliance."', alliance_number='$alliance_count', alliance_score='$alliance_score', alliance_strength='$alliance_strength'";
  363.  
  364.                                     $querydd=mysql_query($sqldd);
  365.                                 } else {
  366.  
  367.            
  368.                                     $sqldd = "UPDATE alliance SET alliance_number='$alliance_count', alliance_score='$alliance_score', alliance_strength='$alliance_strength' WHERE alliance='".$alliance."'";
  369.  
  370.                                     $querydd=mysql_query($sqldd);
  371.    
  372.                                 }
  373.    
  374.                             } else {
  375.    
  376.                                 $sqldd = "DELETE * FROM alliance WHERE alliance='Admin'";
  377.                                
  378.                                
  379.                                 $sqldd = "DELETE * FROM alliance WHERE alliance=''";
  380.    
  381.                                 $sqldd = "DELETE * FROM alliance WHERE alliance='None'";
  382.                             }                      
  383.             }
  384.    
  385.    
  386.    
  387.    
  388.  
  389.         $result = mysql_query("SELECT * FROM alliance ORDER BY alliance_score DESC LIMIT 0, 10");
  390.     $row = mysql_fetch_array($result);
  391.    
  392.    
  393.  
  394.    
  395.     ?>
  396.     <script>
  397. function checkForOther(obj) {
  398.  if (!document.layers) {
  399.  var txt = document.getElementById("alliance");
  400.  if (obj.value == "other") {
  401.  txt.style.display = "inline";
  402.  // gives the text field the name of the drop-down, for easy processing
  403.  txt.name = "alliance";
  404.  obj.name = "";
  405.  } else {
  406.  txt.style.display = "none";
  407.  txt.name = "";
  408.  obj.name = "alliance";
  409.  }
  410.  }
  411. }
  412. </script>
  413.  
  414.               <td width="" align="left" valign="top">
  415.              
  416.               <select name="alliance" onchange="checkForOther(this)">
  417.             <option value="<?php echo $current_alliance; ?>"><?php echo $current_alliance; ?></option>
  418.            <?php
  419.             while($row = mysql_fetch_array($result))
  420.                 {
  421.                 $alliance = $row['alliance'];
  422.                 ?>
  423.                 <option value="<?php echo $alliance; ?>"><?php echo $alliance; ?></option>
  424.                 <?php
  425.              
  426.               }
  427.               ?>
  428.             <option value="other">Specify Other</option>
  429.           </select><br />
  430.           <input type="text" id="alliance" style="display:none;"> </td>
  431.             </tr>
  432. <tr>
  433.               <td width="40%" align="left" valign="top">Capital City:</td>
  434.               <td width="" align="left" valign="top"><input type="text" value="<?php echo $myrow['capital']; ?>" name="capital" id="capital"></td>
  435.             </tr>
  436.             <tr>
  437.               <td width="40%" align="left" valign="top">Galaxy:</td>
  438.               <td width="" align="left" valign="top"><select name="continent">
  439.             <option value="<?php echo $current_continent; ?>"><?php echo $current_continent; ?></option>
  440.             <option value="Andromeda">Andromeda</option>
  441.             <option value="Corvus">Corvus</option>
  442.             <option value="Draco">Draco</option>
  443.             <option value="Orion">Orion</option>
  444.             <option value="Phoenix">Phoenix</option>
  445.             <option value="Scorpius">Scorpius</option>
  446.             <option value="Taurus">Taurus</option>
  447.           </select></td>
  448.             </tr>
  449.     <tr>
  450.               <td width="40%" align="left" valign="top">Government:</td>
  451.               <td width="" align="left" valign="top">
  452.               <?php echo $govbox; ?>
  453.     <tr>
  454.               <td width="40%" align="left" valign="top">Idealism:</td>
  455.               <td width="" align="left" valign="top"><select name="idealism" id="idealism">
  456.             <option value="<?php echo $current_idealism; ?>"><?php echo $current_idealism; ?></option>
  457.             <option value="Aesthetics">Aesthetics</option>
  458.             <option value="Ethics">Ethics</option>
  459.             <option value="Logic">Logic</option>
  460.             <option value="Metaphysics">Metaphysics</option>
  461.             <option value="Physique">Physique</option>
  462.             <option value="Conservation">Conservation</option>
  463.           </select></td>
  464.             </tr>
  465.             <tr>
  466.               <td width="40%" align="left" valign="top">Tax Rate:</td>
  467.               <td width="" align="left" valign="top"><select name="tax_rate">
  468.             <option value="<?php echo $current_tax; ?>"><?php echo $current_tax; ?>%</option>
  469.             <option value="10">10%</option>
  470.             <option value="12">12%</option>
  471.             <option value="14">14%</option>
  472.             <option value="16">16%</option>
  473.             <option value="18">18%</option>
  474.             <option value="20">20%</option>
  475.             <option value="22">22%</option>
  476.             <option value="24">24%</option>
  477.             <option value="26">26%</option>
  478.             <option value="28">28%</option>
  479.           </select></td>
  480.             </tr>
  481.             <tr>
  482.               <td width="40%" align="left" valign="top">Peace Preferences:</td>
  483.               <td width="" align="left" valign="top">
  484.            <?php echo $peace; ?>
  485.           </td>
  486.             </tr>
  487.             <tr>
  488.               <td width="40%" align="left" valign="top">Allow Admin to email you? (Recommended)</td>
  489.               <td width="" align="left" valign="top"><input type="checkbox" name="admin_email" value="yes" <?php echo $checked; ?> /> </td>
  490.             </tr>
  491.                  <tr><td></td><td>    
  492.           <input type="hidden" value="<?php echo $myrow['id']; ?>" name="id" id="id">
  493.           <input type="submit" name="Edit" value="Save ">
  494.           </td></tr>
  495.         </form>
  496.         </table>
  497.  
  498.         <?php
  499. }
  500.  
  501. ?>
  502.       </div></div>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top