Problema htaccess %al posto dei trattini

shirly

Utente Attivo
12 Mag 2010
32
0
0
Ciao a tutti ho un problema per quanto riguarda il mio sito, se andate su http://www.aste-gratis.it/Strumenti-Musicali-240.html e cliccate una asta il browser la vede così
http://www.aste-gratis.it/Cassa M...0 1982-3.html
praticamente il titolo dell’asta non mi mette i trattini negli spazi il titolo dell’asta sarebbe
Cassa Marshall 400 watt jcm lead 800 1982 e dovrebbe essere
Cassa-Marshall-400-watt-jcm-lead-800-1982.html
praticamente dalla home page se clicco un asta appare corretto con i trattini, invece se clicco una categoria ad esempio strumenti musicali
http://www.aste-gratis.it/Strumenti-Musicali-240.html

e clicco un asta non mi mette i trattini ma vedo il simbolo% con questo errore nel browser
The requested URL /Cassa Marshall 400 watt jcm lead 800 1982-3.html was not found on this server.

il mio file htaccess è così

PHP:
DirectoryIndex index.php

# secure htaccess file
<Files .htaccess>
order allow,deny
deny from all
</Files>

# disable directory browsing
#Options All -Indexes

# disable access to logs/template files
<Files ~ "\.(log|tpl)$">
order allow,deny
deny from all
</files>


#Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteRule ^([a-zA-Z0-9--]+)-([0-9]+)\.html$ browse.php?id=$2
RewriteRule ^([a-zA-Z0-9_-]+)-([0-9]+)\.html$ item.php?id=$2




RewriteEngine On
RewriteBase /
RewriteRule ^sitemap.xml ./sitemap.php [L,QSA]

il file index è così



PHP:
<?php
/***************************************************************************
* site	 : [url]http://www.ebayclone.com/[/url]
***************************************************************************/

include 'includes/common.inc.php';
include $main_path . 'language/' . $language . '/categories.inc.php';

// Run cron according to SETTINGS
if ($system->SETTINGS['cron'] == 2)
{
include_once 'cron.php';
}

if ($system->SETTINGS['loginbox'] == 1 && $system->SETTINGS['https'] == 'y' && $_SERVER['HTTPS'] != 'on')
{
$sslurl = str_replace('http://', 'https://', $system->SETTINGS['siteurl']);
header('Location: ' . $sslurl . 'index.php');
exit;
}

$NOW = time();

function ShowFlags()
{
global $system, $LANGUAGES;
$counter = 0;
$flags = '';
foreach ($LANGUAGES as $lang => $value)
{
if ($counter > 3)
{
$flags .= '<br>';
$counter = 0;
}
$flags .= '<a href="?lan=' . $lang . '"><img vspace="2" hspace="2" src="' . $system->SETTINGS['siteurl'] . 'includes/flags/' . $lang . '.gif" border="0" alt="' . $lang . '"></a>';
$counter++;
}
return $flags;
}

// prepare categories list for templates/template
// Prepare categories sorting
if ($system->SETTINGS['catsorting'] == 'alpha')
{
$catsorting = ' ORDER BY cat_name ASC';
}
else
{
$catsorting = ' ORDER BY sub_counter DESC';
}

$query = "SELECT cat_id FROM " . $DBPrefix . "categories WHERE parent_id = -1";
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);

$query = "SELECT * FROM " . $DBPrefix . "categories
WHERE parent_id = " . mysql_result($res, 0) . "
" . $catsorting . "
LIMIT " . $system->SETTINGS['catstoshow'];
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);

while ($row = mysql_fetch_assoc($res))
{

//URL Rewrite Mod MMcG [url]http://www.aste-gratis.it/[/url]

$catname = $category_names[$row['cat_id']];
$cattitle = str_replace(" ","-",$catname);

$cattitle = str_replace(" ","-",$cattitle);

$cattitle = str_replace("#","-",$cattitle);

$cattitle = str_replace("&","-",$cattitle);

$cattitle = str_replace("&","-",$cattitle);

$cattitle = str_replace(";","-",$cattitle);

$cattitle = str_replace(",","-",$cattitle);

$cattitle = str_replace("/","-",$cattitle);




$template->assign_block_vars('cat_list', array(
'CATAUCNUM' => ($row['sub_counter'] != 0) ? '(' . $row['sub_counter'] . ')' : '',
'ID' => $row['cat_id'],
'IMAGE' => (!empty($row['cat_image'])) ? '<img src="' . $row['cat_image'] . '" border=0>' : '',
'COLOUR' => (empty($row['cat_colour'])) ? '#FFFFFF' : $row['cat_colour'],
'NAME' => $category_names[$row['cat_id']],
'CATNAME' => $cattitle

));
}

