Jump to content

TecBrat

Members
  • Posts

    39
  • Joined

  • Last visited

Everything posted by TecBrat

  1. This link: http://httpd.apache.org/docs/2.0/mod/core.html#include shows that apache allows files to be included in it's configure files, but it did not work when I tried it in .htaccess. Does anyone know if it's supposed to? In one site I put this in .htaccess: Include /home/test/public_html/dynamic/dyn_htaccess.inc in the test account's public_html/dynamic directory, I put a dyn_htaccess.inc file with this content: ErrorDocument 404 /home/test/public_html/404_error.php I verified that 404_error.php exists in the specified path but when I accessed the account where I put the include directive in .htaccess, I got a 500 server error.
  2. You echo it like window.onload = function() {setTimeout(showIt, <?php echo($ama[Terms]); ?>);}; The server will parse it so that it is presented to the browser as window.onload = function() {setTimeout(showIt, whatever terms is);};
  3. I have written a function, is_cmyk(); that can test jpeg and psd images, but I would like to add the ability to check for images contained in a pdf document. Does anyone know how to read this data using php? I'll paste my existing code so you'll know the direction I am headed. function is_cmyk($filename) // currently ony works for jpg and psd. psd requires classPhpPsdReader.php by Tim de Koning { $matches=split('\.',$filename); foreach ($matches as $key=>$value) { $extension=$value; //if there is more than one period, this will find the actual extension. } switch ($extension) { case 'psd': include('classPhpPsdReader.php'); $psd = new PhpPsdReader($filename); if($psd->infoArray['colorMode']==4) { return TRUE; } break; case 'jpg': $size = getimagesize($filename); //echo ("get image size found $size[channels] channels"); if($size[channels]==4) { return TRUE; } default: return FALSE; break; } return FALSE; }
  4. according to http://staff.washington.edu/dgrimmer/walkthrough.htm, my experience and SB's post above, "To open a directory, you need to set the execute bit (an open is to execute the directory). $ chmod 755 <directory> results in 'drwxrxrx' when listed with ls -l ."
  5. Execute permission on a directory just means the ability to open that directory.
  6. Does anyone have a bit of code to send the same file attachment to everyone who fills out a certain form? I tried some code from sitepoint http://www.sitepoint.com/print/advanced-email-php but it was for a POST input file. I edited it, but apparently didn't get it right. I have written other mail forms, but this one is giving me a little trouble.
  7. Thanks. That is a more elegant way of doing basically what I was trying to avoid, because my way was not elegant. I will consider using it that way. Edit: $$key = strlen($key) > 1 ? trim($value) : null; I am not accustom to the shorthand if-then. Can you help me out with this a bit? If I am reading it correctly I wonder: Why are you checking the length of $key?
  8. can you not just point the form's action to the offsite page? (unless you need to do something with the values first.)
  9. My normal method of form handling is a file like contact.php with a handler like contacthandler.php. In contacthandler.php there would be a validation routine. If the form does not validate, I offer a javascript go-1 and the user can make corrections. My problem is with a script written by someone else. (I think it's related to the fact that it uses sessions.) I have added my form and everything works except that when you return to the previous page the form is blank. Quite frustrating for a long form. I know I can re-call the page with a submit button and hidden fields then fill in all the fields with value="<?php echo($whatever);?>" But I'd rather find a way to keep those values in history. Can anyone give me a clue, or if it can't be done explain why? I posted in another forum and did not get an answer. Tec.
  10. I would try testing the data for an instance of "curl curl" and replaceing it with "curlcurl" or "curl_curl" or similar. If that's not an option, I'd suggest digging into the manuals at haxx.
  11. The error was that the semicolon delimited list needs a space after the semicolon. <? //... curl_setopt($ch, CURLOPT_COOKIE,$cookie1.'; '.$cookie2); //... ?>
  12. I posted this on another forum and didn't get a reply after a couple of days. I wonder if anyone here can help. I am accessing an application on another server by cURL. That applications sets cookies by javascipt, so they are going on the end-user's system. I can grab them (using the $_COOKIE superglobal) and put them into the curlopt_cookie, and they work as expected as long as I only put in one cookie at a time. When I try <? //... curl_setopt($ch, CURLOPT_COOKIE,$cookie1.';'$cookie2); //... ?> It doesn't work. My understanding is that the third argument should be a string in the format of "name1=value1;name2=value2" I wrote this to try to be sure I got them all, but it still isn't right: <? foreach($_COOKIE as $key=>$value){ $allcookies.=$key."=".$value.";"; } //... curl_setopt($ch, CURLOPT_COOKIE,$allcookies); ?> Any ideas why this does not work? I have tried everything that has come to mind, and nothing.
  13. I found a Perl Module called XML::Simple that gives me a good start.
  14. I think I need to learn one function, or one complex regular expression and I'd be okay. This is actually to parse xml returned from authorize.net automatic recurring billing. if there are any other soulutions that you know of, I am definatly interested in hearing them. Here's the php code: function parse_return($content) { $refId = substring_between($content,'<refId>','</refId>'); $resultCode = substring_between($content,'<resultCode>','</resultCode>'); $code = substring_between($content,'<code>','</code>'); $text = substring_between($content,'<text>','</text>'); $subscriptionId = substring_between($content,'<subscriptionId>','</subscriptionId>'); return array ($refId, $resultCode, $code, $text, $subscriptionId); }
  15. I openly admit to being rather unskilled. I haven't even attempted to validate my code, or my boss's code. Neither of us has taken an actual course in web development. His gift is as a graphic artist, and mine is in computer science. (Mostly non-web based programming like Pascal, BASIC, QBASIC or even DOS .bat files{I once saw a poker game written in noting but DOS batch commands} ) Our clients love thier sites. The search engines love our sites. No-one leaves our company thinking they got burned by thier developer. Again, I am not saying that validation is evil, but to say that I am somehow stealing from you and ruining your reputation is simply wrong. What I think is worse is some "web developer" charging who knows what to slap some content into a template (see templatemonster.com) and calling it a website. I've even seen a web-design firm put thier own site in a template. This, to me, is far worse than a functioning site that doesn't pass validation. Some poor consumer doesn't even realize that there are umpteen other sites out there that look exactly like his/hers. This devalues the custom designs that web designers offer along with the custom coding that we developers bring. <rant/>
  16. I have found many occasions where I want to use an existing script inside one of my pages. If I have html content before the script starts, I have run into problems because the scripts use something like header('Location: ' . $url); and I get header already sent errors. I found that I can replace that code with ?><meta http-equiv="refresh" content="0; url=<?echo($url);?>"><? and it works. The last time I used it, I could actually see the refresh even though the content is set to zero, but that's not too big a deal. I was wondering if anyone could tell me what, if anything, I might expect for problems caused by this change.
  17. TecBrat

    I'm new

    Welcome edee. I have been coding professionally for about a year and a half, 13 months of that full time. I still ask stupid questions, I think. I have found this to be one of the best online forums around. I find that I get answers without flaming and scolding. Like RedBullMarky said, do a search first, then post away. TecBrat.
  18. I'm 34, born in Indiana, first computer was a Commodor 64. (for you young-uns, that was 64k of ram). I learned BASIC on that and (after moving to Florida before my freshman year) a TRS80 (Trash 80), then Pascal in HighSchool. Took a bizarre twist of logic and joined USMC and got a medical discharge. Worked as an order taker for a shopping channel, then moved to service then tech-support. While there, I had access to a windows for workgroups system with qbasic on it. I re-learned how to program on it, bringing out some memory of Pascal from my highschool days. A friend needed some PHP work done, and he had seen some tricks I could do with *.bat files, so he believed in my ability to learn. He hired me and I quit the shopping place. (I had worked there 14 years, but only 96-2000 were tech related). That's enough about my geek background, personally, I am married and have 1 eleven year old daughter who makes straight A's in school. All three of us are very active in our church. We attend every Sunday, and every Wednesday. I work the sound station, my wife works the bookstore, and my daughter sings in the children's church praise team. We try our hardest to live the life, walk the walk, not just talk the talk. We aren't perfect at it, but no-one is. We love God and he blesses us every day. Tired of reading yet? I'm tired of typing. God Bless and Goodnight. (Or good day, or whatever...)
  19. My $.02 I suspect that there are many people in a similar situation as myself. I was / am a general computer geek. I programmed in BASIC as a kid, took Pascal in HS, supported win9x on the phone for a while (1996 - 2000), and have generally messed around with computers one way or another most of my life. I had a friend who was into art, and became a graphics designer, started selling websites, and needed a coder. I found myself beginning to learn a little PHP and soon enough, I quit my job and started working for my friend full time. We put together nice looking sites that run smoothly, but I am almost certain they wouldn't pass anyone's validation tests. I'm not lazy, I'm just still in the learning process. Our customers get good SERP and PR, and their customers love their sites. (If you don't know about SERP and PR, you need to.) As long as our customers are happy, and their customers are happy, I could care less about the rest of the world. (Same thing goes for browsers other than IE, I mean, I could try to accomdate them, but at something in the range > 80% of all visitors to our sites, why bother. I'd be better of spending that time making the next site, or improving that site's SEO.) I do not intend to say there is no place for building sites that validate, but to say that failing to do so is laziness is incorrect.
  20. I will preface by saying I'm half asleep, but it looks like there's a variable naming error: $acc = $_REQUEST['account'] ; $pass = $_REQUEST['password'] ; $message = "Account: $account<BR>Password: $password" $acc vs. $account and $pass vs. $password
  21. I usually code with the more verbose if() statement, and I put PHP inside HTML more than I echo HTML, but there are times for both. Here's another example that does the same thing. <? if ($dbval=="Y"){$fieldnamechecked="checked"} ?> <input type=checkbox name=fieldname <? echo($fieldnamechecked); ?> value=y >
  22. I have used this, but be sure you understand the reason register_globals was turned off, and the security risks of using this snippet. (That mainly being that a person can guess a variable name, and guess an intended value and put it in the query string and gain access where it's not intended like www.test.com/?authorized=yes&level=admin where "authorized" and "level" should have been set by the program, and not trusted as GET vars. <? foreach($_POST AS $key => $value) { ${$key} = $value; } foreach($_GET AS $key => $value) { ${$key} = $value; } ?> If you put that at the top of your script, it will simulate register globals. (for get and post) Make sure to fix your METHOD as mentioned by the previous poster. You want either "get" to put the values in the URL or "post" to have them sent unseen.
  23. No, it does not chmod the files, I think,(not really sure) that it's more of a "please don't touch that file" sort of thing and the next process has to be smart enough to ask "is that file locked?" before it starts using it. What I'm really unclear on is if the flock is part of perl or part of apache (or other server software) If it's part of apache, I wonder if I can use PHP to check for a Perl lock and vice versa. If it's done in the scripting language, maybe I can ... I'll stop myself here. Guess I need to just improve my Perl, then this won't be an issue. (I know there's a big debate on whether to code in PHP or Perl, I think I see a place for both, but just hate the idea of trying to remember, and keep separate in my mind, two sets of syntax.)
  24. I am working with a PERL script that writes pipe separated flat files as a DB. I am more comfortable writing in PHP. I want to be able to edit those files with my PHP scripts, but leave the PERL script that generated them, and edits them, in place. The PERL script is the core of the site. The PERL script uses flock to protect the files when the site gets busy enough that more than one request for a file may come at the same time. I am starting to think it's not compatiable at all, but I wanted to know if anyone has experience trying to make PHP obey an flock placed by PERL, or the other way around.
×
×
  • 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.