Jump to content

iarp

Members
  • Posts

    326
  • Joined

  • Last visited

Everything posted by iarp

  1. I find that PDF's still open in the browser window anyways if i just click open, leaving other files the option open to save or open as well.
  2. Ya i had something like that, just i thought having 3 sets of reloc if statements was a waste of time and hoped their was a simplier way.
  3. <?php ob_start(); # Added include "phpaudit_configuration.php"; include "inc/globals.php"; include "language/".$config['language'].".php"; include "inc/general_functions.php"; include "inc/login_functions.php"; include "inc/display_functions.php"; include "inc/client_area_functions.php"; include "inc/billing_functions.php"; #------------------------------------------------------------------------------------------------------------- clear_cache(); $client_id=process_session($config); if (isset_reset_password($client_id)==1) { $client_in_process=true; header("Location: ".$config['http_web']."/client_in_process.php"); exit; } #------------------------------------------------------------------------------------------------------------- include $config['server_tpl']."/header.php"; include $config['server_tpl']."/client_area.php"; include $config['server_tpl']."/footer.php"; mysql_close($dblink); ob_flush(); # Added ?>
  4. Set both the maximum time allowed and the last-done-something-on-a-page(like NOW()) time in another session variable (to save mysql resources if you want) then just compare those.
  5. JavaScript or Cron job, php alone can't do what you want as it requires the user the do something in order to update its time. JavaScript can update time itself and cron jobs run at timed intervals.
  6. From the error you posted, it seems that mail() does work for you, just your settings in the configuration for ampache is trying to use a SMTP server that requires proper login and password before being able to use it. I'm not familiar with ampache config files so you may have to wait for someone else with better knowledge on that, or google.
  7. I use this script, it allows me to link a file by eithor http://www.someo ne-else-s erver.com/file.exe or /my/servers/document/root/file.exe or .pdf or w/e you want. Info: $file = the files location so eithor http://.. or /document/root/... $name is the output name you want it to have. <?php function output_file($file, $name, $mime_type='') { /* This function takes a path to a file to output ($file), the filename that the browser will see ($name) and the MIME type of the file ($mime_type, optional). If you want to do something on download abort/finish, register_shutdown_function('function_name'); */ //echo "<br><br>file: $file <br>name: $name <br> mime: $mime_type<br><br>"; //if(!is_readable($file)) die('File not found or inaccessible!'); $size = filesize($file); $name = rawurldecode($name); /* Figure out the MIME type (if not specified) */ $known_mime_types=array( "pdf" => "application/pdf", "txt" => "text/plain", "html" => "text/html", "htm" => "text/html", "exe" => "application/octet-stream", "zip" => "application/zip", "doc" => "application/msword", "xls" => "application/vnd.ms-excel", "ppt" => "application/vnd.ms-powerpoint", "gif" => "image/gif", "png" => "image/png", "jpeg"=> "image/jpg", "jpg" => "image/jpg", "php" => "text/plain", "rtf" => "application/msword" ); if($mime_type==''){ $file_extension = strtolower(substr(strrchr($file,"."),1)); if(array_key_exists($file_extension, $known_mime_types)){ $mime_type=$known_mime_types[$file_extension]; } else { $mime_type="application/force-download"; }; }; @ob_end_clean(); //turn off output buffering to decrease cpu usage // required for IE, otherwise Content-Disposition may be ignored if(ini_get('zlib.output_compression')) ini_set('zlib.output_compression', 'Off'); header('Content-Type: ' . $mime_type); header('Content-Disposition: attachment; filename="'.$name.'"'); header("Content-Transfer-Encoding: binary"); header('Accept-Ranges: bytes'); /* The three lines below basically make the download non-cacheable */ header("Cache-control: private"); header('Pragma: private'); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // multipart-download and download resuming support if(isset($_SERVER['HTTP_RANGE'])) { list($a, $range) = explode("=",$_SERVER['HTTP_RANGE'],2); list($range) = explode(",",$range,2); list($range, $range_end) = explode("-", $range); $range=intval($range); if(!$range_end) { $range_end=$size-1; } else { $range_end=intval($range_end); } $new_length = $range_end-$range+1; header("HTTP/1.1 206 Partial Content"); header("Content-Length: $new_length"); header("Content-Range: bytes $range-$range_end/$size"); } else { $new_length=$size; header("Content-Length: ".$size); } /* output the file itself */ $chunksize = 1*(1024*1024); //you may want to change this $bytes_send = 0; if ($file = fopen($file, 'r')) { if(isset($_SERVER['HTTP_RANGE'])) fseek($file, $range); while(!feof($file) && (!connection_aborted()) && ($bytes_send<$new_length) ) { $buffer = fread($file, $chunksize); print($buffer); //echo($buffer); // is also possible flush(); $bytes_send += strlen($buffer); } fclose($file); } else die('Error - can not open file.'); die(); } ?>
  8. Is $projectname set properly? put echo $sql; just after the sql statement and post the result here and whats the value of $_POST['Job_ID'] ? <?php $sql="SELECT * FROM Job_Table WHERE Job_Name='$projectname'"; echo $sql . "<br />"; echo $_POST['Job_ID']; $result = mysql_query($sql) or die ("Couldn't execute query."); ?>
  9. The pages i'm trying to restrict access to are actully located in an if statement. It's 500 lines long ut it goes like this: <?php } elseif (isset($_GET['profile'])) { checkstatus('profile','10'); # Only allow users of rank 10+ $content->pagename = 'My Profile'; require('themes/' . $cms->theme() . '/includes/header.php'); $q = "SELECT * FROM " . USERS . " WHERE uid = '" . $_SESSION['user_id'] . "'"; $r = mysql_query($q); $row = mysql_fetch_array($r, MYSQL_ASSOC); ?> <form method="post"> <label>Name:</label> <input type="text" value="<?php echo $row['fullname'] ?>" /><br /> <label>Email:</label> <input type="text" value="<?php echo $row['useremail'] ?>" /><br /> </form> <?php $cms->endEarly = TRUE; require('themes/' . $cms->theme() . '/includes/footer.php'); } elseif (isset($_GET['messages'])) { # Internal messages form # NOT IN USE/DISABLED checkstatus('mesages','d'); # d for disabled and i want it to show /404/ page ..... continues on furthur.. ?>
  10. <?php session_start(); $sql="SELECT * FROM Job_ID WHERE Job_Name='$projectname'"; # The table and column name the same? Job_ID? $result = mysql_query($sql) or die ("Couldn't execute query."); while ($row=mysql_fetch_array($result)) { $Job_ID = $row['Job_ID']; if(isset($_POST['Job_ID'])) { $_SESSION['Job_ID'] = $Job_ID; } } Other page: <?php session_start(); if(isset( $_SESSION['Job_ID'])) { $_SESSION['Job_ID'] = $Job_ID; # is $Job_ID set on this other page? } echo $_SESSION['Job_ID']; ?>
  11. editplus http://www.editplus.com , not free just a little nag screen at the start that goes away. Also allows editing directly on an ftp server rather then saving locally and manually uploading and overwriting... etc
  12. As far as i know, ob_start() should be at the very very top of the php page, and to use ob_flush() at the very bottom.
  13. Hey, It's been one of those days where i just can't think straight. I'm after a function that will check 2 things, userlevel and the minimum userlevel needed to view the page. I currently have : <?php function checkstatus($url, $level='1') { # This is the function i'm trying to build onto. if ($url == 'lhome') if ($_SESSION['loggedin']) reloc('home'); elseif ($url == '404') reloc('404'); elseif ($url == 'home') reloc('home'); else if (!$_SESSION['user_id']) reloc('login', '?' . $url); } function reloc($url, $from='') { switch ($url) { case 'uri': $url = $_SERVER['REQUEST_URI']; break; case 'home': $url = "http://" . $_SERVER['HTTP_HOST']; break; case 'login': $url = "http://" . $_SERVER['HTTP_HOST'] . "/?login&redir=" . $from; break; case 'place': $url = "http://" . $_SERVER['HTTP_HOST'] . "/" . $from; break; case '404': $url = "http://" . $_SERVER['HTTP_HOST'] . "/404/"; break; } header("Location: $url"); } #This next function is one i've made while trying to come up with a solution, it basically pulls the users level from the table. function rank() { if ($_SESSION['loggedin']) { $r = mysql_query("SELECT userlevel FROM " . USERS . " WHERE uid = '" . $_SESSION['user_id'] . "'"); $row = mysql_fetch_array($r, MYSQL_ASSOC); return $row['userlevel']; } } ?> The levels that i currently work with: 1 = User 10 = Admin d = disabled (need to check for d first and call reloc('404') if true) Everything i've tried turns into a script so long and confusing i get lost and frustrated i just revert everything back and the try again. Try #6 landed me here. Any help is great. Thanks
  14. Perfect, exactly what i needed... learn a little bit more every day. Thanks
  15. As per the title. I was going to do something along these lines: <?php $str = $row1['key_name']; $order = array("&"); $replace = ''; $newstr = str_replace($order, $replace, $str); ?> But i don't know what to place in $replace that will go through a $_GET request without breaking up, and then on the receiving end undo the str_replace back to &
  16. echo "Before: " . $_COOKIE['header_img']; switch ($_COOKIE['header_img']) { case '1': $_COOKIE["header_img"] = '2'; break; case '2'; $_COOKIE["header_img"] = '1'; break; } echo "After: " . $_COOKIE['header_img']; After reading that, i made a few changes. This time the Before and After echo have the appropriate values but are not keeping the values with each page change.
  17. Oh i made a mistake. I changed the cookies name in between getting ready to post this. It's now called 'header_img'. I've changed all the iarp_header_img values.
  18. <?php if(!isset($_COOKIE['iarp_header_img'])) { setcookie("iarp_header_img", '1', time()+60*60*24*30,"/",".iarp.ca"); $url = $_SERVER['REQUEST_URI']; header("Location: $url"); } echo "Before: " . $_COOKIE['iarp_header_img']; switch ($_COOKIE['iarp_header_img']) { case '1': setcookie("iarp_header_img", '2', time()+60*60*24*30,"/",".iarp.ca"); break; case '2'; setcookie("iarp_header_img", '1', time()+60*60*24*30,"/",".iarp.ca"); break; } echo "After: " . $_COOKIE['iarp_header_img']; ?> further down the page: <?php switch ($_COOKIE['header_img']) { case '1': echo '<img src="/themes/gear/images/ico.big/earth.png" alt="Earth"></img>'; break; case '2'; echo '<img src="/themes/gear/images/ico.big/gear.png" alt="Gear"></img>'; break; } ?> The image in the second block of code on this post, won't change the image, it stays as 1 all the time. I don't need to reload the page in the first switch case because i'm setting the value to the next # for whenever someone changes the page yet again. Any helps appreciated.
  19. ok well i was trying not to explode into an array BUT its doable. How can i remerge an array minus the first entry.
  20. l-193-160.sheridanc.on.ca That it does thanks. Is there anyway to only take sheridanc.on.ca(or other domains) part without using explode?
  21. Notice: Undefined index: REMOTE_HOST in /homepages/31/d204952132/htdocs/iarp/main/main_inc/iarp-core-classes.php on line 63 62. function checkbanned() { 63. echo $_SERVER['REMOTE_HOST']; 64. } and checkbanned() is before anything else.
  22. I'm trying to create a script that will redirect those from a certain name address. www.ipchicken.com it lists the Name address and what i'm wanting is to redirect those from example.com to google.ca if they try and view a certain part of my site. http://ca3.php.net/reserved.variables.server REMOTE_HOST i'm taking a stab here and saying its not enabled because i get errors when trying to use it. And the people im trying to redirect have thousands of ips so thats just not an option per ip. Any help?
  23. Might be easier to just rename the div? no?
  24. Well thats good to know, thanks.
  25. <?php $query_check = "SELECT * FROM tbl_customers"; $result_check = mysql_query($query_check) or die ("Couldn't execute query"); while ($row_check = mysql_fetch_array($result_check)) { extract($row_check); if($customer_email == $_POST['email']){ $url = "register_site.php?er=yesh"); header("Location: $url"); } } ?> Now i've never heard of extract so i dont know if it won't redirect because of a bad value there.
×
×
  • 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.