Jump to content

hitman6003

Members
  • Posts

    1,807
  • Joined

  • Last visited

Everything posted by hitman6003

  1. Apache 2.2 and php5.2 don't play nice. See this thread on apachelounge: http://www.apachelounge.com/forum/viewtopic.php?p=3019&sid=4fa309c2778bca8889ceb8bc3a24bccf
  2. what is the query you are using for that?
  3. How are you tracking the number of posts a user makes? Cleaner, more readable version: [code]<?php session_start(); if ($_SESSION['logged'] != "yes"){ echo "Please login!"; exit; } mysql_connect("localhost", "_real", "hidden") or die(mysql_error()); mysql_select_db("_real") or die(mysql_error()); $username = $_SESSION['username']; $id = $_GET['id']; $topicid = $_GET['topicid']; $query = "SELECT * FROM reply WHERE topicid='$topicid' AND groupid='$id'"; $result = mysql_query($query) or die(mysql_error()); $query2 = "SELECT * FROM users WHERE username='$username'"; $result2 = mysql_query($query2) or die(mysql_error()); $user = mysql_fetch_array($result2); echo " <table border=\"0\" cellspacing=\"1\" cellpadding=\"1\">"; while($main = mysql_fetch_array($result)) { echo ' <tr> <td style="text-align: center; border:1px solid black;" width="100"> <b>' . $main['poster'] . '</b><br> <img src="' . $user['avatar'] . '"><br> Posts: <b>' . $user['posts'] . '</b> </td> <td style="border:1px solid black;" width="450"> Posted On: <i>' . $main['time'] . '</i><hr> ' . $main['message'] . ' </td> </tr>'; } echo "</table>"; ?>[/code]
  4. Use the strtotime (http://www.php.net/strtotime), maketime (http://www.php.net/maketime), and date http://www.php.net/date) functions to accomplish what you want. Essentially, use strtotime to change your string to a unix timestamp, then use maketime or date to add 6 days.
  5. Echo out your query and put it into phpMyAdmin or MySQL Query Browser and make sure that it is not a syntax error.
  6. Check out this tutorial: http://www.phpfreaks.com/tutorials/40/0.php
  7. It most likely means that your mysql connection is failing.  Add the "or die(mysql_error());" to the end of your mysql_connect and any other db functions above the code you provided.
  8. You may want to look at this class as an example for your script: http://www.phpclasses.org/browse/package/2759.html
  9. I would recommend that once the user has selected their language via a "Switch to Language" link, set either a cookie or session variable that keeps track of that setting for them.  Then you won't have to attach a "lang=en" onto every url.
  10. php can handle as many file uploads as you want to send to it.
  11. Make sure that you only have the function "tohtml" once in your code.  The error means that you are trying to declare, or create, the same function twice.
  12. There isn't a "system" that manages the "bumps".  The way that it works is by storing all of the threads and responses in a table, when the page it loaded, it grabs the last however-many-threads-are-on-a-page ordered by time.
  13. It means that you have a unique field that you are trying to insert a duplicate entry for. If that is meant to be an ID field, make sure that autoincrement is set.
  14. They work exactly the same, some people find the parenthesis...()...easier to read, but the functionality is the same.
  15. Try this: [code]$result = mysql_query("SELECT * FROM pilot ORDER BY pilotid ASC") or die(mysql_error()); echo '<select size="1" name="D1">'; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo '<option value="' . $row['dbcolum'] . '">' . $row['dbcolum'] . '</option>'; } echo '</select>';[/code]
  16. [code]if(($name_lenth )||($password_lenth) > 15){[/code] should be [code]if(($name_lenth > 15) || ($password_lenth > 15)){[/code]
  17. Try executing your cron line from the command line, manually, but without directing output to /dev/null so you can see any errors.
  18. Use the wordwrap (http://www.php.net/wordwrap) function with the third parameter, which will force it to wrap all lines, regardless of spaces or anything else, at that number of characters.
  19. Use curl or sockets. Here is an example that uses sockets to read a url: [code]<?php function http_get($url) {   $url_stuff = parse_url($url);   $port = isset($url_stuff['port']) ? $url_stuff['port'] : 80;   $fp = fsockopen($url_stuff['host'], $port);   $query  = 'GET ' . $url_stuff['path'] . " HTTP/1.0\n";   $query .= 'Host: ' . $url_stuff['host'];   $query .= "\n\n";   fwrite($fp, $query);   while ($tmp = fread($fp, 1024)) {       $buffer .= $tmp;   }   preg_match('/Content-Length: ([0-9]+)/', $buffer, $parts);   return substr($buffer, - $parts[1]); } echo http_get("http://rss.slashdot.org/Slashdot/slashdot"); ?>[/code]
  20. hitman6003

    select

    Make the name of the select something like: [code]<select name="selectbox[]" MULTIPLE>...</select>[/code] Then it becomes a sub array of $_POST in php
  21. See this page: http://www.php.net/manual/en/language.types.string.php#language.types.string.conversion and this page: http://www.php.net/manual/en/language.types.type-juggling.php
  22. In order for php to do anything with the file it must be uploaded.  PHP is a server side technology. In order to do what you are wanting, you can use one of the libraries located at phpclasses.org: http://www.phpclasses.org/browse/class/42.html to unzip the file to a location, then check each file that was unzipped using the dir functions (http://www.php.net/dir)
  23. I think this will work...although my SQL might be off a bit: [code]$query = ' SELECT COUNT(tutorials.tutorials) as usertuts, COUNT(tutorials.views) as viewcount, users.username, users.website FROM users LEFT JOIN tutorials ON users.user = tutorials.user ORDER BY COUNT(tutorials.tutorials) GROUP BY user'; while ($users = mysql_fetch_array($query)){ echo ' <a href="index.php?act=users&user=' . $users['username'] . '"><b>' . $users['username'] . '</b></a> | <a href="' . $users['website'] . '">' . $users['website'] . '</a> | <b>' . $users['usertuts'] . '</b> Resources | <b>' . $users['viewcount' ]. '</b> Total views<br/><br/>'; }[/code]
  24. tinymce is argueably the most feature rich, however, it isn't the only one.  FCKeditor (http://www.fckeditor.net/), Dojo (http://dojotoolkit.org/), Kupu (http://kupu.oscom.org/), and many others are available. Be careful using these, as many of them are VERY large (I think tinymce is about 2 MB in all), so if a lot of your users have dialup, then they will hate it.  It can also eat up bandwidth quickly.  Caching will help some, but not enough if you have a good number of visitors.
  25. That is a bad way of doing it...not only is it inefficient having to loop through the array, but what happens when you have 10 users and you accidentally get a password in the wrong place...then every user after that one will not be able to login. Rather then two arrays, use key => value pairs in a single array: [code]<?php $username = $_POST['username']; $password = $_POST['password']; $authusers = array( 'chris' => 'piss', 'bob' => 'knob', 'pete' => 'feet' }; if ($password == $authusers[$username]) { echo("logged in"); } else { echo("not logged in"); } ?>[/code]
×
×
  • 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.