// get featured items
$query = "SELECT id, title, current_bid, pict_url, ends, num_bids, minimum_bid, bn_only, buy_now
FROM " . $DBPrefix . "auctions
WHERE closed = 0 AND suspended = 0 AND starts <= " . $NOW . "
AND featured = 'y'
ORDER BY RAND() DESC LIMIT 12";
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);
while($row = mysql_fetch_assoc($res))
{
$ends = $row['ends'];
$difference = $ends - time();
if ($difference > 0)
{
$ends_string = FormatTimeLeft($difference);
}
else
{
$ends_string = $MSG['911'];
}
$high_bid = ($row['num_bids'] == 0) ? $row['minimum_bid'] : $row['current_bid'];
$high_bid = ($row['bn_only'] == 'y') ? $row['buy_now'] : $high_bid;

//URL Rewrite Mod MMcG [url]http://www.ebayclone.com/[/url]

$featured = $row['title'];
$showfeatured = str_replace(" ","_",$featured);
$showfeatured = str_replace(" ","_",$showfeatured);
$showfeatured = str_replace("-","_",$showfeatured);

$showfeatured = str_replace("#","_",$showfeatured);

$showfeatured = str_replace("&","_",$showfeatured);

$showfeatured = str_replace("&","_",$showfeatured);

$showfeatured = str_replace(";","_",$showfeatured);

$showfeatured = str_replace(",","_",$showfeatured);

$showfeatured = str_replace("/","_",$showfeatured);


$template->assign_block_vars('featured', array(
'ENDS' => $ends_string,
'ID' => $row['id'],
'BID' => $system->print_money($high_bid),
'IMAGE' => (!empty($row['pict_url'])) ? 'getthumb.php?w=' . $system->SETTINGS['thumb_show'] . '&fromfile=' . $uploaded_path . $row['id'] . '/' . $row['pict_url'] : 'images/email_alerts/default_item_img.jpg',
'TITLE' => $row['title'],

'FEATURETITLE' => $showfeatured

));
}

// get last created auctions
$query = "SELECT id, title, starts from " . $DBPrefix . "auctions
WHERE closed = 0 AND suspended = 0
AND starts <= " . $NOW . "
ORDER BY starts DESC
LIMIT " . $system->SETTINGS['lastitemsnumber'];
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);

$i = 0;
$bgcolor = '#FFFFFF';
while ($row = mysql_fetch_assoc($res))
{



//URL Rewrite Mod MMcG [url]http://www.ebayclone.com/[/url]

$lastname = $row['title'];
$lasttitle = str_replace(" ","_",$lastname);
$lasttitle = str_replace(" ","_",$lasttitle);
$lasttitle = str_replace(" ","_",$lasttitle);
$lasttitle = str_replace("-","_",$lasttitle);

$lasttitle = str_replace("#","_",$lasttitle);

$lasttitle = str_replace("&","_",$lasttitle);

$lasttitle = str_replace("&","_",$lasttitle);

$lasttitle = str_replace(";","_",$lasttitle);

$lasttitle = str_replace(",","_",$lasttitle);

$lasttitle = str_replace("/","_",$lasttitle);

$template->assign_block_vars('auc_last', array(
'BGCOLOUR' => ($bgcolor == '#FFFFFF') ? '#FFFEEE' : '#FFFFFF',
'DATE' => ArrangeDateNoCorrection($row['starts'] + $system->tdiff),
'ID' => $row['id'],
'TITLE' => $row['title'],

'LASTTITLE' => $lasttitle

));
$i++;
}

$auc_last = ($i > 0) ? true : false;
// get ending soon auctions
$query = "SELECT ends, id, title FROM " . $DBPrefix . "auctions
WHERE closed = 0 AND suspended = 0 AND starts <= " . $NOW . "
ORDER BY ends LIMIT " . $system->SETTINGS['endingsoonnumber'];
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);

