Jump to content

blackcell

Members
  • Posts

    439
  • Joined

  • Last visited

Everything posted by blackcell

  1. I have been working on a file management application and apparently somewhere within the past week a feature stopped working and nobody noticed. I have been backing it up daily but can't tell where the change occurred that is causing the problem. I have a page that will display every file within a folder. With each file is a href that will link to itself passing my variable "usermode". If this href is clicked it will pass usermode=delete&file=$file. It worked fine until I checked it today and now it wants to save my index.php "the page I am on" to my desktop with pure html and none of my php in it. It should do nothing but unlink($_REQUEST['file'] and print the listed items in the directory again. Any ideas? I am lost on any and have to present this tomorrow. I started using session_start() to have variables on a require("header.php") that is included on all of the pages. I don't know if that affects anything because this is my first time using session vars. Also, when the file was clicked it would display the file in a right frame wheras the listing of files were in left frame. <?php //This is my header file included in everything <? //****************************************************************************** //******************************Header Data************************************* //****************************************************************************** $phpSelf = $_SERVER['PHP_SELF']; //echo $phpSelf; $jamRoot = $_SERVER["DOCUMENT_ROOT"] . "/jam"; $persInfo_ID = $_REQUEST['id']; $_JAMSYS['version'] = "1.21"; session_start(); $bannerHead = "<img src='images/banner_main.png' width='351' height='38' alt='' />"; //echo "<center>JamRoot = $jamRoot</center><br>"; //SYSTEM MESSAGES*************************************************************** //These messages are excluded from the scan manager windows. if(!($phpSelf == "/jam/index.php" || $phpSelf == "/jam/form.php" || $phpSelf == "/jam/attachment.php" || $phpSelf == "/jam/iforms.php")){ //echo "<center><b>JAM Message:</b> JAM is undergoing maintenance. Although JAM may appear to be functional, changes should wait until this message is gone.</center><br>"; //echo "<center><b>JAM Message:</b> JAM is undergoing maintenance but should be working normally.</center><br>"; //die("<center><big>JAM Message:</big><br> A serious problem with JAM was found. Try again later.</center><br>"); //echo("<center><big>JAM Message:</big><br> A serious problem with JAM was found. Try again later.</center><br>"); //echo "<center>Please help us improve JAM. Report any errors, needed corrections, or suggestions to the IT Department.</center><br>"; //echo "<center><big><b>JAM R&D</b></big><br>JAM Development Team is working within JAM and you may have odd encounters. Ignore any messages you see at the top, they are used for development and troubleshooting.<br><br>"; } //****************************************************************************** //ENGINE CHECK****************************************************************** //Turn on to check each module that loads with each page. $checkEngineModules = 0; if($checkEngineModules)echo"<left><big><b>Checking JAM Engine Modules...</b></big></left><br>"; if($checkEngineModules)echo"<left><b>JAMINC.ENG.PHP</b> Successfully Loaded!</left><br>"; //****************************************************************************** //functions,handleINI,sqlUserPass,sqlConnect,SAB,mailto,trashMan,jcpLinker,jamJar,selectOptions require("other/engineconfigs.eng.php"); if(substr($JAMINC,10,1))require("$jamRoot/engine/other/defineUsers.eng.php"); //10 if(substr($JAMINC,0,1))require("$jamRoot/engine/function/functions.eng.php"); //1 if(substr($JAMINC,1,1))require("$jamRoot/engine/function/handleINI.eng.php"); //2 if(substr($JAMINC,2,1))require("$jamRoot/engine/sql/sqlUserPass.cfg"); //2 if(substr($JAMINC,3,1))require("$jamRoot/engine/sql/sqlConnect.cfg"); //2 if(substr($JAMINC,4,1))require("$jamRoot/engine/other/SAB.eng.php"); if(substr($JAMINC,5,1))require("$jamRoot/engine/other/mailto.maildata.php"); if(substr($JAMINC,6,1))require("$jamRoot/engine/other/trashMan.eng.php"); if(substr($JAMINC,7,1))require("$jamRoot/engine/other/jcpLinker.eng.php"); if(substr($JAMINC,8,1))require("$jamRoot/engine/other/jamJar.eng.php"); if(substr($JAMINC,9,1))require("$jamRoot/engine/other/selectOptions.eng.php"); if(substr($JAMINC,11,1))require("$jamRoot/engine/function/viewQuery.eng.php"); ?> ************************************************************ <?php //Here is my delete button routine $jamRoot = $_SERVER["DOCUMENT_ROOT"] . "/jam"; //Delete Button if($userMode == "delete"){ $file = $_REQUEST['file']; $binName = date("Y-n-d H_i_s-") . rand(0,999) . ".pdf"; if(copy("$jamRoot/incoming/$file","$jamRoot/jcp/backup/trash_bin/$binName")){ unlink("incoming/$file"); $onLoad = "onLoad='top.open(\"index.php\",\"_self\")'"; }else{ JamErrorLog("JAM","Application Delete","JAM failed to move file from incoming/$file to ../jcp/backup/trash_bin/$binName."); } } // Stopped self management whenever control panel featured a self-restore button. //Trash Bin Management if(!$userMode == "delete"){ //Monthly Dumping of trash_bin $handle = opendir("file_repos/trash_bin"); while(false !== ($file = readdir($handle))){ if($file == ".")continue; if($file == "..")continue; if($file == "...")continue; $binM = substr($file,5,1); if($binM < date("n") ){ unlink("file_repos/trash_bin/$file"); } //To take care of files in december. if($binM == "1"){ if($binM > date("n") ){ unlink("file_repos/trash_bin/$file"); } } } closedir($handle); } */ if($checkEngineModules)echo"<left>trashMan.eng.php Successfully Loaded!</left><br>"; ?> ************************************************************ <?php //Here is my index.php where the display happens $JAMINC = 1111100001; $JAMINC = 1; //functions $JAMINC .= 1; //handleINI $JAMINC .= 1; //sqlUserPass $JAMINC .= 1; //sqlConnect $JAMINC .= 1; //SAB $JAMINC .= 0; //mailto data $JAMINC .= 1; //trashMan $JAMINC .= 0; //jcpLinker $JAMINC .= 0; //jamJar $JAMINC .= 1; //selectOptions $JAMINC .= 1; //defineUsers REQUIRED require("engine/JAMINC.ENG.PHP"); $userMode = $_REQUEST['usermode']; $userIP = $_SERVER['REMOTE_ADDR']; $phpSelf = $_SERVER['PHP_SELF']; $onLoad = ""; $tasks = " <table align='center' width='100%' border='0'> <tr> <td width='100%' align='center'></td> </tr> "; //Finding Files in INCOMING directory $handle = opendir("incoming/"); $sideBar = " <table align='left' width='100%' border='0'> <tr> <td width='100%' align='left'><font size='4'><u>Scans</u></font></td> </tr> "; $x = 1; while (false !== ($file = readdir($handle))){ if($file == ".")continue; if($file == "..")continue; if($file == "...")continue; if(substr($file,-22,22) == "jam.attachment.request")continue; $fileView = str_ireplace("im4510_","",$file); //Determines if the file viewing is for attachment or application submitting $jamJAR = "incoming/" . str_ireplace(".","_",$userIP) . ".jam.attachment.request"; //echo"[$jamJAR]<br>"; if(file_exists($jamJAR)){ $onLoad = "onLoad='top.open(\"attachment.php\",\"_self\")'"; }else{ //echo"[JAM JAR File Does Not Exist]<br>"; $sideTarget = "form.php?file=$file"; } $sideBar .= " <tr> <td><a href='index.php?usermode=delete&file=$file' target='_self'><img src='images/delete_button.gif' border='0' width='16' height='16' alt='' /></a><a href='$sideTarget' target='_self'><b> $x. </b>$fileView</a> </td> </tr> "; $x++; } closedir($handle); if($x <= 1){ $sideBar .= " <tr> <td>Directory is Empty</a> </td> </tr> </table> "; }else{ $sideBar .= " </table> "; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>JAM Scan Manager</title> <style type="text/css"> a { text-decoration : none; color : #000000; } a:visited { text-decoration : none; color : #000000; } a:hover { color : #F5AE25; background : ; } .hdr { text-decoration : none; color : #ff0000; } .hdr:visited { text-decoration : none; color : #ff0000; } .hdr:hover { color : #F5AE25; background : #bb0000; } .hihiterow:hover { color : #F5AE25; background : #ffffff; } </style> </head> <body bgcolor="#FFFFFF" style="font-family: arial; font-size: 14px;" <? echo $onLoad ?>> <table align="center" width="100%" border="0"> <tr> <td align='center'><b><big>JAM Scan Manager</big></b></td> </tr> <tr> <td align='center'><a href="view.php" title="Viewer"><b><font color="#000080">Go to Viewer</font></b></a></td> </tr> <tr> <td align='center'><? echo $tasks ?></td> </tr> </table> <table align="left" width="75%" border="0"> <tr> <td valign='top' width='50%'><? echo $sideBar ?></td> </tr> </table> </body> </html> I know it is sloppy and probably not the preferred method of doing things but I am learning.
  2. Please tell me that this stuff isn't an easy thing to grasp (mentally). I have been glancing at it off and on for the last month (6 months of php programming for me) and it still dumbfounds me. I haven't had a need to implement a class/framework/OOP is any of my applications but I want to know how to do this crap for the sake of satisfying curiosity and I can't find any material that will break through to me.
  3. Will this act the very same as a type='button' every time?
  4. Ok. So if you start session() this creates the session. When is the session destroyed or released? When the user closes the browser or leaved the site? I have a feeling it works like htaccess but not for sure. Also, do you have to start session() on each page to recall the users session?
  5. Now is data stored uniqe per session or do you need to make it unique by say...creating <?php $_SESSION['userIP']['something1']['something2'] ?>
  6. Can you pass a variable from page to page without passing it in the address bar? I think you can do this with globals but I don't understand "variable scopes" very well yet.
  7. I know...im not posting any code yet because there is so much with this web app but... I made some changes and I am 98% positive none had to do with javascript. Now my pop-up calendar and hover tooltips stopped working. My top-page script is still working but nothing else is. Any ideas on some of the common things that might cause this? I thought it might be because I upgraded to FF3 Beta 3 but on another pc running FF2 it didn't work either. I had them both working the day before they stopped working btw.
  8. IMO, easy isn't a matter of finding the way that the majority considers easy. It is how you like it and how it will make it easy to maintain the code.
  9. I need to be able to process php within. I am wanting to add custom forum code that will enable me to do some basic math with interaction to a mysql database. The catch is I think I have to do the code through html. I think I need to look into <object>s
  10. I want to display page.html within a table of index.html. How do I do this. Google doesn't help because I can't find the right wording.
  11. Dude, I don't know if it will work because of security issues. I tried for half a day at work to have files/directories copied from our web server to our file server (two different computers) and it would not have anything to do with it. My boss and I had stabbed and stabbed at it until we came to the conclusion it may not be possible. The thing we did to get around it was setup xampp lite directory on the file server and ran the services from the webserver pc. Therefore file transfers were easy because we were handling them completely on the file server with only one php program being hosted from that pc. That was an odd situation and I don't know if that provides you with any insight on how to get around or solve it but let me know if you find anything.
  12. OK, I am building a setup/diagnostic routine that will ensure that the required database is setup correctly, and properly named. I do not want to return mysql errors so that the user sees them. Therefore that is what I am trying to accomplish and DO. I don't want lame mysql errors to appear, because it doesn't seem like good design. I just want a field to be highlighted in red saying "`database` doesn't exist. Attempt to repair? <---then they click on this to try to correct the problem. Does that properly define what I am trying to accomplish rather than what I am trying to DO? Plus, I want the general knowledge and best method of approach to this for future reference.
  13. Whats the worst case scenario if table is being accessed while exporting the file? I know it can't be good and remembering that you can't do this basically kills my selective automatic backup method I had.
  14. So I am assuming now that there is a command to execute a 'check for existence' query. That is what I meant in the first place. I will try to look around but I am so buried in home work that I have a hard time find the time to dig deeper into this issue for work. I also need to study on the php try. It sounds like it will do something I want to implement in a few programs but I don't understand it from a quick glance. At any rate thank you for your input.
  15. Yes it is always good for growth and intellectual expansion to copy/paste into a new page and figure out how to do it another way.
  16. I found a method of backing up the table(s) via hard sql files located in the mysql directory. I don't know if that can cause issues later on or how unstable it is. Seems to work and retain information, although the files are slightly bigger than expected.
  17. I want to backup directories but I want to compress the copy instead of using copy(); Ive been trying a few things and they don't seem to be working. I am positive I have my source and destination correct but it keeps bugging out.
  18. I mean there wont be conflicts when using Wamp instead of lamp. Does it effectively handle compression?
  19. Hey will using gzopen and gzwrite and gzread ways of utilizing compression when handling files through php? If so, is it cross plat-form capable? (ie windows)
  20. Any way to suppress the errors onscreen without modifying php.ini?
×
×
  • 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.