Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About chadrt

  • Rank
    Not So Advanced Member
  • Birthday 12/11/1978

Profile Information

  • Gender
  • Location
    Spokane Valley, WA
  • Age
  1. chadrt

    PHP Login System?

    So I have been scouring the web (google searches galore) looking for a simple PHP based login system that isn't going to be hacked 1.6 seconds from time of upload. I have found a TON of them but alas they all rely on the deprecated mysql_ grrrrr. If anyone has any ideas of places to go look I would love to know where!! I don't need anything fancy or for users to self signup either.
  2. chadrt

    Drop down with pay periods...

    So paydays are always every other Friday with one week as a lag behind as decided by management I suppose. A week always ends on a Friday the bookkeeper then has a full week to have all the commission sheets in and accounted for so that she can process payroll. Next payday would be from Sept 2nd 2017 to September 15th 2017 and the following Friday would be payday again which would be the 22nd of September and it would be for the previous pay period (9/2/17 to 9/15/17). So I created a simple database that holds all my commissions that we keep track of then I output a page that looks just like the hand written sheets we have to turn in. Only for me since I tend to hate pen and paper I can just select a pay period and click a button to display the sheet. I have a very simple with 6 fields that I fill out for each commission that I access on my smart phone. This keeps me happy with something electronic and management happy cause they get to see it in the same format they are used to (only they don't have to decipher handwriting).
  3. chadrt

    Drop down with pay periods...

    As an example: Aug 19th - Aug 25th is a pay week Aug 26th - Sep 1st is a pay week Those two weeks are a pay period then Friday September 8th is Payday (tomorrow im getting excited for payday btw LOL) Hopefully that was basically what you meant by rules?
  4. So I would like to do a drop down menu with 4 pay periods this drop down would include the current pay period and 3 previous pay periods. I can calculate dates within a range of days but I need a static starting point so that all the "pay periods" within are always based on that. Any hints or tricks on doing this? I usually like to post some code usually to show I am trying but I am at a total loss!!
  5. chadrt

    Execute shell script in PHP

    That is freaking awesome! So I own the box its in my house as my little playground with one of my static ip's. I am not worried anyone else on the box with abilities. With that being said I have tried changing the directory ownership to www-data:www-data and 777 on the script, that does not work I only get this: OK so I was using absolutes everywhere except the file output location in my shell script. Now that I have that out of the way I can go hang my head in a corner Everything is working as expected!!
  6. chadrt

    Execute shell script in PHP

    That gave me the answer I needed. Apache has no permission to write there so even though I applied 777 permissions to the script when run by apache it cant write the resulting file to the directory it resides in. I have had nothing but terrible luck with the whole permissions for my user webserver and apache running as www-data. I have followed several tutorials in this topic all to no avail. Nothing seems to give apache the rights to make files in the system. Short of 777 the entire box lol (NO I WILL NOT DO THAT!) I am at a loss. Thank you for your assistance!!! Funny how all I have done is "hack" many scripts together over the years and I am still a total noob and yet the forum calls me an "Advanced Member"
  7. OK I am banging my head here and it hurts... I am trying to execute a shell script that I wrote and it is being a PITA <?php // for future use $end = $_REQUEST['end']; $start = $_REQUEST['start']; // This DOES NOT WORK - pdfit.sh has temporary permissions 777 $output = shell_exec('/home/webserver/mysite/public_html/commissions/wkhtmltox/bin/pdfit.sh'); echo "<pre>$output</pre>"; // This WORKS GREAT $output = shell_exec('ln -a'); echo "<pre>$output</pre>"; ?> So I know I am able to use shell_exec as in the second example shown, the pdfit.sh script works great from the CL so I am at a total loss. Chad
  8. chadrt

    php function() help...

    Ok so I have taken your advise to heart! My systems that I have been working on building for myself I have completely reworked, used prepared statements, specified column names when I didn't need every row and have a very functional system. I am running php7.0 and all my sites now use that as a standard and I have even removed php5 from the system. I do have to say it was a bit of a learning curve but thanks to your push in the right direction I am now up to date and from all that I have read a lot more secure too. Funny thing I have a page that was being hacked so often that I took down the site and I am willing to bet all because of one query box that used to retrieve callsign data for amateur radios operators. I may even resurrect that system now that I have a clue what was causing the hacking.
  9. chadrt

    A PHP if () between two numbers

    oh my brain hurts now, us amateurs should be banned from any kind of code if (($coumadinEntry->inr >= 2) && ($coumadinEntry->inr <= 3)) { $coumadinINR = $coumadinEntry->inr." It's Good"; } elseif(is_null($coumadinEntry->inr)){ $coumadinINR = ""; } elseif($coumadinEntry->inr < 2){ $coumadinINR = $coumadinEntry->inr." It's Low"; } elseif($coumadinEntry->inr > 3){ $coumadinINR = $coumadinEntry->inr." It's High"; }else{} But alas its done and it works...
  10. chadrt

    A PHP if () between two numbers

    if (($coumadinEntry->inr >= 2) && ($coumadinEntry->inr <= 3)) { $coumadinINR = $coumadinEntry->inr." It's Good"; }elseif($coumadinEntry->inr < 2){ $coumadinINR = $coumadinEntry->inr." It's Low"; }elseif($coumadinEntry->inr > 3){ $coumadinINR = $coumadinEntry->inr." It's High"; }else{ $coumadinINR = ""; } Ok so there is my hundredth attempt at this. I know why its failing but I don't how to correct for it. At this point because NULL is less than 2 it assumes that this is true and displays the "It's Low" with no value. I thought this was the answer but I am missing something. I if (($coumadinEntry->inr >= 2) && ($coumadinEntry->inr <= 3)) { $coumadinINR = $coumadinEntry->inr." It's Good"; }elseif($coumadinEntry->inr < 2) && ($coumadinEntry->inr != ''){ $coumadinINR = $coumadinEntry->inr." It's Low"; }elseif($coumadinEntry->inr > 3){ $coumadinINR = $coumadinEntry->inr." It's High"; }else{ $coumadinINR = ""; } I think I am on the right track but its kicking me still... if (($coumadinEntry->inr >= 2) && ($coumadinEntry->inr <= 3)) { $coumadinINR = $coumadinEntry->inr." It's Good"; }elseif(is_null($coumadinEntry->inr)){ coumadinINR = ""; }elseif($coumadinEntry->inr < 2){ $coumadinINR = $coumadinEntry->inr." It's Low"; }elseif($coumadinEntry->inr > 3){ $coumadinINR = $coumadinEntry->inr." It's High"; }else{};
  11. Ok here goes this little experiment... if (($coumadinEntry->inr >= 2) && ($coumadinEntry->inr <= 3)) { $coumadinINR = $coumadinEntry->inr." It's Good"; }else{ $coumadinINR = $coumadinEntry->inr." Adjustment Needed"; } this is located in a "foreach" building a table and although "It's Good" works reliably it now fills every box in that column with "Adjustment Needed" unless that column is between 2 and 3. What I am wanting to happen is: If between 2 and 3 it shows the level INR and "It's Good" If below 2 it will show something else (likely "actual reading and an icon of some sort on each side of the number) If above 3 it show something else (likely "actual reading and an icon of some sort on each side of the number) if empty or NULL then it will set $coumadinINR=""; so nothing is displayed
  12. Now that we have some tech details out of the way... I followed these instructions https://www.cyberciti.biz/faq/installing-php-7-on-debian-linux-8-jessie-wheezy-using-apt-get/ in order to get my php version from 5.6.3 up to the php7 everything appeared to be going great and when I went to load my website it was trying to download .php files. I checked the "webmin > Server > Apache Webserver > Global Configuration > MIME Types" page and changed the "application/x-httpd-php php" to "application/x-httpd-php7 php" that had no effect! Checked that a2enconf php7.0-fpm is loaded and it is. Checked that a2enmod proxy_fcgi is loaded and it is. Checked that a2enmod setenvif is loaded and it is I have restarted all processes associated with the apache2 and php no help. There are no .htaccess files in play that are conflicting PHP versions. So I am sure that I have missed something if anyone has any ideas I am all ears. Its a hobby server so I will keep the apache2 in a down state except to test so no one gets hold of any config files containing service passwords.
  13. chadrt

    php function() help...

    I followed a tutorial on changing out php5 for php7.0 and what do you know NOTHING works on my box at all. I had wordpress sites on there and I had a minecraft site that my daughter likes to play on and update the pages from time to time. Not even a simple phpinfo.php page will work, it tries to download it and show me the underlying code of the page. I will have to figure out where I went wrong there. But I will upgrade to php7.0 and I will take the time to read the info on using PDO. Thank you benanamen!
  14. chadrt

    php function() help...

    I am not a "coder" per se. Just because someone adds washer fluid or oil to their car does not make them a "mechanic". I dabble in code and every so often I get bored and I need to occupy my mind some, so I think of something I would like for myself and I just start doing it. I cobble things together from little resources I find on the net like tizag.com and from here in the forums. I have no formal training I just love tech and keeping my racing mind going. So PHP allows me to do some of that. There are times where I go a year before I look at the code again. So no I dont know what has been improved upon over the years or what is an absolute taboo in coding. I dont know what is considered "Dangerous" but I can learn. And no I cannot learn from the word vomit at php.net. But comments from folks like requinix those are super helpful and I can easily read thru his code to find out why he suggests a particular way. This makes me better at this hobby and is very constructive. Sorry I am not all great and powerful coder. The page I am building is a medication tracker that exists on a debian box on my local LAN it is in a protected directory .htaccess style and I am the only one that will ever see it. I wanted to make an app that would help me keep track of my Coumadin Therapy so I dont have another stroke in the middle of the night that nearly crippled me. I still keep it on a spreadsheet but I thought wow wouldnt this be cool if I could make it a web page and store it in a MySQL DB. So that is what I have done as well. I am the only one looking at it. Nope I didnt know but how about you tell me something or point me to a resource that has info like that, I have a feeling that if given a chance I would be able to learn something new.
  15. chadrt

    php function() help...

    PHP 5.6.30-0+deb8u1 (cli) (built: Feb 8 2017 08:50:21) Copyright © 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright © 1998-2016 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright © 1999-2016, by Zend Technologies mysql Ver 14.14 Distrib 5.5.54, for debian-linux-gnu (x86_64) using readline 6.3 When I first started out in PHP i would have these elaborate switch/case assemblies that would be super hard to follow so now I am wanting to make things cleaner and separate my coding a bit. Please forgive me because I get super confused when I am looking at php.net help pages all the foo and bar and I want to tear my hair out of my head. I have this... $result = mysql_query("SELECT * FROM $datatable") or die(mysql_error()); echo "<table border='1'>"; echo "<tr> <th>Date</th> <th>Dose</th> <th>INR</th> <th>Notes</th> <th>Script</th> <th>Action</th></tr>"; while($row = mysql_fetch_array( $result )) { echo "<tr> <td>"; echo $row['date']; echo "</td> <td>"; echo $row['dose']; echo " mg."; echo "</td> <td>"; echo $row['inr']; echo "</td> <td>"; echo $row['notes']; echo "</td> <td>"; echo $row['script']; echo "</td> <td>"; echo "Edit | Delete"; echo "</td></tr>"; } echo "</table>"; This works very nicely at the moment and I plan to clean it up and jazz it up some but once I enclose it in a function viewEntries() {code here} then all holy heck breaks loose when I use the viewEntries(); to call it. If I understand it correctly I need to have the functions defined before I try and CALL them up. So I had planned to create several functions then use them in a cleaner case/switch based on ?action=something from a $_GET['action'];

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.