Jump to content

floridaflatlander

Members
  • Posts

    671
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by floridaflatlander

  1. You didn't have a doc type on a page I looked at.

     

    If cost is an issue put the whole thing in a wrapper and center, change your hover color in your menu, on the white background it's hard to see and it really is old school but you need to design for your customers and not us.

     

    What is the customer expecting?

  2. I'm not sure I know what your doing.

     

    If this ..

     

    <?php

    include ("css/additionalcss.css");

    ?>

     

     

    Take out the php tags in your css and try it

     

    Opening and closing php tags should be <?php & ?>

     

    I don't know where you're at in your script as far as opening and closing php tags go.

     

    Play with it and see what happens

  3. I've been thinking that I needed to build a database to store sessions in. However, seeing a post in another topic got to pondering if I really need it now.

     

    My site is very small and as of now the login script makes the normal sessions variables, member id, display name, etc., and I've also thrown in http_user_agent.

     

    If sessions are destroyed by logging out or by closing the browser is a session database really needed?

     

    How much does site size matter? Say on a very small site (10-15 people a day, no money changing hands, just logging in and posting) or medium small site (50-100 people a day, no money ...) ?

     

    Thanks

  4. My register_globals settings are to on

     

    Do you have any code at all (logout) that clears $_SESSION['id_mem']? Where is that code at relative to what you have posted?

     

    A user has to click a logout link to logout or close the browser.

     

    Here is the logout code on the logout page

    <?php
    ...calls to connect to db
    ..call header
    // If no member id session variable exists, redirect the user:
    if (!isset($_SESSION['id_mem'])) {
    
    $url = "$home/index.php"; // Define the URL:
    ob_end_clean(); // Delete the buffer.
    header("Location: $url");
    exit(); // Quit the script.
    
    } else { // Log out the user.
    
    $_SESSION = array(); // Destroy the variables.
    session_destroy(); // Destroy the session itself.
    setcookie (session_name(), '', time()-300); // Destroy the cookie.
    
    }
    ?>
    

     

    it updates the database as expected? i mean if when you use $_SESSION['id_mem'] it returns the right value

     

    Yes, it updates the db and to play I added

     

    // Test to see id_mem value

    $id_mem = $_SESSION['id_mem'];

     

    header("Location: $home/member/index.php?user=$id_mem");

    exit(); // Quit the script.

     

    To see if $_SESSION['id_mem'] still had a value after the insert and it did, sending me to the correct user page /member/index.php?user=20

  5. ONE of my SESSION values isn't remaining after login while others do.

     

    This works fine on my localhost, it's on the live site that there is a problem and it just started yesterday. Before that it worked great.

     

    Out of the four SESSIONs made I can only echo three values on other pages, member id the most important doesn't transfered to other pages

     

    Notes: all these files are in the same folder, there is a SESSION started for the member id on the login page, you can see that it is used in the redirect below and the redirect works fine with the redirect going to the correct page " $home/member/index.php?user=$id_mem "

     

    Here is the login page

    // Here's the basic login page info
    <?php # login.php
    session_start();
    ob_start() 
    ...connect to db & header called...
    ...Form validation.....
    
    if ($e && $p) { // If everything's OK.
    	// Query the database:
    	$q = "SELECT id_mem, display_name, mem_group FROM sn_members WHERE (email='$e' AND password=SHA1('$p')) AND active IS NULL";		
    	$r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc));
    	//  or die("Error: ".mysqli_error($dbc));
    
    	if (@mysqli_num_rows($r) == 1) { // If a match was made.
    
    		// Register the values & redirect:
    		// Give SELECTED elements a session
    		$_SESSION = mysqli_fetch_array ($r, MYSQLI_ASSOC);
    		$_SESSION['agent'] = md5($_SERVER['HTTP_USER_AGENT']);
    		mysqli_free_result($r);
    
    		// Update db for last login
    		$id_mem = $_SESSION['id_mem']; // <<< SESSION member id has a value here because it's used in the redirect below
    		$ip = $_SERVER['REMOTE_ADDR']; // Get ip address of person logging in
    		$q = "UPDATE sn_members SET last_login = Now(), ip = '$ip' WHERE id_mem = '$id_mem' LIMIT 1";
    		$r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc));
    
    		header("Location: $home/member/index.php?user=$id_mem");
    		exit(); // Quit the script.
    
    	}
    ?>
    

     

    Here is the main page that a user would be redirect to above

    <?php // /member/ all member info is through this folder
    session_start();
    ob_start();
    
    if (isset($_GET['user']) && is_numeric($_GET['user'])) {
    $user = $_GET['user'];
    $user = $user;
    		if ($user < 0) {
    			header("Location: $home/index.php");
    			exit();
    			}
    }
    
    	if ((!isset($_SESSION['id_mem']))  && (!isset($_SESSION['agent']) OR ($_SESSION['agent'] != md5($_SERVER['HTTP_USER_AGENT'])))){
    	// If not a logged in member redirect
    		header("Location: $home/index.php");
    		exit(); // Quit the script.
    	}
    ?>
    

    Thanks in advance for the help

    SJ

  6. Well, when I make the window smaller it works for me in both ie 7&8. I see from firebug you have your body set to

     

    body {

        border: 0 solid #000000;

        margin: 0 auto;

        width: 800px;

    }

     

    The body is everthing in the monitor. You don't have any style for the class "topMenu" which most people name wrapper or allcontant.

     

    Play a little and use

     

    body {

        margin: 0;

        padding: 0;

    }

     

    .topMenu { /* AKA allcontent, AKA wrapper */

        border: 0 solid #000000;

        margin: 0 auto;

        width: 800px;

    }

     

    Also ck for different padding and margin settings between elements on different pages

  7. PHP_SELF is insecure. Use REQUEST_FILENAME instead.

     

    I just thought about that as my dinner was cooking. I use PHP_SELF on pages that don't need really need security(I hope), no login or out or entering or editing info etc.  I'm going to ck into REQUEST_FILENAME, thanks

  8. Like I said, I just need a generic way of determining if I am on the Home Page or any other page.

     

    I use

    // Start defining the URL...
    // URL is http:// plus the host name plus the current directory:
    $url = dirname($_SERVER['PHP_SELF']);
    // Remove any trailing slashes:
    $url = rtrim($url, '/\\');
    $file = basename($_SERVER['PHP_SELF']);
    $file = "/$file";
    $url = $url.$file;
    

     

    You can echo $url or $file or both and see what they give you on different pages

     

    I don't know what you want but I then use a switch function to determine the info page I needs

    //$folder = ''; when online <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    switch ($url) 
    {
    case "$folder/index.php":
    $page_title = 'Xyz';
    $h1 = 'Xyz';
    $h2 = 'xxx';
    $description = page description';
    $keywords = 'keywords';
    break;
    
    // Default is to include the main page.
    // Note no robots as default
    default:
    $page_title = 'Xyz';
    $h1 = 'Xyz';
    $h2 = 'xxx';
    $description = page description';
    $keywords = 'keywords';
    break;
    }
    

     

    I use this nto determine the folder

     

    if (stristr($_SERVER['HTTP_HOST'], 'local') || (substr($_SERVER['HTTP_HOST'], 0,7) == '127.0.0')) {

    $local = TRUE;

    $home = 'http://localhost/local-folder'; // No backslash, it's added in switch

    $folder = '/local-folder';

    $debug = TRUE;

    } else {

    $local = FALSE;

    $home = 'http://www.website.com';

    $folder = ''; //$folder = ''; when online

    }

     

     

    I throw the $home in links like <a href="<?php echo "$home"; ?>/index.php">Home</a> that way they work on my localhost & online

     

    $folder is used in the switch file

  9. With a little work it may work

     

    You have a lot of minor errors according to http://validator.w3.org/.

     

    Put your url in w3 and then look at your source html and find the problem in your php files.

     

    There is two mentions of open comment tags with no closing tags. There are escaping slashes in your JavaScript, meaning you used single quotes or something and then escaped the double quotes. Many are repeated errors, something wrong with your code not smarties .

     

    Get fire foxes fire bug and it will also help you find your problems.

     

    PS it will look d****n fine when your through

  10. I'm not sure what you're asking, you can use any column for the WHERE clause in the delete.

     

    I put my deletes in single quotes like WHERE user_id = '1' or something like WHERE user_id ='$user_id'

     

    Are you sure there is  a record WHERE user_id = 1 AND question_id = 7 AND answer_id = 3

     

    Why does your " AND `answer_id` " have quotes?

     

    Have you tried " or die("Error: ".mysqli_error($dbc)); " to see if there is a specific error.

     

    Also use LIMIT 1 if you're deleting just one row.

×
×
  • 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.