Jump to content

kicken

Gurus
  • Content Count

    3,841
  • Joined

  • Last visited

  • Days Won

    110

kicken last won the day on September 8

kicken had the most liked content!

Community Reputation

559 Excellent

1 Follower

About kicken

  • Rank
    Wiser? Not exactly.

Contact Methods

  • Website URL
    http://aoeex.com/

Profile Information

  • Gender
    Male
  • Location
    Bonita, FL
  • Age
    33

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. The delimiters don't matter really, though by using # you could skip escaping the / in the expression. Normally I'd probably use something other than / as well in a situation like this just to avoid that escape, but I was to lazy to change them on the website. You need the start and end of string anchors though if you want to enforce the value strictly. Without them it just looks for the pattern somewhere in the string, not that the string is exactly that pattern. So your regex would also match if: $_POST['ay'] = 'I want to attend in the (2020/21) academic year';
  2. If you want the entire string to be in that format, you need to use the start (^) and end ($) anchors and put your pattern in between. Your regex currently also only looks for digits and /, but they can be in any order. If you want to enforce that strict format you need to look 4 digits followed by a slash followed by 2 more digits. Given the above, you end up with a regex such as /^\(\d{4}\/\d{2}\)$/
  3. When you're trying to re-create a flow, the best thing to do generally is to use either the browsers developer tools or something like fiddler to monitor what exactly the requests being made are, then figure out how to re-create those requests. Sometimes it's as simple as loading a URL, other times it's more complicated and involves parsing the previous pages source for various details. The process is something you general have to figure out on a case-by-case basis so it'll be difficult for anyone to really guide you without at lot of details.
  4. Trying to run your other script with shell_exec just introduces unnecessary complexity to the problem. Since your script is just another PHP script (and a simple one at that) then you can just include() it to run it. if (isset($_POST['clearflags'])){ include 'clearflags.php'; } You shouldn't be messing with the shell functions unless you need to run some external non-php program or some other php application that's intended to be run standalone from the command like (ie, composer).
  5. Perhaps if you check the manual, you can find the function you need.
  6. Undefined index (as specified in your title) refers specifically to array indexes, not variables in general so code like you posted wouldn't really help any. The common scenario where you encounter this is with the input arrays $_POST, $_GET, etc as what they contain depends on the request. Since you can't be certain whether a given key exists in those arrays, you should always be checking for it and providing a sensible fall-back value if it doesn't. With PHP 7 this has been made easy by using the null coalesce operator. In older versions you'd have to use isset() to check. Ther
  7. When I started out with PHP I'd always use a simple PHP array in a file and include that file, as demonstrated above. This is very simple and easy to use. One thing that can be both a benefit and a detriment of this is that the configuration is PHP code. One the plus side, you can use the code to do some fancy stuff. On the down side, allowing code to run in the configuration could cause problems. Typos for example could cause the whole application to break. As with most people, I eventually moved toward JSON for my configuration files. The format works well for simple data and is
  8. I don't think it is possible. I can't see how the code would possibly work in production either if it's trying to declare a class twice. Only thing I can think of is the problem was fixed but that fix didn't make it into the version you have. One way to try and deal with it while still being able to track you changes reasonably well would be to create a branch that has all the changes needed just to get the application working. Then create a new branch from that to do your debugging on. When done you can diff the two branches.
  9. I showed you everything you need to know to figure out it out my first post. I showed you how you can replace t3_home with a variable called key. I showed you how you can construct a variable named key from some strings and another variable containing a number. Put those together and you have your answer for how to add your x variable into that command. You can then extrapolate from that and figure out how to make your home part into a variable also.
  10. The query just asks the database for information matching your criteria. After you run the query you need to fetch the data to make use of it. If nothing matches your criteria, you'll know because your attempt to fetch the data will return false instead of usable data.
  11. So make it a variable also and concatenate it as well just like was done with the 3.
  12. Javascript allows an object's properties to be accessed using array notation as well, so you can use either document.freeone.t3_home or document.freeone['t3_home'] to access the t3_home property. Array notation allows the use of variables as the index value, so you can do something like this: var key = 't3_home'; document.freeone[key].value = 'close'; Now all you have to do is construct the appropriate value for the key variable, which can be done using simple concatenation. var x = 3; var key = 't'+x+'_home';
  13. PHP is the wrong tool for the job. If the form she has to fill in is within a web browser then you could use what's known as a bookmarklet to do the job. You need to identify the inputs using the developer tools. If they have an ID then life is fairly easy. Your bookmarklet would just be code like: javascript:document.getElementById('session-input-id-here').value='her-session-id';document.getElementById('password-input-id-here').value='her-session-password';void(0); You'd create a new bookmark in your browser and put that in for the bookmark's URL/Location. Replace the values
  14. Small rant thread for some recent frustrations. So a friend of mine has a few sites she has been trying to run using a third-party system she bought. I've been providing some hosting for her for free on my VPS to help her save some money. The software she has is kind of junk by modern standards I think. Uses Zend Framework v1 and was probably written in the early php 5.x days originally. For some reason she likes it even though she seems to be constantly opening support tickets for things. Support was always slow to respond too and used to always complain that they couldn't acc
  15. Yes, from all the ones you are using as an include file. Those parts of the code should only exist once in your page. You already have them in your PHP file so you don't want them in your html files as well.
×
×
  • 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.