TinyPortal

Development => Support => Topic started by: MoreBloodWine on April 08, 2011, 04:56:04 AM

Title: 1.0 RC1 & whitespaces ( )
Post by: MoreBloodWine on April 08, 2011, 04:56:04 AM
http://www.myu2sig.com/forum/index.php?page=4

When I try to use white space ( ) TP spits them out as squares... What gives ?
and other stuff ? If I take the &npsp's out and use a regular space TP looks at em like there not there and removes em.

Here's the code from the article minus the DB stuff.

Edit: I've since modified the code and aside from the &nbsp thing something in the below code is now causing errors and for whatever reason referencing TPSubs.php

Edit 2: Errors fixed was backslash issue, white space thing still weird.

$skinarray = array (
"asassinscreedbrotherhood" => "Asassins Creed Brotherhood",
"aqua" => "Aqua",
"khaxel" => "Axel",
"baseballshirtdrake" => "Baseball Shirt Drake",
"cameramanjeff" => "Cameraman Jeff",
"carcover" => "Car Cover",
"tchimera" => "Chimera Hybrid",
"chimerahybrid" => "Chimera Hybrid",
"chimerahybrid2" => "Chimera Hybrid v. 2",
"chimerahybrid3" => "Chimera Hybrid v. 3",
"chimerahybrid4" => "Chimera Hybrid v. 4",
"chloewithagun" => "Chloe Frazier",
"tchloe" => "Chloe Frazier",
"coleeyes" => "Coles Eyes",
"darkterra" => "Dark Terra",
"deadexplorer" => "Dead Explorer",
"deadexplorer2" => "Dead Explorer v. 2",
"doughnutdrake" => "Doughnut Drake",
"tdrakeandchloe" => "Drake & Chloe",
"udfdrakeandelena" => "Drake & Elena",
"drakesfortune" => "Drakes Fortune",
"drakewounded" => "Drake Wounded",
"khdualweildroxas" => "Dual Weild Roxas",
"eddieraja" => "Eddie Raja",
"elenalooking" => "Elena Fisher",
"evilcole" => "Evil Cole",
"gabrielroman1" => "Gabriel Roman v. 1",
"gabrielroman2" => "Gabriel Roman v. 2",
"gabrielroman3" => "Gabriel Roman v. 3",
"gabrielroman4" => "Gabriel Roman v. 4",
"ghengiskhan1" => "Ghengis Khan v. 1",
"ghengiskhan2" => "Ghengis Khan v. 2",
"grenades" => "Grenades",
"glowzor" => "Glowzor",
"harryflynn" => "Harry Flynn",
"heilghast" => "Heilghast",
"heilghastv1" => "Heilghast v. 1",
"heilghastv2" => "Heilghast v. 2",
"theilghast1" => "Heilghast v. 1",
"theilghast2" => "Heilghast v. 2",
"herocole" => "Hero Cole",
"highrisewallhole" => "Highrise Wall Hole",
"highriseview" => "Highrise View",
"highriseview1" => "Highrise View v. 1",
"highriseview2" => "Highrise View v. 2",
"hotelview" => "Hotel View",
"inFAMOUS" => "inFAMOUS",
"jetskiexplosion" => "JetSki Explosion",
"kingmickey" => "King Mickey",
"marcopolo" => "Marco Polo",
"khmarluxia" => "Marluxia",
"mastererauqs" => "Master Erauqs",
"masterxehanort" => "Master Xehanort",
"mgsrising" => "Metal Gear Solid Rising",
"museumenterance" => "Museum Entrance",
"museumview" => "Museum View",
"museumfight" => "Museum Fight",
"museuminside" => "Museum Inside",
"pinkerton1" => "Mr. Pinkerton v. 1",
"pinkerton2" => "Mr. Pinkerton v. 2",
"nathanfighting" => "Nathan Drake v. 1",
"nathanjumping" => "Nathan Drake v. 2",
"nathanshooting" => "Nathan Drake v. 3",
"nathanwithgun" => "Nathan Drake v. 4",
"tdrake1" => "Nathan Drake v. 1",
"tdrake2" => "Nathan Drake v. 2",
"tdrake3" => "Nathan Drake v. 3",
"tdrake4" => "Nathan Drake v. 4",
"tnathanhale1" => "Nathan Hale v. 1",
"tnathanhale2" => "Nathan Hale v. 2",
"naughtydog" => "Naughty Dog",
"nepal" => "Nepal",
"nepalv2" => "Nepal v. 2",
"nepalv3" => "Nepal v. 3",
"khplain" => "Plain",
"plainnoimg" => "Plain (No Image)",
"plunderv1" => "Plunder",
"prakosopirate" => "Prakoso the Pirate",
"psublacknoimg" => "PSU Black (No Image)",
"rikaraja" => "Rika Raja",
"khroxas" => "Roxas",
"khsaix" => "Saix",
"sark" => "Sark",
"sanctuary" => "Sanctuary",
"nathanhale" => "Sgt. Nathan Hale",
"skeleton" => "Skeleton",
"sneaky" => "Sneaky",
"sora(kh1)" => "Sora (KH1)",
"sullysplane" => "Sullys Plane",
"tenzinwithgun" => "Tenzin",
"tenzinv1" => "Tenzin",
"terra" => "Terra",
"thefort" => "The Fort",
"thefortview" => "The Fort View v. 1",
"thefortview2" => "The Fort View v. 2",
"icecave1" => "The Ice Cave v. 1",
"icecave2" => "The Ice Cave v. 2",
"facility1" => "The Facility v. 1",
"facility2" => "The Facility v. 2",
"facilitywindow" => "The Facility Window",
"floodedruins1" => "The Flooded Ruins v. 1",
"floodedruins2" => "The Flooded Ruins v. 2",
"thegirls" => "The Girls",
"lostcity" => "The Lost City v. 1",
"lostcity2" => "The Lost City v. 2",
"theplaza" => "The Plaza",
"plazasky" => "The Plaza Sky",
"thetemple" => "The Temple",
"village" => "The Village",
"tsev" => "Thomas 'Sev' Sevchenko v. 1",
"tsev2" => "Thomas 'Sev' Sevchenko v. 2",
"trainride" => "Train Ride v. 1",
"trainride2" => "Train Ride v. 2",
"treewalking" => "Tree Walking",
"uncharteddrakesfortune" => "Uncharted Drakes Fortune",
"urbanwarzone" => "Urban Warzone",
"vanitas" => "Vanitas",
"ventus" => "Ventus",
"victorsullivanakasully" => "Victor Sullivan (Sully)",
"wetsuitdrake" => "Wetsuit Drake",
"khxemnas" => "Xemnas",
"khxigbar" => "Xigbar",
"khxion" => "Xion",
"youngzack(FFCCVII)" => "Young Zack (FFCCVII)",
"zeke" => "Zeke",
"zoranpissed" => "Zoran Lazarevic",
"tlazarevic" => "Zoran Lazarevic",
"zorskelv1" => "Zorskel v. 1",
"zorskelv2" => "Zorskel v. 2",
"zorskelv3" => "Zorskel v. 3",
"zorskelv4" => "Zorskel v. 4"
);

   $h = "100";
   $url = "index.php?page=4";
   $url2 = "$url;";

