Jump to content

whatabrother

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

whatabrother's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I was editing in notepad2. I usually use linux, but I built this at my uncles office so all I had was windows. Anyways the font is weird in notepad 2 for variables. An uppercase and a lowercase x look very much the same. It wasn't until I put the code in a pastebin that I noticed the issue. It's funny how that works.
  2. wow. The bug was this: $X = 1; x should be lowercase.
  3. Hey, I have been working on a PHP system to manage a booking system for my families Cabin. The cabin is used weekly by different people. My (2) uncles built the cabin, and share it with their 6 other siblings. The problem is that there is often conflict with who is using the cabin and when so My uncle asked me if I could write this application. The app is very close to completion with the exception of one bug. The user chooses a year and a month, then the script shows all the available days in that month. The user chooses a starting day to book, and enters a number of days to use the cabin. The bug lies in the section of the program that handles a situation where a stay at the cabin sits over two different months ie. March 30 for 10 days. The program attempts to handle the issue on line 153-162 in the pastebin below. Specifically, the program seems to be satisfying the conditions on line 183 and 192 when it shouldn't. These conditions should only get satisfied if the user tries to book a day that has already been booked. If a user books a date near the end of the month, the rest of that month gets booked, but as soon as the first day of the next month comes the conditions mentioned above get satisfied even if the day is open in the database. I've dedicated hours to this bug now and still can't figure it out. Maybe somebody can help me find it? Here is the pastebin http://pastebin.com/m349cf608
  4. yep, preg_match_all did it for me.  It always feels great to spend hours working with the wrong function! ha. Thanks a ton
  5. It worked better after using the expression that you posted, but it not quite as I expected.  Here is my actual code: <?php //all my precreated functions.  I have two in there that I use encrypt_data() and decrypt_data() require "vigilsreign/functions.php"; $string= '<a href="http://example.com">example</a><a href="http://example2.com">example</a>'; $pattern = '/(?<=href=")(.*?)(?=")/'; preg_match($pattern,$string,$match); $y = 0; while ($match[$y]) { $pattern = '/href\="/'; $replacement = ''; $match[$y] = preg_replace($pattern,$replacement,$match[$y]); $pattern = '/"/'; $replacement = ''; $match[$y] = preg_replace($pattern,$replacement,$match[$y]); $url = parse_url($match[$y]); if (!isset($url[scheme])) { $url[scheme] = "http"; } if (!isset($url[host])) { $nothing = decrypt_data($_GET[variable]); $hmmm = parse_url($nothing); $url[host] = $hmmm[host]; } $hmmm = "$url[scheme]://$url[host]$url[path]"; $hmmm = encrypt_data($hmmm); $pattern = "/http:\/\/$url[host]/"; $replacement = "vigilsreign/proxy.php?page=1&&variable=$hmmm"; $string = preg_replace($pattern,$replacement,$string); ++$y; } ?> the array $matches show's like this: Array ( [0] => http://myspace.com [1] => http://myspace.com ) when I want it to show like this: Array ( [0] => http://example.com [1] => http://example2.com )
  6. Thanks, that helped, but I ran in to another problem.  I want to match everything between href=", and ".  I used this expression, but it takes everything between the first double quote and the last double quote.  I want it to match everything between href=" and the next double quote.  This is the expression I've been trying to make work: /href\=".*."/        
  7. I need to use a variable in a replacement. i've been using this format: $string = 'xhellox'; $variable = 'hello' $pattern = '/$variable/'; $replacement = 'goodbye'; $string = preg_replace($pattern,$replacement,$string,-1,$x); I would want for xhellox to turn in to xgoodbyex, but no replacements are made, and I am assuming that it is because I used a variable in the regular expression.  What would be the proper way to do this?
×
×
  • 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.