Jump to content

phpwiz

Members
  • Posts

    78
  • Joined

  • Last visited

    Never

Everything posted by phpwiz

  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!"; } ?>
  14. Hi, i was wondering how i could make it so if the user is logged into my website and they try to go to the login page it says an error message like: Sorry you have to be logged out to see this page. and this is what i have so far. if () { } else { echo "Sorry, you have to be logged out to view this page. <a href='logout.php'>Logout?</a>"; } but i dont know what to put in the if statement.
  15. i didntreally understand that :/
  16. Ok, i am trying to make it so that if the user goes to index.php it looks somewhat like this... http://tpa-rpg.co.cc/index.php they click the splash and it goes to http://tpa-rpg.co.cc/index.php?Splash=False but if they go to ?Splash=True it shows the splash. can someone please tell me how to do this. (Keep in mind that i am a newb)
  17. phpwiz

    Pages...

    You sure seem to need a lot of things ASAP. Maybe you should pay someone if you're in such a hurry. well i am trying to create my own website since i am only 13 years old and i have been coding for about a month or so
  18. ok i was wondering on my news_comments.php where i display all the user comments how i could make it add a new page every 20 or so comments so that it dosent totally lag the page, if you can please tell me how to do this it would be awesome, i kinda need this asap for my website since i put it into maintenance for me coding this/learning how to code it.
  19. phpwiz

    HELP!!!

    Ok i tried to get one to work and it didnt, here is the entire code <?php session_start(); ?> <script language="JavaScript"> var Editor; function Format(action) { Editor.execCommand(action, false, null); } function Colour(colour) { Editor.execCommand("forecolor",false, colour); } window.onload = function() { Editor = document.getElementById('textbox').contentWindow.document; Editor.designMode = "on"; document.forms[0].onsubmit = function() { var text = document.getElementById('text'); text.value = Editor.body.innerHTML; } } </script> <?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 username FROM users"); $count = mysql_num_rows($namecheck); if ($_SESSION['username']) { if ($_POST ['post']) { //get data $title = $_POST ['title']; $body = $_POST ['body']; $date = $_POST ['date']; $postee = $_SESSION['username']; $avatar = $_POST ['avatar']; //check for existance if ($title&&$body&&$avatar) { $date = date ("Y-m-d"); //insert data $insert = mysql_query("INSERT INTO news VALUES ('','$title','$body','$date','$postee','$avatar')") or die (mysql_error ()); echo "Your news has been posted! <a href='v_news.php'>News here.</a>"; } else { echo "Please fill out title and body!<p>"; } } else { ?> <form action='p_news.php' method='POST'> <table> <tr> <td> <input type="button" onclick="Format('[b]TEXT HERE[/b]')" value="Bold" /> <input type="button" onclick="Format('[u]TEXT HERE[/u]')" value="Underline" /> <input type="button" onclick="Format('[i]TEXT HERE[/i]')" value="italics" /> <input type="button" onclick="Format('[s]TEXT HERE[/s]')" value="Strike" /> <input type="button" onclick="Format('[url=http://URL HERE]LINK[/u]')" value="Url" /> <input type="button" onclick="Format('[img=IMG LINK HERE]')" value="Img" /> <input type="button" onclick="Format('[color=blue]TEXT HERE[/color]')" value="Color" /> </td> </tr> </table> <table> <td> Title: </td> <td> <input type='text' name='title'><p> </td> </tr> <tr> <td> Avatar: </td> <td> <input type='text' name='avatar'><p> </td> </tr> <tr> <td> Body:<br> </td> <td> <iframe id="textbox" style="width:300px; height:150px"></iframe><br/> </td> </tr> <tr> <td> </td> <td> <input type='submit' name='post' value='Post this news!'> </td> </tr> </table> </form> <?php } } else die("Sorry you are not logged in <a href='login.php'> Click here</a> to login"); ?>
  20. phpwiz

    HELP!!!

    ok i have made a script with bbcodes and emoticons and it all works perfectly but i need a php code where it inserts the selected option into the text area. what i mean to say is. on top of when u post a topic or reply on phpfreaks forum there are buttons and stuff that u can click and it enters the [][/] stuff for you i am trying to make this does anyone know how or can they teach me please because i need this ASAP!!!!!
  21. alert function then use onclick :/
  22. can someone please help i need this fixed ASAP!!!!
  23. ok, i have made a register script on my localhost and i made an IP variable so that it inserts the users IP when they register but when i tested it it dosent show the IP it says ::1 in the database PLEASE HELP!!!! here is tthe code: <?php //connect to database $connect = mysql_connect("localhost","root",""); mysql_select_db("members"); $submit = $_POST['submit']; // form data $username = (strip_tags($_POST['username'])); $password = (strip_tags($_POST['password'])); $repeatpassword = (strip_tags($_POST['repeatpassword'])); $date = date("Y-m-d"); $IP = $_SERVER['REMOTE_ADDR']; $avatar = "http://www.pokemonelite2000.com/sprites/frlgemtr/frlgemtr113.png"; $money = 250; $sig = "No Signature"; $title = (strip_tags($_POST['title'])); $email = (strip_tags($_POST['email'])); $group = 0; $form = 1; $gender1 = @$_POST['gender']; $gender = $_POST['gender']; if ($submit) { $namecheck = mysql_query("SELECT username FROM users WHERE username='$username'"); $count = mysql_num_rows($namecheck); if ($count!=0) { die("This username has already been taken! <a href='register.php'>Back?</a>"); } //check for existance if ($username&&$password&&$repeatpassword&&$email&&$title) { if($password==$repeatpassword) { //check char length of username and name if (strlen($username)>35||strlen($email)>255||strlen($title)>55) { echo "Length of username,email or Title is too long! <a href='register.php'>Back?</a>"; } else { //check password length if (strlen($password)>100||strlen($password)<6) { echo "Password must be between 6 and 35 characters <a href='register.php'>Back?</a>"; } else { //register the user switch ($gender) { case "Male"; $gender_db = "M"; break; case "Female"; $gender_db = "F"; break; } //encrypt password $password = md5($password); $repeatpassword = md5(repeatpassword); $queryreg = mysql_query("INSERT INTO users VALUES('','$username','$password','$title','$sig','$gender_db','$email','$group','$date','$avatar','$credits','$IP') "); die ("You have Successfully been registered! <a href='login.php'>login</a>"); } } } else echo "Your passwords do not match! <a href='register.php'>Back?</a>"; } else echo "Please fill in <b>all</b> fields! <a href='register.php'>Back?</a>"; } ?> <form action="<?php echo $PHP_SELF ?>" method="POST"> <table> <tr> <td><font size='2' face='arial'>Username:</td> <td><input type="text" name="username" value="<?php echo $username ?>"></td> </tr> <tr> <td><font size='2' face='arial'>Password:</td> <td><input type="password" name="password"></td> </tr> <tr> <td><font size='2' face='arial'>Confirm:</td> <td><input type="password" name="repeatpassword"></td> </tr> <tr> <td><font size='2' face='arial'>Email:</td> <td><input type='text' name='email'></td> </tr> <tr> <td><font size='2' face='arial'>Trainer Title</td> <td><input type='text' name='title'></td> </tr> <tr> <td><font size='2' face='arial'>Gender:</td> <td><font size='2' face='arial'><select name='gender'> <option>Male</option> <option>Female</option> </select></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" name="submit" value="Register"></td> </tr> </table></font> </form> </td> </tr> </table>
×
×
  • 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.