Jump to content

J-C

Members
  • Posts

    33
  • Joined

  • Last visited

    Never

Everything posted by J-C

  1. Is it supposed to be in the same file? because the form is in index.php and the upload script is in upload.php, this is the form: <form action="upload.php" method="POST" enctype="multipart/form-data" name="upform" onSubmit="return No_file();"> <div class="input"> Image to upload: <br /> <input type="file" name="upload" /> <br /> </div> <center> <input type=submit name=Submit value="Upload Image" /> </center> </form>
  2. Ok my main problem is that When I refresh a page ( upload.php ) it uploads the file even if the form has not been submitted through the upload page ( index.php ), so essentially what I want is that when I refresh the page where I uploaded the file, instead of re-uploading to just keep the last uploaded file instead. Would this be achieved through sessions? if so can anyone help me please, because is really annoying that it just keeps re-uploading when I press refresh.
  3. damn could not edit post... use empty it works best...
  4. I KNOW THIS IS GRAVE DIGGING, but I was browsing through Google for some help and I decided to help the poster, Again sorry for grave digging. What you want to do is use isset(), or check if the $_POST/$_GET == 'NULL', again sorry for grave digging, I'm probably going to get flamed...
  5. J-C

    Guestbook

    After going tru the whole code one more time I finally found out what it was, thanks to you catfish i took a look at the portion you told me and figured it out, I was like wtf is $r if I have not declared it anywhere, and then i noticed that $r was incomplete it was supposed to be $rows xD so here it is $num_of_rows = $r[0]; that line should read $num_of_rows = $rows[0]; xD thanks catfish [ SOLVED ]
  6. J-C

    Guestbook

    But you made rows =16; because that is how many rows they are on that table, so if there are more rows it won't show them it would just stop at row 16... and i want to show new entered rows, any one else might know how to fix this?
  7. J-C

    Guestbook

    what the hell!!!! i see it working fine in your server!!!!!! how come in mine it just stays in the same page like here. http://74.170.18.102/gb maybe is something in my tables here: THIS is inside my while loop <center><table class=gb_table1 style="border-collapse:collapse; border:solid 1px #999999;" > <tr> <td style=> <div class=gbdiv > <table style="border-collapse:collapse; "> <tr> <td style="background:#202020; color:white; font-size:11px; font-weight:bold;" align=left> Date</td> <td style="background:#202020; color:white; font-size:11px; font-weight:bold;" align=left> : </td> <td style="background:#202020; color:#cccccc; font-size:11px; font-weight:100;padding-left:10px;"> <?php echo $rows['datetime']; ?> </td> </tr> <td style="background:#202020; color:white; font-size:11px; font-weight:bold;" align=left> Name</td> <td style="background:#202020; color:white; font-size:11px; font-weight:bold;" align=left> : </td> <td style="background:#202020; color:green; font-size:13px; font-weight:100;padding-left:10px;"> <?php echo $rows['name']; ?> </td></tr> <tr> <td style="background:#202020; color:white; font-size:11px; font-weight:bold;" align=left> Number </td> <td style="background:#202020; color:white; font-size:11px; font-weight:bold;" align=left> : </td> <td style="background:#202020; color:red; font-size:11px; font-weight:100;padding-left:10px;"> <?php echo $rows['id']; ?> </td></tr> </table> <tr><td class="comment" style="background:#333333; padding:5px; font-size:14px; color:white; " > <?php echo $rows['comment']; ?> </td></tr> </div> </td> </tr> </td> </tr> </table > </center>
  8. J-C

    Guestbook

    <?php $host="localhost"; $username=""; $password=""; $db_name="guestbook"; $tbl_name="gb"; // Connect to server and select database. $conn = mysql_connect("$host", "$username", "$password")or die("cannot connect to the server "); $select_db = mysql_select_db("$db_name",$conn)or die("cannot select the Data Base"); $sql="SELECT COUNT(*) FROM $tbl_name"; $result=mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); $rows = mysql_fetch_row($result); $num_of_rows = $r[0]; $rowsperpage = 2; $totalpages = ceil($num_of_rows / $rowsperpage); // get the current page or set a default if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) { // cast var as int $currentpage = (int) $_GET['currentpage']; } else { // default page num $currentpage = 1; } // end if // if current page is greater than total pages... if ($currentpage > $totalpages) { // set current page to last page $currentpage = $totalpages; } // end if // if current page is less than first page... if ($currentpage < 1) { // set current page to first page $currentpage = 1; } // end if $offset = ($currentpage - 1) * $rowsperpage; $sql = "SELECT name, datetime, email, comment, id, comment FROM $tbl_name LIMIT $offset, $rowsperpage"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); //while ($list = mysql_fetch_assoc($result)) { while($rows=mysql_fetch_assoc($result)){ ?> DISPLAY ROWS HERE!!!! <?php } // end while /****** build the pagination links ******/ // if not on page 1, don't show back links if ($currentpage > 1) { // show << link to go back to page 1 echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1'><<</a> "; // get previous page num $prevpage = $currentpage - 1; // show < link to go back to 1 page echo " <center><a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'><</a></center> "; } // end if // range of num links to show $range = 3; // loop to show links to range of pages around current page for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) { // if it's a valid page number... if (($x > 0) && ($x <= $totalpages)) { // if we're on current page... if ($x == $currentpage) { // 'highlight' it but don't make a link echo " [<b>$x</b>] "; // if not current page... } else { // make it a link echo "<center> <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> </center>"; } // end else } // end if } // end for // if not on last page, show forward and last page links if ($currentpage != $totalpages) { // get next page $nextpage = $currentpage + 1; // echo forward link for next page echo "<center><a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'> <font color=#6d80f6> ></font></a> "; // echo forward link for last page echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'> <font color=red> >> </font></a> </center><br>"; } // end if /****** end build pagination links ******/ mysql_close(); //close database ?> Well i posted in the other thread but it says solved so i guess people won't look there, Like i said in the other thread this works just fine except when i click next page it just shows the main page the first one... I don't know what I did wrong
  9. J-C

    Guestbook

    OK so i followed the tutorial and everything works fine except for one thing... when ever i click next to go to next page it doesn't go to it, it goes to it on the browser but it still displays the same page i was currently at. <?php $host="localhost"; $username=""; $password=""; $db_name="guestbook"; $tbl_name="gb"; // Connect to server and select database. $conn = mysql_connect("$host", "$username", "$password")or die("cannot connect to the server "); $select_db = mysql_select_db("$db_name",$conn)or die("cannot select the Data Base"); $sql="SELECT COUNT(*) FROM $tbl_name"; $result=mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); $rows = mysql_fetch_row($result); $num_of_rows = $r[0]; $rowsperpage = 2; $totalpages = ceil($num_of_rows / $rowsperpage); // get the current page or set a default if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) { // cast var as int $currentpage = (int) $_GET['currentpage']; } else { // default page num $currentpage = 1; } // end if // if current page is greater than total pages... if ($currentpage > $totalpages) { // set current page to last page $currentpage = $totalpages; } // end if // if current page is less than first page... if ($currentpage < 1) { // set current page to first page $currentpage = 1; } // end if $offset = ($currentpage - 1) * $rowsperpage; $sql = "SELECT name, datetime, email, comment, id, comment FROM $tbl_name LIMIT $offset, $rowsperpage"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); //while ($list = mysql_fetch_assoc($result)) { while($rows=mysql_fetch_assoc($result)){ ?> DISPLAY ROWS HERE!!!! <?php } // end while /****** build the pagination links ******/ // if not on page 1, don't show back links if ($currentpage > 1) { // show << link to go back to page 1 echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1'><<</a> "; // get previous page num $prevpage = $currentpage - 1; // show < link to go back to 1 page echo " <center><a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'><</a></center> "; } // end if // range of num links to show $range = 3; // loop to show links to range of pages around current page for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) { // if it's a valid page number... if (($x > 0) && ($x <= $totalpages)) { // if we're on current page... if ($x == $currentpage) { // 'highlight' it but don't make a link echo " [<b>$x</b>] "; // if not current page... } else { // make it a link echo "<center> <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> </center>"; } // end else } // end if } // end for // if not on last page, show forward and last page links if ($currentpage != $totalpages) { // get next page $nextpage = $currentpage + 1; // echo forward link for next page echo "<center><a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'> <font color=#6d80f6> ></font></a> "; // echo forward link for last page echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'> <font color=red> >> </font></a> </center><br>"; } // end if /****** end build pagination links ******/ mysql_close(); //close database ?>
  10. did you know you can just enable MYSQL from the xampp control panel (executable) and also run as svc ( service mode ) it works for me.
  11. J-C

    Guestbook

    LOL!! I can't believe it was right under my nose and it starts with some lil jokes that make a me lol a lil, anyways THANK YOU !
  12. J-C

    Guestbook

    EXACTLY. I have tried looking for tutorial and man no luck, I'm guessing it has to search mysql and some other stuff, if you can point me to a tutorial to achieve something similar that'd be great
  13. OH lol well you can do as suggested above or you can do this echo ' <br /> '; lol i know is really gay but it works xD
  14. LOL i actually didn't think he wanted to output an ACTUAL "<br />" xD i guess that would make more sense why he can't get it working
  15. J-C

    Guestbook

    Well I have finally coded a simple guest book for my site, didn't take long is pretty simple I haven't even added bb codes or smiles etc, but I want to know how to make a next page after 10 entries have been made in the database. For example 10 people signed my guest book I want to automatically generate another page for 10 more entries because displaying all entries would make a page load slow. I hope some one understood what i meant
  16. You can still out put a line break but you need to do it like this echo '<br>';
  17. J-C

    Fine in FF but IE...

    lol is a css bug not php I just realized that... Firefox does all the work for you but apparently you need to code your css like in "ORDER" for it to be correctly displayed, well anyways thanks for your help it took me some time but i finally did everything right.
  18. J-C

    Fine in FF but IE...

    WOW can't edit my posts lol wtf, anyways the thing was i HAD to have the classess in css like according how they were on the html like if class gpb comes before class gpa I HAD to have them before in the style css... is some weird stuff, didn't happen to me b4
  19. J-C

    Fine in FF but IE...

    Can't even modify my post... anyways is not that i put server on and still the problem remains Can you guys go to the website and tell me if you see it fine?
  20. J-C

    Fine in FF but IE...

    nah im sure what i think it might be now is ( LOL ) My port 80 isn't open o.O but i don't get how that should affect it though...
  21. J-C

    Fine in FF but IE...

    lol I am using the same one o.O version 6
  22. wait what? are you just trying to get like what ever was typed in the form? then you just need to give a name to all the inputs in the form. for example <input type="text" name="name1"> then to get the $_POST you would just use $_POST['name1'] of course the form would have to be method=post is this not what you want?
  23. Ok i have this scripts that were working fine on both browsers and then i backed them up and did a clean install windows xp and now they are fine in Fire fox but explorer.... they are really weird not displaying any images and tables ... ugh is like is not using the css i assigned at all... anyways here is the website: http://davenger.tk or http://74.170.18.102 index: <?php define('access',true); require_once '/xampp/htdocs/f/handler.php'; echo' <html> <!-- HEAD --> <head> <title>Dark Avenger</title> <link rel="stylesheet" type="text/css" href="style.css" > </head> <!-- HEAD --> <body> <!-- Main Banner --> <div class=MT1> <div class=banner> </div> </div> <!-- Main Banner --> <!-- Main title --> <div class=MT1> <div class=MT> </div> </div> <!-- Main title --> <!-- Main table --> <table class=maint align=center> <tr> <td> <!-- Control panel --> <!-- Log in form -->'; if ($loggedIn == False) { echo '<form method="POST" action="f/log/Hlogin.php" > <table class=top_left_table align=left > <caption class="topbg" style="padding:1px; border-width:1px;border-color:#C7C7C7;border-style:solid solid none solid;"> Control Panel </caption> <tr> <td > Username: </td> <td> <input type="text" id="username" name="username" class=userbox /> </td> </tr> <tr><td> Password:</td> <td> <input type="password" id="password" name="password" class=userbox /> </td> </tr> <td> <input type="submit" value="Log in" name="submit" class="button" > </td> <td> <a href="f/Register/index.php" target="_top" STYLE="text-decoration:none" > <input type="button" value="Register" class="button" > </a> </td> </form> </table> '; } if($loggedIn == True) { echo' <table class=loggedin align=left > <caption class="topbg" style="padding:1px; border-width:1px;border-color:#C7C7C7;border-style:solid solid none solid;"> Control Panel </caption> <tr> <td > Logged in as : <b><font color=green>' .$_SESSION['username']. ' </font></b> <form method="POST" action="/f/log/Hlogout.php" > <br /> <input type="submit" name="logout" value="Logout" class="logoutb" > <a style="text-decoration: none" href="f/Cpanel.php"> <input type="submit" name="Cpanel" value="Cpanel" class="cpb" ></a> </form> </td></tr></table> <!-- Log in form --> <!-- Control panel --> '; } echo' <table class=main_table> <th> Main </th> <tr> <td> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer porttitor felis at nunc tincidunt tincidunt. Nulla posuere convallis tincidunt. Sed gravida turpis vitae metus ullamcorper congue. In vitae orci eu purus commodo fermentum et sit amet sem. Vivamus sed accumsan turpis. Etiam placerat feugiat sollicitudin. Nam vitae est augue, quis commodo tellus. <br><br> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer porttitor felis at nunc tincidunt tincidunt. Nulla posuere convallis tincidunt. Sed gravida turpis vitae metus ullamcorper congue. In vitae orci eu purus commodo fermentum et sit amet sem. Vivamus sed accumsan turpis. Etiam placerat feugiat sollicitudin. Nam vitae est augue, quis commodo tellus. </td> </tr> </table> </table> <!-- Main table --> <!-- bottom title --> <div class=MT1> <div class=table_bottom_title> </div> </div> <!-- bottom title --> <!-- bottom frame --> <center> <iframe src="f/f.htm" class=iframe frameborder=0 scrolling=no marginheight=0 > </iframe> </center> <!-- bottom frame --> <!-- last frame --> <div class=MT1> <table class=copyright > <tr> <td> Dark Avenger by <b> <a href="http://www.Davenger.tk"> <font color="#4CC417"> J-C </font> </a> </b> </td> </tr></table> </div> <!-- last frame --> </table> </body> </html>'; ?> css: body { background: #333333; color:#c7c7c7; } .copyright{ margin-top:30px; font-size:11px; text-align:center; margin-left:auto; margin-right:auto; background:url(images/cr.jpg); width:236px; height:28px; } .banner { margin-left:auto; margin-right:auto; margin-bottom:30px; width:800px; height:110px; margin-top:20px; background:url(images/banner.gif); } .MT1 { text-align:center; } .gbdiv { border:solid 1px #999999; padding:2px;background:#333333;" } .gb_tables { border-collapse:collapse;background:#333333; font-size:11px; font-weight:bold; color:white; } .MT { border-collapse:collapse; margin-left:auto; margin-right:auto; width:800px;height:60px; background-image: url(images/mt.gif); } .userbox { width:80px; height:20px; } .gbbox { width:150px; height:20px; } .gb_table { background:#202020; padding:10px; width:798; border:1px solid #7b7b7b; } .gb_info_table { background:#202020; padding:1px; border:1px solid #7b7b7b; } .gb_table td{ background:#202020; } .gb_table1 { vertical-align:top; width:100%; } .gb_table2 { text-align:center; } .gb_table2 td{ text-align:left; padding:6px; border:1px solid #7b7b7b; color:white; font-size:13px; } .comment_box { width:150px; height:60px; } .button{ width:80px; float:left; text-align:center; } .logoutb{ width:55px; float:left; text-align:center; } .cpb{ width:60px; float:right; text-align:center; } .maint { background:#202020; width:794px; border:1px solid #7b7b7b; } .maint td{ padding-top:15px; padding-bottom:15px;padding-left:34; padding-right:10; background:#202020; } .top_left_table { background:#262626; border:solid 1px #c7c7c7 ; } .top_left_table td{ font: 11px verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; background:#262626; padding:3px; width:80px; } .loggedin { background:#262626; border:solid 1px #c7c7c7 ; } .loggedin td{ border:dotted 1px #c7c7c7; padding-left:4px; font: 11px verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; background:#262626;padding-top:4px; } .topbg { font: 13px geneva, lucida, 'lucida grande', arial, helvetica, sans-serif ; color:#202020; font-weight:600; background:url(images/td.png); } .main_table { background:#202020; margin-left:300px; border:solid 1px #c7c7c7 ; } .main_table td{ font: 11px verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; padding-left:10px; padding-top:10px; padding-bottom:10px; border:dotted 1px #e7e7e7; width:400; background:#262626; } .main_table th{ font: 13px geneva, lucida, 'lucida grande', arial, helvetica, sans-serif ; color:#202020; font-weight:600; background:url(images/td.png); } .table_bottom_title { border-collapse:collapse; margin-bottom:10px; margin-left:auto; margin-right:auto; width:800px; height:30px; background:url(images/bottom_title.gif); } .iframe{ width:798; height:26px; }
  24. Ok simple question, I have been goggling and the stuff i come around doesn't work like <script>document.form.reset();</script> when i press f5 in Firefox the values that I already put are still there, is not really a big deal but if you know how to do this please help. EDIT: ok I have founded it is onload="document.FORMNAME.reset();" where FORMNAME is obviously the form you want to refresh, guess I should have looked harder.
×
×
  • 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.