Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by severndigital

  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.
  16. I would like to be able to manage inotify with php. I have the inotify pecl extensions installed, and inotify works on the server. But I would like to add a watch to the global instance of inotify, not just the instance that php is creating. I am trying to build a watch manager that allows us to add watches via a web interface. any help would be great. The only way I can think of would be to echo the watch to to the incrontab file. But I would like to be able to manage the watches, so I would need to get some type of access to them after I add them. Thanks, C
  17. you'll need to explain more what you are looking to do. are you trying to see information on the server? or on the user side? if it is the user side, I don't believe it can be done with PHP along since it is a server side language. you will need at the very least some javascript
  18. i've checked that like a dozen times. the exact script worked yesterday and now does not. the only that was different is that the server was rebooted. on the reboot it stopped working.
  19. As of this morning, I am unable to directly output any images from gd or imagemagick if i save them, to a file the exact same code works fine. when I try to display the images directly to the browser i get this error The image “http://www.mineposter.com/testing” cannot be displayed because it contains errors. I am trying to determine what has changed, but I am having difficulty figuring it out, since nothing has changed that I can tell. has anyone else experienced this? and if so, what did you do to fix it? again .. the exact same code works if i save the file and then display it.
  20. no that was excellent information. the project I am working isn't highly sensitive. But I wanted to make sure I was following some kind of best practice. the user id will be used to display billing address, and invoice data. no credit cards or anything, it is mainly just for reporting to the user so they can see recent activity. we may end up getting an SSL certificate, but I mostly wanted to make sure i was passing the information back and forth in a proper manner. I am currently using cookies, and sessions that are logged in the database, along with IP address and whatnot. my main concern was storing the user id in the session. Thanks, C
  21. I want to send some user info to the screen like first name, last name, email address, etc... to the screen. Is it secure to push something like the userid to a session or is there a more secure way store the user id, to pull the data later. thanks, C
  22. answered my own question .. i needed an outer join. SELECT pap.*,res.total_sheets FROM paper_inventory pap LEFT OUTER JOIN paper_reserve res ON res.paper_id = pap.id WHERE pap.rec_num = '49' did the trick
  23. I am trying to pull data from a table and join information only if it exists. can it be done? my example SELECT pap.*,res.total_sheets FROM paper_inventory pap INNER JOIN paper_reserve res ON res.paper_id = pap.id WHERE pap.rec_num = '49' in this case .. the result runs correctly since there is a res.paper_id that matches pap.id. however in other cases, there may not be an entry for it in res. Is there a way to make this query return the results even if res does not contain the paper id?
  24. I want to have a field in my table called 'after_reserves' I want this field to always store the result of an equation on two other fields called 'inv_count' and 'total_reserves' Is is possible to store the result of an equation automatically? When I add the column and cast the type, I was thinking it would look something like this. ALTER TABLE inv_items ADD COLUMN after_reserves integer SET DEFAULT (inv_count - total_reserves) ... When I do a select I just want to do this SELECT after_reserves FROM inv_items WHERE id ='54'; and I want it to automatically return inv_count - total_reserves Can it be done? Thanks in advance..
  25. yeah i tried that .. i have also tried the following str.replace("\\\\","/"); str.replace("[\\]","/"); str.replace("[\\\\]","/"); str.replace("/\\\\/","/"); str.replace("/\\/","/"); it is weird, because I built in an alert on fail and I don't even get that. the best I have gotten so far is the type of thing I am attaching. in that case here is the code used var field = '8 5\16'; field.replace("\\","/"); document.write(field); [attachment deleted by admin]
  • 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.