Autor | Zpráva | ||
---|---|---|---|
Josef Přerovský Profil |
Zdravím, mám takový problém s fórem...
Mám tam kod: <div class="col-md-8"> <?php //This page display a topic if(isset($_GET['id'])) { $id = intval($_GET['id']); $dn1 = mysql_fetch_array(mysql_query('select count(t.id) as nb1, t.title, t.message, t.parent, count(t2.id) as nb2, c.name from topics as t, topics as t2, categories as c where t.id="'.$id.'" and t.id2=1 and t2.id="'.$id.'" and c.id=t.parent group by t.id')); if($dn1['nb1']>0) { ?> <?php $dn2 = mysql_query('select t.id, t.title, t.authorid, u.nick as author, count(r.id) as replies from topics as t left join topics as r on r.parent="'.$id.'" and r.id=t.id and r.id2!=1 left join users as u on u.id=t.authorid where t.parent="'.$id.'" and t.id2=1 group by t.id order by t.timestamp2 desc'); while($dnn2 = mysql_fetch_array($dn2)) { ?> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">Fórum • <?php echo htmlentities($dn1['name'], ENT_QUOTES, 'UTF-8'); ?> • <?php echo htmlentities($dn1['title'], ENT_QUOTES, 'UTF-8'); ?> <?php if(isset($_SESSION['user'])) { ?> <a href="new_reply.php?id=<?php echo $id; ?>" class="btn btn-success pull-right">Nová odpověď</a> <?php } ?></h3> </div> <div class="panel-body"> <?php echo $dn1['message']; ?> <br><br> <div class="panel-footer"> <i class="fas fa-calendar-alt"></i> <?php echo date('d.m.Y v H:i' ,$dnn2['timestamp2']); ?> <i class="fa fa-user"></i> <a href="profile.php?id=<?php echo $dnn2['authorid']; ?>"><?php echo $dnn2['author']; ?></a> </div> </div> </div> <?php }} else { echo '<h2>This topic doesn\'t exist.</h2>'; } } else { echo '<h2>The ID of this topic is not defined.</h2>'; } ?> </div> A je divné, že zobrazuje topic pouze 1 a 2... 3,4,5,6 nic |
||
Keeehi Profil |
#2 · Zasláno: 28. 9. 2018, 23:25:54
Víckrát se ti to vpisuje nejspíše proto, že máš na řádku 13 cyklus.
|
||
Joker Profil |
Josef Přerovský:
Kromě toho má ten kód ještě další problémy: • Nebude fungovat v aktuální verzi PHP, protože tam nejsou mysql_* funkce. ' OR 1=1 -- , vypíše mi všechny záznamy.Kajman: Aha, opraveno, díky za upozornění. |
||
Kajman Profil |
#4 · Zasláno: 29. 9. 2018, 11:57:16
Joker:
Je tam intval. |
||
Časová prodleva: 6 let
|
0