Jump to content

Pedro999

New Members
  • Posts

    5
  • Joined

  • Last visited

Pedro999's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Absolutely, and seriously.
  2. I am very new to PHP myself and have noticed how fiddly it can be. At the moment, get things working by keeping things simple. For example, in the first page, index.php, do: <?php if (!isset($_SESSION['Login'])) { Log_Visitor(); $_SESSION['Login']="No"; $_SESSION['MemberID']=0; $_SESSION['Name']=""; $_SESSION['AccessLevel']=0; } ?> When a person logs in, the parameters above are set appropriately. Don't know if this helps.
  3. Done various searches to find out out to get the screen width. Need to do this to set the width and scrollable height of a table. Mostly, people talk about using javascript to set a cookie. Am I on to a loser here? Occurs that the user may not have cookies set. Also, in my implementation of apache/google chrome get an access error when trying to do (code example from the web): <head> <? if(isset($_COOKIE['screenresolution'])) { //cookie found! $screenres = $_COOKIE['screenresolution']; } else { //cookie is not found, so set it with JavaScript ?> <script language="javascript"> <!-- writeCookie(); function writeCookie() { var enddate = new Date("December 31, 2060"); document.cookie = "screenresolution="+ screen.width +"x"+ screen.height + ";expires=" + enddate.toGMTString(); window.location.replace("<?= $_SERVER['PHP_SELF'] .'?'.$_SERVER['QUERY_STRING'] ?>"); } //--> </script> <? } ?> </head> Access forbidden!You don't have permission to access the requested object. It is either read-protected or not readable by the server. If you think this is a server error, please contact the webmaster. Error 403
  4. Hi Muddy, have not tested fully, but what you have suggested appears to be working and has solved the problem. Thank you. Before, instead of using isset(), I was using empty(). The subtleties of PHP, and the ignorance of the newby, I guess! Cheers Pedro
  5. Hi, Just joined the forum. Am new to PHP. Been reading the books,etc, and written a simple program. On the index page I do Start_Session() at the top. I then call a function to log a new visitor by adding a record in a MySQL table. Also call a function to display the visitor number. One the hyperlinks on index.php allows a user to login. If successful various $_SESSION[ ] variables are set. The user is then taken back to the index.php uisng the header statement. The $_SESSION[ ] variables are set ok and are visible in index.php. The question I have, is this. When the user is sent back to index.php, the Add_New_Visitor and Display_Visitor_No functions get called again. How do I stop this? This also happens if the header function is not used and the user is allowed to navigate back to index.php using the browser back arrow key. Thought of doing something like: <? session_start() if ($_SESSION['login']!='Yes') { Add_Visitor(); etc } Is there something easy I should be doing here and something fundamental I am not appreciating? Another question occurs is how do I code a logout? Pedro
×
×
  • 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.