$i = 0;
$bgcolor = '#FFFFFF';
while ($row = mysql_fetch_assoc($res))
{
$difference = $row['ends'] - time();
if ($difference > 0)
{
$ends_string = FormatTimeLeft($difference);
}
else
{
$ends_string = $MSG['911'];
}

//URL Rewrite Mod MMcG [url]http://www.ebayclone.com/[/url]

$endname = $row['title'];
$endtitle = str_replace(" ","_",$endname);

$template->assign_block_vars('end_soon', array(
'BGCOLOUR' => ($bgcolor == '#FFFFFF') ? '#FFFEEE' : '#FFFFFF',
'DATE' => $ends_string,
'ID' => $row['id'],
'TITLE' => $row['title'],

'ENDTITLE' => $endtitle

));
$i++;
}

$end_soon = ($i > 0) ? true : false;
// get higher bids
$query = "SELECT max(b.bid) AS max_bid, a.title, a.id FROM " . $DBPrefix . "bids b
LEFT JOIN " . $DBPrefix . "auctions a ON (a.id = b.auction)
WHERE a.suspended = 0 AND a.closed = 0 AND a.starts <= '" . $NOW . "'
GROUP BY b.bid, b.auction ORDER BY max_bid DESC
LIMIT " . $system->SETTINGS['higherbidsnumber'];
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);

$i = $j = 0;
$bgcolor = '#FFFFFF';
$AU = array();
while ($row = mysql_fetch_assoc($res))
{
if (!in_array($row['id'], $AU))
{

//URL Rewrite Mod MMcG [url]http://www.ebayclone.com/[/url]


$name = $row['title'];
$urltitle = str_replace(" ","_",$name);


$template->assign_block_vars('max_bids', array(
'BGCOLOUR' => ($bgcolor == '#FFFFFF') ? '#FFFEEE' : '#FFFFFF',
'FBID' => $system->print_money($row['max_bid']),
'BID' => $row['max_bid'],
'ID' => $row['id'],
'TITLE' => $row['title'],

'URLTITLE' => $urltitle

));
$AU[] = $row['id'];
$j++;
}
$i++;
}
$high_bids = ($j > 0) ? true : false;
// Build list of help topics
$query = "SELECT id, category FROM " . $DBPrefix . "faqscat_translated WHERE lang = '" . $language . "' ORDER BY category ASC";
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);
$i = 0;
while ($faqscat = mysql_fetch_assoc($res))
{
$template->assign_block_vars('helpbox', array(
'ID' => $faqscat['id'],
'TITLE' => $faqscat['category']
));
$i++;
}

$helpbox = ($i > 0) ? true : false;
// Build news list
if ($system->SETTINGS['newsbox'] == 1)
{
$query = "SELECT n.title As t, n.new_date, t.* FROM " . $DBPrefix . "news n
LEFT JOIN " . $DBPrefix . "news_translated t ON (t.id = n.id)
WHERE t.lang = '" . $language . "' AND n.suspended = 0
ORDER BY new_date DESC, id DESC LIMIT " . $system->SETTINGS['newstoshow'];
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);
while ($new = mysql_fetch_assoc($res))
{
$template->assign_block_vars('newsbox', array(
'ID' => $new['id'],
'DATE' => FormatDate($new['new_date']),
'TITLE' => (!empty($new['title'])) ? $new['title'] : $new['t']
));
}
}

$template->assign_vars(array(
'FLAGS' => ShowFlags(),
'LOGIN_ERROR' => (isset($_SESSION['loginerror'])) ? $_SESSION['loginerror'] : '',

'B_AUC_LAST' => $auc_last,
'B_HIGH_BIDS' => $high_bids,
'B_AUC_ENDSOON' => $end_soon,
'B_HELPBOX' => $helpbox,
'B_MULT_LANGS' => (count($LANGUAGES) > 1),
'B_LOGIN_BOX' => ($system->SETTINGS['loginbox'] == 1),
'B_LOGIN_ERROR' => (isset($_SESSION['loginerror'])),
'B_NEWS_BOX' => ($system->SETTINGS['newsbox'] == 1)
));

include 'header.php';
$template->set_filenames(array(
'body' => 'home.tpl'
));
$template->display('body');
include 'footer.php';

unset($_SESSION['loginerror']);
?>
 
Ultima modifica di un moderatore:

Eliox

Utente Attivo
25 Feb 2005
4.390
3
0
Ricordati di delimitare sempre il codice tra i tag PHP, diversamente per noi diventa illeggibile.

