Jump to content

severndigital

Members
  • Posts

    355
  • Joined

  • Last visited

About severndigital

  • Birthday 11/25/1977

Profile Information

  • Gender
    Male
  • Location
    PA

severndigital's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. I have a multi-dimensional array that might look like this. Array ( [0] => Array ( [type] => feet [color] => red ) [2] => Array ( [type] => feet [color] => blue ) [3] => Array ( [type] => head [color] => blue ) [4] => Array ( [type] => body [color] => blue ) ) I say might because it's being handed different information each time, but the premise is still the same. I need to check for a color match but only on specific type combinations (head,body.feet). So basically I need to check if the array includes specific type combinations first, and then check them for color matches. so an array that had the above items would return TRUE for a match of Blue I'm having a tough time with this one. Any help would be great. Thanks!
  2. no you are right. The dyndns.org website is gone and the links are dead. for now I am going to write a quick fix in js or something to rewrite the urls until I can get it fixed. thanks.
  3. I have a problem where we used a DYNDNS.org domain name when developing a site. somehow the domain got hard coded and. I try to edit the database but when I do find and replace for all instances, the site just crashes. Is there a way to use mod_rewrite sniff our the offending code and replace it with the right information. basically I have something like this on the page <a href="old.dyndns.org">A Link</a> and I want to change it to this <a href="www.correctdomain.com">A Link</a> could this be done with mod_rewrite?
  4. i did read the manual, but what that says to me is that if this is the string '{companyName}{companyContact}' then the result would be $match[0] = companyName $match[1] = companyContact and that is not what I am getting. I am getting an array that looks like this $match[0][0] = '{companyName}' $match[0][1] = '{companyContact}' $match[1][0] = 'companyName' $match[1][1] = 'companyContact' this is causing a problem because some the matches are coming back like the following $match[0][0] = '{companyName {companyContact}' $match[0][1] = '{companyContact}' $match[1][0] = 'companyName {companyContact' $match[1][1] = 'companyContact so there seems to be something wrong with my regex expression .. which is what my question was about. Chris
  5. I need to extract some information from a text string. The information is between two curly braces { my stuff i need here } here is my regex call preg_match('/\{([^}]+)\}/',$pdfString,$info) This works and $info is filled with content, but it is not correct this is what I get from it. //this is part of the string. It is being read in from a text file generated by another system. $string = '2,563.71 {companyName } {companyContact } '; //when I do a print_r of the output from the preg_match_all command the following is what I get. Array ( [0] => Array ( [0] => {companyName } [1] => {companyContact } ) [1] => Array ( [0] => companyName [1] => companyContact ) ) What is wrong with my preg_match_all command that I am getting 2 items in my array that are basically filled with the same thing only the array[1] has no curly braces, and array[0] does. How do I get just information between the curly braces? Thanks in advance, Chris
  6. I know most of this issue is me not knowing how to use SIMILAR TO and regex so any help would be great. I am trying to match a product title entered into a search field with titles already in a database. for example in the database the title is "Robocop" when I look up another title say ... "Robocop Blu-Ray" or "Robocop (The Criterion Collection)" or "Prime Directives Robocop Series" how can I get it to return a match? Thanks in advance. C
  7. I am trying to show / hide some divs inside another div, I am running into a problem. here is my code <script> function showTools() { $('#toggle').show('blind'); } function hideTools() { $('#toggle').hide('blind'); } </script> <h1>Test Area</h1> <div id="wrapper" style="height:150px; width:125px; border:1px solid black;" onmouseover="showTools();" onmouseout="hideTools();"> <div id="toggle" class="span-3 last hideMe"> <div id="tool1" class="span-1"> Tool </div> <div id="tool2" class="span-1"> Tool </div> <div id="tool3" class="span-1 last"> Tool </div> </div> </div> <script> $(function(){$('.hideMe').hide();}); </script> the problem is when I enter the "revealed" div, it counts as a "onmouseout" command on the wrapper div and hides the toggle div. once the div is gone it counts as a "onmouseover" on the wrapper div and the toggle div appear again. This loops over and over until you move off the wrapper div. I know why it's happenen, but I have no idea how to fix it. Any help would be great. thanks,
  8. The problem with with cURL. I was using -d and when i switch it to --data-urlencode it works. Thanks again for helping me face the right direction.
  9. ok .. thanks .. that has pointed me the right direction at least. It seems the file is coming into the script without the name correctly. I couldn't use var_dump, but I had $input value written to the log file. //a correct entry. INFO - 2012-07-27 10:48:58 --> var_dump -- /home/ftp_root/web_transfers/TestFile.pdf //one with an ampersand .. file was named .. TestFile & Name.pdf INFO - 2012-07-27 10:49:28 --> var_dump -- /home/ftp_root/web_transfers/TestFile I am using cURL to access this script from incron. like this INCRON entry /home/ftp_root/web_transfers/ IN_CLOSE_WRITE /home/scripts/process_ftp_file.sh $@/$# process_ftp_file.sh contents #!/bin/bash curl -d "sourceFile=$1" http://portal.chernay.com/webservices/ftp_service/process_ftp_upload I will begin debugging the incron and curl inputs. Thanks for your help in getting me to the correct place. for posterity I will post the fix once I get it figure out. Thanks.
  10. As requested. Like I said, the script has been working without issue and even handles files with quotes in them. I didn't even think to test it with an ampersand. $err = array(); $notify_all = FALSE; $input = $this->input->post('sourceFile'); $source_path = explode("/",$input); $source_file = array_pop($source_path); $source_path = implode("/",$source_path).'/'; $dest_path = STORAGE.'mega_share_1/Downloaded/Incoming/'; $dest_back = STORAGE.'mega_share_1/Downloaded/Backup/'; if(copy($source_path.$source_file,$dest_path.$source_file)) { //make the backup if(copy($source_path.$source_file,$dest_back.$source_file)) { //remove source file if(unlink($source_path.$source_file)) { //notify everyone log_message('info', 'SUCCESS - controllers/ftp_service/process_ftp_upload copied and removed file: '.$source_file.'.'); $notify_all = TRUE; } else { log_message('error', 'ERROR - controllers/ftp_service/process_ftp_upload could not remove source file: '.$source_file.'.'); $err[] = 'source file '.$source_file.' not deleted'; } } else { log_message('error', 'ERROR - controllers/ftp_service/process_ftp_upload '.$source_file.': backup not made.'); $err[] = 'backup copy not made'; } } else { log_message('error', 'ERROR - controllers/ftp_service/process_ftp_upload '.$source_file.': original copy not made.'); $err[] = 'original copy not made'; }
  11. the way i do it is add a field to database table called access_level in my case I need to control 2 things .. page view and page content items (menu links in your case). I wrote 2 functions .. 1. can_i_be_here($allowed_levels) this function checks the allowed levels to see if the users access_level is allow to view. if not it redirects to the previous page. 2. can_i_see_this($allowed_levels) this function checks to see if the users access_level is allowed to see the item in question. it just returns true or false. i use them like this if(can_i_be_here('5|9')) { run code and display content. } and if(can_i_see_this('2|9')) { echo 'this is my content only you can see'; } this is a very basic explanation, but it should get you pointed in the right direction. hope it helps.
  12. I recently wrote a script that sweeps directories and copies the files to an alternate location. Everything works fine. until someone uploaded a file call 'This & That cover.zip' the script tried to execute but the copy() function returned an error of Severity: Warning --> copy(/home/ftp_root/This ): failed to open stream: No such file or directory /home/web_roots/portal/ci_app/controllers/webservices/ftp_service.php i'm doing anything fancy just a simple copy($source_path.$source_file,$dest_path.$source_file) It seems that the copy command is only seeing the file name as 'This ' instead of 'This & That.zip' Truncating the file name at the ampersand. Any suggestions? I tried googling but was unsuccessful. Thanks in advance, C
  13. i think i got it working sort of. I cleared the cache in firefox and that seemed to get it closer to what I wanted.
  14. I am trying to get wordpress to display the full article in the category view. if you goto my site www.attackofthekillerbs.com you will see the posts on the front page looking correct. http://www.attackofthekillerbs.com/category/action/ shows the posts in some kind of other view, and I can't seem to get it to look like front page. I am very frustrated, since I think this should be an easy fix. Any help or a point in the right direction would be great. Under Reading in the admin settings I have For each article in a feed, show Full Text selected. Could it be the template that is controlling this? if so, any idea where to look to fix it? Thanks again, C
  15. scripting against an additional post item is one thing, but you really need to be sanitizing the $_POST contents before you do anything. if you are not sanitizing the post fields correctly, posting something as simple as /* into a field can give someone access to ALL of the data in the database. or worse .. they could DELETE the entire contents of the table. I understand that is some controlled environments security is not that big of an issue. But turning on register_globals to remove a step that can be simplified with a function and foreach loop is just lazy. cross site forgery is HUGE security problem and without minimal security steps like sanitizing input data you are just asking from problems.
×
×
  • 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.