← PHP

Links diferentes - como se faz?

Lida 4680 vezes

Offline

João Godinho 
Membro
Mensagens 1755 Gostos 2
Troféus totais: 27
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

Eu sei que o thomato já perguntou aqui isto e foi resolvido, mas não encontrei esse tópico.
O links são deste género: http://www.blabla.com/index.php?id=blabla
Offline

Thomato 
Membro
Mensagens 4125 Gostos 3
Feedback +2

Troféus totais: 28
Trófeus: (Ver todos)
Apple User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2

A tua questão é ao entrar ai preencher um input ou como eu usava na lusowebs para a publicidade?
Offline

João Godinho 
Membro
Mensagens 1755 Gostos 2
Troféus totais: 27
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

A tua questão é ao entrar ai preencher um input ou como eu usava na lusowebs para a publicidade?
Como tinhas na publicidade.
Offline

Nuno 
Administrador
Mensagens 7780 Gostos 216
Feedback +2

Troféus totais: 42
Trófeus: (Ver todos)
100 Poll Votes Level 7 Search Mobile User Level 6 Super Combination Combination Topic Starter 50 Poll Votes 10 Poll Votes

Abre o htaccess
1
Código: [Seleccione]
Redirect 301 /produto http://linkaqui

Cria um ficheiro php (produto.php)
2
Código: [Seleccione]
<?php
header
'Location: linkaqui' ) ;
?>

3 Cria uma pasta coloca lá o ficheiro produto.php

4 Já podes usar dominio.com/pasta/produto.php em vez do link
Offline

Thomato 
Membro
Mensagens 4125 Gostos 3
Feedback +2

Troféus totais: 28
Trófeus: (Ver todos)
Apple User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2

O código foi criado pelo DiguiVirus, mas agora não encontro o tópico :s
Offline

João Godinho 
Membro
Mensagens 1755 Gostos 2
Troféus totais: 27
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

O código foi criado pelo DiguiVirus, mas agora não encontro o tópico :s
Pois também não encontrei.

Mas não tens o código no teu site?

Abre o htaccess
1
Código: [Seleccione]
Redirect 301 /produto http://linkaqui

Cria um ficheiro php (produto.php)
2
Código: [Seleccione]
<?php
header
'Location: linkaqui' ) ;
?>

3 Cria uma pasta coloca lá o ficheiro produto.php

4 Já podes usar dominio.com/pasta/produto.php em vez do link
Não sei se é bem isto, vou testar.
Offline

Thomato 
Membro
Mensagens 4125 Gostos 3
Feedback +2

Troféus totais: 28
Trófeus: (Ver todos)
Apple User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2

Código criado pelo DiguiVirus.

Citar
<?php

$link[0] = "http://www.teusite.pt"; //o link
  • é o default para a tua página

$link[1] = "http://anunciante1.pt";
$link[2] = "http://anunciante2.pt";
$link[3] = "http://anunciante3.pt";
$link[4] = "http://anunciante4.pt";
// adiciona quantos links tu quiseres para aqui adicionando sempre mais um número

$linkobt = $_GET['link'];

if (array_key_exists($linkobt, $link)) {
$linkfinal = $link[$linkobt];
} else {
$linkfinal = $link[0];
}

header('Location:'.$linkfinal.'');

?>
Offline

João Godinho 
Membro
Mensagens 1755 Gostos 2
Troféus totais: 27
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

Obrigado, posso não usar números no link e usar palavras?
Offline

anjo2 
Membro
Mensagens 3020 Gostos 0
Troféus totais: 31
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2

Podes, coloca aspas ou plicas.

Mas isso é para o quê mesmo? Pode não ser a melhor forma de fazeres as coisas.
Offline

João Godinho 
Membro
Mensagens 1755 Gostos 2
Troféus totais: 27
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

Mudo a parte onde então os números.

Podes, coloca aspas ou plicas.

Mas isso é para o quê mesmo? Pode não ser a melhor forma de fazeres as coisas.
É para testar uma coisa.
Offline

Diogo Pinto 
Administrador
Mensagens 4400 Gostos 371
Feedback +4

Troféus totais: 37
Trófeus: (Ver todos)
Avatar Search Level 6 Linux User Mobile User Super Combination Combination Topic Starter 50 Poll Votes 10 Poll Votes

O código foi criado por mim mas de uma forma muito rudimentar, pode até ter problemas a nível de segurança. :)

Um abraço