login  Naam:   Wachtwoord: 
Registreer je!
 Forum

tekst gaat niet weg in php

Offline citexx - 12/02/2006 13:55 (laatste wijziging 12/02/2006 13:56)
Avatar van citexxNieuw lid He ik ben totaal beginner in php 

Ik heb een news systeem ergens vandaan gehaald (werkt prima)
maar nu heb ik een foutje ondekt..

kijk maar op www.citexx.nl en druk maar een op "join us" dan komt de tekst er boven te staan en het news er onder maar ik wil dat news weg hebben. Hoe werkt dat..

het is eeen heel goed scriptje maar ik laat hem tog ffjtes zien..
heb alleen de eerste 3 regeltjes toegevoegd.
  1. <?php
  2. if($action == "join"){
  3. echo "We hebben geen mensen meer nodig op dit moment";
  4. } //alleen deze 3 regeltjes heb ik gemaakt waarschijnlijk staat die heer fout ofzow
  5.  
  6. include 'config.php';
  7.  
  8.  
  9.  
  10.  
  11.  
  12. $tmpname = $_SESSION['name'];
  13.  
  14. if($tmpname == ""){
  15. }else{
  16. $sql = "SELECT user FROM `$newsadmin` WHERE user = '$tmpname'";
  17. $query = mysql_query($sql);
  18. $tmpname = mysql_result($query,0);
  19. }
  20. $sql = "SELECT nppage FROM `$newsoptions` WHERE 1";
  21. $query = mysql_query($sql);
  22. $nppage = mysql_result($query,0);
  23.  
  24. $sql = "SELECT cppage FROM `$newsoptions` WHERE 1";
  25. $query = mysql_query($sql);
  26. $cppage = mysql_result($query,0);
  27.  
  28. $sql = "SELECT * FROM `$newscomments` WHERE pid = '$_GET[id]'";
  29. $query = mysql_query($sql);
  30. $totalcomments = mysql_num_rows($query);
  31.  
  32. $sql = "SELECT * FROM `$newstable`";
  33. $query = mysql_query($sql);
  34. $totalnews = mysql_num_rows($query);
  35.  
  36.  
  37. $from = $_GET['from'];
  38. if($from == ""){
  39. $from = 0;
  40. }
  41. $page = $_GET['page'];
  42. if($page == ""){
  43. $page = 1;
  44. }
  45.  
  46.  
  47.  
  48.  
  49. $sql = "SELECT commentsorder FROM `$newsoptions` WHERE 1";
  50. $query = mysql_query($sql);
  51. $commentsorder = mysql_result($query,0);
  52.  
  53. $sql = "SELECT newsorder FROM `$newsoptions` WHERE 1";
  54. $query = mysql_query($sql);
  55. $newsorder = mysql_result($query,0);
  56.  
  57. $sql = "SELECT * FROM $newstable ORDER BY 0+ID $newsorder LIMIT $from ,$nppage";
  58. $result = mysql_query($sql)
  59. or die ("Couldn't execute query.");
  60.  
  61. $sql2 = "SELECT header FROM $newsoptions WHERE 1";
  62. $result2 = mysql_query($sql2);
  63. $sql3 = "SELECT footer FROM $newsoptions WHERE 1";
  64. $result3 = mysql_query($sql3);
  65. $sql4 = "SELECT template FROM $newsoptions WHERE 1";
  66. $result4 = mysql_query($sql4);
  67. $header = mysql_result($result2,0);
  68. $footer = mysql_result($result3,0);
  69. $template = mysql_result($result4,0);
  70.  
  71.  
  72. echo $header;
  73.  
  74. if($_GET['comments'] == ""){
  75. while($row = mysql_fetch_array( $result )) {
  76. $sql5 = "SELECT * FROM $newscomments WHERE pid = '$row[id]'";
  77. $query5 = mysql_query($sql5);
  78. $numcomments = mysql_num_rows($query5);
  79.  
  80. $template2 = $template;
  81. $template2 = str_replace("{title}",$row[title],$template2);
  82. $template2 = str_replace("{story}",$row[story],$template2);
  83. $template2 = str_replace("{author}",$row[author],$template2);
  84. $template2 = str_replace("{date}",$row[date],$template2);
  85. $template2 = str_replace("{id}",$row[id],$template2);
  86. $template2 = str_replace("[email]","<a href=\"mailto:$row[email]\">",$template2);
  87. $template2 = str_replace("[/email]","</a>",$template2);
  88. $template2 = str_replace("{email}",$row[email],$template2);
  89. $template2 = str_replace("[comments]","<a href=\"?comments=true&amp;id=$row[id]\">",$template2);
  90. $template2 = str_replace("[/comments]","</a>",$template2);
  91. $template2 = str_replace("{comments}",$numcomments,$template2);
  92. $template2 = str_replace("[img]","<img src=\"",$template2);
  93. $template2 = str_replace("[/img]","\">",$template2);
  94. if($row[avatar] == ""){
  95. $template2 = str_replace("{avatar}","",$template2);
  96. } else {
  97. $template2 = str_replace("{avatar}","<img src=\"$row[avatar]\">",$template2);
  98. }
  99. $sql = "SELECT * FROM $newssmilies";
  100. $query = mysql_query($sql);
  101. while($row = mysql_fetch_array( $query )) {
  102. $template2 = str_replace($row['keycode'],"<img src=\"$row[path]\">",$template2);
  103. }
  104. echo $template2;
  105. }
  106.  
  107.  
  108. $i = ($totalnews / $nppage);
  109. $i = ceil($i);
  110. $s = 1;
  111.  
  112. function previous($from,$nppage){
  113. if($from == 0){
  114. return " ";
  115. }else{
  116. $b = ($from - $nppage);
  117. return "<a href=\"?from=$b\"> ";
  118. }
  119. }
  120. $prev = previous($from,$nppage);
  121. echo $prev;
  122.  
  123.  
  124. function pages($nppage, $s , $i, $from){
  125. while ($s <= $i){
  126. $y = $s * $nppage;
  127. $x = $y - $nppage;
  128. if($from == $x){
  129. $c .= "$s ";
  130. }else{
  131. $c .= "<a href=\"?from=$x&amp;page=$s\">$s</a> ";
  132. }
  133. $s++;
  134. }
  135. return $c;
  136. }
  137.  
  138.  
  139. function nextlink($totalnews, $nppage, $page, $from){
  140. if($page >= ($totalnews / $nppage)){
  141. return " ";
  142. }else{
  143. $b = ($from + $nppage);
  144. $c = ($page + 1);
  145. return "<a href=\"?from=$b&amp;page=$c\">";
  146. }
  147. }
  148.  
  149.  
  150. $sql = "SELECT npagintation FROM `$newsoptions` WHERE 1";
  151. $query = mysql_query($sql);
  152. $npagintation = mysql_result($query,0);
  153. $npagintation = str_replace("[prev-link]", previous($from,$nppage),$npagintation);
  154. $npagintation = str_replace("[/prev-link]", "</a>",$npagintation);
  155. $npagintation = str_replace("[next-link]", nextlink($totalnews, $nppage, $page, $from),$npagintation);
  156. $npagintation = str_replace("[/next-link]", "</a>",$npagintation);
  157. $npagintation = str_replace("{pages}", pages($nppage,$s,$i,$from),$npagintation);
  158.  
  159. echo $npagintation;
  160.  
  161.  
  162. }else{
  163. $sql2 = "SELECT * FROM $newstable WHERE id = '$_GET[id]'";
  164. $result2 = mysql_query($sql2);
  165. $sql3 = "SELECT comments FROM $newsoptions WHERE 1";
  166. $result3 = mysql_query($sql3);
  167. $commentstemplate = mysql_result($result3,0);
  168. while($row = mysql_fetch_array($result2)) {
  169. $sql5 = "SELECT * FROM $newscomments WHERE pid = '$row[id]' ORDER BY 0+ID $commentsorder LIMIT $from ,$cppage";
  170. $query5 = mysql_query($sql5);
  171. $sql = "SELECT * FROM $newscomments WHERE pid = '$row[id]'";
  172. $query = mysql_query($sql);
  173. $numcomments = mysql_num_rows($query);
  174.  
  175. $template2 = $template;
  176. $template2 = str_replace("{title}",$row[title],$template2);
  177. $template2 = str_replace("{story}",$row[story],$template2);
  178. $template2 = str_replace("{author}",$row[author],$template2);
  179. $template2 = str_replace("{date}",$row[date],$template2);
  180. $template2 = str_replace("{id}",$row[id],$template2);
  181. $template2 = str_replace("[email]","<a href=\"mailto:$row[email]\">",$template2);
  182. $template2 = str_replace("[/email]","</a>",$template2);
  183. $template2 = str_replace("{email}",$row[email],$template2);
  184. $template2 = str_replace("[comments]","",$template2);
  185. $template2 = str_replace("[/comments]","",$template2);
  186. $template2 = str_replace("{comments}",$numcomments,$template2);
  187. $template2 = str_replace("[img]","<img src=\"",$template2);
  188. $template2 = str_replace("[/img]","\">",$template2);
  189. if($row[avatar] == ""){
  190. $template2 = str_replace("{avatar}","",$template2);
  191. } else {
  192. $template2 = str_replace("{avatar}","<img src=\"$row[avatar]\">",$template2);
  193. }
  194. $sql = "SELECT * FROM $newssmilies";
  195. $query = mysql_query($sql);
  196. while($row = mysql_fetch_array( $query )) {
  197. $template2 = str_replace($row['keycode'],"<img src=\"$row[path]\">",$template2);
  198. }
  199. echo $template2;
  200. while($row = mysql_fetch_array($query5)) {
  201. $commentstemplate2 = $commentstemplate;
  202.  
  203. $commentstemplate2 = str_replace("{date}",$row[date],$commentstemplate2);
  204. $author = strip_tags($row['user']);
  205. $commentstemplate2 = str_replace("{author}",$author,$commentstemplate2);
  206. $message = strip_tags($row['message']);
  207. $commentstemplate2 = str_replace("{message}",$message,$commentstemplate2);
  208. $email2 = strip_tags($row['email']);
  209. $commentstemplate2 = str_replace("{email}",$email2,$commentstemplate2);
  210. if($email2 == ""){
  211. $commentstemplate2 = str_replace("[email]","",$commentstemplate2);
  212. $commentstemplate2 = str_replace("[/email]","",$commentstemplate2);
  213. }else{
  214. $commentstemplate2 = str_replace("[email]","<a href=\"mailto:$row[email]\">",$commentstemplate2);
  215. $commentstemplate2 = str_replace("[/email]","</a>",$commentstemplate2);
  216. }
  217. $sql = "SELECT * FROM $newsfilter";
  218. $result = mysql_query($sql);
  219. while($row = mysql_fetch_array($result)) {
  220. $commentstemplate2 = eregi_replace($row['filter'],$row['alt'],$commentstemplate2);
  221. }
  222. echo $commentstemplate2;
  223. }
  224. }
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232. $i = ($totalcomments / $cppage);
  233. $i = ceil($i);
  234. $s = 1;
  235.  
  236. function cprevious($from,$cppage){
  237. if($from == 0){
  238. return " ";
  239. }else{
  240. $b = ($from - $cppage);
  241. return "<a href=\"?comments=true&amp;id=$_GET[id]&amp;from=$b\"> ";
  242. }
  243. }
  244. $prev = cprevious($from,$cppage);
  245. echo $prev;
  246.  
  247.  
  248. function cpages($cppage, $s , $i, $from){
  249. while ($s <= $i){
  250. $y = $s * $cppage;
  251. $x = $y - $cppage;
  252. if($from == $x){
  253. $c .= "$s ";
  254. }else{
  255. $c .= "<a href=\"?comments=true&amp;id=$_GET[id]&amp;from=$x&amp;page=$s\">$s</a> ";
  256. }
  257. $s++;
  258. }
  259. return $c;
  260. }
  261.  
  262.  
  263. function cnextlink($totalcomments, $cppage, $page, $from){
  264. if($page >= ($totalcomments / $cppage)){
  265. return " ";
  266. }else{
  267. $b = ($from + $cppage);
  268. $c = ($page + 1);
  269. return "<a href=\"?comments=true&amp;id=$_GET[id]&amp;from=$b&amp;page=$c\">";
  270. }
  271. }
  272.  
  273.  
  274. $sql = "SELECT cpagintation FROM `$newsoptions` WHERE 1";
  275. $query = mysql_query($sql);
  276. $cpagintation = mysql_result($query,0);
  277. $cpagintation = str_replace("[prev-link]", cprevious($from,$cppage),$cpagintation);
  278. $cpagintation = str_replace("[/prev-link]", "</a>",$cpagintation);
  279. $cpagintation = str_replace("[next-link]", cnextlink($totalcomments, $cppage, $page, $from),$cpagintation);
  280. $cpagintation = str_replace("[/next-link]", "</a>",$cpagintation);
  281. $cpagintation = str_replace("{pages}", cpages($cppage,$s,$i,$from),$cpagintation);
  282.  
  283. echo $cpagintation;
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291. if($_POST['B1'] == ""){
  292. $sql2 = "SELECT commentsform FROM $newsoptions WHERE 1";
  293. $result2 = mysql_query($sql2);
  294. if($tmpname == ""){
  295. }else{
  296. $sql = "SELECT email FROM $newsadmin WHERE user = '$tmpname'";
  297. $query = mysql_query($sql);
  298. $email = mysql_result($query,0);
  299. }
  300. $commentsform = mysql_result($result2,0);
  301. $commentsform = str_replace("{id}",$_GET['id'],$commentsform);
  302. $commentsform = str_replace("&lt;","<",$commentsform);
  303. $commentsform = str_replace("&gt;",">",$commentsform);
  304. $commentsform = str_replace("{name}","$tmpname",$commentsform);
  305. $commentsform = str_replace("{email}","$email",$commentsform);
  306. echo $commentsform;
  307. }else{
  308.  
  309. $sql = "SELECT * FROM `$newsadmin` WHERE user='$_POST[T1]'";
  310. $query = mysql_query($sql);
  311. $numrows = mysql_num_rows($query);
  312.  
  313. if($numrows > 0){
  314.  
  315. if($tmpname == $_POST['T1']){
  316. }else{
  317. echo "<font color=\"FF0000\">Please choose a different name. or log into the admin area <a href=\"admin.php\">here</a>.";
  318. die;
  319. }
  320.  
  321. }
  322. $sql2 = "SELECT commentsform FROM $newsoptions WHERE 1";
  323. $result2 = mysql_query($sql2);
  324. $commentsform = mysql_result($result2,0);
  325. $commentsform = str_replace("{id}",$_GET['id'],$commentsform);
  326. $commentsform = str_replace("&lt;","<",$commentsform);
  327. $commentsform = str_replace("&gt;",">",$commentsform);
  328. $commentsform = str_replace("{name}","$tmpname",$commentsform);
  329. $commentsform = str_replace("{email}","$email",$commentsform);
  330. if($_POST['T1'] == ""){
  331. echo "<font color=\"FF0000\">Please enter a username.</font>";
  332. echo $commentsform;
  333. }elseif($_POST['S1'] == ""){
  334. echo "<font color=\"FF0000\">Please enter a message.</font>";
  335. echo $commentsform;
  336. }else{
  337. $sql = "SELECT * FROM `$newscomments` WHERE pid = '$_GET[id]'";
  338. $result = mysql_query($sql);
  339. $comm = mysql_num_rows($result);
  340. $comm = $comm + 1;
  341. $user = $_POST['T1'];
  342. $user = strip_tags($user);
  343. $email = $_POST['T2'];
  344. $email = strip_tags($email);
  345. $message = $_POST['S1'];
  346. $message = strip_tags($message);
  347. $sql = "SELECT commentstime FROM `$newsoptions` WHERE 1";
  348. $query = mysql_query($sql);
  349. $date2 = mysql_result($query,0);
  350. $date = gmdate($date2);
  351. $sql = "INSERT INTO $newscomments (user,email,date,message,pid,id) VALUES ('$user','$email','$date','$message','$_GET[id]','$comm')";
  352. $result = mysql_query ($sql);
  353. $sql = "UPDATE $newstable SET comments = '$comm' WHERE id = '$_GET[id]'";
  354. $result = mysql_query ($sql);
  355. echo "Comment added.";
  356. echo "<SCRIPT LANGUAGE=\"JavaScript\">";
  357. echo "window.location=\"index.php?comments=true&id=$_GET[id]\"";
  358. echo "</script>";
  359. }
  360.  
  361. }
  362. if($action == "join"){
  363. echo "We hebben geen mensen meer nodig op dit moment";
  364.  
  365.  
  366. }
  367. }
  368. echo "\n$footer";
  369.  
  370.  
  371.  
  372.  
  373.  
  374. ?>

