• Home
  • Forum
  • Fare Web
  • PHP

[PHP] url friends

  • Creatore Discussione Creatore Discussione avatar
  • Data di inizio Data di inizio 2 Set 2019
Stato
Chiusa ad ulteriori risposte.
Prec.
  • 1
  • 2
  • 3
Succ.
Primo Prec. 2 di 3 Succ. Ultimo
A

avatar

Utente Attivo
3 Gen 2017
97
0
6
55
  • 3 Set 2019
  • #21
scusami Marcus ma io non sono programmatore e non capisco niente di php , se mi dici come devo fare e meglio
 
A

avatar

Utente Attivo
3 Gen 2017
97
0
6
55
  • 3 Set 2019
  • #22
PHP:
} else if ((isset ($_GET ["do"])) and ($_GET ["do"] === "hublist")) { // do=hublist
    $html = str_replace ("[class_news]", "menu", $html);
    $html = str_replace ("[class_work]", "menu", $html);
    $html = str_replace ("[class_network]", "menu", $html);
    $html = str_replace ("[class_forum]", "menu", $html);
    $html = str_replace ("[class_gallery]", "menu", $html);
    $html = str_replace ("[class_hublist]", "menu active", $html);
    $html = str_replace ("[class_tools]", "menu", $html);
    $html = str_replace ("[class_stats]", "menu", $html);
    $html = str_replace ("[class_about]", "menu", $html);
    $html = str_replace ("[class_login]", "menu", $html);
    $html = str_replace ("[class_client]", "menu", $html);
    $html = str_replace ("[class_clientdc]", "menu", $html);
    $html = str_replace ("[class_Lists]", "menu", $html);

    if ($nosc) { // dont count visitors for plain text pages
        $html = str_replace ("[visit_page]", 0, $html);
        $html = str_replace ("[visit_country]", 0, $html);
    } else {
        $visit = visitcount ("hublist");
        $html = str_replace ("[visit_page]", $visit ["page"], $html);
        $html = str_replace ("[visit_country]", $visit ["country"], $html);
    }

    $echo = true;

    if ((isset ($_GET ["id"])) and ($_GET ["id"] !== "")) { // specific id
        if (($sql = $mysql->query ("select * from `hublist` where `id` = " . intval ($_GET ["id"]) . " OR `rediraddr` = '" . $mysql->escape_string ($_GET ["id"]) . "'" )) and ($sql->num_rows > 0) and ($row = $sql->fetch_array ())) {
            if ((isset ($_GET ["action"])) and ($_GET ["action"] === "comment")) { // action=comment
                $html = str_replace ("%title%", "HublistDc++ хабов Huburi" . safetext ((($row ["name"]) and ($row ["name"] !== "")) ? $row ["name"] : $row ["address"] . ((intval ($row ["port"]) !== 411) ? ":" . $row ["port"] : "")) . " - Comment", $html);
                $html = str_replace ("%id%", "hublist" . safetext ((($row ["id"]) and ($row ["id"] !== "")) ? $row ["id"] : $row ["address"] . ((intval ($row ["port"]) !== 411) ? ":" . $row ["port"] : "")) . "&action=comment", $html);
                $content = "";
                $err_author = false;
                $err_text = false;
                $err_vote = false;
                $err_code = false;
                $err_string = "";

                if (isset ($_POST ["comment_send"])) {
                    if ((isset ($_POST ["comment_author"])) and ($_POST ["comment_author"] !== "") and ($authorized === 0) and ($sql = $mysql->query ("select `class` from `accounts` where `username` = '" . $mysql->escape_string ($_POST ["comment_author"]) . "'")) and ($sql->num_rows > 0)) {
                        $err_author = true;
                        $err_string = "Author value is reserved, please use something else.";
                    } else if ((!isset ($_POST ["comment_text"])) or ($_POST ["comment_text"] === "")) {
                        $err_text = true;
                        $err_string = "Comment field is required.";
                    } else if ((isset ($_POST ["comment_vote"])) and ($_POST ["comment_vote"] !== "") and ($_POST ["comment_vote"] !== "good") and ($_POST ["comment_vote"] !== "bad")) {
                        $err_vote = true;
                        $err_string = "Vote field value is invalid.";
                    } else if (($authorized === 0) and ((!isset ($_POST ["comment_code"])) or ($_POST ["comment_code"] === ""))) {
                        $err_code = true;
                        $err_string = "Code field is required.";
                    } else if (($authorized === 0) and (!captcharesult ($_POST ["comment_codea"], $_POST ["comment_codeb"], $_POST ["comment_codec"], $_POST ["comment_code"]))) { // ($_POST ["comment_code"] !== (((isset ($_SESSION ["key"])) and ($_SESSION ["key"] !== "")) ? $_SESSION ["key"] : "123456"))
                        $err_code = true;
                        $err_string = "Invalid security code.";
                    } else if ((isset ($_POST ["comment_vote"])) and ($_POST ["comment_vote"] !== "") and ($istor)) {
                        $err_vote = true;
                        $err_string = "You can't vote for this hub because you're using Tor.";
                    } else if ((isset ($_POST ["comment_vote"])) and ($_POST ["comment_vote"] !== "") and (intval ($row ["banned"]) === 1)) {
                        $err_vote = true;
                        $err_string = "You can't vote for this hub because it's banned.";
                    } else {
                        $ok = true;

                        if ((isset ($_POST ["comment_vote"])) and ($_POST ["comment_vote"] !== "")) { // submit vote if we have one
                            if (($sql = $mysql->query ("select `id`, `time` from `hubvotes` where `addr` = '" . $mysql->escape_string ($_SERVER ["REMOTE_ADDR"]) . "' and `hub` = " . $row ["id"] . " limit 1")) and ($sql->num_rows > 0) and ($vote = $sql->fetch_array ())) {
                                if (($diff = (time () - $vote ["time"])) < 86400) {
                                    $err_vote = true;
                                    $err_string = sprintf ("You can't vote for this hub more than once a day, wait another %s.", uptimefromsec (86400 - $diff));
                                    $ok = false;
                                } else {
                                    $mysql->query ("update `hubvotes` set `vote` = '" . (($_POST ["comment_vote"] === "good") ? "+" : "-") . "', `time` = " . time () . ", `notify` = 0 where `id` = " . $vote ["id"]);
                                }
                            } else {
                                $mysql->query ("insert into `hubvotes` (`vote`, `time`, `addr`, `hub`) values ('" . (($_POST ["comment_vote"] === "good") ? "+" : "-") . "', " . time () . ", '" . $mysql->escape_string ($_SERVER ["REMOTE_ADDR"]) . "', " . $row ["id"] . ")");
                            }

                            if ($ok) {
                                $mysql->query ("update `hublist` set `" . $_POST ["comment_vote"] . "vote` = `" . $_POST ["comment_vote"] . "vote` + 1 where `id` = " . $row ["id"]);
                            }
                        }

                        if ($ok) {
                            $mysql->query ("insert into `comments` (`author`, `text`, `time`, `ip`, `type`, `type_id`) values (" . (((isset ($_POST ["comment_author"])) and ($_POST ["comment_author"] !== "")) ? "'" . $mysql->escape_string ($_POST ["comment_author"]) . "'" : "null") . ", '" . $mysql->escape_string ($_POST ["comment_text"]) . "', " . time () . ", '" . $mysql->escape_string ($_SERVER ["REMOTE_ADDR"]) . "', 5, " . $row ["id"] . ")");
                            header ("Location: https://andress/?do=hublist&id=" . $row ["id"] . "#" . $mysql->insert_id);
                            $echo = false;
 
A

avatar

Utente Attivo
3 Gen 2017
97
0
6
55
  • 3 Set 2019
  • #23
questo e un pezzo di codice
 

macus_adi

Utente Attivo
5 Dic 2017
1.343
91
48
IT/SW
  • 3 Set 2019
  • #24
avatar ha scritto:
se mi dici come devo fare e meglio
Clicca per allargare...
Devi parametrizzare le richieste....
Come devo dirtelo???
Hai bisogno di un router altrimenti non funziona...
Crea un piccolo helper per settare le variabili in _GET.

"Se utilizzi molte variabili in get"
ES: arriva la stringa /do/hublist/id/10
Come devo fare?
PHP:
function createGET(){
    $expl=explode('/',$_SERVER['REQUEST_URI']);
    $my_get=[];
    $parametri_da_considerare=['do','id']
     foreach($expl as $key=>$item){
          if(in_array($item,$parametri_da_considerare) && isset($expl[$key+1]) && !isset($my_get[$item])){
                 $my_get[$item]=$expl[$key+1];
          }
     }
    //SERVE SOLO PER VEDERE SE FUNZIONA TUTTO CORRETTAMENTE
     print_r($my_get);
     //questo passaggio lo lascio solo a scopo dimostrativo, sarebbe meglio aggiungerlo all'interno del primo ciclo
    foreach($my_get as $k=>$v){
          $_GET[$k]=$v;
    }
}
Nel file index.php o dove ti piace di più, ammettendo che tu abbia importato l'helper di cui sopra o la funzione...


index.php
PHP:
/**********************PRIMA DI TUTTO IL TUO CODICE ******************/
createGET();
/**********************INIZIA IL TUO CODICE*****************************/

Tutto qui, se magari crei una definizione di rotte è meglio....
 
A

avatar

Utente Attivo
3 Gen 2017
97
0
6
55
  • 3 Set 2019
  • #25
pensavo che era facile , invece non ho capito niente , tu mi dici le cose come se io fossi un programmatore , non ho capito nemmeno 1 parola di quello che hai scritto , scusa
 
A

avatar

Utente Attivo
3 Gen 2017
97
0
6
55
  • 3 Set 2019
  • #26
il primo codice dove lo inserisco ? devo creare un file.php ? secondo codice che hai scritto lo devo mettere nella index all'inizio dopo <?php ??
 
A

avatar

Utente Attivo
3 Gen 2017
97
0
6
55
  • 3 Set 2019
  • #27
se inserisco tutto il codice della index di 20618 linee mi potresti aiutare meglio ?
 
A

avatar

Utente Attivo
3 Gen 2017
97
0
6
55
  • 4 Set 2019
  • #28
buon giorno , Marcus inserendo tutti e 2 codici nella index.php il sito non funziona , errore 500
 

macus_adi

Utente Attivo
5 Dic 2017
1.343
91
48
IT/SW
  • 4 Set 2019
  • #29
avatar ha scritto:
buon giorno , Marcus inserendo tutti e 2 codici nella index.php il sito non funziona , errore 500
Clicca per allargare...
? Non so come è strutturato... ma 20k di righe di codice mi sembrano eccessive.... tutta la logica l'hai messa li dentro?
 
A

avatar

Utente Attivo
3 Gen 2017
97
0
6
55
  • 4 Set 2019
  • #30
gentilmente mi puoi dire con parole povere dove e cosa devo fare per inserire i 2 codici ?
 
A

avatar

Utente Attivo
3 Gen 2017
97
0
6
55
  • 4 Set 2019
  • #31
tutta la struttura del sito e nella index.php
 

macus_adi

Utente Attivo
5 Dic 2017
1.343
91
48
IT/SW
  • 4 Set 2019
  • #32
Vabbè...
PHP:
function createGET(){
    $expl=explode('/',$_SERVER['REQUEST_URI']);
    $my_get=[];
     //qui mancava il ";"
    $parametri_da_considerare=['do','id'];
     foreach($expl as $key=>$item){
          if(in_array($item,$parametri_da_considerare) && isset($expl[$key+1]) && !isset($my_get[$item])){
                 $my_get[$item]=$expl[$key+1];
          }
     }
    //SERVE SOLO PER VEDERE SE FUNZIONA TUTTO CORRETTAMENTE
     print_r($my_get);
     //questo passaggio lo lascio solo a scopo dimostrativo, sarebbe meglio aggiungerlo all'interno del primo ciclo
    foreach($my_get as $k=>$v){
          $_GET[$k]=$v;
    }
}
/**********************PRIMA DI TUTTO IL TUO CODICE ******************/
createGET();
/**********************INIZIA IL TUO CODICE*****************************/
Hai controllato eventuali ; mancati o hai fatto copia incolla?
Prova.... Però devi controllare non si copia->incolla senza capire....
 
A

avatar

Utente Attivo
3 Gen 2017
97
0
6
55
  • 4 Set 2019
  • #33
errore 500 non ce , ma nel sito spunta questo Array ( ) e le pagine sono sempre tutte uguali
 
A

avatar

Utente Attivo
3 Gen 2017
97
0
6
55
  • 4 Set 2019
  • #34
tutto il codice inserito da te io faccio solamente copia e incolla e inserisco tutto nella index.php
 
A

avatar

Utente Attivo
3 Gen 2017
97
0
6
55
  • 4 Set 2019
  • #35
Marcus ci rinuncio ?
 
A

avatar

Utente Attivo
3 Gen 2017
97
0
6
55
  • 5 Set 2019
  • #36
buon giorno , all'inizio della pagina web spunta questo Array ( ) e le pagine sono sempre tutte uguali
 

Max 1

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
29 Feb 2012
4.445
338
83
  • 5 Set 2019
  • #37
@avatar
Non avevi rinunciato?
Ti chiedo di non fare tanti post con poche parole (diventa anche difficile seguirti) riassumi tutto in un post
Grazie
 
A

avatar

Utente Attivo
3 Gen 2017
97
0
6
55
  • 5 Set 2019
  • #38
un Grazie a Marco per Aiuto e tempo dedicato per aiutarmi , Grazie Molto
 
A

avatar

Utente Attivo
3 Gen 2017
97
0
6
55
  • 7 Set 2019
  • #39
buona sera , Google indicizza URL cosi , dominio/hublist invece dovrebbe essere dominio/hublist/nomedellapagina , forse perché url e troppo lungo e viene indicizzato più corto da Google ? ( sarebbe buono se si puo fare dominio/nomedellapagina ed eliminare hublist ) un aiutino grazie grazie
 
Ultima modifica: 7 Set 2019
A

avatar

Utente Attivo
3 Gen 2017
97
0
6
55
  • 7 Set 2019
  • #40
un aiutino pleas ?
 
Prec.
  • 1
  • 2
  • 3
Succ.
Primo Prec. 2 di 3 Succ. Ultimo
Stato
Chiusa ad ulteriori risposte.

Discussioni simili

P
Rimozione automatica url da sitemap.xml con PHP
  • Peterrey76
  • 17 Set 2020
  • PHP
Risposte
1
Visite
946
PHP 17 Set 2020
Tommy03
[PHP] [regex] Validare un url
  • MarcoGrazia
  • 12 Giu 2020
  • PHP
Risposte
2
Visite
1K
PHP 12 Giu 2020
MarcoGrazia
N
WEBBOT CURL PHP
  • nuvola
  • 23 Apr 2020
  • PHP
Risposte
1
Visite
337
PHP 23 Apr 2020
Max 1
W
Come effettuare ripetute chiamate Curl con la stessa connessione autentica [PHP]
  • webfra01
  • 14 Set 2019
  • PHP
Risposte
0
Visite
1K
PHP 14 Set 2019
webfra01
W
L
[PHP] cambiare gli if in un url semplice
  • luigi777
  • 6 Ago 2019
  • PHP
Risposte
1
Visite
1K
PHP 7 Ago 2019
Tommy03
I
[PHP] generazione url "uguale" che punta a due immagini diverse
  • iucaa
  • 2 Ago 2019
  • PHP
Risposte
0
Visite
1K
PHP 2 Ago 2019
iucaa
I
L
[PHP] Riscrivere url
  • lucavalentino
  • 4 Lug 2019
  • PHP
Risposte
0
Visite
2K
PHP 4 Lug 2019
lucavalentino
L
Eliminare url index.php con variabili e reindirizzare alla home del sito
  • maxnegri
  • 3 Lug 2019
  • PHP
Risposte
7
Visite
3K
PHP 6 Lug 2019
maxnegri
L
[PHP] comando curl ad una pagin web
  • luigi falcone
  • 9 Mag 2019
  • PHP
Risposte
1
Visite
1K
PHP 9 Mag 2019
Max 1
L
[PHP] convertire gli url ad forma semplice
  • luigi777
  • 27 Apr 2019
  • PHP
Risposte
3
Visite
2K
PHP 28 Apr 2019
luigi777
L
P
[PHP] $_GET non preleva variabile nell’URL
  • paolofiorito
  • 26 Mar 2019
  • PHP
Risposte
4
Visite
2K
PHP 1 Apr 2019
paolofiorito
P
M
PHP CURL
  • mardom
  • 19 Set 2018
  • PHP
Risposte
0
Visite
951
PHP 19 Set 2018
mardom
M
A
[PHP] Inserimento url dinamici in pagina html
  • Aped
  • 20 Ago 2018
  • PHP
Risposte
3
Visite
2K
PHP 20 Ago 2018
Aped
A
W
[PHP] gestire una richiesta curl sul server
  • w_t
  • 13 Mag 2018
  • PHP
Risposte
0
Visite
1K
PHP 13 Mag 2018
w_t
W
I
[PHP] CURL per accesso ad area riservata
  • inkemodo
  • 15 Mar 2018
  • PHP
Risposte
6
Visite
2K
PHP 15 Mar 2018
inkemodo
I
M
[PHP] Bloccare richieste indesiderate cURL
  • MaryDB
  • 15 Dic 2017
  • PHP
Risposte
12
Visite
3K
PHP 16 Dic 2017
MaryDB
M
I
[PHP] Login Facebook SDK returned an error: No URL set!
  • iucaa
  • 20 Nov 2017
  • PHP
Risposte
0
Visite
2K
PHP 20 Nov 2017
iucaa
I
G
[PHP] togliere sotto directory dall'url
  • gio661
  • 9 Nov 2017
  • PHP
Risposte
0
Visite
1K
PHP 9 Nov 2017
gio661
G
G
[PHP] [HTML] Sito web URL e altro
  • Ghiso98
  • 16 Set 2017
  • PHP
Risposte
3
Visite
1K
PHP 16 Set 2017
Sevenjeak
G
  • Bloccata
Siti web URL e altro (PHP, HTML)
  • Ghiso98
  • 15 Set 2017
  • Presentati al Forum
Risposte
1
Visite
1K
Presentati al Forum 16 Set 2017
Max 1
Condividi:
Facebook X (Twitter) LinkedIn WhatsApp e-mail Condividi Link
  • Home
  • Forum
  • Fare Web
  • PHP
  • Italiano
  • Termini e condizioni d'uso del sito
  • Policy Privacy
  • Aiuto
  • Home
Community platform by XenForo® © 2010-2024 XenForo Ltd. | Traduzione a cura di XenForo Italia
Menu
Accedi

Registrati

  • Home
  • Forum
    • Nuovi Messaggi
    • Cerca...
  • Novità
    • Featured content
    • Nuovi Messaggi
    • Ultime Attività
X

Privacy & Transparency

We use cookies and similar technologies for the following purposes:

  • Personalized ads and content
  • Content measurement and audience insights

Do you accept cookies and these technologies?

X

Privacy & Transparency

We use cookies and similar technologies for the following purposes:

  • Personalized ads and content
  • Content measurement and audience insights

Do you accept cookies and these technologies?