2easy Posted January 27, 2010 Report Share Posted January 27, 2010 un kādas rules iekš .htaccess tu šobrīd izmanto? Quote Link to comment Share on other sites More sharing options...
EdgarsK Posted January 27, 2010 Report Share Posted January 27, 2010 eT -> pm Quote Link to comment Share on other sites More sharing options...
eT` Posted January 27, 2010 Author Report Share Posted January 27, 2010 mans htaccess RewriteRule ^zhanri/(.+)$ zhanri.php?zhanrs=$1 [QSA,L] RewriteRule ^filma/(.+)$ view.php?id=$1 [QSA,L] RewriteRule ^news/(.+)$ news.php?id=$1 [QSA,L] RewriteRule ^(.*)$ index.php?lapa=$1 [QSA,L] Quote Link to comment Share on other sites More sharing options...
EdgarsK Posted January 27, 2010 Report Share Posted January 27, 2010 :/ tev gadijuma nesanak pie katras ielades parlades? heh :D es eju .lv/news man lade index.php?id=... un index.php?lapa=.. ?! Quote Link to comment Share on other sites More sharing options...
2easy Posted January 27, 2010 Report Share Posted January 27, 2010 (edited) mod_rewrite ir tikai ārējā virsbūve. to mākslīgo adresi vajag translēt atpakaļ uz parastajiem parametriem un aizpildīt $_GET masīvu tā, it kā mod_rewrite nemaz netiktu lietots ar tavu pašreizējo .htaccess sanāk tā viewtv/$seoid episode/supernatural/wendigo -> index.php?lapa=viewtv/$seoid index.php?lapa=episode/supernatural/wendigo lai tgd dabūtu kādreizējos index.php?lapa=viewtv&id=$id index.php?lapa=episode&tvid=$tvid&id=$id dara tā $a = explode('/', $_GET['lapa']); $sLapa = isset($a[0]) ? $a[0] : null; $sId1 = isset($a[1]) ? $a[1] : null; $sId2 = isset($a[2]) ? $a[2] : null; $_GET['lapa'] = $sLapa; if ($sLapa == 'viewtv') $_GET['id'] = $sId1; if ($sLapa == 'episode') { $_GET['tvid'] = $sId1; $_GET['id'] = $sId2; } // un tālāk viss notiek tā, it kā mod_rewrite nemaz nebūtu bijis... šo kodu netestēju. tikai demonstrēju ideju Edited January 27, 2010 by 2easy Quote Link to comment Share on other sites More sharing options...
eT` Posted January 27, 2010 Author Report Share Posted January 27, 2010 ar tavu pašreizējo .htaccess sanāk tā viewtv/$seoid episode/supernatural/wendigo -> index.php?lapa=viewtv/$seoid index.php?lapa=episode/supernatural/wendigo emm bet tātad, kas jāmaina, lai varētu viewtv/supernatural => index.php?lapa=viewtv&id=2 un episode/supernatural/wendigo => index.php?lapa=episode&tvid=2&id=4 ? Quote Link to comment Share on other sites More sharing options...
2easy Posted January 27, 2010 Report Share Posted January 27, 2010 tu pamēģināji sadalīt ar explode() un aizpildīt $_GET? pēdējais, ko rakstīju... Quote Link to comment Share on other sites More sharing options...
eT` Posted January 27, 2010 Author Report Share Posted January 27, 2010 (edited) jā es viņu iemetu tv.php bet tagad, kad uzspiežu uz seriāla viņs refresho filmam.lv/tv Edited January 27, 2010 by eT` Quote Link to comment Share on other sites More sharing options...
2easy Posted January 27, 2010 Report Share Posted January 27, 2010 tu padomā par šo lietu, kad ej gulēt, un no rīta pamodīsies un tev viss būs skaidrs ;) Quote Link to comment Share on other sites More sharing options...
eT` Posted January 27, 2010 Author Report Share Posted January 27, 2010 (edited) diez vai :D es nesaprotu tikai vienu lietu, kā var iet filmam.lv/filma/avatar => index.php?lapa=filmas&id=$id bet neiet filmam.lv/viewtv/supernatural => index.php?lapa=viewtv&id=$id EDIT: viss aizgāja. un es jūtos tik stulbs, ka neiedomājos pačekot kādu $_GET mainīgo viņs saņem viewtv.php :D ak, Dievs :D Edited January 27, 2010 by eT` Quote Link to comment Share on other sites More sharing options...
eT` Posted January 31, 2010 Author Report Share Posted January 31, 2010 (edited) BUMP! kas tas ir ka man mod_rewrite visur rukā kā vajag izņemot šeit: links - http://filmam.lv/user/doublet oriģinālais links - index.php?lapa=user&id=1 indexā: case 'user': include('viewuser.php'); break; htaccesā RewriteRule ^(.*)$ index.php?lapa=$1 [QSA,L] un viewuser.php <div id="text"> <? if(isset($_COOKIE["id"])) { $name = html($_GET["id"]); $select = mysql_query("SELECT * FROM useri WHERE username='$name'"); $row = mysql_fetch_array($select); if(!empty($row)) { echo "$row[username]"; } else { echo "Nav tāda lietotāja!"; } } else { echo "Tev jābūt reģistrētam, lai apskatītu šo lapu!"; } ?> </div> Edited January 31, 2010 by eT` Quote Link to comment Share on other sites More sharing options...
waplet Posted January 31, 2010 Report Share Posted January 31, 2010 $name = html($_GET["id"]); html paštaisīta funkcija vai kā? btw.. , kas ja tu pamēģini šādi links/user/?id=1 nevis doublet ? Quote Link to comment Share on other sites More sharing options...
eT` Posted February 1, 2010 Author Report Share Posted February 1, 2010 (edited) man iet šādi - http://filmam.lv/user?id=1 html ir f-ja kurā iekļauts trim,stripslashes un str_replace $ ' % @ :) EDIT: kaut vai html f-jas vietā ielieku htmlspecialchars neiet :) Edited February 1, 2010 by eT` Quote Link to comment Share on other sites More sharing options...
2easy Posted February 1, 2010 Report Share Posted February 1, 2010 (edited) vai tiešām tu dari ar explode(), kā rakstīju iekš #35 ? Edited February 1, 2010 by 2easy Quote Link to comment Share on other sites More sharing options...
eT` Posted February 1, 2010 Author Report Share Posted February 1, 2010 ups es headerī nebiju tajā explode ielicis jaunu argumentu priekš useru lapas :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.