Jump to content

PC Nerd

Members
  • Posts

    1,122
  • Joined

  • Last visited

    Never

Everything posted by PC Nerd

  1. Hi, I'm wanting to use mod_dbd's odbc option to connect with mysql. I was wondering if anyone could recomend a source because I cant find much documentation on how to get odbc with mod_dbd ( though I have read it mentioned that is was done).* If your wondering why I want odbc with mysql instead of jsut using mysql driver, there is a known conflict between php with mysql and apache with mysql, that when both are used together ,apache seg faults (though seperately they work fine). odbc is my way around that. Thanks
  2. Hmmm ok.... Ill try and screenshot* im using hte following code as a demo <?phpif($condition) { echo "String";}?> ok.... that code being used, was directly copied across from notepad ( and notpad++ for testing).... and was using tabs as indents. the php tags were on new lines, and the output looks like: [attachment deleted by admin]
  3. being the idiot i am, I didnt actually check if it was beta: Im running 1.0.154.36, which is not beta..... Also, I understand that chtome uses the same rendering engine as safari, so are there any safari users that can let us know if their code tags display properly? Thanks
  4. Hi, When I go to new topic, anythign in my code tage becomes one long string, ignoring indenting and a 50 line entry becomes about 3 lines of unrecognisable rubish ( unindented code... urgh!). When I moved over to firefox ( my usual browser), it worked fine again. I noticed that someone else was having issues with IE8 beta (http://www.phpfreaks.com/forums/index.php/topic,228138.0.html), but it seemed slightly different since chrome isnt in beta... is it? Thanks
  5. Hi, Im trying to upload an excel spreadsheet and rename it to file{timestamp}.xls. At the moment I'm getting a Permisison Denied error from move_uploaded_file( and its to a folder that is 777 permissions). Thanks <?php else if(isset($_GET['checkin'])) { if (($_FILES["file"]["type"] == "application/octet-stream" || $_FILES["file"]["type"] == "application/vnd.ms-excel") && $_FILES["file"]["size"] < 2000000) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { if(is_uploaded_file($_FILES["file"]["tmp_name"])) { echo $_FILES["file"]["name"]; $newfile = make_directory(getcwd()).basename(str_replace("&&&", time(), $basename)); echo "upload file: [".$newfile."]"; // usr DIRECTORY_SEPERATOR instead of make_directory(); if(@move_uploaded_file($_FILES["file"]["tmp_name"], $newfile)) { //rename($_FILES['file']['name'], str_replace("&&&", time(), $basename)); $currentlock = loadcurrentlockdata(); setlock(UNLOCKED); setcurrentlockdata(NULL); writelog("IN"."|".$currentlock[0]."|".time()."\n"); } else { echo "Failed to upload the file. Please try again"; } } else { echo "Checkin failed."; } } } else { echo "Invalid file. Either you have uploaded the wrong file, or it is too big. [".$_FILES["file"]["type"]."][".$_FILES["file"]["size"]."]"; } }?>
  6. - either way I should be able to chmod... it jsut occured to me that it might be a case where the files arent "777", ie - readonly (because its reading from other files that were uploaded in the same session), so only the writing function to that file fails.... thus --- I think that its just a 777 issue ( Ill check). Thanks
  7. Hi, shell access - so ill look into that ( im new to linux command line)..... /tmp is a good idea but I did want it all in a single directory so its easily "contained" etc. Thanks for your help.
  8. function setcurrentlockdata($data) { // Writes data about the current lock to the file. Can only be read using loadcurrentlock($data); $f = fopen("curlock", "w"); if($f == FALSE) { return 2; } if(flock($f, LOCK_EX)) { $r = @fwrite($f, $data); flock($f, LOCK_UN); } else { return 3; } fclose($f); if($r == FALSE) { return 4; } return TRUE; } Warning: fopen(curlock) [function.fopen]: failed to open stream: Permission denied in <FILE> on line 109 line 109 is @fopen(.....); Im not 100% sure about the permission's on a linux machine, how would I change the user of the files? Thanks
  9. its its possible. If i understand you correctly then your looking to have something similar to PHPMyAdmin's upload feature - where you can import an XML or CSV or SQL file into the specified database. It would require a lot of work to ensure that the file is in the correct format - most likely you would want ot load the file using file() and then parse each line with regex. gdlk
  10. Hi, I've got a directory that is protected by apache .htaccess file. At the moment, it allows access to the one php file in the directory - however whenever I try and read or write to any of the other files - I get a permission denied error. Is there any way that I can open these files through php? Thanks
  11. Ok - ended up with the target="_blank" option.... and used a cookie across the current page to that ( using the link). That way the file was still only downloadable only once even if they refreshed with the same data etc. Thanks!!!
  12. Ahhh ok * Ive tried to format the code above but for some reason its not liking it - so that "dump" of code is the best I can do atm. Thanks - Ill look at the iframe.
  13. Hi, I'm trying to get this script to work, so that it still outputs the HTML of the page, and then sends the download. The overall effect is that once the page (HTML) is dowloaded, the File is sent so that the information on the html page is viewable ( it contains information regarding licences and passwords within the file being downloaded). * this code does force the download - just doesnt output any of the HTML. It is called as the last like after all the HTML. I am using output buffering so my code goes: ob_start();HTML outputdownload();ob_flush(); thanks function download() { if(is_file(FILE)) { // required for IE if(ini_get('zlib.output_compression')) { ini_set('zlib.output_compression','Off'); } $mime="application/vnd.ms-excel"; header('Pragma: public'); // required header('Expires: 0'); // no cache header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Cache-Control: private',false); header('Content-Type: '.$mime); header('Content-Disposition: attachment; filename="'.basename(STATIC_NAME).'"'); header('Content-Transfer-Encoding: binary'); header('Content-Length: '.filesize(FILE)); // provide file size readfile(FILE); // push it out } *** Un fortunately for some reason the CODE tags didnt work.
  14. Hmmm ok, Now Ill post this here - and let it sit.... Are there any php developers here that know if anyone is planning to fix this bug in the near future? If not - are there any C developers out there that would be interested in giving me a quote to find the issue and fix it - because I really do want to have this module ( if not then I have to revert to writing a cron that dumps from database into the .htpasswd file etc). Thanks for your help! PC_Nerd
  15. Hmmm ok, Is there anyone here ( and i might put this in the php freelancing section) who might know how to diagnose what is causing the conflict or how you might go about fixing it. I know this is a separate question for freelancing and the php bug database community etc - but if anyone here knows where I might start looking that would be an enormous help ( or alternatively how I can use mysql database authentication with apache 2.2 with php and mysql5 on the save server - that would be great too). Thanks, PC_Nerd
  16. Hi, I'm attempting to find a way around a documented bug ( because I don't even know where to start about coding for apache to fix the bug. The short is that when PHP and mod_dbd is compiled with mysql5 driver support, apache seg faults ( though when one or the other is disabled it works).http://bugs.php.net/bug.php?id=45995&edit=1 - is the bug location Note: To get mod_dbd to work wiht mysql I need to compile everything from source so im compiling mysql, php, apache, apr, apr_utils I'm thinking that if I was to compile mysql twice, once into my production directory to run - and one into a seperate location to use as a driver... Then I compile PHP and mod_dbd each with the seperate copy of mysql driver... Then each one connects to the same mysql server ( mysql.sock in the /tmp dir)..... Do you think this might solve the conflict. I understand that you guys probably cant give me a definative yes or no... Im just looking for a "it might work" before I look at spending a day recompilign everything from scratch again ( which took me about 7 hours last time with all the configuration options etc - yes im a linux noob but am learning fast). thanks in advance for any and all helpPC_Nerd
  17. Ok thanks, Ive worked at the moment using file(); After reading in more depth about file(), I learned that the faster method it to manually read it from teh file using fread and then explode() based on a newline etc. I think there is a solution in teh comments for file(). Thanks!
  18. Ok thanks, but is there any specific way to read a specific line withought havbing to load the entire file ? Thanks
  19. Hi all, I'm looking to see if there is a better method than reading the entire file and then splitting it into an array ( at "\n"). I have a long text file, and I want to be able to select specific lines in the file. Eventually I anticipate that the file could be into the tens or hundreds of thousands of lines long so I would like to try not to have to load the entire file everytime the script runs. Thanks,PC_Nerd
  20. lol, I tend to agree -well sort of. I thought it would be easier to have it next to the reply/notify/send this topic/print buttons at the top - because thats where ( personally ) my post editing comes in, top right of the post. So by having it at the top of the page ( even on the left) - it means that on longer threads its easier for the original poster to go topic sovled. The other thing is that it might be handy to have it in quick edit || edit for the original poster - so that when it is solved and they reply (ie: "thanks, ended up being mysql wasnt running"sort of thing) - they dont have to then go back into the post to be able to mark it as solved - its all through the same page to sort of "finish off" the topic? Anwyay - thats my 2 cents worth
  21. Fantastic thanks ( now for interpretting the C code ) Solved
  22. Thats because when you include a file - it simply sort of "dumps" that file into the position where the current code is. So your header probably wants to be <html> | \/ <body> and then the footer: </body> | \/ </html> So that your index can be "content" as such. index.php: <?php require("header.php"); place code here to run in the content section require("footer.php"); ?> jsut a note, remember to make sure that your include files end in php ( even if you have header.inc.php) because if someone requests the inc file from outside your script it will show them the source code.
  23. EDIT: And jsut at the moment i post it I find the file, I think: Is it zend_exceptions.c ? Thanks ( Ive removed my original post stating I couldnt find the file in the source) Thanks
  24. Ok, Ive run it through Reflection - and it seems that all I get is an output of the classes properties and methods - not the actual source code that was used to create the class. Is the Exception class written in PHP or is it "built" in the C/C++ in compilation? Thanks Ive placed what I get below: <?php echo "<pre>"; Reflection::export(new ReflectionClass('Exception')); echo "</pre>"; ?> DISPLAYS: Class [ class Exception ] { - Constants [0] { } - Static properties [0] { } - Static methods [0] { } - Properties [6] { Property [ protected $message ] Property [ private $string ] Property [ protected $code ] Property [ protected $file ] Property [ protected $line ] Property [ private $trace ] } - Methods [9] { Method [ final private method __clone ] { } Method [ method __construct ] { - Parameters [2] { Parameter #0 [ $message ] Parameter #1 [ $code ] } } Method [ final public method getMessage ] { } Method [ final public method getCode ] { } Method [ final public method getFile ] { } Method [ final public method getLine ] { } Method [ final public method getTrace ] { } Method [ final public method getTraceAsString ] { } Method [ public method __toString ] { } } }
  25. most likely. However you might want to have them each as a class, whos parent is an AJAX class, so it knows how to handle connections by default - withought your scripts having to handle that. Its a nice Idea that I hadnt even thought of till I read it. I was going to go with bdmovies idea.
×
×
  • 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.