Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. Change: for($i = 0; $i < count($asplit); $i++) { $checked = " <input type=radio name='a".$row['idq']."' value='".$lsplit[$i]."' checked>".$asplit[$i]."\n"; $unchecked = " <input type=radio name='a".$row['idq']."' value='".$lsplit[$i]."'>".$asplit[$i]."\n"; switch($_POST[$postvalue]) { case "A": echo $checked; break; case "B": echo $checked; break; case "C": echo $checked; break; case "D": echo $checked; break; case "E": echo $checked; break; default: echo $unchecked; } to: for($i = 0; $i < count($asplit); $i++) { $key = 'a'.$row['idq']; $checked = ($_POST[$key] == $lsplit[$i]) ? ' checked="checked"' : null; echo '<input type="radio" name="'.$key.'" value="' . $lsplit[$i] . '"' . $checked . '>' . $asplit[$i] . "\n"; }
  2. There is no need to call the session_register function when creating a session variable. The use of this function is now depreciated. Looking at your script it looks like you should change all instance of $cart to $_SESSION['cart'] Also you'll need to change variables which access form field values too the new $_POST superglobals, so $form_field_name should be $_POST['form_field_name'] the same for a any URL variables, eg instead of $my_url_var it should be $_GET['my_url_var']; You should read up on superglobals
  3. Yes always use isset when accessing $_POST vars, eg: if (isset($_POST['item']) && $_POST['item'] == "test") { echo "item is equal to test!"; }
  4. Try the following tutorial: http://blondr.blogspot.com/2006/11/set-up-iis-7-w-mysql-and-php-5.html Been meaning to read that tutorial myself
  5. The amount of bandwidth your PHP script will use depends on what it outputs. So if you are including files which adds up to 100KB, however only 12KB of that is output then only 12KB will be used of your sites bandwidth.
  6. not really.
  7. If you want to include only the output of the cgi script then I'd include it using the http:// wrapper, eg: include 'http://www.mysite.com/' . $_GET['page']; For html/php files don't include the http:// wrapper. However it would be better to convert your cgi script to PHP.
  8. By addons I presume you mean extensions? Although it would be helpful if you configured PHP to use all extensions, however I would recommend you enable the extensions you plan on using. the most common extensions would be the following gd2 mbstring mysql (and/or mysqli if you have PHP5)
  9. Do not modify the include_path. The default setting will work fine: include_path = "."
  10. That error suggests that you have not installed mysql yet or mysql is currently not running.
  11. If you are getting underfined indexes then your style of programming is floored. You should treat indexes the same as variables. You wont use a variable before you use it. Sorting out notices is usually quite easy. However just ignoring them is not an option that should the last resort.
  12. Look at the affect of different timezones: <?php date_default_timezone_set('America/New_York'); echo '<h1>' . date_default_timezone_get() . "</h1>\n"; print date("Y m d H:i:s",1099198800) ."<br />\n"; print date("Y m d H:i:s",1099202400) ."<br />\n"; echo '<br /><br />'; date_default_timezone_set('Europe/London'); echo '<h1>' . date_default_timezone_get() . "</h1>\n"; print date("Y m d H:i:s",1099198800) ."<br />\n"; print date("Y m d H:i:s",1099202400) ."<br />\n"; echo '<br /><br />'; date_default_timezone_set('Australia/Sydney'); echo '<h1>' . date_default_timezone_get() . "</h1>\n"; print date("Y m d H:i:s",1099198800) ."<br />\n"; print date("Y m d H:i:s",1099202400) ."<br />\n"; ?> Output: America/New_York 2004 10 31 01:00:00 2004 10 31 01:00:00 Europe/London 2004 10 31 05:00:00 2004 10 31 06:00:00 Australia/Sydney 2004 10 31 16:00:00 2004 10 31 17:00:00 The result you are recieve is infact correct. However I'm not sure why for America timezone the dates are the same.
  13. date/mksir will generate a date based on the servers timezone. You can use date_default_timezone_set function (not available for php4) to use a different timezone. This is why everyones results will be different to yours ddd119
  14. function mostRecentModifiedFileTime($dirName, $doRecursive) { global $newest, $newest_artist; $d = dir($dirName); $lastModified = 0; while($entry = $d->read()) { if ($entry != "." && $entry != "..") { list($name,$ext) = split("\.", $entry,2); if($ext != "m3u" && $ext != "jpg" && $ext != "txt" && $ext != "php" && $ext = "mp3") { if (!is_dir($dirName."/".$entry)) { clearstatcache('fileatime'); $currentModified = filemtime($dirName."/".$entry); } elseif ($doRecursive && is_dir($dirName."/".$entry)) { $currentModified = mostRecentModifiedFileTime($dirName."/".$entry, true); } if ($currentModified > $lastModified) { $lastModified = $currentModified; } } } if ($lastModified > $newest ) { $newest = $lastModified; $newest_artist = $dirName."/".$entry; } } $d->close(); return $lastModified; } Even though they are not errors you should still try to correct them.
  15. The main site is currently going under complete reconstruction. The admins decided to import the current tutorials into the forum for now. Once the main site is relaunched all forums members will have access to publishing tutorials.
  16. Have a read of phpfox support page. phpfox should come with a web based installer by going to yoursite.com/install/install.php the installer will configure phpfox for you.
  17. What do you get currently when you go to your IP address? 403 Forbidden or your index page (eg index.php)
  18. This line: $_CONF['host'] = $_CONF['www.poundpup.net/muse/'].'/'; Should be, you should not need to modify that line: $_CONF['host'] = $_CONF['domain'].'/';
  19. The error is not coming from line 224. It is in actual fact coming form line 8 within process.php. You are most probably getting that error because you have some form of output (which appears to be coming from process.php) before you call the header() function (line 224 in maincore.php).
  20. Leave that line as is, it will automatically define the path. phpFox should come with some form of documentation which explains what each of the $_CONFIG settings do. The settings you want to concentrate on are the ones starting with $_CONF['db'] and $_CONF['domain']. That's it. Edit, beaten to it
  21. I dont think SMF use separate templates for every error message. The error message is most probably hard coded or its an error coming directly from MySQL.
  22. Bug fixed, forgot to add some in. Try: <?php function keywordSearch(&$keywords) { global $keyword_count; $lines = file('search_data.txt'); $results = array(); $symbols = array('[', ']', '-', '(', ')'); $replace = array('\[', '\]', '\-', '\(', '\)'); // colors for highlighting keywords $colors = array( '#FF0000', // red '#0000FF', // blue '#99CC00', // green '#CCCC00', // yellow '#660066', // purple '#FF0099' // pink ); $i = 0; foreach($lines as $line) { $keyword_found = false; foreach($keywords as $key => $keyword) { if(!isset($keyword_count[$keyword])) { $keyword_count[$keyword] = 0; } $keyword = str_replace($symbols, $replace, $keyword); if(eregi($keyword, $line)) { $keyword_found = true; // remove answer from end of line $line = eregi_replace("\*([a-z0-9 ]+)", '?' , $line); // highlight search keyword $line = eregi_replace("($keyword)", "<span style=\"color: {$colors[$key]}; font-weight: bold;\">\\1</span>", $line); $results[$i] = $line; $keyword_count[$keyword]++; } } if($keyword_found) $i++; } return $results; } function displaySearchResults() { global $keyword_results, $keywords, $keyword_count; $output = '<p>The keywords "<i><b>'. implode('</b></i>", "<i><b>', $keywords) . '</b></i>" found ' . count($keyword_results) . " result(s):\n"; if(is_array($keyword_results) && count($keyword_results) > 0) { $output .= "<ol>\n <li>" . implode("</li>\n <li>", $keyword_results) . "</li>\n</ol>\n"; } echo "<p>$output</p>"; } if(isset($_POST['submit'])) { if(!empty($_POST['keyword'])) { $_POST['keyword'] = str_replace(array("\r\n", "\r", "\n"), "\n", $_POST['keyword']); $keywords = explode("\n", $_POST['keyword']); $keyword_results = keywordSearch($keywords); displaySearchResults(); } else { echo 'Invalid search term'; } } ?> HTML <form action="search.php" method="post"> Keywords:<br /><textarea name="keyword" cols="40" rows="4"><?php echo isset($_POST['keyword']) ? $_POST['keyword'] : null; ?></textarea> <p><input type="submit" name="submit" value="Search" /></p> </form> Also note that I changed the search box to a textarea rather than a text field so you'll need to modify your search box HTML code to the HTML code posted above. When performing a search you now place each keyword on a separate line within the Keywords search box rather than a space.
  23. You should use AddType application/x-httpd-php .php instead. Note: in order for the AddType directive to work Apache will need be configured with the PHP Module ( eg php5apache2_2.dll) Check with your webhost whether PHP is supported with your hosting account. Not all hosts will provide PHP support, you may have to change hosts if your webhost doesn't provide PHP.
  24. Provided $row['priority'] holds either urgent, medium or low then do something like this: Add the following line: $colors = array('urgent' => 'red', 'medium' => 'orange', 'low' => 'blue'); Before: // store the record of the "example" table into $row echo "<CENTER><TABLE BORDER='2' BORDERCOLOR='#336699' CELLPADDING='2' BGCOLOR='white' CELLSPACING='2' WIDTH='100%'></CENTER>"; and change: echo "</td><td>"; echo $row['priority']; echo "</td></tr>"; to: echo '</td><td style="font-weight:bold; color:' . $colors[strtolower($row['priority'])] . ';">'; echo '<span' . $row['priority'] . '</spam>'; echo "</td></tr>";
  25. When you include files via PHP, PHP requests for files via the OS not Apache. If you used require_once "http://yoursite.com/home/connect/lordofansalon.php" then it'll work however PHP wont include the PHP source code only the output of the included php file. When including files I always do this: define('ROOT', $_SERVER['DOCUMENT_ROOT']); include ROOT . '/path/to/file.php';
×
×
  • 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.