Ora, giusto per essere sicuri, il nome della categoria sta nel campo "cat_id"?
 

shirly

Utente Attivo
12 Mag 2010
32
0
0
Ricordati di delimitare sempre il codice tra i tag PHP, diversamente per noi diventa illeggibile.

Ora, giusto per essere sicuri, il nome della categoria sta nel campo "cat_id"?

ok scusa, raramente di solito posto quando ho bisogno di aiuto, ho copiato tutto il codice strano che mancano i tag php
cosa intendi nel campo ca_id?php capisco poco.
 

Eliox

Utente Attivo
25 Feb 2005
4.390
3
0
Qui vedo:
PHP:
$catname = $category_names[$row['cat_id']];
questo vuol dire che nella tabella del DB c'è un campo chiamato "cat_id", sicuro che questo contego il nome della categoria?
Più probabile che sia:
PHP:
$catname = $row['category_names'];
 

shirly

Utente Attivo
12 Mag 2010
32
0
0
Qui vedo:
PHP:
$catname = $category_names[$row['cat_id']];
questo vuol dire che nella tabella del DB c'è un campo chiamato "cat_id", sicuro che questo contego il nome della categoria?
Più probabile che sia:
PHP:
$catname = $row['category_names'];

non lo so, posso entrare nel phpmyadmin e verificare
 

shirly

Utente Attivo
12 Mag 2010
32
0
0
htaccess

Allora i campi che vedo nella tabella categorie sono


cat_id
parent_id
left_id
right_id
level
cat_name
sub_counter
counter
cat_colour
cat_image
 

Eliox

Utente Attivo
25 Feb 2005
4.390
3
0
Allora è molto probabile che sia:
PHP:
$catname = $row['cat_name'];
 

shirly

Utente Attivo
12 Mag 2010
32
0
0
htaccess

Niente da fare ho sostituito
$catname = $row['cat_name']; a
$catname = $category_names[$row['cat_id']]; stesso errore, cioè se passo l'url sul titolo dell'asta dalla pagina della categoria, mancano i trattino e mi da errore, non puo essere un errore nel file htaccess?Perchè in home page le url delle aste sono giuste?
 

shirly

Utente Attivo
12 Mag 2010
32
0
0
Esperimento url

ho fatto un esperimento, ho cambiato il titolo dell'asta che ho creato io, quindi sono entrato nel mio account, e ho modificato il titolo e ho inserito i trattini - negli spazi , l'url funziona, cioè se un utente si registra non posso mica dirgli di inserire i trattini nel titolo dell'asta, dovrebbe essere automatico, non capisco.
 

Eliox

Utente Attivo
25 Feb 2005
4.390
3
0
Io per la riscrittura uso questa funzione:
PHP:
//per la riscrittura
function rupulisci($string)
  {
      $string = strtolower($string);
      
      // caratteri tedeschi
      $string = preg_replace('/[äÄ]/', 'ae', $string);
      $string = preg_replace('/[üÜ]/', 'ue', $string);
      $string = preg_replace('/[öÖ]/', 'oe', $string);
      $string = preg_replace('/[ß]/', 'ss', $string);
      
      // special chars
      $specialCharacters = array(
	 '#' => 'sharp',
	 '$' => 'dollar',
	 '%' => 'prozent',	//'percent',
	 '@' => 'at',
	 '.' => '',	//'dot',
	 '€' => 'euro',
	 '+' => 'plus',
	 '=' => 'uguale',	//'equals',
	 '§' => 'paragraph',
	 '&agrave;' => 'a',
	 '&egrave;' => 'e',
	 '&eacute;' => 'e',
	 '&igrave;' => 'i',
	 '&ograve;' => 'o',
	 '&ugrave;' => 'u',
	 ' ' => '-',
      );
      
      while (list($character, $replacement) = each($specialCharacters)) {
          $string = str_replace($character, '' . $replacement . '', $string);
      }
      
      $string = strtr($string, 
	"ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ",
	"AAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuyNn"
      );
      
      // tutti gli altri        
      $string = preg_replace('/[^a-zA-Z0-9\-]/', '-', $string);
      $string = preg_replace('/^[\-]+/', '', $string);
      $string = preg_replace('/[\-]+$/', '', $string);
      $string = preg_replace('/[\-]{2,}/', '-', $string);
      
      return $string;
  }
 

Eliox

