Jump to content

garyed

Members
  • Posts

    143
  • Joined

  • Last visited

Everything posted by garyed

  1. It's a calculation program that defaults to about 50 inputs but if the user chooses, it can go up to 1,000 inputs.
  2. That seems like a great idea. I wish I had done that before building my site. I've can have as much as 1,000 variables on one page so it's going to be a lot of work no matter what I do now. Thanks again for the ideas
  3. I've tried these two options & they seem to work OK. The null option works better if I'm using the variable for any mathematical calculations. Is there anything wrong with declaring all variables that might be used in a form with the null fallback value as I did below? $var=$_POST['var']; ?? ''; $var=$_POST['var']; ?? null;
  4. "Now I see", says the blind man Thanks for the explanation. Now it looks like the only problem I'll have to be careful about is not having this type of universal fix to affect my sessions too.
  5. I really appreciate the ideas but I have to admit that I don't understand the examples. I have no idea what the : ?? 'Guest'; does or even means. I am actually learning as I'm going, sort of on an as needed basis. Things that may seem obvious to the experienced programmer, are not obvious to me. I'm going to do a little testing with some of this stuff & see if i can make it work.
  6. On pages where there are only a few variables I've tried : if (!isset($_POST['var1'])) { $var1=""; } else { $var1=$_POST['var1']; } That works but I don't want to have to do that with every variable.
  7. I have a lot form variables where I'm having the errors show up since I updated my php version on my webhost server. Since I have well over 100 variables, it's going to take a lot of time to correct them so i just disabled errors for now in the php.ini file to keep things working. I was wondering that since form variables are in kept an array, if there isn't an easy way to have them all initiated when the page loads. I think that would solve the majority of the errors & there wouldn't be that many left. Any ideas appreciated?
  8. Update, I decided to uninstall my LAMP server & reinstall it to see if that would fix anything & sure enough, it did. I'm not sure what happened to only effect two directories but they are working fine since I reinstalled Apache. Anyways, thanks for all the ideas.
  9. I think I'm going to take your advice & close down port 80 until I can figure out what is going on. I wanted to be able to remotely access my work & I've also been tinkering with the idea of hosting my own website so I've been playing around with this for quite a while. My port has been open for a few years & I've never had any problem until now. It all started when I forwarded one of my domain names to my computer as an experiment about a week or two ago. I used a php password protected index page with a mysql database to see if I had any visitors. When I realized it wasn't a good idea, I got rid of the domain name thing but I was still getting visitors. Then I added the .htaccess file with a password. I'm not sure exactly when my directories started having the problem but I'm sure it wasn't until after I forwarded my domain name. It might have started when I added the .htaccess file & changed some configuration files but I can't be sure. If my whole site was down then I would think it would have to do with something I did, but having just two directories down doesn't make sense.
  10. Did you get to the login page? If you did, did you get to any of the site at all?
  11. Yes, I have quite a few different web sites & each site has its own directory. I use my Apache server to design the pages & test them before i upload them to my web host. So I can either just go to localhost from my browser or type in my ip address to view all my sites & pages. There's only two sites & pages on two separate directories along with their sub directories that I get the error & all the other sites & pages in about 40 other directories work fine. The path is fine & that's why i'm wondering if I've been attacked. I'm running Apache on Ubuntu Linux.
  12. I assume Apache has to be running because 90% of my server site is working & it's only two directories that I'm having the problem with. I created a new directory & copied the index file & the background image from one of the directories that wasn't working into it & it works OK except the background image doesn't work. If I type the url of the image file I get the same error but if I put another image file I don't get the error. It's like something has happened to some of the files in those two directories. I'm at a complete loss.
  13. For a couple days I experimented with hosting my own site by routing a domain name to my computer. I didn't really want any outside traffic but i found i was getting a few visitors & i didn't have confidence in my password security. So i decided to unlink the domain name so at least someone would have to use my ip address to get to my site. I found that I was still getting a few visitors each day so I decided to use a password through .htaccess which was on of the suggestions I got from another thread. Everything seemed to be working fine & as far as I could tell no more visitors were getting in to my site. Now I find that two of my directories will not work through either browser, Chrome or Firefox. When I go to localhost to work on my site & to those two directories I just get: " This site can’t be reached localhost refused to connect. Try: Checking the connection Checking the proxy and the firewall ERR_CONNECTION_REFUSED " I've checked permissions & can't find anything different than my other directories that do work. All my files are still there so I'm a little confused. I have plenty of other directories on my site still working. I have messed with some configuration files to get .htaccess password to work but I can't even remember what I did. I tried removing the .htaccess file but that didn't help either. Any ides?
  14. By doing the RewriteRule would that mean if I have any file in the root directory let's say called jimbo.php & someone typed in http://myipaddress/jimbo.php it would redirect them to index.php?
  15. Thanks, If I understand you right, it could either be done through the .htaccess file or else I would have to edit every page to look for the correct session variable that is passed from index.php when the correct password is entered. Assuming that is correct then .htaccess would be a better idea assuming it is reasonably secure. I don't do much other than surfing the web & doing my site on my server but I still don't like the idea of it being insecure.
  16. I'm not sure if this is a php or Apache question but here goes anyways. I have my Apache web server set up so I can access it from anywhere which obviously means anyone else can access it too. I have my index page which is basically a menu for the site password protected with a simple php script. The problem is the index.php password page can be bypassed by just typing the name or path of any of the pages on the site. I don't want to have to password protect or enter a session variable onto every page. Is there a practical way to make it where no page can be accessed without being routed from the index.php page ?
  17. If anyone is using Chromium broswer I'd be curious if they tried that code & see what happened. That code that I posted is the whole html file & nothing else. I made that simple html file just to test the onchange & alert functions together to see why they wouldn't work on my website. In Firefox it works as expected but in Chrome it crashes my browser & freezes my mouse & I have go to the terminal to close the program down. I should have been more specific because it doesn't crash until you actually change from one option to the other. Then the alert pops up on the screen & that's when everything locks up. After spending most of the day on it I finally found a solution. There have evidently been some conflicts with Chrome & the alert & confirm javascript functions & the only thing that worked for me was to use the setTimeout function. After adding that, everything works in Chrome. It's possible it's just the particular Linux version of Chrome that I am using. This works now: <html> <head> </head> <body> <select name="testify" onchange="setTimeout(function(){ alert('something'); })"> <option value=1> one </option> <option value=2> two </option> </select> </body> </html>
  18. When using javascript onchange with an alert function chrome freezes up. I've tried the same code in Firefox & it works fine so I'm wondering if it is a bug or I need to do something different in Chrome. This code couldn't be any simpler & it locks up my browser & freezes my mouse. I'm running Chrome in Ubuntu Linux 18.04. The same happens if I try a confirm function with onchange but both confirm & alert work as long as they are not used with the onchange function. <html> <head> </head> <body> <select name="testify" onchange="alert('something');"> <option value=1> one </option> <option value=2> two </option> </select> </body> </html>
  19. I must apologize because I finally got it. I didn't realize that i could add to the variable you showed me in the brackets. I just used: for (i=2;i<5;i++) { var key='t'+i; document.tester[key+'_home'].value=''; document.tester[key+'_wall'].value=''; /// etc.. } & it works. Thanks again
  20. I do appreciate the help but I still don't think i'm making myself clear. I've tried using the way you showed me with the key variable but in order to make that work i would need 60 different variables. What I need to do is use just a number for the variable so i can run it through a loop without the text. I can't run the way you showed me through a loop because i have to change not just the number inside the key variable but the text inside the variable also. That is why I'm trying to find a way to just add a number variable that can fit into the command line string..
  21. That's what I don't know how to do in javascript. I know how to add a variable to a command in php but not javascript. In other words var x=3; document.house.t+x+_home.value="9"; doesn't work. How can i fit that variable "x" into that command to get it to work the same as: document.house.t3_home. value="9"; ? If I can do that then I can figure out the rest of what I want to do.
  22. Thanks for the help, That would work if "home" stayed the same but it changes too. I really didn't give a good example of what I was trying to do because the 3 does need to change but I have a bunch of different values than .."home" also. I already have about 60 different fields that I've already set up in a script to get the value I want but only for "t3_home.. t3_wall.. t3_window.. etc... " . So what I'm trying to do is just put a variable in just where the "3" is so i can run it through a for loop to get t2.. t3.. t4.. etc.
  23. Is there a simple way to use a javascript variable as part of the actual command? I have : var x=3; & I want my command to be: document.freeone.t3_home.value="close"; x is going to change from 1 to 100 so I want to substitute the variable instead of using the actual number 3 in my example. Any ideas?
  24. I just wanted you guys to know i came up with a pretty simple solution for most of the errors. It may not be right but it works pretty good. It just converts all the empty spaces to zero. I couldn't check for just numbers because there are too many hidden values that are posted that are not numbers so I just checked for empty fields. foreach($_POST as $key => $value) { if ($value=="") { $_POST[$key]=0; } } I needed to add a few more if statements to get rid of division by zero errors & everything seems to be working OK & all the errors are now gone.
  25. Thanks for the ideas, I'll look into them & see if it would be more practical than what i was doing to get rid of the errors. I started thinking that even though everything is working fine now, that down the road when my web host changes to another version of PHP or anything in their settings that I have no control over, those errors could come back & bite me. So I think you guys are right that I should take the time to clean the code up now & not just leave it alone because it's working. I'm in the HVAC business & a lot of times you can get something working temporarily even though it's not right. If you don't go back with the right part or whatever it takes to get it right then down the road it causes a problem. I'm starting to look at my php code the same way, that it needs to be error free or it can hurt you in the future. Thanks again to everyone for the advice
×
×
  • 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.