-
Posts
289 -
Joined
-
Last visited
Everything posted by Noskiw
-
<?php function no_password($password){ $password = "bambam"; if(!$password){ echo "Please enter the password <a href='index.php?p=blog&p=admin&p=credentials'>here</a>!"; }else{ echo " <form action='index.php?p=blog' method='POST'> <table width='100%'> <tr> <td width='7%' valign='top'> Your Name: </td> <td valign='top'> <input type='text' name='name' maxlength='25' /> </td> </tr> <tr> <td valign='top'> Your Email: </td> <td> <input type='text' name='email' maxlength='35' /> </td> </tr> <tr> <td valign='top'> Your Message: </td> <td> <textarea cols='20' rows='2' name='message' maxlength='250'></textarea> <p><input type='submit' name='submit' value='Post' /> </td> </tr> </table> </form>"; } } ?> there is my function for protecting it <?php $cred = $_GET['credentails']; $p = $_GET['p']; include "functions.php"; no_password($password); ?> there is my admin page. <?php if(!$_POST['submit']){ echo "<form action='index.php?p=blog&p=admin&p=credentials' method='POST'>"; echo "Enter Credentials (password): <input type='password' name='password'>"; echo "<input type='submit' name='submit' value='Access' />"; echo "</form>"; }else{ $password = $_POST['password']; if(!$password){ echo "Password Required"; }else{ if($password != "bambam"){ echo "Wrong Password!"; } } } if($password == "bambam"){ echo "Successful!"; echo " <a href='index.php?p=blog&p=admin'>Place your post</a>"; } ?> and there is my credentials page... what am I doing wrong?
-
Nevermin, I'm going to do it the old fashioned way and put a link there instead. *Sigh*
-
why would I wan't it to stop outputting stuff when I want it to go to a different page?
-
<?php $cred = $_GET['credentails']; $p = $_GET['p']; require "credentials.php"; if(!$password){ header("Location: http://localhost/dynamic web page/index.php?p=blog&p=admin&p=credentials"); } if(!$_POST['submit']){ echo " <form action='index.php?p=blog' method='POST'> <table width='100%'> <tr> <td width='7%' valign='top'> Your Name: </td> <td valign='top'> <input type='text' name='name' maxlength='25' /> </td> </tr> <tr> <td valign='top'> Your Email: </td> <td> <input type='text' name='email' maxlength='35' /> </td> </tr> <tr> <td valign='top'> Your Message: </td> <td> <textarea cols='20' rows='2' name='message' maxlength='250'></textarea> <p><input type='submit' name='submit' value='Post' /> </td> </tr> </table> </form>"; } ?> Basically I have been trying to setup a blog for my band and make it easy for them to input data in the mysql table because half the time they don't know what i'm on about. I can do that, it's just these darn header errors that are buggin me. If someone would kindly help me, it would be greatly appreciated. Thankyou. :D I get the error before i have even put anything in on credentials.php <?php if(!$_POST['submit']){ echo "<form action='index.php?p=blog&p=admin&p=credentials' method='POST'>"; echo "Enter Credentials (password): <input type='password' name='password'>"; echo "<input type='submit' name='submit' value='Access' />"; echo "</form>"; }else{ $password = $_POST['password']; if(!$password){ echo "Password Required"; }else{ if($password != "bambam"){ echo "Wrong Password!"; } } } if($password == "bambam"){ header("Location: http://localhost/dynamic web page/index.php?p=blog&p=admin"); } ?> on this one I get when I enter the password... Please bear in mind I have read the header errors topic. didn't seem to help. i tried <?php $res = header("Location: http://localhost/dynamic web page/index.php?p=blog&p=admin"); if(!$_POST['submit']){ echo "<form action='index.php?p=blog&p=admin&p=credentials' method='POST'>"; echo "Enter Credentials (password): <input type='password' name='password'>"; echo "<input type='submit' name='submit' value='Access' />"; echo "</form>"; }else{ $password = $_POST['password']; if(!$password){ echo "Password Required"; }else{ if($password != "bambam"){ echo "Wrong Password!"; } } } if($password == "bambam"){ execute($res); } ?> but got undefined function errors. Which is getting really annoying, please will someone help.
-
thankyou, that worked.... xD
-
honestly, this stuff doesn't work for me...
-
i have the same problem again......
-
i have the same problem...
-
[/img] [attachment deleted by admin]
-
that gives me a list of my folders...
-
i still have the same problem...
-
it doesn't work...
-
that didn't really help...
-
<?php $title = "Guestbook"; $connect = mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("guest") or die(mysql_error()); function bbcode($string) { if ($string) { $bbcode_array = array('[b]', '[/b]', '[u]', '[/u]', '[i]', '[/i]', '[code]', ' ', ''); $bbcode_array_2 = array('<b>', '</b>', '<u>', '</u>', '<i>', '</i>', '<center><div style="width:90%;padding:3px;background-color:#000099;color:#FFFFFF;border:2px solid;">', '</div></center>', '<img src="', '">'); $new_string_2 = str_ireplace($bbcode_array, $bbcode_array_2, $string); return $new_string_2; } } echo "<h1>Guestbook</h1><hr />"; $queryget = mysql_query("SELECT * FROM guest ORDER BY id DESC") or die(mysql_error()); $querygetrownum = mysql_num_rows($queryget); if ($querygetrownum == 0) { echo "No posts have been made yet! Be the first!"; } //start pagination $per_page = 5; $start = $_GET['start']; $record_count = mysql_num_rows(mysql_query("SELECT * FROM guest")); $max_pages = $record_count / $per_page; if (!$start) { $start = 0; $get = mysql_query("SELECT * FROM guest ORDER BY id DESC LIMIT $start, $per_page"); while ($row2 = mysql_fetch_assoc($get)) { $name2 = $row2['name']; $email2 = $row2['email']; $message2 = $row2['message']; $date2 = $row2['date']; $time2 = $row2['time']; echo "<table><tr><td><b>Posted by: " . $name2 . "(" . $email2 . ") on " . $date2 . " at " . $time2 . "</b></td></tr><tr><td>" . nl2br(bbcode(strip_tags($message2))) . "</td></tr></table>"; echo "<hr />"; } } //setup prev and next variables $prev = $start - $per_page; $next = $start + $per_page; //show prev button if (!($start <= 0)){ echo "<a href='index.php?p=guestbook&start=$prev'>« Prev</a> "; }else{ echo "« Prev"; } //show page numbers //set variable for first page $i = 1; for ($x = 0; $x < $record_count; $x = $x + $per_page) { if ($start != $x){ echo " <a href='index.php?p=guestbook&start=$x'>$i</a> "; }else{ echo " <a href='index.php?p=guestbook&start=$x'><b>$i</b></a> "; } $i++; } //show next button if (!($start >= $record_count - $per_page)){ echo " <a href='index.php?p=guestbook&start=$next'>Next »</a>"; }else{ echo "Next »"; } if ($_POST['submit']) { $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $date = date("Y-m-d"); $time = date("H:i:s"); if ($name && $email && $message) { $querypost = mysql_query("INSERT INTO guest VALUES('','" . $name . "','" . $email . "','" . $message . "','" . $date . "','" . $time . "')"); echo "Please wait... <meta http-equiv='refresh' content='2'>"; } else { echo "Please fill out all fields!"; } } echo "<hr />"; echo " <form action='guestbook.php' method='POST'> <table width='100%'> <tr> <td width='7%' valign='top'> Your Name: </td> <td valign='top'> <input type='text' name='name' maxlength='25' /> </td> </tr> <tr> <td valign='top'> Your Email: </td> <td> <input type='text' name='email' maxlength='25' /> </td> </tr> <tr> <td valign='top'> Your Message: </td> <td> <textarea cols='20' rows='2' name='message' maxlength='250'></textarea> <p><input type='submit' name='submit' value='Post' /> </td> </tr> </table> </form>"; ?>[/code] my problem is that when i got to the next page, it doesn't show my next set of results in the mysql table... I was hoping that someone here could help me, i've tried rearanging the curly brackets but nothing seems to work...
-
It doesn't show the next set of results in my mysql table. I set the limit to 5 per page, and I purposely put 6 results in the table, and yet, when I go to the next page, the next set of results doesn't show.
-
<?php $connect = mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("guest") or die(mysql_error()); function bbcode($string) { if ($string) { $bbcode_array = array('[b]', '[/b]', '[u]', '[/u]', '[i]', '[/i]', '[code]', ' ', ''); $bbcode_array_2 = array('<b>', '</b>', '<u>', '</u>', '<i>', '</i>', '<center><div style="width:90%;padding:3px;background-color:#000099;color:#FFFFFF;border:2px solid;">', '</div></center>', '<img src="', '">'); $new_string_2 = str_ireplace($bbcode_array, $bbcode_array_2, $string); return $new_string_2; } } echo "<h1>Guestbook</h1><hr />"; $queryget = mysql_query("SELECT * FROM guest ORDER BY id DESC") or die(mysql_error()); $querygetrownum = mysql_num_rows($queryget); if ($querygetrownum == 0) { echo "No posts have been made yet! Be the first!"; } $per_page = 5; $start = $_GET['start']; $record_count = mysql_num_rows(mysql_query("SELECT * FROM guest")); $max_pages = $record_count / $per_page; if (!$start) { $start = 0; $get = mysql_query("SELECT * FROM guest ORDER BY id DESC LIMIT $start, $per_page"); while ($row2 = mysql_fetch_assoc($get)) { $name2 = $row2['name']; $email2 = $row2['email']; $message2 = $row2['message']; $date2 = $row2['date']; $time2 = $row2['time']; echo "<table><tr><td><b>Posted by: " . $name2 . "(" . $email2 . ") on " . $date2 . " at " . $time2 . "</b></td></tr><tr><td>" . nl2br(bbcode(strip_tags($message2))) . "</td></tr></table>"; echo "<hr />"; } } //setup prev and next variables $prev = $start - $per_page; $next = $start + $per_page; //show prev button if (!($start <= 0)){ echo "<a href='index.php?start=$prev'>Prev</a> "; }else{ echo "« Prev"; } //show page numbers //set variable for first page $i = 1; for ($x = 0; $x < $record_count; $x = $x + $per_page) { if ($start != $x){ echo " <a href='index.php?start=$x'>$i</a> "; }else{ echo " <a href='index.php?start=$x'><b>$i</b></a> "; } $i++; } //show next button if (!($start >= $record_count - $per_page)){ echo " <a href='index.php?start=$next'>Next</a>"; }else{ echo "Next »"; } if ($_POST['submit']) { $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $date = date("Y-m-d"); $time = date("H:i:s"); if ($name && $email && $message) { $querypost = mysql_query("INSERT INTO guest VALUES('','" . $name . "','" . $email . "','" . $message . "','" . $date . "','" . $time . "')"); echo "Please wait... <meta http-equiv='refresh' content='2'>"; } else { echo "Please fill out all fields!"; } } echo "<hr />"; echo " <form action='index.php' method='POST'> <table width='100%'> <tr> <td width='7%' valign='top'> Your Name: </td> <td valign='top'> <input type='text' name='name' maxlength='25' /> </td> </tr> <tr> <td valign='top'> Your Email: </td> <td> <input type='text' name='email' maxlength='25' /> </td> </tr> <tr> <td valign='top'> Your Message: </td> <td> <textarea cols='20' rows='2' name='message' maxlength='250'></textarea> <p><input type='submit' name='submit' value='Post' /> </td> </tr> </table> </form>"; ?> <style type="text/css"> body{font-family:Arial;font-size:14px;background-image: url('./images/bg.png');color:#FFFF00;}h1{font-family:Arial;}hr{color:#FFFF00; }a{color:#FFFFFF;text-decoration:none;}a:hover{color:#FFFFFF;text-decoration:underline;} </style>[/code] i'm having a problem with the next row of results. They wont show...
-
that was a test and you all failed... I put an extra "LIMIT" in somewhere $queryget = mysql_query("SELECT * FROM guest ORDER BY id DESC LIMIT".$start."") or die(mysql_error()); i put it there on purpose to see if anyone could catch it out.
-
<?php $connect = mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("guest") or die(mysql_error()); function bbcode($string) { if ($string) { $bbcode_array = array('[b]', '[/b]', '[u]', '[/u]', '[i]', '[/i]', '[code]', ' ', ''); $bbcode_array_2 = array('<b>', '</b>', '<u>', '</u>', '<i>', '</i>', '<center><div style="width:90%;padding:3px;background-color:#000099;color:#FFFFFF;border:2px solid;">', '</div></center>', '<img src="', '">'); $new_string_2 = str_ireplace($bbcode_array, $bbcode_array_2, $string); return $new_string_2; } } echo "<h1>Guestbook</h1><hr />"; $queryget = mysql_query("SELECT * FROM guest ORDER BY id DESC") or die(mysql_error ()); $querygetrownum = mysql_num_rows($queryget); if ($querygetrownum == 0) { echo "No posts have been made yet! Be the first!"; } $per_page = 5; $start = $_GET['start']; $record_count = mysql_num_rows(mysql_query("SELECT * FROM guest")); $max_pages = $record_count / $per_page; if (!$start) { $start = 0; $get = mysql_query("SELECT * FROM guest LIMIT $start, $per_page"); while ($row2 = mysql_fetch_assoc($get)) { $name2 = $row2['name']; $email2 = $row2['email']; $message2 = $row2['message']; $date2 = $row2['date']; $time2 = $row2['time']; echo "<table><tr><td><b>Posted by: " . $name2 . "(" . $email2 . ") on " . $date2 . " at " . $time2 . "</b></td></tr><tr><td>" . nl2br(bbcode(strip_tags($message2))) . "</td></tr></table>"; echo "<hr />"; } } //setup prev and next variables $prev = $start - $per_page; $next = $start + $per_page; //show prev button if (!($start <= 0)){ echo "<a href='index.php?start=$prev'>Prev</a> "; }else{ echo "« Prev"; } //show page numbers //set variable for first page $i = 1; for ($x = 0; $x < $record_count; $x = $x + $per_page) { if ($start != $x){ echo " <a href='index.php?start=$x'>$i</a> "; }else{ echo " <a href='index.php?start=$x'><b>$i</b></a> "; } $i++; } //show next button if (!($start >= $record_count - $per_page)){ echo " <a href='index.php?start=$next'>Next</a>"; }else{ echo "Next »"; } if ($_POST['submit']) { $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $date = date("Y-m-d"); $time = date("H:i:s"); if ($name && $email && $message) { $querypost = mysql_query("INSERT INTO guest VALUES('','" . $name . "','" . $email . "','" . $message . "','" . $date . "','" . $time . "')"); echo "Please wait... <meta http-equiv='refresh' content='2'>"; } else { echo "Please fill out all fields!"; } } echo "<hr />"; echo " <form action='index.php' method='POST'> <table width='100%'> <tr> <td width='7%' valign='top'> Your Name: </td> <td valign='top'> <input type='text' name='name' maxlength='25' /> </td> </tr> <tr> <td valign='top'> Your Email: </td> <td> <input type='text' name='email' maxlength='25' /> </td> </tr> <tr> <td valign='top'> Your Message: </td> <td> <textarea cols='20' rows='2' name='message' maxlength='250'></textarea> <p><input type='submit' name='submit' value='Post' /> </td> </tr> </table> </form>"; ?> <style type="text/css"> body{font-family:Arial;font-size:14px;background-image: url('./images/bg.png');color:#FFFF00;}h1{font-family:Arial;}hr{color:#FFFF00; }a{color:#FFFFFF;text-decoration:none;}a:hover{color:#FFFFFF;text-decoration:underline;} </style>[/code] i have finished what i wanted to do, but unfortunately, when i click on next in the page part, it wont display the next set of rows. There is more than 5 when i looked in my mysql table, but when i go to the next page, there is nothing.... Please may someone help me.
-
please help me, it's really frustrating.
-
i've read the manual and it doesn't seem to help...
-
This is so frustrating >.< >.< <?php $connect = mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("guest") or die(mysql_error()); $per_page = 5; $start = $_GET['start']; $record_count = mysql_num_rows(mysql_query("SELECT * FROM guest")); $max_pages = $record_count / $per_page; if(!$start){ $start = 0; $get = mysql_query("SELECT * FROM guest ORDER BY id DESC LIMIT $start, $per_page"); while($row2 = mysql_fetch_assoc($get)){ $name2 = $row2['name']; $email2 = $row2['email']; $message2 = $row2['message']; $date2 = $row2['date']; $time2 = $row2['time']; } } function bbcode($string){ if($string){ $bbcode_array = array('[b]','[/b]', '[u]', '[/u]', '[i]', '[/i]', '[code]', ' ', ''); $bbcode_array_2 = array('<b>', '</b>', '<u>', '</u>', '<i>', '</i>', '<center><div style="width:90%;padding:3px;background-color:#000099;color:#FFFFFF;border:2px solid;">', '</div></center>', '<img src="', '">'); $new_string_2 = str_ireplace($bbcode_array, $bbcode_array_2, $string); return $new_string_2; } } echo "<h1>Guestbook</h1><hr />"; $queryget = mysql_query("SELECT * FROM guest ORDER BY id DESC LIMIT".$start."") or die(mysql_error()); $querygetrownum = mysql_num_rows($queryget); if($querygetrownum == 0){ echo "No posts have been made yet! Be the first!"; } while ($row = mysql_fetch_assoc($queryget)) { $id = $row['id']; $name = $row['name']; $email = $row['email']; $message = $row['message']; $date = $row['date']; $time = $row['time']; echo "<table><tr><td><b>Posted by: ".$name."(".$email.") on " . $date . " at " . $time . "</b></td></tr><tr><td>" . nl2br(bbcode(strip_tags($message))) ."</td></tr></table>"; } if($_POST['submit']){ $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $date = date("Y-m-d"); $time = date("H:i:s"); if($name && $email && $message){ $querypost = mysql_query("INSERT INTO guest VALUES('','".$name."','".$email."','".$message."','".$date."','".$time."')"); echo "Please wait... <meta http-equiv='refresh' content='2'>"; }else{ echo "Please fill out all fields!"; } } echo "<hr />"; echo " <form action='index.php' method='POST'> <table width='100%'> <tr> <td width='7%' valign='top'> Your Name: </td> <td valign='top'> <input type='text' name='name' maxlength='25' /> </td> </tr> <tr> <td valign='top'> Your Email: </td> <td> <input type='text' name='email' maxlength='25' /> </td> </tr> <tr> <td valign='top'> Your Message: </td> <td> <textarea cols='20' rows='2' name='message' maxlength='250'></textarea> <p><input type='submit' name='submit' value='Post' /> </td> </tr> </table> </form>"; ?> <style type="text/css"> body{font-family:Arial;font-size:14px;background-image: url('./images/bg.png');color:#FFFF00;}h1{font-family:Arial;}hr{color:#FFFF00;} </style>[/code] it comes up with the error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT0' at line 1 Please Help... xD
-
function bbcode($string){ if($string){ $bbcode_array = array('[b]','[/b]', '[u]', '[/u]', '[i]', '[/i]', '[code]', ' ', ''); $bbcode_array_2 = array('<b>', '</b>', '<u>', '</u>', '<i>', '</i>', '<center><div style="width:90%;padding:3px;background-color:#000099;color:#FFFFFF;border:2px solid;">', '</div></center>', '<img src=', '"">'); $new_string_2 = str_ireplace($bbcode_array, $bbcode_array_2, $string); return $new_string_2; } }[/code] wont appear with a picture... ignore the http:// part in the code, i didn't put that there...
-
thanks for the code, but i was kind of hoping for more help with the smiley face part... I don't understand whats wrong with the colon. The output is just a simple "1"...