Jump to content

jscix

Members
  • Posts

    197
  • Joined

  • Last visited

    Never

Everything posted by jscix

  1. Well, What happens.. do you get a white screen? an error? Anything?
  2. Maybe not the best code, but it works and maybe it will give you an idea of what you need to do. # Get Paging data $getpgid = ($_GET['page']); if (!isset($getpgid)) { $getpgid = "1"; } if (!is_numeric($getpgid)) { $getpgid = "1"; } $clean2 = $getpgid . "0"; $clean1 = ($clean2 - 10); $getlistn = mysql_query("SELECT * FROM `events` "); if (!$getlistn) { die ("Unable to list events"); } # Print Page listings $cntx = mysql_num_rows($getlistn); // count the rows $divb = ceil(intval($cntx)/10)*10; // round total results to a number divisible by 10 $howmany = ceil($divb / 10); //number of times 10 goes into total rows Print "[ Pages: "; for ($ix = 1; $ix <= $howmany; $ix++) { if ($ix != $howmany) { echo "<a href=www.example.com&page=$ix>$ix</a> - "; } else { echo "<a href=www.example.com&page=$ix>$ix</a>"; } } print " ]"; $getlist = mysql_query("SELECT * FROM `events` LIMIT $clean1 , $clean2"); if (!$getlist) { die ("Unable to list projects"); }
  3. I didn't fix anything FYI. I don't totally understand what you're trying to do, but I figured this might help anyone who does - Much prettier code .. <?php set_time_limit (30); // Run this script every 15 minutes! // Do workings for time to be parsed // What time was the script last run? $timefile = 'time.txt'; $timeopen = fopen($timefile, "r"); $thentiming = fread($timeopen, filesize($timefile)); fclose ($timeopen); // whats the time Mr Wolf? $nowtiming = date('Gis'); //whats the time difference $timedifference = $nowtiming - $thentiming; // Now update last run time in file $timefile2 = 'time.txt'; $timeopen2 = fopen($timefile, "w"); fwrite($timeopen2, $nowtiming); fclose ($timeopen2); $filename = 'logs/' . 'ex' . date('ymd') . '.log'; // Filename Checker // D:\home\Planet Cruise Sites\planetcruise.co.uk\logs\W3SVC10019\ if (file_exists($filename)) // Does the corresponding filename exist - if yes then { $fp = fopen($filename, "r"); //Open the server log $content = fread($fp, filesize($filename)); // Read the server log $content = explode("\n", $content); // explode into array $content = array_reverse($content); // reverse the array foreach ($content as $temp => $value) { $findme = 'Googlebot'; $googlebot = strpos($value, $findme); $findme1 = 'picsearch.com/bot'; $picsearch = strpos($value, $findme1); $findme2 = '/sys-includes'; $sysincludes = strpos($value, $findme2); $findme3 = '/offers/Scat'; $offersscat = strpos($value, $findme3); $findme4 = '/revelex'; $revelex = strpos($value, $findme4); $findme5 = '.gif'; $gif = strpos($value, $findme5); $findme6 = '.jpg'; $jpg = strpos($value, $findme6); $findme7 = '.txt'; $txt = strpos($value, $findme7); $findme8 = '.swf'; $swf = strpos($value, $findme8); $findme9 = '.dll'; $dll = strpos($value, $findme9); $findme10 = '.asp'; $asp = strpos($value, $findme10); $findme11 = '.png'; $png = strpos($value, $findme11); $findme12 = '.css'; $css = strpos($value, $findme12); $findme13 = '.ico'; $ico = strpos($value, $findme13); $findme14 = '.js'; $js = strpos($value, $findme14); $findme15 = '- 200'; $error = strpos($value, $findme15); $findme16 = 'msnbot'; $msnbot = strpos($value, $findme16); $findme17 = 'gigablast.com/spider.html'; $gigaspider = strpos($value, $findme17); $findme18 = 'InternetSeer.com'; $internetSeer = strpos($value, $findme18); $findme19 = '+Slurp'; $yahoo = strpos($value, $findme19); $findme20 = '....../1.0+'; $msnsneakbot = strpos($value, $findme20); $firstcharacter = substr($value, 0, 1); //strip lines beginning with #/null $weberror = substr($value, -18, 3); //strip lines beginning with 400/401/403/404/503 if ($googlebot === false && $picsearch === false && $sysincludes === false && $offersscat === false && $revelex === false && $firstcharacter != "#" && $firstcharacter != "" && $weberror != "400" && $weberror != "401" && $weberror != "403" && $weberror != "404" && $weberror != "503" && $gif === false && $jpg === false && $txt === false && $swf === false && $dll === false && $asp === false && $png === false && $css === false && $ico === false && $js === false && $error == true && $msnbot === false && $gigaspider === false && $internetSeer === false && $yahoo === false && $msnsneakbot === false) { //echo "$value<br/><br/>"; $bits = explode(" ", $value); // CLIENT IP // $bits[9] $log_clientIP[] = $bits[9]; // CLIENT REQUEST // $bits[5] $log_request[] = $bits[5]; // Now sort out time range return $hour = substr($value, 11, 2); $hour = $hour * 60; $minute = substr($value, 14, 2); $minutes = $minute + $hour; // These are the minutes for this line echo "$minutes - The time (as minutes)<br/>"; //echo the minutes for this day. echo "$bits[1] The time<br/>"; $uniqueip[] = array_unique($log_clientIP); if ($log_clientIP == $uniqueip) { echo "This is a unique ip<br/><br/>"; // Then count this as a new visitor and an addittion to log_request } elseif ($log_clientIP != $uniqueip) { $mylogtime = $minutes[$temp - 1] - $minutes; echo "$mylogtime = The sum of this time loop - the last time loop<br/><br/><br/>"; if ($mylogtime >= 7) { // Then count this as a (returning but new) visitor and an addittion to log_request } else { } } // end of elseif statement } // end of if stripper statement else { } } //end of foreach $value command fclose ($fp); } //end of original if file exists statement else { echo 'This file does not exist!'; } ?>
  4. *shivers at the thought of entering my bank account number and routing numbers anywhere online, ever again*
  5. "If you are saving your file in UTF-8 encoding, it could be the BOM (Byte Order Mark)." -- From your suggested thread.. Thanks alot thebadbad, I never would of figured that out.
  6. Ok, I'm using PHP5.1xxxx, on Apache.. I don't know what could be causing this but, On one certain script, everytime I call Session_Start(); I get the 'headers already sent out', error... However, There is most Definitely nothing being outputted to the page beforehand. I can't figure this out, everything is working fine elsewhere.. Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/j/s/c/jscix/html/echains/register/index.php:1) in /home/content/j/s/c/jscix/html/echains/register/index.php on line 2 You can see it here: http://www.bawk.org/echains/register/index.php This the the script, nothing comes before this. <?php session_start(); include "../includes/DBClass.php"; $Submited = ($_POST['submit']); $errors = Array(); etcetc .. so on and so fourth.. .... *Scratches head*
  7. Oh that's cool, I didn't know php could do that... this is similar to 'out' in C# eh? public Foo(out string bar) { bar = "Bar"; }
  8. Ok, Then ... In your footer, after the user follows the link to: contact.php?frompage=business and in your contacts.php, you have: $_SESSION['var'] = $_GET['frompage']; ------------- print $_SESSION['var']; This should print 'business', does it?
  9. Well I'm gonna ask the obvious just to make sure -- You do have Session_Start() as the very, very, first thing on your page right? If so, that should be working.
  10. You'l most likely need to use sessions, I don't know what your doing .. how-EVER, It looks to me like you are giving your users alot of control by passing Access Restrictions in the URL Bar. Users can change these values, which is a potential security risk. I would save the users access level in a session variable.. that way you won't need to worry about passing variables around so much, only initially.. If you need help with this, just respond back.. I will give ya plenty of info if your willing to read.
  11. Well Man that's what debugging is for ! Echo $Var; print_r($array);
  12. if (empty($_REQUEST['co_telephone']) || !(is_numeric($_REQUEST['co_telephone'])) || strlen($_REQUEST['co_telephone']) !== 9) { $app->error('Please enter Telephone'); }
  13. generally when you upload through a script, the file is stored in a temporary folder, then moved to a perm. folder, after which the file in the tmp folder is deleted
  14. Hrm.. I would try FTPing into the temp directory and watch as the file is uploaded. Try a larger file so you can check the file size periodically, if all is well during the upload, then either the file is being removed before the script can move it, or their is a file path, or permissions error somewhere.
  15. if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path . $filename)) { what are the $target_path and $filename variables? Does the upload folder have permissions?
  16. You have to loop through each element and examine the field in question. If the field matches 'live', then you extract the required information from that entry.
  17. $contents = file_get_contents('file.txt'); $vara = $db->$_GET['vara']; $varb = $db->$_GET['varb']; $newdata = $contents."\n$vara,http://www.site.com/$varb"; if (is_writable("file.txt")) { $txtfile = fopen('file.txt',a); fwrite($txtfile, $newdata); fclose($txtfile); } should work .......
  18. That is happening because on each loop through $start_Directory is getting replaced by the current directory that it's in, you need to use a full path name for the unlink; on a side-note: I'm sorry - I should of mentioned, never run something that deletes files in that way, without first making sure it's going to do EXACTLY, what you want it to.
  19. This has not been tested well, im sure there are tons of errors.. anyway. I hope it helps you. <?php function DelTree($start_Directory) { $directory_List = array(); echo "<b>Removing all contents from: " . $start_Directory . "</b><br>"; if ($handle = opendir($start_Directory)) { while (false !== ($curEle = readdir($handle))) { if (is_dir($curEle) && substr($curEle,0,1) !== ".") { array_push($directory_List,$curEle); } else { echo "unlink file: " . $curEle . "<br>"; } } closedir($handle); } foreach ($directory_List as $dir) { $new_Dir = $dir; array_shift($directory_List); DelTree($new_Dir); } } DelTree("/var/www/"); ?>
  20. <html> <body> <?php $weapons = array( array( id => 0, weapon => "L85A2", price => 250, damage => 15, type => "Rifle", rarity => "Basic", description => "The L85A2 is a bullpup assault rifle, it can be fitted with a laser. A iron-sight comes standard.", options => "You can give it a Laser." ), array( id => 1, weapon => "AK-47", price => 325, damage => 25, type => "Rifle", rarity => "Good", description => "The AK-47(Kalashnikov) is a Russian made assault rifle, it is one of the most popular weapons in the world, and is also one of the most reliable.", options => "You can give it a iron-sight." ), array( id => 2, weapon => "L96", price => 400, damage => 30, type => "Sniper Rifle", rarity => "Good", description => "The L96(super magnum) is a sniper rifle with deadly accuracy.", options => "You can give it a stand." ), ); echo "<table border=\"1\">"; foreach ($weapons as $topof) { print "<tr><td colspan='2'>WEAPONS</td></tr>"; foreach ($topof as $lowerof => $desc) { if (substr($lowerof,0,2) !== "id") { print "<tr><td>" . $lowerof . "</td><td>" . $desc . "</td></tr>"; } } echo "<tr><td colspan='2'></td></tr>"; } echo "</table>"; ?> </body> </html>
  21. Well, the error message is telling you, that you are passing a non-array.. or non enumerable object to a foreach loop, thus it can do nothing with it.. I'm asking if you dump the content of your variable, (Which should be an array) does it output an array?
  22. Also probably irrelevant but if you have an sql database, it's really easy to use a uniquely generated id for naming your images, everytime an image is uploaded, just add a new entry to your database, and wallah. a unique id. but since your doing it this way, you prolly not working with one?
  23. Well, I'm saying you could pretty much eliminate the loop by using date/time instead of random
  24. You will always get duplicate randoms, no matter how high your source variation is, especially over enough random generations. You could sort-of fix this by prefixing your file name with the date/time..
×
×
  • 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.