Jump to content

NoSalt

Members
  • Posts

    77
  • Joined

  • Last visited

Everything posted by NoSalt

  1. Xaotique ... I'm not sure what you mean by "span.logout a:visited there" cutielou222 ... Yes, the html is correct, thank you.
  2. Hello All Could I get a little help with this CSS? In my stylesheet I have my anchor colors defined: a:link {} a:visited {} a:hover {} Later on in the stylesheet, I have some anchors that are within a span defined: span.logout {} span.logout a:link, a:visited {} span.logout a:hover {} The only thing is, my anchor colors in the logout div are overriding my primary anchor colors. I am confused as to why this is happening. I thought only the anchors within the "logout" span would be affected by this CSS. Anyway, if anybody could help out with this, I would appreciate it. Also, am I using the term "CSS subclass" correctly? Thanks for taking the time to read, and have a great day.
  3. Thank you for the critique, I appreciate it. I will look into implementing the changes you suggested. FYI, there is a navigation menu that shows up at the bottom of every page. Have a great day
  4. Sorry, that username is bad. Try this: username: test@quickgiftlist.com password: password I apologize for the inconvenience.
  5. username: testUser@host.tld password: password
  6. No test account, but accounts are quick and free to set up. All you need is an email address and password.
  7. Hello All I have been working on a gift registry site for quite a while now. I have it up and running and I would appreciate feedback. The URL is: http://www.quickgiftlist.com/ Thank you in advance for taking the time to check it out. Have a great day.
  8. Very cool, thank you. And, thank you to all who took the time to read and reply. Now I can sit back and wait for my hair to grow back in.
  9. So, now that I have a handle on that, what does everybody recommend to check if a variable has a value associated to it in a GET or POST?
  10. So, what you're telling me is that just the existence of the myVar variable means that it is "set", even if it is empty?
  11. But ... I thought if you attempted to GET or POST something that wasn't there, then isset would always evaluate to false. Is this not correct? When you look at the address bar, you will see "index.php?myVar=". How can isset evaluate to true if there is nothing to GET???
  12. Hello All I am not an expert PHP developer, but I thought I had a pretty good handle on the language. That is until I was goofing off yesterday, playing around with isset. All of a sudden, I feel like I have lost my mind. I will get straight to the point. Why does this display the message "THE VARIABLE WAS FOUND!" when no input is submitted? <html> <head> <title> form test </title> </head> <body> <div> <form action="" method="GET"> <table> <tr><td>enter myVar: </td><td><input type="text" name="myVar" id="myVar"></td></tr> <tr><td><button type="submit">submit</button></td><td><button type="reset">reset</button></td></tr> </table> </form> <?php if(isset($_GET['myVar'])){ print("]" . $_GET['myVar'] . "[<br>"); print("THE VARIABLE WAS FOUND!"); } ?> </div> </body> </html> If you were to click the submit button without putting anything into the myVar field, the message will still show up, but it shouldn't. If you submit an empty field there is nothing sent to the "next page", so to speak. If nothing is sent, then the isset should evaluate to false because there is no myVar to "GET", therefore the message should not be displayed. But, as you can see, the message is displayed whether or not you enter anything into the field. I have many sites that use isset that appear to be working as expected, so you can understand why this is driving me crazy. Would any of you nice people please explain to me why this is "working" when it shouldn't? Thanks for reading, and have a nice day.
  13. PFMaBiSmAd ... thanks for reading and replying. I will look into adding some error checking to the site to correct for this. Although, I am suspicious as the site gets, maybe, one or two visitors a day, and mostly from bots. The reason I don't use a db is because this is a "play" site and I am not sure if I will even keep it after my years registration is up. Thanks again.
  14. Hello All I wrote a tiny piece of cookie code (to set and record cookies and hits) that works pretty well but seems to have a bug in it that I cannot figure out. First, here is the code: <?php $my_cookie = (isset($_COOKIE['my_cookie'])) ? true : false; $countFile = "./data/count.txt"; $cookieFile = "./data/cookie.txt"; $dateTime = date('Y-m-d\,H:i:s\,U\,T\,O\G\M\T'); $remoteIPAddress .= $_SERVER['REMOTE_ADDR']; $remoteUserAgent .= $_SERVER['HTTP_USER_AGENT']; $cookieVal = $dateTime; $cookieVal .= ","; $cookieVal .= $remoteIPAddress; $cookieVal .= ","; $cookieVal .= $remoteUserAgent; $cookieVal .= "\r\n"; if(!$my_cookie){ // read the visit counter $countHandle = fopen($countFile, 'r'); $visitCount = intval(trim(@fread($countHandle, filesize($countFile)))); fclose($countHandle); // incremenet the visit counter $visitCount++; // write the new visit count and cookie value to their respective files $countHandle = fopen($countFile, 'w'); $cookieHandle = fopen($cookieFile, "a+b"); if(!preg_match('/bot/',$remoteUserAgent)){ fwrite($countHandle, $visitCount); fwrite($cookieHandle, $cookieVal); } fclose($countHandle); fclose($cookieHandle); setcookie("my_cookie", $cookieVal, time()+31556926); } else{ // read the visit counter $countHandle = fopen($countFile, 'r'); $visitCount = fread($countHandle, filesize($countFile)); fclose($countHandle); } ?> What is happening is that sometimes, not every time, but, sometimes my cookie.txt count gets a 0 (zero) written back to it and I can't figure out why. Can anybody see anything in there that would have this effect? Like I said, it only gets zeroed out from time to time. Thanks to all for taking the time to read.
  15. Hello All I am working on a page that has data elements. I want the users to be able to hover over each data element and have a box pop-up/appear/materialize with more information for each element. I, obviously, don't want to use the Javascript "alert" function so I am looking for something very simple yet elegant for this. I have seen what I want out there on the net but I am not sure how they implement it. I thought I could use Javascript or CSS to change a box's visibility when hovered over, but I would like the box to be near the original, hovered over, element and I don't really know how to go about repositioning this box for each element. Like I said, I am hoping to find something simple so that I may learn and expand on the code. Does anybody have any good ideas? Thanks for reading and have a great day.
  16. Hello All I am working on an AJAX script but am having difficulties. First, here is the script: var xmlHttp; function GetXmlHttpObject(){ var objXMLHttp=null if (window.XMLHttpRequest){ objXMLHttp=new XMLHttpRequest() } else if (window.ActiveXObject){ objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") } return objXMLHttp } function retrieveData(){ var jBossServer = new Array(); jBossServer[0] = "d01"; jBossServer[1] = "d02"; jBossServer[2] = "p01"; jBossServer[3] = "p02"; for(var i=0; i<jBossServer.length; i++){ xmlHttp = GetXmlHttpObject(); if (xmlHttp == null){ alert ("Something weird happened ..."); return; } var url="./retrieveData.php"; url = url + "?jBossID=" + jBossServer[i]; url = url + "&sid=" + Math.random(); xmlHttp.open("GET",url,true); xmlHttp.onreadystatechange = updateMemory; xmlHttp.send(null); } } function updateMemory(){ if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete"){ aggregateArray = new Array(); aggregateArray = xmlHttp.responseText.split(','); for(var i=0; i<aggregateArray.length; i++){ alert(aggregateArray[i]); } return; } } The "retrieveData.php" page will return data that looks like this: d01,1 MB,2 MB,3 MB They relate to my 4 servers d01, d02, p01, and p02 (dev and prod). I want to save code so I attempted to put the AJAX xmlHttp call into a loop, but I don't think it is working. All I ever get back is the information for "p02" four times. Am I able to do what I want or do I need four different functions for each server (i.e., xmlHttpServer01, xmlHttpServer02, xmlHttpServer03, xmlHttpServer04)? Thank you all for reading, have a good day.
  17. I have an update to my update. Apparently using the "getcwd()" function is NOT a good idea. It did set different SIDs per application, but they also changed every time I refreshed the pages. So, I tested it with static paths and it set different SIDs that were stable for the life of the session and each refresh. Here is what I did: $my_session_path = "/var/www/html/sessionsTest/[directory name] premiso ... to answer your post. Download my test files and remove the "session_set_cookie_params" instance from the index.php files, put the "sessionsTest" folder in your www directory and see what happens. Get back to me if I am doing anything incorrectly. Thanks for reading and replying.
  18. After doing some testing I have discovered that if you set the "session path" variable to a unique directory for each application, then the SIDs will be different. For example, if I have: /var/www/html/myAwesomeApp01 /var/www/html/myAwesomeApp02 /var/www/html/myAwesomeApp03 Both of the following methods will produce unique SIDs for each application: session_name('myAwesomeApp01') or $my_session_path = [some path] session_set_cookie_params(0,$my_session_path); To set the $my_session_path variable I used the "getcwd()" funciton. $my_session_path = getcwd(); Does anybody else do it similarly? Are there any more fancy or approved ways of doing this? I'll attach my working files in case you want to see what I was doing. Thanks for reading. [attachment deleted by admin]
  19. You say that I don't require "session_name()" but when I have multiple web applications that I have written running on the same server in the same "/var/www/html" web directory (but in different sub-folders), I seem to get overlapping SIDs, variables, and actions unless I use the "session_name()". Is there something else that I could be overlooking? Thanks for reading and replying.
  20. I'm not sure if I understand exactly what you want, but I'll give an answer a try. If you are doing something from a form "submit", you should direct the user to some "process.php" page - that does not render any HTML - to do what you want (e.g., db update, etc.) and, depending on the success/failure of the process, direct them to another page using: header("Location: ./{1,2,3}.php"); exit; I don't know if this is what you need but I hope it helps.
  21. Hello All I have two questions regarding PHP Sessions that I need some information on. First, is at the top of every page (execpt includes) I have the following two lines: session_name('<some name>'); session_start(); However, when I look at other's code, it doesn't appear to me that they do the same thing. I have found that if I do not have those two lines at the top of every page, the session variables aren't available on those pages. By the way, I use the "session_name" because I was having overlapping session issues when running multiple PHP applications on the same server. Sometimes one user on one application could log out another user on another application and so forth. Am I doing something wrong or am I doing it correctly? Second, I have an application where there are user accounts. They log in, do some stuff, and then they "can" log out. I would like to track the users "logged in" status but I am finding that difficult. I have a "lastLoggedIn" column in the MySQL table as well as a "loggedIn" flag. These can easily be set and unset when a user actually logs in or out, but I am not sure how to handle this if the user stays logged in and their session simply expires. Then, they are logged out but not in a way where I can use their log-out process to make annotations in the db. Any advice? Thank you all for reading and have a good day.
  22. You are correct ... I came here to post that my initial finding didn't work after all. Yours works absolutely perfectly. Thank you very much for recognizing my incorrectness and rectifying the situation. Next time I'll know not to be so hasty with my "conclusions". Have a great day.
  23. Nevermind ... I got it after some more fooling around. Here is the answer: SELECT * FROM EVENT_TABLE where EVENT_TYPE_ID = 1 || 2 || 3 || 6 || 10 || 11 || 13 || 15 || 16 || 34;
×
×
  • 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.