Jump to content


  • Content count

  • Joined

  • Last visited

  • Days Won


sKunKbad last won the day on August 14 2014

sKunKbad had the most liked content!

Community Reputation

17 Neutral

About sKunKbad

  • Rank
    Prolific Member

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location
    Temecula, CA, USA
  1. sKunKbad

    CodeIgniter - Blocking access to admin pages

    Authentication for CodeIgniter can be handled by a few different libraries, depending on what version of CodeIgniter you are using. If you are using 3.X, then you might try Community Auth: https://community-auth.com It's probably way over your head, but it works great. Another popular choice is Ion Auth. I don't have experience with Ion Auth, so I can't tell you about it.
  2. I was thinking that being able to start and stop the ssh tunneling would be nice to do with php, but after investigation I'm just going to use autossh and keep the ssh tunnel open permanently. Since the server will be using the connection at all hours of the day and night, I don't think it could hurt to keep it open.
  3. I did figure it out. The user running shell_exec, in my case www-data, needed its own self-created rsa key. I guess when I initially created it I didn't create it as www-data, so it didn't work. All is well now.
  4. PC is just a development environment, but production server is also Ubuntu, so figured if it works on dev it should work on production. I'm supposed to create an application on that production machine that can do mysql queries on that "castrated" server. I cannot make a secure connection with MySQL because that castrated server is not set up for that. I think this might be my only option.
  5. I see all over the internet tutorials that are basically saying that setting up the ssh tunnel for mysql is easy, but I get an error, and no joy: Host key verification failed This error is in a log file that I created. I am attempting to use PHP's shell_exec on my Ubuntu desktop: shell_exec('ssh -p 2233 -f -L 3307: acct@remote-server.com sleep 60 >> ./ssh.logfile 2>&1'); So, pretty standard according to the internet, but it's not working for me. 1) The remote server is a hosted website. It's a "semi-dedicated" plan, and just a glorified shared hosting account. 2) I can already do a passwordless SSH connection to the remote server by using the terminal. So my key based authentication is working for me. 3) I use SQLyog (MySQL tunneling through SSH) to this remote server. It's not key based, but the tunnel is there. 4) The host was not helpful. They were trying (I think), but nothing worked. 5) Yes, the remote server requires SSH connections on port 2233. Why is this failing? I need somebody to walk me through this. I saw somewhere online that the error message may mean that apache was not able to check a known_hosts file. I created an .ssh directory at /var/www/.ssh, and I put a known hosts file in there. Chowned these to www-data:www-data. Permission set at 600. Don't know what else to do or check.
  6. sKunKbad

    Send mail Raspberry Pi (sSMTP)

    I have mail sending out of my Raspberry Pi using SSMTP, but going through my gmail account. It was super easy: root=$smail Debug=yes mailhub=smtp.gmail.com:587 hostname=irrigation AuthUser=example@gmail.com AuthPass=Pas$weRd123 UseTLS=yes useSTARTTLS=YES RewriteDomain=gmail.com I didn't do anything else, and it just works. So if you can set up a gmail account, your good. Well, I did have to tell google to trust my insecure app, but that's it.
  7. sKunKbad

    Unset not working in PHP 5.5 but works in PHP 7

    Figured it out. Just need to wrap $property in curly braces. unset( $this->{$property}[$key] );
  8. I'm having a problem unsetting an array element when in PHP 5.5, but only when it's a class property. See code: <?php /** * Works fine as procedural code */ $arr = [23213523, 3634634, 68486468]; $val = 3634634; if( ( $key = array_search( $val, $arr ) ) !== FALSE ) { unset( $arr[$key] ); } echo '<pre>'; print_r($arr); echo '</pre>'; /** * Works fine on PHP7, but not PHP5.5 */ class Foo { public $arr = [23213523, 3634634, 68486468]; public function bar() { $this->_unset_numeric_val('arr', 3634634 ); } private function _unset_numeric_val( $property, $val ) { if( ( $key = array_search( $val, $this->$property ) ) !== FALSE ) { unset( $this->$property[$key] ); } } } $foo = new Foo; $foo->bar(); echo '<pre>'; print_r($foo->arr); echo '</pre>'; On PHP7 the results are the same, but on PHP 5.5 unset doesn't work. What's the problem here? What happened between versions? I looked at the docs for unset, but didn't see anything.
  9. I'm guilty, so shoot me.

  10. sKunKbad

    Require digits, but not necessarily together

    Unless I'm being asked for my opinion, I'm just doing what the customer wants. That's kind of besides the point though, as I'm just learning some more about regular expressions in general. I thought I'd come here to PHP freaks because the site members are usually pretty responsive and knowledgeable. I'm guilty, so shoot me.
  11. sKunKbad

    Require digits, but not necessarily together

    Forget about passwords. I told ya I'm just learning, and I'm just using passwords because it's Sunday and I'm too lazy to come up with something else on my day off. So, I found an answer, but while I understand the basics of what a positive lookahead is, I guess my next question would be if I'm not needing a capturing group, does it hurt performance or anything if it is capturing vs non-capturing? // This /^(?=(?:.*[\d].*){3,}).*$/ // Works the same as this /^(?=(.*[\d].*){3,}).*$/ In the end preg_match is going to give me a boolean and I'm not using the matches parameter at all. PS. While it might seem silly, I've had customers ask me to enforce passwords that were 5 alphas and 3 numbers. It happens.
  12. sKunKbad

    Require digits, but not necessarily together

    I found this works: /^(?=(?:.*[\d].*){3,}).*$/ I can change the 3 to whatever number I want, and seems to match appropriately.
  13. sKunKbad

    Require digits, but not necessarily together

    Well, what I was trying to achieve is a config file that has a bunch of rules that are used to dynamically create regex for the validation of password strength, and turning this off completely would be an option. I only got this idea because I've been watching some videos on regex. Even though I've been tinkering with regex for years, it's just not something I'm good at. So, while looking at the existing regex I've been using for password strength, I wondered how I would force somebody to have more than one digit, say 2 or 3 or 50. It was just a thought.
  14. I'm playing around with some regex that is used for password strength, and right not it ensures that there is at least one digit: /^(?=.*\d).*$/ This works great, but I was thinking what if I wanted to say that more than 1 digit was required, so I tried this: /^(?=.*\d{2,}).*$/ This works only if the two digits are next to each other: exam22ple // match exam2pl2e // does not match So, what I'd like to know is how to match when the digits are not next to each other.
  15. sKunKbad

    Software to read thoughts and convert to type

    Yeah, I don't think I'd want to dictate for code, but if I could just think it and it was typed, dang that would be awesome.

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.