$numbers = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
$letters = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');

if (isset($_GET['n']))
$get_numbers = (int) $_GET['n'];
if (isset($_GET['l']))
$get_letters = (int) $_GET['l'];

$search_psn = !empty($_POST['search']) ? mysql_real_escape_string($_POST['search']) : '';

if (isset($_GET['n']))
$where = " WHERE `psnid` LIKE  '$numbers[$get_numbers]%'";
elseif(isset($_GET['l']))
$where = " WHERE `psnid` LIKE  '$letters[$get_letters]%'";
elseif(isset($_POST['search']))
$where = " WHERE `psnid` LIKE  '$search_psn%'";
else
$where = " WHERE `psnid` != ''";

   $query="SELECT * FROM `ucard` $where ORDER BY `psnid`";

   $result=mysql_query($query);

   $num=mysql_num_rows($result);

   $page = isset($_GET['p'])? (int)$_GET['p']: 1;

   mysql_close();

echo '
<style type="text/css">
table#users {
    border: solid 3px #9E853D;
}
table#users td {
    border: solid 1px #9E853D;
}
</style>
';

echo '
<style type="text/css">
     #background {
        background: url(./U2Signatures/u2generatorbackground4.jpg) top left no-repeat;
     }
     .content {
        padding-top: 1px;
        padding-left: 2px;
     }
     .span{
     color: #FF0000;
     font-weight: bold;
     background-image:url("http://www.myu2sig.com/transparent.png");
     float: left;
     }