Utente Attivo
25 Feb 2005
4.390
3
0
Utilizzare la funzione per filtrare il contenuto del campo cat_name.
Le sai usare le funzioni?
 

Eliox

Utente Attivo
25 Feb 2005
4.390
3
0
  • ti salvi la funzione in un file
  • includi il file nel file in cui devi usare la funzione;
  • richiami la funzione, ad esempio "ripulisci($row['cat_name']);"
 

shirly

Utente Attivo
12 Mag 2010
32
0
0
Invece di farlo da capo non posso modificare il fale attuale che è incluso?sempre se ci sia.
A parte php poco, comunque una volta incluso, per richiamare la funzione, lo scrivo così?
cosa scrivo al posto di ripulisci?

"ripulisci($row['cat_name']);"
 

Eliox

Utente Attivo
25 Feb 2005
4.390
3
0
La funzione la puoi inserire anche in un file ke hai già incluso in precedenza o anche nel file corrente, devi scrivere proprio:
PHP:
ripulisci($row['cat_name']);
perkè la funzione ke ti ho postato si kiama proprio così ("ripulisci"), naturalmente se vuoi cambiare nome della funzione puoi farlo, non è vincolante.
 

shirly

Utente Attivo
12 Mag 2010
32
0
0
htaccess

Niente non riesco, ripeto programmazione zero, ho creato un file gli ho copiato il tuo codice, lo incluso nella index cambiato la variabile, ma non sono capace,prova a scrivermelo più dettagliatamente grazie.
 
Discussioni simili
Autore Titolo Forum Risposte Data
SebaGravi [PHP] problema url semantici con .htaccess PHP 3
A [PHP] problema htaccess PHP 2
M Problema Paginazione con Mod_rewrite .htaccess PHP 0
F Problema di seria incompetenza .htaccess Web Server 3
F problema .htaccess wordpress WordPress 1
U problema con .htaccess su remoto? Web Server 4
LaKanka Problema rewrite rule file .htaccess Apache 7
G Problema htaccess Web Server 0
G problema con file .htaccess PHP 5
F Problema pulsante cerca record su access Database 0
I Sto progettando nuovi siti utilizzando bootstrap e devo dire funziona bene, l'unico problema e la maschera -moz- HTML e CSS 0
K Problema form update PHP 2
O problema con dvr dahua xvr5116 IP Cam e Videosorveglianza 0
S Problema nel ciclare un json Javascript 0
G Problema con Xampp Web Server 1
andrea barletta Problema con miniature comandi Photoshop 0
I problema con alice Posta Elettronica 0
K Problema Inner join PHP 1
F firefox problema http Linux e Software 0
N Problema con position absolute e overflow HTML e CSS 4
E Problema jquery Success jQuery 2
L Problema con inner join PHP 11
K [php] Problema con inner join PHP 4
E problema selezione sfumata Photoshop 2
K [PHP] Problema con variabili concatenate. PHP 1
A Problema filtro fluidifica Photoshop Photoshop 1
H Problema Bordi Scontorno Photoshop 1
O problema con query PHP 4
R Problema installazione Realtek WiFi USB rtl8821 Reti LAN e Wireless 1
I problema con 2 account Posta Elettronica 1
L problema collegamento file css con html HTML e CSS 1
Y Problema percorso file in rete PHP 1
N Problema SEO "L'URL non si trova su Google" SEO e Posizionamento 4
E Problema accesso a file con app sviluppata con MIT APP INVENTOR 2 Sviluppo app per Android 0
P Problema acquisizione clienti Webdesign e Grafica 1
F NetBeans problema creazione progetto Java Windows e Software 0
M Problema con Try Catch PHP 0
C problema seo + cerco esperto SEO e Posizionamento 11
Sergio Unia Problema con gli eventi del mouse su una data table: Javascript 2
T PROBLEMA CON SESSIONI PHP 3
A Problema, non so, di scale() o transform, oppure altro? HTML e CSS 0
T ALTRO PROBLEMA CON ARRAY PHP PHP 1
R problema con else PHP 0
T PROBLEMA CON ARRAY PHP 8
L problema con query select PHP 2
R Problema query con ricerca id numerico PHP 2
F Problema con risposta PHP 0
S problema con recupero dati tabella mysql PHP 2
Z Problema con il mio tp-l i nk Reti LAN e Wireless 1
I PROBLEMA: Sostituzione sito XAMPP E-Commerce 0

Discussioni simili