4 antwoorden

Gesponsorde links
Offline Sasuke - 12/02/2006 14:02 (laatste wijziging 12/02/2006 14:05)
Avatar van Sasuke HTML interesse Je moet er nog een else toevoegen.
Anders als het action gelijk is aan join dan gaat hij dat van if afdrukken EN dat van je nieuws systeem.

  1. <?php
  2. if($action == "join"){
  3. echo "We hebben geen mensen meer nodig op dit moment";
  4. } //alleen deze 3 regeltjes heb ik gemaakt waarschijnlijk staat die heer fout ofzow
  5. else {
  6. include 'config.php';
  7.  
  8. ....
  9. }
  10. ?>
Offline citexx - 12/02/2006 14:10 (laatste wijziging 12/02/2006 14:13)
Avatar van citexx Nieuw lid kan ik dat
  1. <?php
  2. if($action == "join"){
  3. echo "We hebben geen mensen meer nodig op dit moment";
  4. } //alleen deze 3 regeltjes heb ik gemaakt waarschijnlijk staat die heer fout ofzow
  5. else {
  6. ?>


Kijk maar www.citexx.nl en druk join us

niet ergens anders zetten want nu pakt die het zelfde lettertype en zo
Offline Sasuke - 12/02/2006 14:13
Avatar van Sasuke HTML interesse Snap je vraag niet zo goed, maar je kan het lettertype veranderen door bijvoorbeeld
  1. echo '<font size="1" face="verdana" color="...">We hebben...';


bedoel je dat?
Offline citexx - 12/02/2006 14:14 (laatste wijziging 12/02/2006 14:17)
Avatar van citexx Nieuw lid nee kijk maar ook naar de tekst links

maar ik heb het wel gewwoon eeen style.php gemaakt een dan include ^^
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.267s