</style>
';

echo '<div id="background"><div class="content">';

echo '
<!-- Begin ND News Ticker -->
<div>
<span class="span">Current ND News:Ã, </span>
<style type="text/css">
#ajaxticker1{
font-weight: bold;
background-image:url("http://www.myu2sig.com/transparent.png");
display: inline-block;
width: auto;
}
</style>
<script src="http://www.myu2sig.com/ndnewsticker/ajaxticker.js" type="text/javascript"></script>

<script type="text/javascript">
   // Path to ticker txt file on your server.
   var xmlfile = "http://www.eojmarket.com/tickerdata.php"
   // ajax_ticker(xmlfile, spanId, spanClass, delay, optional - fade or not)
   new ajax_ticker(xmlfile, "ajaxticker1", "someclass", 3500, "fade");
</script>
</div>
<!-- End ND News Ticker -->';

$br = strtolower($_SERVER['HTTP_USER_AGENT']);

if(ereg("msie", $br)) {
echo \'<P style="padding-top: 50px"></P>\';
}else{
echo \'<P style="padding-top: 62px"></P>\';
}

echo '<table id="users">
     <tr align="center">
   <td colspan="6">All of the data shown below is accurate as of '.date('F jS Y, g:ia T').'</td>
</tr>
<tr align="center">
   <td colspan="2">
   &nbsp;Total Unique User Count: '. number_format($num) .'&nbsp;
   </td>
   <td>
   &nbsp;'. date('M. jS') .' Daily Total: '. number_format($dailymcount) .'&nbsp;
   </td>
   <td rowspan="2">
   &nbsp;Latest Member:&nbsp;
   <br />
   &nbsp;'. date('n/j/Y g:ia T', strftime($latestmember)) .'&nbsp;
   <br />
   &nbsp;<a href="',"http://www.naughtydog.com/stats/index/", $latestmember2, '" title="User '.number_format($idnum - 1).'" target="new_page">', $latestmember2, '</a>&nbsp;
   </td>
   <td colspan="2" rowspan="2">
   ';

  $totalpages = ceil($num/$h);
   
      $prevpage = max(1, $page - 1);
  $nextpage = min($totalpages, $page + 1);
     
  echo "Page " . number_format($page) . " of " . number_format($totalpages) . "<br />";
   
  $starting_user = $i = ($page - 1) * $h + 1;
 
  echo "Results: " . number_format($starting_user) . " to " . number_format(min($starting_user+$h-1, $num)) . "<br />";

  $pg = (int) $_GET[ 'page' ];
  if ($pg == '21' && isset($_GET['n']) && $_GET['n'] == $get_numbers)
  {
if ($page > 1) {
echo '&nbsp;<a href="'.$url2.'n='.$get_numbers.'" title="First Page">First</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
echo '<a href="'.$url2.'n='.$get_numbers.';p='.$prevpage.'" title="Previous Page">Previous</a>';
      }
      else {
         echo '&nbsp;First&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
echo 'Previous';
      }

echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';

      if ($page < $totalpages) {
         echo '<a href="'.$url2.'n='.$get_numbers.';p='.$nextpage.'" title="Next Page">Next</a> ';
         echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.$url2.'n='.$get_numbers.';p='.$totalpages.'" title="Last Page">Last</a>&nbsp;';
      }
     
      else {
echo 'Next';
echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Last&nbsp;';
      }
  }
  elseif ($pg == '21' && isset($_GET['l']) && $_GET['l'] == $get_letters)
  {
if ($page > 1) {
echo '&nbsp;<a href="'.$url2.'l='.$get_letters.'" title="First Page">First</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
echo '<a href="'.$url2.'l='.$get_letters.';p='.$prevpage.'" title="Previous Page">Previous</a>';
      }
      else {
         echo '&nbsp;First&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
echo 'Previous';
      }

echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';

      if ($page < $totalpages) {
         echo '<a href="'.$url2.'l='.$get_letters.';p='.$nextpage.'" title="Next Page">Next</a> ';
         echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.$url2.'l='.$get_letters.';p='.$totalpages.'" title="Last Page">Last</a>&nbsp;';
      }
     
      else {
echo 'Next';
echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Last&nbsp;';
      }
  }
  elseif ($pg == '21')
  {
if ($page > 1) {
echo '&nbsp;<a href="'.$url.'" title="First Page">First</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
echo '<a href="'.$url2.'p='.$prevpage.'" title="Previous Page">Previous</a>';
      }
      else {
         echo '&nbsp;First&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
echo 'Previous';
      }

echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';

      if ($page < $totalpages) {
         echo '<a href="'.$url2.'p='.$nextpage.'" title="Next Page">Next</a> ';
         echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.$url2.'p='.$totalpages.'" title="Last Page">Last</a>&nbsp;';
      }
     
      else {
echo 'Next';
echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Last&nbsp;';
      }
  }
     
   echo '</td>
    </tr>
