Jump to content

phpwiz

Members
  • Posts

    78
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

phpwiz's Achievements

Member

Member (2/5)

0

Reputation

  1. http://youtube.com/phpacademy great news tutorial. and if you need help: http://phpacademy.info
  2. is it possible to make an auto refreshing chatbox with php and ajax maybe??? becase i know how to do the database and php stuff but i dont know about the ajax?!?!?!
  3. ok well that didn't help me with my problem.
  4. ok i have made a code for a contest on my site. a pretty simple code but when they click submit it says "Please fill in all fields" when i did fill them all in here is the PHP code: <?php //include "BBcode.php"; //include "admin.php"; $connect = mysql_connect('localhost', 'root', '') or die("Couldnt connect"); mysql_select_db('members') or die("Couldn't find db"); $namecheck = mysql_query("SELECT IP FROM results"); $count = mysql_num_rows($namecheck); if ($_POST ['post']) { //get data $sprite = $_POST ['sprite']; $body = $_POST ['body']; $date = $_POST ['date']; $IP = $_SERVER["HTTP_X_FORWARDED_FOR"]; //check for existance if ($sprite&&$body) { $date = date ("Y-m-d"); //insert data $insert = mysql_query("INSERT INTO results VALUES ('$sprite','$body','$date','$IP')") or die (mysql_error ()); echo "You have successfully submitted the contest form! <a href='#'>View It?</a>"; } else { echo "Please fill out all fields<p>"; } } else { } ?> please help, thankyou. edit: here is the full code. <html> <head> <title>Pokemon Celestial :: Online RPG</title> <style type='text/css'> body { background-image: url('images/main_g.png'); background-repeat:repeat-x; font-family: arial; font-size: 8px; color: #000000; } input[type=text] { border: 1px solid green; background: #D6F4FF; } input[type=text]:hover { border: 1px solid red; background: #D6F4FF; } input[type=submit] { border: 1px solid black; background: #e1e1e1; } #container { width: 900px; font-family: arial; font-size: 8px; color: #000000; } .nav_top { background-image: url('images/nav_top.png'); font-size: 20px; text-align: center; height: 30px; width: 221px; position: relative; top: 3px; left: 180px; display: block; } .nav_topR { background-image: url('images/nav_top.png'); font-size: 20px; text-align: center; height: 30px; width: 221px; position: relative; top: 3px; left: 0px; float: right; } .border { border: 1px solid black; border-left: 1px solid black; border-top: 1px solid black; color: black; background: #000000; font-family: arial; border-right: 1px solid black; border-bottom: 1px solid black; } .padding { padding: 6px; } </style> </head> <body> <?php //include "BBcode.php"; //include "admin.php"; $connect = mysql_connect('localhost', 'root', '') or die("Couldnt connect"); mysql_select_db('members') or die("Couldn't find db"); $namecheck = mysql_query("SELECT IP FROM results"); $count = mysql_num_rows($namecheck); if ($_POST ['post']) { //get data $sprite = $_POST ['sprite']; $body = $_POST ['body']; $date = $_POST ['date']; $IP = $_SERVER["HTTP_X_FORWARDED_FOR"]; //check for existance if ($sprite&&$body) { $date = date ("Y-m-d"); //insert data $insert = mysql_query("INSERT INTO results VALUES ('$sprite','$body','$date','$IP')") or die (mysql_error ()); echo "You have successfully submitted the contest form! <a href='#'>View It?</a>"; } else { echo "Please fill out all fields<p>"; } } else { } ?> <center> <div id='container' align="center"> <!-- Start Banner --> <img src="http://localhost/splash/images/banner.png"></center> <!-- End banner --> <br><br><br><br> <center> <table class='border' width='700px'> <tr bgcolor='#FFFFC2'> <td colspan='2'> <center>.:: Spriter Contest! ::.</center> </td> </tr> <tr bgcolor='#FFFFFF'> <td colspan='2'> <div class='padding'><center>I am making a Spriter contest because i need help with the sprites, i am coding alone so it would be <b><u>VERY</u></b> hard to make all of the sprites aswell.</center></div> </td> </tr> <tr bgcolor='#FFFFFF'> <td> <center><div class='padding'> Rules:</div> </center> </td> <td> The Sprites have to be yours, and they <u>CANNOT</u> be fullbody recolors. you can decorate them as you please. and you can only submit an entry once! (i have your IP stored in the database). </td> </tr> <tr bgcolor='#FFFFFF'> <td> <center><div class='padding'>Prize(s):</div> </center> </td> <td> if you get chosen to become the spriter you will be on the staff list and you will get a Celestial Rayquaza one of the rarest pokemon inside of the RPG! and 300 Celestial Coins or CC for short. </td> </tr> <tr bgcolor='#FFFFFF'> <td colspan='2'> <center>Please enter the link to a sample of your sprites:</center> </td> </tr> <tr bgcolor='#FFFFFF'> <td colspan='2'> <div class='padding'> <center><input type='text' name='sprite' maxlength='200'></center> </div> </td> </tr> </tr> <tr bgcolor='#FFFFFF'> <td colspan='2'> <center>Please tell me why you would like to be a spriter for The Pokemon Celestial RPG:</center> </td> </tr> <tr bgcolor='#FFFFFF'> <td colspan='2'> <div class='padding'> <center><textarea rows='6' cols='35' name='body'></textarea></center> </div> </td> </tr> <tr bgcolor='#FFFFFF'> <td colspan='2'> <div class='padding'><center> <form action='' method='post'> <input type='submit' name='post' value='Submit'> </form> </center></div> </td> </tr> </table> </center> <br><br><br><br> <!-- start disclaimer --> <center><img src="images/disclaimer-celestial.png"></center> <!-- end disclaimer --> </div> </body> </html>
  5. Well perhaps you could elaborate on what you are looking for? Do you mean like: [Prev] 1 - 2 - 3 ... - 10 -11 [Next] ? ok exactly what i want is here go to http://tpa-rpg.co.cc click the splash, make an account, login and go on the left menu where it says "news comments" then under where it displays the news it shows how many pages of comments there are. i already know how to display the news and stuff but i want to be able to display the "comment pages" where ever i want on my web page. if that makes sense. So you're looking to paginate the comments? Just apply what Bendude14 said to your comments section of your code. i was trying to work it out with him on msn and he logged out i really have no idea how to do this if you could like show me. here is the entire code i have so far: <html> <head> <title>comments</title> <style type='text/css'> body { background: #333333; } #container { width: 905px; <!-- border-style: solid; border-width: 1px; border-color: white; --> } .banner { background-image: url('images/banner.png'); width: 900px; height: 132px; } .cen { background-image: url('images/Comment_top.png'); width: 494px; height: 18px; text-align: center; color: #000000; font-family: arial; font-size: 13px; } .Nav_L { background-image: url('images/N_head.png'); width: 200px; height: 17px; text-align: center; color: #000000; font-family: arial; font-size: 13px; float: left; } .Nav_R { background-image: url('images/N_head.png'); width: 200px; height: 17px; text-align: center; color: #000000; font-family: arial; font-size: 14px; float: right; } .nav { text-align: center; background-image: url('images/Nav.png'); text-decoration: none; font-family: verdana; height: 18px; width: 200px; font-size: 10px; display: block; } .solid { border: 1px solid black; border-left: 1px solid black; border-top: 1px solid black; color: black; font-family: verdana; border-right: 1px solid black; border-bottom: 1px solid black; } .padding { padding: 5px; } .padding1 { padding: 2px; } </style> <head> <body> <center> <?php include("BBcode.php"); //connect to database mysql_connect('localhost','root','') or die(mysql_error()); mysql_select_db('comments') or die(mysql_error()); //max displayed per page $per_page = 1; //get start variable $start = $_GET['start']; //count records $record_count = mysql_num_rows(mysql_query("SELECT * FROM comments")); //count max pages $max_pages = $record_count / $per_page; //may come out as decimal if (!$start) $start = 0; //display data //query the db $getnews = mysql_query("SELECT * FROM news ORDER BY id DESC LIMIT 1") or die(mysql_error()); while ($row1 = mysql_fetch_assoc ($getnews) ) { //get data $id1 = $row1 ['id']; $title1 = $row1 ['title']; $body1 = $row1 ['body']; $date1 = $row1 ['date']; $time1 = $row1 ['time']; $avatar1 = $row1 ['avatar']; $postee1 = $row1 ['postee']; echo "<div class='cen'><div class='padding1'>News Subject: <b> "; echo $title1; echo "</b></div></div>"; echo "<table class='border1' width='494px'>"; echo " <tr bgcolor='#D0D0D0'> <td colspan='2' width='5px'><font size='2'><center><u>Avatar</u></td> <td colspan='2'><font size='2'><center>News Post</td> </tr> <tr bgcolor='#FFFFFF'> <td colspan='2' width='21%'><font size='2'><center><img src='$avatar1'></td> <td colspan='2' class='padding' valign='top'><font size='2' face='verdana'>"; echo nl2br(bbcode_format(strip_tags($body1))); echo "</td> </tr> <tr bgcolor='#D0D0D0'> <td colspan='2' width='5px'><font size='2'><center>Options</td> <td colspan='2'><font size='2'><center><a href='#'>Modify</a> <a href='#'>Delete</a> <a href='#'>Quote</a></td> </tr> <tr bgcolor='#D0D0D0'> <td colspan='2' width='5px'><font size='2'><center><u>Date:</u></td> <td colspan='2'><font size='2'><center>"; echo $date1; echo "</td> </tr> <tr bgcolor='#D0D0D0'> <td colspan='2' width='5px'><font size='2'><center><u>Time:</u></td> <td colspan='2'><font size='2'><center>"; echo $time1; echo "</td> </tr> "; echo "</table>"; echo "<br>"; } echo "<div class='cen'><div class='padding1'>Pages Of Comments</div></div>"; echo "<table width='494px' class='border1'>"; echo " <tr bgcolor='#FFFFFF'> <td> <center><font size='2' face='verdana'>Number of pages inside of here.</font></center> </td> </tr> "; echo "</table>"; echo "<br />"; $get = mysql_query("SELECT * FROM comments LIMIT $start, $per_page"); while ($row = mysql_fetch_assoc($get)) { // get data $id = $row ['id']; $body = $row ['body']; $date = $row ['date']; $postee = $row ['poster']; $time = $row ['time']; $avatar = $row ['avatar']; echo "<div class='cen'><div class='padding1'>Comment</div></div>"; echo "<table width='494px' class='solid'>"; echo " <tr bgcolor='#D0D0D0'> <td colspan='2' width='5px'><font size='2'><center><u>Avatar:</u></td> <td colspan='2'><font size='2'><center>Posted By:"; echo $postee; echo "</td> </tr> <tr bgcolor='#FFFFFF'> <td colspan='2' width='21%'><font size='2'><center><img src='$avatar'></td> <td colspan='2' class='padding' valign='top'><font size='2' face='verdana'>"; echo nl2br(bbcode_format(strip_tags($body))); echo "</td> </tr> <tr bgcolor='#D0D0D0'> <td colspan='2' width='5px'><font size='2'><center>Options</td> <td colspan='2'><font size='2'><center><a href='#'>Modify</a> <a href='#'>Delete</a> <a href='#'>Quote</a></td> </tr> <tr bgcolor='#D0D0D0'> <td colspan='2' width='5px'><font size='2'><center><u>Date:</u></td> <td colspan='2'><font size='2'><center>"; echo $date; echo "</td> </tr> <tr bgcolor='#D0D0D0'> <td colspan='2' width='5px'><font size='2'><center><u>Time:</u></td> <td colspan='2'><font size='2'><center>"; echo $time; echo "</td> </tr> "; echo "</table>"; echo "<br>"; } //setup prev and next variables $prev = $start - $per_page; $next = $start + $per_page; //show prev button if (!($start<=0)) echo "<a href='omg.php?start=$prev'>Prev</a> "; //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='omg.php?start=$x'>$i</a> "; else echo " <a href='omg.php?start=$x'><b>$i</b></a> "; $i++; } //show next button if (!($start>=$record_count-$per_page)) { echo " <div class='Cen'>Pages</div> <table class='solid'> <tr bgcolor='#FFFFFF'> <td width='486px'><center> <a href='omg.php?start=$next'>Next</a> </td> </tr> </table> "; } else { } ?> </body> </html> can you please just show me so i can learn from that since i am a visual learner.
  6. Well perhaps you could elaborate on what you are looking for? Do you mean like: [Prev] 1 - 2 - 3 ... - 10 -11 [Next] ? ok exactly what i want is here go to http://tpa-rpg.co.cc click the splash, make an account, login and go on the left menu where it says "news comments" then under where it displays the news it shows how many pages of comments there are. i already know how to display the news and stuff but i want to be able to display the "comment pages" where ever i want on my web page. if that makes sense.
  7. phpwiz

    Layout help!

    dude are you blind? i was showing a screenshot of what the code i posted makes the other site is here obviously you can't help me :/
  8. phpwiz

    Layout help!

    the one i am working on is the screenshot i want it to somewhat look like the site i showed you, like the same style, can you help me with that o.o?
  9. Ok i think i am going blind, lol i dont know how to edit my post but i wanted to say that can you also check out my css post here
  10. phpwiz

    Layout help!

    Ok, i am trying to make a layout and it isnt working, i have tried MANY diffrent ways of trying to do this and when i tried to do it it looks like this: screenshot here but i want it to look something like this site: link here! and here is the code: <html> <head> <title>Website</title> <style type='text/css'> body { background: #333333; } #container { width: 905px; <!-- border-style: solid; border-width: 1px; border-color: white; --> } .banner { background-image: url('images/banner.png'); width: 900px; height: 132px; } .cen { background-image: url('images/Comment_top.png'); width: 494px; height: 18px; text-align: center; color: #000000; font-family: arial; font-size: 13px; } .Nav_L { background-image: url('images/N_head.png'); width: 200px; height: 17px; text-align: center; color: #000000; font-family: arial; font-size: 13px; float: left; } .Nav_R { background-image: url('images/N_head.png'); width: 200px; height: 17px; text-align: center; color: #000000; font-family: arial; font-size: 14px; float: right; } .nav { text-align: center; background-image: url('images/Nav.png'); text-decoration: none; font-family: verdana; height: 18px; width: 200px; font-size: 10px; display: block; } </style> <head> <body> <!-- start and center container --> <div align='center'> <div id='container'> <!-- start banner --> <center> <div class='banner'></div> </center> <!-- End banner --> <!-- start table --> <table valign='top'> <!-- start Left nav --> <div align='left'> <div class='Nav_L'>General</div><br> <div class='nav'>test</div> </div> <!-- End Left Nav --> <!-- start right nav --> <div class='Nav_R'>Statistics</div> <!-- End Left Nav --> <!-- Start middle --> <center> <div class='cen'>.::Welcome::.</div> </center> <!-- End middle --> </table> </div> </div> <!-- End center and container --> </body> </html> please can someone help me fix this problem. i kinda need it done asap
  11. Ok, i have a code for my comments using pagintation but i just want to display the number of pages like intead of next/prev and also i want to put the number of pages in the table i have where it says "next" but i also want to be able to put the number of the pages and links anywhere else on the page can you please help me do this it would be AMAZING. here is the code. <html> <head> <title>Website</title> <style type='text/css'> body { background: #333333; } #container { width: 905px; <!-- border-style: solid; border-width: 1px; border-color: white; --> } .banner { background-image: url('images/banner.png'); width: 900px; height: 132px; } .cen { background-image: url('images/Comment_top.png'); width: 494px; height: 18px; text-align: center; color: #000000; font-family: arial; font-size: 13px; } .Nav_L { background-image: url('images/N_head.png'); width: 200px; height: 17px; text-align: center; color: #000000; font-family: arial; font-size: 13px; float: left; } .Nav_R { background-image: url('images/N_head.png'); width: 200px; height: 17px; text-align: center; color: #000000; font-family: arial; font-size: 14px; float: right; } .nav { text-align: center; background-image: url('images/Nav.png'); text-decoration: none; font-family: verdana; height: 18px; width: 200px; font-size: 10px; display: block; } .solid { border: 1px solid black; border-left: 1px solid black; border-top: 1px solid black; color: black; font-family: verdana; border-right: 1px solid black; border-bottom: 1px solid black; } .padding { padding: 5px; } </style> <head> <body> <center> <?php include("BBcode.php"); //connecting to the database $error = "Could not connect to the database"; mysql_connect('localhost','root','') or die($error); mysql_select_db('comments') or die($error); //max displayed per page $per_page = 1; //get start variable $start = $_GET['start']; //count records $record_count = mysql_num_rows(mysql_query("SELECT * FROM comments")); //count max pages $max_pages = $record_count / $per_page; //may come out as decimal if (!$start) $start = 0; //display data $get = mysql_query("SELECT * FROM comments LIMIT $start, $per_page"); while ($row = mysql_fetch_assoc($get)) { // get data $id = $row ['id']; $body = $row ['body']; $date = $row ['date']; $postee = $row ['poster']; $time = $row ['time']; $avatar = $row ['avatar']; echo "<div class='cen'>Comment</div>"; echo "<table width='494px' class='solid'>"; echo " <tr bgcolor='#D0D0D0'> <td colspan='2' width='5px'><font size='2'><center><u>Avatar:</u></td> <td colspan='2'><font size='2'><center>Posted By:"; echo $postee; echo "</td> </tr> <tr bgcolor='#FFFFFF'> <td colspan='2' width='21%'><font size='2'><center><img src='$avatar'></td> <td colspan='2' class='padding' valign='top'><font size='2' face='verdana'>"; echo nl2br(bbcode_format(strip_tags($body))); echo "</td> </tr> <tr bgcolor='#D0D0D0'> <td colspan='2' width='5px'><font size='2'><center>Options</td> <td colspan='2'><font size='2'><center><a href='#'>Modify</a> <a href='#'>Delete</a> <a href='#'>Quote</a></td> </tr> <tr bgcolor='#D0D0D0'> <td colspan='2' width='5px'><font size='2'><center><u>Date:</u></td> <td colspan='2'><font size='2'><center>"; echo $date; echo "</td> </tr> <tr bgcolor='#D0D0D0'> <td colspan='2' width='5px'><font size='2'><center><u>Time:</u></td> <td colspan='2'><font size='2'><center>"; echo $time; echo "</td> </tr> "; echo "</table>"; echo "<br>"; } //setup prev and next variables $prev = $start - $per_page; $next = $start + $per_page; //show prev button if (!($start<=0)) echo "<a href='omg.php?start=$prev'>Prev</a> "; //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='omg.php?start=$x'>$i</a> "; else echo " <a href='omg.php?start=$x'><b>$i</b></a> "; $i++; } //show next button if (!($start>=$record_count-$per_page)) { echo " <div class='Cen'>Pages</div> <table class='solid'> <tr bgcolor='#FFFFFF'> <td width='486px'><center> <a href='omg.php?start=$next'>Next</a> </td> </tr> </table> "; } else { } ?> </body> </html>
  12. Ok, i have made a BBcode/emoticon script and i have a "quote" option in it it all works perfectly BUT i want the Quotes to get smaller/smaller everytime someone quotes someone else so it becoames like a quote pyrimid i will show a screenshot of what i kinda want mine to look like. screenshot: i smudged out some of the words. here is the BBcode script: <html> <head> <style type='text/css'> .solid { border: 1px solid black; border-left: 1px solid black; border-top: 1px solid black; color: black; font-family: arial; border-right: 1px solid black; border-bottom: 1px solid black; } .border { border: 1px solid black; border-left: 1px solid black; border-top: 1px solid black; color: black; background: #97B3FF; font-family: arial; border-right: 1px solid black; border-bottom: 1px solid black; } .border1 { border: 1px solid black; border-left: 1px solid black; border-top: 1px solid black; color: black; background: #000000; font-family: verdanda; border-right: 1px solid black; border-bottom: 1px solid black; } </style> </head> </html> <?php function bbcode_format ($str) { $str = htmlentities($str); $simple_search = array( //added line break '/\[br\]/is', '/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[u\](.*?)\[\/u\]/is', '/\[url\=(.*?)\](.*?)\[\/url\]/is', '/\[url\](.*?)\[\/url\]/is', '/\[align\=(left|center|right)\](.*?)\[\/align\]/is', '/\[img\](.*?)\[\/img\]/is', '/\[mail\=(.*?)\](.*?)\[\/mail\]/is', '/\[mail\](.*?)\[\/mail\]/is', '/\[font\=(.*?)\](.*?)\[\/font\]/is', '/\[size\=(.*?)\](.*?)\[\/size\]/is', '/\[color\=(.*?)\](.*?)\[\/color\]/is', //added textarea for code presentation '/\[codearea\](.*?)\[\/codearea\]/is', //added pre class for code presentation '/\[code\](.*?)\[\/code\]/is', //added paragraph '/\[p\](.*?)\[\/p\]/is', '/\[quote\](.*?)\[\/quote\]/is', //emoticons '/\:smile:/is', '/\:wow:/is', '/\:cool:/is', '/\:bigsmile:/is', '/\:cry:/is', ); $simple_replace = array( //added line break '<br />', '<strong>$1</strong>', '<em>$1</em>', '<u>$1</u>', // added nofollow to prevent spam '<a href="$1" rel="nofollow" title="$2 - $1">$2</a>', '<a href="$1" rel="nofollow" title="$1">$1</a>', '<div align="$1">$2</div>', //added alt attribute for validation '<img src="$1" alt="" />', '<a href="mailto:$1">$2</a>', '<a href="mailto:$1">$1</a>', '<span style="font-family: $1;">$2</span>', '<span style="font-size: $1;">$2</span>', '<span style="color: $1;">$2</span>', //added textarea for code presentation '<textarea class="code_container" rows="10" cols="60">$1</textarea>', //added pre class for code presentation '<pre class="code">$1</pre>', //added paragraph '<p>$1</p>', '<div class="border"><b>Quote</b><br>$1</div>', //emoticons '<img src="http://i587.photobucket.com/albums/ss319/allstarbrian/smiley/005_ssmile.gif">', '<img src="http://i587.photobucket.com/albums/ss319/allstarbrian/smiley/005_ssuprised.gif">', '<img src="http://i587.photobucket.com/albums/ss319/allstarbrian/smiley/005_scool.gif">', '<img src="http://i587.photobucket.com/albums/ss319/allstarbrian/smiley/005_sbiggrin.gif">', '<img src="http://i587.photobucket.com/albums/ss319/allstarbrian/smiley/005_scry.gif">', ); // Do simple BBCode's $str = preg_replace ($simple_search, $simple_replace, $str); // Do <blockquote> BBCode $str = bbcode_quote ($str); return $str; } function bbcode_quote ($str) { //added div and class for quotes $open = '<blockquote><div class="quote">'; $close = '</div></blockquote>'; // How often is the open tag? preg_match_all ('/\[quote\]/i', $str, $matches); $opentags = count($matches['0']); // How often is the close tag? preg_match_all ('/\[\/quote\]/i', $str, $matches); $closetags = count($matches['0']); // Check how many tags have been unclosed // And add the unclosing tag at the end of the message $unclosed = $opentags - $closetags; for ($i = 0; $i < $unclosed; $i++) { $str .= '</div></blockquote>'; } // Do replacement $str = str_replace ('[' . 'quote]', $open, $str); $str = str_replace ('[/' . 'quote]', $close, $str); return $str; } can someone PLEASE help me with this, thankyou --Brian
  13. Ok, i did what catfish told me to do and most of it works but when i put ?Splash=false it goes to the index page and when i put ?Splash=True it still goes to the same page? here is the code <?php if ($_GET['Splash']) { // insert code to load the splash page echo "you are not on the splash page!"; } else { // insert code to load normal index.php echo "Welcome to the splash page!"; } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.