
mam formularz, który po wprowadzeniu danych tworzy wpis o takim linku
strona/jakis-adres,20130417205950.html (dodaje jak widac jaks date, chyba utworzenia na koncu)
jak zmienic na taka strukture
strona/jakis-adres , w ktorym miejscu trzeba zmienic, zeby usunac ten ciag liczb w adresie ?
plik .htaccess
Cytat
RewriteEngine on
#RewriteBase /
RewriteRule ^index\.html$ index.php [L]
RewriteRule ^dodaj\.html$ index.php?s=dodaj [L]
RewriteRule ^regulamin\.html$ index.php?s=regulamin [L]
RewriteRule ^kontakt\.html$ index.php?s=kontakt [L]
RewriteRule ^kontakt_wyslij\.html$ index.php?s=kontakt_send [L]
RewriteRule ^szukaj\.html$ index.php?s=szukaj [L]
RewriteRule ^dodaj_wpis\.html$ index.php?s=dodaj_base [L]
RewriteRule ^([a-z0-9_]+),([0-9]+)\.html$ index.php?s=zobacz&id=$2 [L]
RewriteRule ^([a-z0-9_]+),([0-9]+),([0-9]+)\.html$ ?s=ogloszenia&catid=$2_$3 [L]
RewriteRule ^([a-z]+),([0-9]+),([0-9]+),([0-9]+)\.html$ index.php?s=$1&catid=$2_$3&p=$4 [L]
#RewriteBase /
RewriteRule ^index\.html$ index.php [L]
RewriteRule ^dodaj\.html$ index.php?s=dodaj [L]
RewriteRule ^regulamin\.html$ index.php?s=regulamin [L]
RewriteRule ^kontakt\.html$ index.php?s=kontakt [L]
RewriteRule ^kontakt_wyslij\.html$ index.php?s=kontakt_send [L]
RewriteRule ^szukaj\.html$ index.php?s=szukaj [L]
RewriteRule ^dodaj_wpis\.html$ index.php?s=dodaj_base [L]
RewriteRule ^([a-z0-9_]+),([0-9]+)\.html$ index.php?s=zobacz&id=$2 [L]
RewriteRule ^([a-z0-9_]+),([0-9]+),([0-9]+)\.html$ ?s=ogloszenia&catid=$2_$3 [L]
RewriteRule ^([a-z]+),([0-9]+),([0-9]+),([0-9]+)\.html$ index.php?s=$1&catid=$2_$3&p=$4 [L]
plik chyba odp. za tworzenie linku
Cytat
<?
$nazwa_sesji='pad_ogloszenia';
function connection() {
global $conn;
include('config.php');
if ($conn)
return $conn;
else {
$conn = mysql_connect ($mysql_host, $mysql_base, $mysql_pass);
if (!$conn || !mysql_select_db ($mysql_users, $conn))
return 0;
else
return $conn;
}
}
function query ($sqlquery) {
if (!($conn = connection ()))
return 0;
else {
$result = mysql_query ($sqlquery, $conn);
if (!$result)
echo "Bł±d w zapytaniu!";
else
return $result;
}
}
function next_record ($result) {
$ans = mysql_fetch_row ($result);
return $ans;
}
function records_qty ($result) {
return (mysql_num_rows ($result));
}
function check ($sql_zapytanie) {
$sql_result = query ($sql_zapytanie);
return records_qty ($sql_result);
}
function sql_select ($sql_zapytanie) {
$sql_result = query ($sql_zapytanie);
$result[0][0] = records_qty ($sql_result);
for ($a = 1; $a <= $result[0][0]; $a++) {
$ans = next_record ($sql_result);
$result [$a] = $ans;
}
return ($result);
}
function sql_update ($sql_zapytanie) {
$sql_result = query ($sql_zapytanie);
}
function sql_delete ($sql_zapytanie) {
$sql_result = query ($sql_zapytanie);
}
function sql_insert ($sql_zapytanie) {
$sql_result = query ($sql_zapytanie);
}
function idtodate($id){
$rok=substr($id,0,4);
$miesiac=substr($id,4,-8);
$dzien=substr($id,6,-6);
$data="$dzien-$miesiac-$rok";
return $data;
}
function domyslny_plik($d_plik){
if ($d_plik == 0)
$wyjscie="ogloszenia.php";
else
$wyjscie="oczekujace.php";
return $wyjscie;
}
function zdjecia($zdjecie, $ogl_id, $i){
//copy ($zdjecie, "../o_images/".$ogl_id."_".$i.".jpg");
move_uploaded_file($zdjecie, "o_images/".$ogl_id."_".$i.".jpg");
$source2 = imagecreatefromjpeg("../o_images/".$ogl_id."_".$i.".jpg");
if(imagesy($source2)>150){
$new_height2 = floor(imagesy($source2)*(150/imagesx($source2)));
$new_width2 = 150;
}
else{
$new_width2 = imagesx($source2);
$new_height2 = imagesy($source2);
}
$dest2 = imagecreatetruecolor($new_width2,$new_height2);
imagecopyresampled($dest2,$source2,0,0,0,0,$new_width2,$new_height2,imagesx($source2),imagesy($source2));
imagejpeg($dest2,"../o_images/min_".$ogl_id."_".$i.".jpg",50);
imagedestroy($source2);
imagedestroy($dest2);
$source = imagecreatefromjpeg("../o_images/".$ogl_id."_".$i.".jpg");
if(imagesy($source)>400){
$new_height = 400;
$new_width = floor(imagesx($source)*(400/imagesy($source)));
}
else{
$new_width = imagesx($source);
$new_height = imagesy($source);
}
$dest = imagecreatetruecolor($new_width,$new_height);
imagecopyresampled($dest,$source,0,0,0,0,$new_width,$new_height,imagesx($source),imagesy($source));
imagejpeg($dest,"../o_images/".$ogl_id."_".$i.".jpg",50);
imagedestroy($source);
imagedestroy($dest);
}
function zdjecia_user($zdjecie, $ogl_id, $i){
//copy ($zdjecie, "o_images/".$ogl_id."_".$i.".jpg");
move_uploaded_file($zdjecie, "o_images/".$ogl_id."_".$i.".jpg");
$source2 = imagecreatefromjpeg("o_images/".$ogl_id."_".$i.".jpg");
if(imagesy($source2)>150){
$new_height2 = floor(imagesy($source2)*(150/imagesx($source2)));
$new_width2 = 150;
}
else{
$new_width2 = imagesx($source2);
$new_height2 = imagesy($source2);
}
$dest2 = imagecreatetruecolor($new_width2,$new_height2);
imagecopyresampled($dest2,$source2,0,0,0,0,$new_width2,$new_height2,imagesx($source2),imagesy($source2));
imagejpeg($dest2,"o_images/min_".$ogl_id."_".$i.".jpg",50);
imagedestroy($source2);
imagedestroy($dest2);
$source = imagecreatefromjpeg("o_images/".$ogl_id."_".$i.".jpg");
if(imagesy($source)>400){
$new_height = 400;
$new_width = floor(imagesx($source)*(400/imagesy($source)));
}
else{
$new_width = imagesx($source);
$new_height = imagesy($source);
}
$dest = imagecreatetruecolor($new_width,$new_height);
imagecopyresampled($dest,$source,0,0,0,0,$new_width,$new_height,imagesx($source),imagesy($source));
imagejpeg($dest,"o_images/".$ogl_id."_".$i.".jpg",50);
imagedestroy($source);
imagedestroy($dest);
}
function tytul($tytul){
$s_len=strlen($tytul);
if (strlen($tytul) > 25){
for ($i=0;$i<25;$i++){
$new_t=$tytul[$i];
echo $new_t;
}
echo' ...';
}
else
echo $tytul;
}
function tytul_ogl($str){
$str=str_replace(" ","_",$str);
$str=str_replace("ą","a",$str);
$str=str_replace("ć","c",$str);
$str=str_replace("ę","e",$str);
$str=str_replace("ł","l",$str);
$str=str_replace("ń","n",$str);
$str=str_replace("ó","o",$str);
$str=str_replace("ś","s",$str);
$str=str_replace("ż","z",$str);
$str=str_replace("ź","z",$str);
$str=str_replace("Ą","A",$str);
$str=str_replace("Ć","C",$str);
$str=str_replace("Ę","E",$str);
$str=str_replace("Ł","L",$str);
$str=str_replace("Ń","N",$str);
$str=str_replace("Ó","O",$str);
$str=str_replace("Ś","S",$str);
$str=str_replace("Ż","Z",$str);
$str=str_replace("Ź","Z",$str);
$str = strtolower($str);
$str = preg_replace('/[^a-z0-9_]/', '', $str);
return $str;
}
?>
$nazwa_sesji='pad_ogloszenia';
function connection() {
global $conn;
include('config.php');
if ($conn)
return $conn;
else {
$conn = mysql_connect ($mysql_host, $mysql_base, $mysql_pass);
if (!$conn || !mysql_select_db ($mysql_users, $conn))
return 0;
else
return $conn;
}
}
function query ($sqlquery) {
if (!($conn = connection ()))
return 0;
else {
$result = mysql_query ($sqlquery, $conn);
if (!$result)
echo "Bł±d w zapytaniu!";
else
return $result;
}
}
function next_record ($result) {
$ans = mysql_fetch_row ($result);
return $ans;
}
function records_qty ($result) {
return (mysql_num_rows ($result));
}
function check ($sql_zapytanie) {
$sql_result = query ($sql_zapytanie);
return records_qty ($sql_result);
}
function sql_select ($sql_zapytanie) {
$sql_result = query ($sql_zapytanie);
$result[0][0] = records_qty ($sql_result);
for ($a = 1; $a <= $result[0][0]; $a++) {
$ans = next_record ($sql_result);
$result [$a] = $ans;
}
return ($result);
}
function sql_update ($sql_zapytanie) {
$sql_result = query ($sql_zapytanie);
}
function sql_delete ($sql_zapytanie) {
$sql_result = query ($sql_zapytanie);
}
function sql_insert ($sql_zapytanie) {
$sql_result = query ($sql_zapytanie);
}
function idtodate($id){
$rok=substr($id,0,4);
$miesiac=substr($id,4,-8);
$dzien=substr($id,6,-6);
$data="$dzien-$miesiac-$rok";
return $data;
}
function domyslny_plik($d_plik){
if ($d_plik == 0)
$wyjscie="ogloszenia.php";
else
$wyjscie="oczekujace.php";
return $wyjscie;
}
function zdjecia($zdjecie, $ogl_id, $i){
//copy ($zdjecie, "../o_images/".$ogl_id."_".$i.".jpg");
move_uploaded_file($zdjecie, "o_images/".$ogl_id."_".$i.".jpg");
$source2 = imagecreatefromjpeg("../o_images/".$ogl_id."_".$i.".jpg");
if(imagesy($source2)>150){
$new_height2 = floor(imagesy($source2)*(150/imagesx($source2)));
$new_width2 = 150;
}
else{
$new_width2 = imagesx($source2);
$new_height2 = imagesy($source2);
}
$dest2 = imagecreatetruecolor($new_width2,$new_height2);
imagecopyresampled($dest2,$source2,0,0,0,0,$new_width2,$new_height2,imagesx($source2),imagesy($source2));
imagejpeg($dest2,"../o_images/min_".$ogl_id."_".$i.".jpg",50);
imagedestroy($source2);
imagedestroy($dest2);
$source = imagecreatefromjpeg("../o_images/".$ogl_id."_".$i.".jpg");
if(imagesy($source)>400){
$new_height = 400;
$new_width = floor(imagesx($source)*(400/imagesy($source)));
}
else{
$new_width = imagesx($source);
$new_height = imagesy($source);
}
$dest = imagecreatetruecolor($new_width,$new_height);
imagecopyresampled($dest,$source,0,0,0,0,$new_width,$new_height,imagesx($source),imagesy($source));
imagejpeg($dest,"../o_images/".$ogl_id."_".$i.".jpg",50);
imagedestroy($source);
imagedestroy($dest);
}
function zdjecia_user($zdjecie, $ogl_id, $i){
//copy ($zdjecie, "o_images/".$ogl_id."_".$i.".jpg");
move_uploaded_file($zdjecie, "o_images/".$ogl_id."_".$i.".jpg");
$source2 = imagecreatefromjpeg("o_images/".$ogl_id."_".$i.".jpg");
if(imagesy($source2)>150){
$new_height2 = floor(imagesy($source2)*(150/imagesx($source2)));
$new_width2 = 150;
}
else{
$new_width2 = imagesx($source2);
$new_height2 = imagesy($source2);
}
$dest2 = imagecreatetruecolor($new_width2,$new_height2);
imagecopyresampled($dest2,$source2,0,0,0,0,$new_width2,$new_height2,imagesx($source2),imagesy($source2));
imagejpeg($dest2,"o_images/min_".$ogl_id."_".$i.".jpg",50);
imagedestroy($source2);
imagedestroy($dest2);
$source = imagecreatefromjpeg("o_images/".$ogl_id."_".$i.".jpg");
if(imagesy($source)>400){
$new_height = 400;
$new_width = floor(imagesx($source)*(400/imagesy($source)));
}
else{
$new_width = imagesx($source);
$new_height = imagesy($source);
}
$dest = imagecreatetruecolor($new_width,$new_height);
imagecopyresampled($dest,$source,0,0,0,0,$new_width,$new_height,imagesx($source),imagesy($source));
imagejpeg($dest,"o_images/".$ogl_id."_".$i.".jpg",50);
imagedestroy($source);
imagedestroy($dest);
}
function tytul($tytul){
$s_len=strlen($tytul);
if (strlen($tytul) > 25){
for ($i=0;$i<25;$i++){
$new_t=$tytul[$i];
echo $new_t;
}
echo' ...';
}
else
echo $tytul;
}
function tytul_ogl($str){
$str=str_replace(" ","_",$str);
$str=str_replace("ą","a",$str);
$str=str_replace("ć","c",$str);
$str=str_replace("ę","e",$str);
$str=str_replace("ł","l",$str);
$str=str_replace("ń","n",$str);
$str=str_replace("ó","o",$str);
$str=str_replace("ś","s",$str);
$str=str_replace("ż","z",$str);
$str=str_replace("ź","z",$str);
$str=str_replace("Ą","A",$str);
$str=str_replace("Ć","C",$str);
$str=str_replace("Ę","E",$str);
$str=str_replace("Ł","L",$str);
$str=str_replace("Ń","N",$str);
$str=str_replace("Ó","O",$str);
$str=str_replace("Ś","S",$str);
$str=str_replace("Ż","Z",$str);
$str=str_replace("Ź","Z",$str);
$str = strtolower($str);
$str = preg_replace('/[^a-z0-9_]/', '', $str);
return $str;
}
?>
pomoze ktos ?