Jump to content
php.lv forumi

Filmam.lv


eT`

Recommended Posts

  • Replies 46
  • Created
  • Last Reply

Top Posters In This Topic

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 by 2easy
Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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 by eT`
Link to comment
Share on other sites

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 by eT`
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...