<tr align="center">
   <td colspan="2">
   &nbsp;Registrations for '. date('M. ',$month_start) . $year_last_month .': '. number_format($previousmcount) .'&nbsp;
   </td>
   <td>
   &nbsp;Current total for '. date('M. Y') .': '. number_format($currentmcount) .'&nbsp;
   </td>
</tr>
<tr align="center">
   <td colspan="4"><b><a href="'.$url.'">Show All</a><br />';

foreach($numbers as $n => $v)
echo '<a href="'.$url2.'n=' . $n .'">' . $v . '</a> ';

echo '<br />';

foreach($letters as $l => $v)
echo '<a href="'.$url2.'l=' . $l .'">' . $v . '</a> ';

echo '
</b>
</td>
<td>
<form style="padding: 0; margin: 0;" action="'.$url.'" method="post">
<input type="text" name="search" value="Enter PSN ID" onblur="if(this.value == \'\') { this.value=\'Enter PSN ID\'}" onfocus="if (this.value == \'Enter PSN ID\') {this.value=\'\'}" /><br />
&nbsp;<input type="image" src="http://www.myu2sig.com/usersearch.png" style="padding: 5px 0px 0px 0px;" />&nbsp;
</form>
</td>
<td>&nbsp;DU: '.number_format($dailyupdate).'&nbsp;</td>
</tr>
   <tr align="center">
        <td>&nbsp;#&nbsp;</td>
<td>&nbsp;PSN ID / Profile&nbsp;</td>
<td>&nbsp;ND Stats Page&nbsp;</td>
        <td>&nbsp;Skin Chosen&nbsp;</td>
        <td>&nbsp;Last Updated&nbsp;</td>
<td>&nbsp;Registered&nbsp;</td>
       </tr>';

if (mysql_num_rows($result)){

   $i = ($page - 1) * $h;
   $j = 0;
   while (($i < $num) && ($j < $h)) {
      $k = $j + $i;
  if ($k >= $num) break;
      $psnid=mysql_result($result,$k,"psnid");
      $skin=mysql_result($result,$k,"skin");
      $lastupdate=mysql_result($result,$k,"lastupdate");
  $registered=mysql_result($result,$k,"registered");
  $custom=mysql_result($result,$k,"customskin");

    $j++;
   
   echo '
       <tr>
        <td>';
if ($page < 2)
echo number_format($j);
else echo number_format($j + $i);
echo '</td>
<td>' . '<a href="',"http://us.playstation.com/publictrophy/index.htm?onlinename=", $psnid, '" target="new_page">', $psnid, '</a>' . '</td>
<td>' . '<a href="',"http://www.naughtydog.com/stats/index/", $psnid, '" target="new_page">', $psnid, '</a>' . '</td>';
if($custom == 0){
echo '<td>' . $skinarray[$skin] . '</td>';
}else{
echo '<td>--- Custom Skin ---</td>';
}
echo '
<td>' . date('n/j/Y g:ia T', $lastupdate - 1800 ) . '</td>
<td>';
if ($registered >= 1){
// echo date('M. jS Y', strftime($registered));
echo date('n/j/Y', strftime($registered));
}else{
// echo 'Not Recorded';
echo 'Unknown';
}
echo '
   </td>
       </tr>';
       
}

}else{

echo '<tr>
<td colspan="6" align="center">Sorry, no users were found matching your search criteria.</td>
</tr>';

}
       
   echo '
       </table>';
   
echo '</div></div>';

echo '
<script language="javascript">
    window.onload = function function1(){
    window.scrollTo(0,265);
}
</script>
';
Title: Re: 1.0 RC1 & whitespaces (&nbsp;)
Post by: MoreBloodWine on April 08, 2011, 05:25:34 AM
All issues solved, with the exception to my Previous, First, Next & Last links not showing.

All 100%, links was a good on an if statement.