Jump to content

pocobueno1388

Members
  • Posts

    3,369
  • Joined

  • Last visited

    Never

Everything posted by pocobueno1388

  1. Just to build on the previous post: <?php mysql_query("TRUNCATE table table_name"); ?>
  2. Write to a text file: http://www.tizag.com/phpT/filewrite.php http://www.phphelps.com/9_How_to_write_a_file_in_PHP.shtml Create a text file: http://www.tizag.com/phpT/filecreate.php
  3. Try this out: <?php $check = 'ps -A | grep $PROCESS'; if ($check_result = shell_exec($check)) { // server is running echo '$PROCESS is running.'; } else { echo '$PROCESS is not running'; } ?>
  4. This should give you what you want. <?php $str = "There should be no spaces"; $str = str_replace(array("\n", "\r", "\t", " "), '', $str); echo $str; ?>
  5. <?php $str = "There should be no spaces"; $str = str_replace(' ', '', $str); echo $str; ?>
  6. The only thing you really can do is keep a watch over everyone and how many accounts they have on their IP, and if the IP has too many people on it, just look through the accounts and see if there is anything suspicious going on.
  7. Give this a try: <?php $two_weeks_ago = date ('Y-m-d', strtotime ("$date - 14")); if (($row["date_post"] < $two_weeks_ago) echo "<font color=red>new</font></li>"; else echo "</li>"; ?>
  8. Did you try what I told you to do? That should give you what you want...
  9. Whats the difference between a dropdown box and a list box? If your referring to a listbox being the same thing as a drop-down, just with more choices showing, then you just have to add the "size" attribute. echo '<select name="houselist" size=10>';
  10. Strange, when I upload it to my server I get no errors. Make sure you have a text editor that isn't going to count white spaces as code, that could mess the script up. Try this: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>New user</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php if (isset($_POST['add'])) { include 'library/config.php'; include 'library/opendb.php'; $username = $_POST['login']; $password = $_POST['password']; $query = "INSERT INTO login (login, password) VALUES ('$username','$password')"; mysql_query($query) or die('Error, insert query failed'); $query = "FLUSH PRIVILEGES"; mysql_query($query) or die('Error, insert query failed'); include 'library/closedb.php'; echo "New MySQL user added"; } else { ?> <form method="post"> <table width="400" border="0" cellspacing="1" cellpadding="2"> <tr> <td width="100">Username</td> <td><input name="username" type="text" id="login"></td> </tr> <tr> <td width="100">Password</td> <td><input name="password" type="text" id="password"></td> </tr> <tr> <td width="100"> </td> <td> </td> </tr> <tr> <td width="100"> </td> <td><input name="add" type="submit" id="add" value="Add New User"></td> </tr> </table> </form> <?php } ?> </body> </html> I didn't change much, but that might make the difference. Also, make sure you use [code.][./code] next time (without the dots).
  11. I don't think PHP can do this...here are some pages that might be of some help: http://www.devx.com/tips/Tip/29285 http://www.quirksmode.org/js/events_properties.html Here, there is a bunch on google: http://www.google.com/search?hl=en&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=finding+coordinates+of+mouse+with+javascript&spell=1
  12. I don't know how much chat logs would hold up. Honestly bad mouthing him isn't going to do any good, I wouldn't put all the blame on him. If you are programming for someone, you need to have a contract, and if you don't have a contract, have them pay first.
  13. Do you have a contract with this person? If you don't, I'm not sure theres much you can do...
  14. echo your query out and see what it prints...there is probably a variable with no value in it.
  15. The first block of code you posted has a never ending amount of errors...but your second block of code didn't have much. Here is your second block of code with no syntax errors: <?php if (isset($_POST['add'])) { include 'library/config.php'; include 'library/opendb.php'; $username = $_POST['login']; $password = $_POST['password']; $query = "INSERT INTO login (login, password) VALUES ('$username','$password')"; mysql_query($query) or die('Error, insert query failed'); $query = "FLUSH PRIVILEGES"; mysql_query($query) or die('Error, insert query failed'); include 'library/closedb.php'; echo "New MySQL user added"; } else { ?> <form method="post"> <table width="400" border="0" cellspacing="1" cellpadding="2"> <tr> <td width="100">Username</td> <td><input name="username" type="text" id="login"></td> </tr> <tr> <td width="100">Password</td> <td><input name="password" type="text" id="password"></td> </tr> <tr> <td width="100"> </td> <td> </td> </tr> <tr> <td width="100"> </td> <td><input name="add" type="submit" id="add" value="Add New User"></td> </tr> </table> </form> <? } ?>
  16. Try this: <html> <head> <title>Mastercool Inc., Search</title> </head> <body background="../media/gradient_dark.png" link="#003366"> <table width="691" border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <td colspan="3"><img src="../media/header.gif" alt="" height="100" width="700" usemap="#headerc2dc93f3" border="0"><map name="headerc2dc93f3"><area shape="rect" coords="10,10,270,71" href="http://www.mastercool.com" alt=""></map></td> </tr> <tr> <td colspan="3" nowrap bgcolor="#003366"> <div align="center"> <menumachine name="mastercoolmenu071607" id="m26v3267"> <csobj t="Component" csref="../menumachine/mastercoolmenu071607/menuspecs.menudata"><noscript> <p><a class="mm_no_js_link" href="../menumachine/mastercoolmenu071607/navigation.html">Site Navigation</a></p> </noscript> </csobj> <script type="text/javascript"><!-- var mmfolder=/*URL*/"../menumachine/",zidx=1000; //--></script> <script type="text/javascript" src="../menumachine/menumachine2.js"></script> <script type="text/javascript" src="../menumachine/mastercoolmenu071607/menuspecs.js"></script> </menumachine> </div> </td> </tr> <tr bgcolor="#999999"> <td colspan="3" nowrap bgcolor="#999999"> <table width="70%" border="0" cellspacing="0" cellpadding="2" align="right" bgcolor="#edf8fe"> <form action="search.php" method="get"> <tr> <td align="right" class="search" nowrap bgcolor="#999999" width="62%"> <div align="right"> <font size="1" color="#003366" face="Arial, Helvetica, Geneva, Arial, SunSans-Regular, sans-serif"><b>SEARCH</b></font><font size="1"> </font></div> </td> <td bgcolor="#999999" width="135"> <div align="center"> <input type="text" name="keyword" size="20" maxlength="40" class="input"></div> </td> <td align="left" bgcolor="#999999"> <div align="left"> <input type="image" src="../media/search_icon.gif" class="inputs"></div> </td> </tr> </form> </table></td> </tr> <tr bgcolor="#999999"> <td colspan="3" nowrap bgcolor="white"><?php $keyword = $found = $count = $file = $filescope = 0; $titl = array(); $keyword = @$HTTP_GET_VARS['keyword']; if ($keyword and strlen($keyword) > 2) : ?> <table width="90%" border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <td width="20" align="center" class="tabletitle"></td> <td width="2" align="center" class="tabletitle"></td> <td height="22" align="center" class="tabletitle"> <font color="black">search result(s) for word:</font> <b><? echo $keyword ?></b></td> </tr> <tr> <td height="2" colspan="3"></td> </tr> <tr> <td></td> <td colspan="2" class="txt"> found on page(s)</td> </tr> <?php if(!isset($_SERVER["DOCUMENT_ROOT"])) { $_SERVER["DOCUMENT_ROOT"]=substr($_SERVER['PATH_TRANSLATED'] , 0 , -strlen($_SERVER['PHP_SELF'])+1 ); } $DOCROOT = $_SERVER['DOCUMENT_ROOT']; $patch=opendir($DOCROOT); while ($file = readdir($patch)) : $tmpfile = $DOCROOT . $file; if (is_file($tmpfile) and preg_match("/.*\.html/i", $tmpfile)) { $fop = fopen($tmpfile, "r"); $search = fread($fop, filesize($tmpfile)); fclose($fop); $filecope2 = $search; $search = preg_replace("/<option.*>(.*)\n/i", "", $search); $search = strip_tags($search, "<title>"); $filecope = $search; if (preg_match("/\s($keyword)\s/i", $search, $result)) { // echo $result[1];/\<title\>(+*)\</i if (!$found) { $found="yes"; } preg_match("/<title>(.*)/i", $filecope2, $result); ?><!-- --> <tr> <td height="6" colspan="3"></td> </tr> <tr> <td align="center" class="count"><?php $count++; echo $count; ?></td> <td></td> <?php echo "<td> <a href='$file'>$result[1]</a> </td>"; ?> </tr> <tr> <td height="6" colspan="3"></td> </tr> <?php } } endwhile; closedir($patch); if (!$found) : ?> <tr> <td height="5" colspan="3"></td> </tr> <td colspan="3" class="txt"><b>The required word is not found</b></td> </tr> <?php endif; ?> <tr> <td height="5" colspan="3"></td> </tr> <tr> <td colspan="3"><img src="../media/index_bottom_rule.jpg" alt="" height="19" width="700" border="0"></td> </tr> <tr> <td><font size="1" color="black" face="Arial, Helvetica, Geneva, Arial, SunSans-Regular, sans-serif">© Mastercool Inc. 2007</font></td> <td></td> <td> <table width="180" border="0" cellspacing="0" cellpadding="3" align="right"> <tr> <td><font size="1" color="#003366" face="Arial, Helvetica, Geneva, Arial, SunSans-Regular, sans-serif"><a href="featured_items.html">Featured Items</a></font></td> <td><font size="1" color="#003366" face="Arial, Helvetica, Geneva, Arial, SunSans-Regular, sans-serif"><a href="sitemap.html">Site Map</a></font></td> </tr> <?php endif; ?> </table> </body> </html>
  17. Oh okay, I see what you mean. <?php //first you need to get how many entries you have in the database $query = mysql_query("SELECT COUNT(*) as num, MIN(id) as start FROM guestbook")or die(mysql_error()); $row = mysql_fetch_assoc($query); //Store the ID of the first record number in a var. $start = $row['start']; //How many records you want to delete each time $del_count = 50; //Get the ID of the record you want to start deleting from $del_num = $start + $del_count; if ($row['num'] > 100){ //delete some old entries mysql_query("DELETE FROM guestbook WHERE id < $del_num")or die(mysql_error()); } ?> That will delete the first 50 comments, but I'm assuming you have an auto incremented field that stores the comments unique ID. I called this row "id" in the queries.
  18. Well, you need to ask yourself where your script retrieves the information to know which row in the database to update. Figure that out, and it will be easy to help you.
  19. If you are trying to display multiple images, you need to put the code that displays the image in the while loop. I'm not sure why you have the header function there, but if there is a different $type for each image, that needs to go into the while loop as well.
  20. You just have to assign the optional arguments a default value, that makes it optional. <?php function myfunction($a,$b,$c,$d=1){ return $a.$b.$c.$d; } ?> So if you don't put anything for $d, it will automatically become "1" as default. If you don't want it to be anything, just put NULL in place of the 1.
  21. I wouldn't use "SELECT *" in all the queries...that means your selecting all the fields, and you don't need ANY of them. Use this instead: SELECT COUNT(*) FROM...
  22. <?php //first you need to get how many entries you have in the database $query = mysql_query("SELECT COUNT(*) FROM guestbook")or die(mysql_error()); $num = mysql_num_rows($query); if ($num > 100){ echo "<meta http-equiv=refresh content=1; url=http://www.mysite.com/blah>"; } ?> Instead of redirecting them, I would personally put a message...otherwise they won't know what the heck happened, lmao.
  23. Try this: <form action='game.php' method='GET'> <p><input type='text' name='game_id' size='20'> <input type='submit' value='Search' name='search'></p> </form>
×
×
  • 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.