include("../php-include/dbconn.php"); $uid = $_REQUEST['uid']; $bis = $_REQUEST['isearch']; if (strlen($bis) == 0) $bis = 1; if (!empty($_REQUEST['sc'])) { // expire in 30 days setcookie("GalleryPref", $bis, time()+60*60*24*60); } else { if (isset($HTTP_COOKIE_VARS['GalleryPref'])) { // echo "
cookie: " .$HTTP_COOKIE_VARS['GalleryPref']; $bis = $HTTP_COOKIE_VARS['GalleryPref']; } // else // echo "
empty cookie."; } function convertLinks($text) { $text = preg_replace("/(\r\n|\n|\r)/", "\n", $text); $lines = explode("\n", $text); $nLineCount = count($lines); for ($x = 0, $y = $nLineCount; $x < $y; $x++) { $line = $lines[$x]; $words = explode(' ', $line); $nWordCount = count($words); for ($i = 0, $j = $nWordCount; $i < $j; $i++) { $word = $words[$i]; $punctuation = '.,\'")(<>;:'; // Links may not end in these if (substr($word, 0, 7) == 'http://' || substr($word, 0, 4) == 'www.') { $trailing = ''; // Knock off ending punctuation $last = substr($word, -1); while (strpos($punctuation, $last) !== false) { // Last character is punctuation - eliminate it $trailing .= $last; $word = substr($word, 0, -1); $last = substr($word, -1); } // Make link, add trailing punctuation back afterwards $link = $word; if (substr($link, 0, 4) == 'www.') { // This link needs an http:// $link = 'http://'.$link; } $word = ''.$word.''.$trailing; } else if (strpos($word,"@") > 0 && strpos($word,".") > 0) { $trailing = ''; // Knock off ending punctuation $last = substr($word, -1); while (strpos($punctuation, $last) !== false) { // Last character is punctuation - eliminate it $trailing .= $last; $word = substr($word, 0, -1); $last = substr($word, -1); } $word = ''.$word.''.$trailing; } $words[$i] = $word; } $lines[$x] = implode(' ', $words); } return implode("\n", $lines); } function redirect( $page_path , $type=0, $pass_val=0 ) { if ($type == 0)// simple redirect { header("Location: " . $page_path); } if ($type == 1)// this redirects and sends the session info { header("Location: ". $page_path ."?" . session_name() . "=" .session_id() ); } if ($type == 2) // this redirects and sends possible url vars { // pass_val in the format 'VAR=Val' if ($pass_val[0] == "") return -1; else { $index = 0; while($pass_val[$index] != "") { if ($index == 0) $values = $pass_val[$index]; else $values = $values . "&" . $pass_val[$index]; $index++; } } header("Location: ". $page_path ."?" . $values ); } if ($type == 3) // this redirects and sends session and possible url vars { // pass_val in the format 'VAR=Val' if ($pass_val[0] == "") return -1; else { $index = 0; while($pass_val[$index] != "") { if ($index == 0) $values = $pass_val[$index]; else $values = $values . "&" . $pass_val[$index]; $index++; } } header("Location: " . $page_path . "?" . session_name() . "=" . session_id() . "&" . $values ); } } $bEditProfile = 0; if (!empty($_REQUEST['editprofile'])) { $bEditProfile = $_REQUEST['editprofile']; } $curuser = ""; // session id check if (!empty($_REQUEST['uid'])) { $conn = new CDbConnection; if ($conn->Connect("itr","itr2","mysql1234","localhost")) { if ($conn->Query("select c.caryear,c.modint,c.modext,c.modengine,c.modsuspen,c.contacts,c.location,c.comment,p.username,c.ice,c.misc,c.model from phpbb_cars c,phpbb3_users p where c.user_id=$uid and p.user_id=$uid")) { if ($conn->Fetch() == false) { // redirect redirect('/gallery/index.php',0); exit; } } } } else { // redirect redirect('/gallery/index.php',0); exit; } function convertModText($txtContents,$strColumn,$uuid,$conn) { // replace space $txtContents = str_replace(" ", ",", $txtContents); $txtContents = str_replace("\n",",", $txtContents); // $txtContents = str_replace("'","", $txtContents); $txtContents = str_replace("(",",", $txtContents); $txtContents = str_replace(")",",", $txtContents); $txtOutputText = ""; // echo "
Org txtContents: " . $txtContents;
$arrItems = explode(",",$txtContents);
$nCount = sizeof($arrItems);
for ($nX = 0; $nX < $nCount; $nX++)
{
if (strlen(trim($arrItems[$nX])) > 3)
{
$txtOutputText .= trim($arrItems[$nX]);
if ($nX + 1 < $nCount)
$txtOutputText .= ",";
}
}
// remove the escape words
$arrsearch = array ('/\./',
'/\?/',
'/\"/',
'/\(/',
'/\)/',
'/\',
'/\>/',
'/\;/',
'/\:/',
'/\*/');
$arrreplace = array (' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ');
$arrMods = explode(",",preg_replace($arrsearch,$arrreplace, $txtOutputText));
/*
echo "
";
for ($nX = 0; $nX < count($arrMods); $nX++)
{
if (strlen($arrModsEx[$nX]) > 0)
{
echo "Org ModEx: " . $arrModsEx[$nX];
echo "
";
}
}
*/
$txtOutputText = addslashes($txtOutputText);
// echo "
txtOutputText: " . $txtOutputText; $strSql = "select " . $strColumn . " from phpbb_cars where match (" . $strColumn . ") against('" . $txtOutputText . "') and user_id<>" . $uuid; // echo "
strSql: " . $strSql . "
";
if ($conn->Query($strSql))
{
$nIndexPos = 0;
$nRecCount = 0;
// echo "
" . $txtOutputText . "
";
$strReturn = "";
while ($conn->Fetch())
{
$strReturn .= $conn->row[0];
$strReturn .= " ";
$nRecCount++;
// echo "
";
// echo $conn->row[1];
}
if ($nRecCount > 0)
{
//$strReturn = addslashes($strReturn);
//echo "
Org strReturn: " . $strReturn . "
"; $strReturn = preg_replace($arrsearch,$arrreplace, $strReturn); // $strReturn = str_replace(","," ",$strReturn); // echo "
strReturn: " . $strReturn . "
";
$nItemCount = sizeof($arrMods);
$nRecCount = 0;
for ($nX = 0; $nX < $nItemCount; $nX++)
{
if (strlen(trim($arrMods[$nX])) > 3)
{
if (stristr($strReturn,trim($arrMods[$nX])) != false)
{
if (stristr($arrMods[$nX],"with") == false)
{
// echo "
arrMod: " . $arrMods[$nX];
$arrModsEx[$nRecCount] = trim($arrMods[$nX]);
$nRecCount++;
}
}
/*
else
{
echo "
Item Remove: " . $arrMods[$nX];
$arrMods[$nX] = ''; // clear the value
}
*/
}
/*
else
{
echo "
Item Remove: " . $arrMods[$nX];
$arrMods[$nX] = ''; // clear the value
}
*/
}
}
mysql_free_result($conn->result);
$conn->result = null;
}
/*
echo "
";
for ($nX = 0; $nX < count($arrModsEx); $nX++)
{
if (strlen($arrModsEx[$nX]) > 0)
{
echo $arrModsEx[$nX];
echo "
";
}
}
*/
return $arrModsEx;
}
function putLinksIn($text,$arrText,$modSection,$uuid) {
$text = preg_replace("/(\r\n|\n|\r)/", "\n", $text);
$lines = explode("\n", $text);
$arrSize = sizeof($arrText);
// echo "
uid: " . $uuid . "
";
// echo "
arrSize: " . $arrSize . "
";
$arrPunc[0] = ',';
// $arrPunc[1] = ':';
$nLineCount = count($lines);
for ($x = 0, $y = $nLineCount; $x < $y; $x++)
{
$line = $lines[$x];
//echo "line: " . $line . "
";
$words = explode(' ', $line);
$nWordsCount = count($words);
for ($i = 0, $j = $nWordsCount; $i < $j; $i++)
{
$word = $words[$i];
$punctuation = '.,\'")(<>;:'; // Links may not end in these
$bExec = 0;
$nPuncSize = sizeof($arrPunc);
for($p=0;$p<$nPuncSize;$p++)
{
$wordsEx = explode($arrPunc[$p] ,$word);
$nWordExCount = sizeof($wordsEx);
//echo "
nWordExCount: " . $nWordExCount . "
";
if ($nWordExCount > 0 && strpos($word,$arrPunc[$p]) != false)
{
//echo "org word2: " . $word . "
";
for ($r = 0; $r < $nWordExCount; $r++)
{
$word2 = trim($wordsEx[$r]);
/////////////////////////////////////////////////////////
$trailing = '';
// Knock off ending punctuation
$last = substr($word2, -1);
while (strpos($punctuation, $last) !== false) {
// Last character is punctuation - eliminate it
$trailing .= $last;
$word2 = substr($word2, 0, -1);
$last = substr($word2, -1);
}
/////////////////////////////////////////////////////////
// echo "word2: " . $word2 . "
";
if (strlen(trim($word2)) > 3)
{
for ($z = 0; $z < $arrSize; $z++)
{
if (strlen(trim($arrText[$z])) > 0)
{
if (stristr($arrText[$z],$word2) != false)
//if ((stristr($arrText[$z],$word2) != false) || (stristr($word2,$arrText[$z]) != false))
{
$word2 = ''.htmlentities($word2,ENT_QUOTES).'';
$z = $arrSize;
}
}
}
}
if ($r + 1 < $nWordExCount)
$word2 .= $arrPunc[$p] . " ";
// echo "word2: " . $word2 .$trailing . "
";
if ($r == 0)
$words[$i] = $word2 .$trailing;
else if ($r > 0)
$words[$i] .= $word2 .$trailing;
}
}
else
$bExec = 1;
}
if ($bExec == 1)
{
// echo "org word: " . $word . "
";
////////////////////////////////////////////////////////////
$trailing = '';
// Knock off ending punctuation
$last = substr($word, -1);
while (strpos($punctuation, $last) !== false) {
// Last character is punctuation - eliminate it
$trailing .= $last;
$word = substr($word, 0, -1);
$last = substr($word, -1);
}
////////////////////////////////////////////////////////////
if (strlen(trim($word)) > 3)
{
// echo "word: " . $word . "
";
for ($z = 0; $z < $arrSize; $z++)
{
if (strlen(trim($arrText[$z])) > 0)
{
if (stristr($arrText[$z],$word)!=false)
//if ((stristr($arrText[$z],$word)!=false) || (stristr($word,$arrText[$z])!= false))
{
$word = ''.htmlentities($word,ENT_QUOTES) .'';
$z = $arrSize;
}
}
}
}
$words[$i] = $word .$trailing;
}
}
$lines[$x] = implode(' ', $words);
}
return implode("\n", $lines);
}
function replace_different($search,$replace,$string) {
$occs = substr_count($string,$search);
$last = 0;
$cur = 0;
$data = '';
$text = '';
if (strlen($string) > 0)
$string = "
|