Jump to content

DeanWhitehouse

Members
  • Posts

    2,527
  • Joined

  • Last visited

Posts posted by DeanWhitehouse

  1. I have this code for the time and date

    echo gmdate('l jS \of F Y h:i:s A');
    

    But i am unsure how to add different time zone and daylight saving.

    I also want this data to be saved in a mysql database.

    i believe the code to apply daylight saving time is a capital I but i don't no where to insert the code

  2. edit to my previous post

    so do i not need a code to check for the session?

    Edit: Also can you help with this, i want the index page to redirect to whatever the user specified page is.

    <?php
    require_once 'main.inc.php';
    header('Location: '$home_page'');
    ?>

    but it is being read as '$home_page' as the page i want, not what is entered into the varaible

    main.inc.php

    <?php
    $home_page = "install/install.php";
    ?>

    Edit: Also can you help with this, i want the index page to redirect to whatever the user specified page is.

    <?php
    require_once 'main.inc.php';
    header('Location: '$home_page'');
    ?>

    this kinda works but i get this error:

     

    Warning: Division by zero in /home/www/deanwhitehouse.awardspace.co.uk/main.inc.php on line 2

     

    Warning: Cannot modify header information - headers already sent by (output started at /home/www/deanwhitehouse.awardspace.co.uk/main.inc.php:2) in /home/www/deanwhitehouse.awardspace.co.uk/index.php on line 3

  3. so do i not need a code to check for the session?

    Edit: Also can you help with this, i want the index page to redirect to whatever the user specified page is.

    <?php
    require_once 'main.inc.php';
    header('Location: '$home_page'');
    ?>

    but it is being read as '$home_page' as the page i want, not what is entered into the varaible

    main.inc.php

    <?php
    $home_page = "install/install.php";
    ?>

  4. As you might be able to tell, i am fairly new to PHP, please can you go into more details on how to do this.

    My other idea was to use the user ID as a way to determine it, because the admin will always be ID 1.

     

  5. i thought that was a problem, but if i do

    <?php
    $login_check = mysql_num_rows(mysql_query("SELECT * FROM `$user` WHERE user_name='$user_name' AND user_password='$userPswd' AND userlevel='1'" ));
    ?>

    this will only check it for admin or if i do

    <?php
    $admin == 1;
    $user == 2;
    $login_check = mysql_num_rows(mysql_query("SELECT * FROM `$user` WHERE user_name='$user_name' AND user_password='$userPswd'" userlevel='$admin'));
    $login_check = mysql_num_rows(mysql_query("SELECT * FROM `$user` WHERE user_name='$user_name' AND user_password='$userPswd'" userlevel='$user'));
    ?>

    the

    $login_check == 1 

    will not work, as there is more than one user, but only one main admin

     

  6. I have begun writing a PHP website template system, and have hit a problem

    <?php
    
    include '../includes/db_connect.php';
    include '../includes/config_table.inc.php';
    
    
    $user_name = $_POST["user_name"];        
    $user_password = $_POST["user_password"];    
    
    if ($user_name && $user_password)        
    {
    
    $salt = substr($user_password, 0, 2);
    $userPswd = crypt($user_password, $salt);
    $login_check = mysql_num_rows(mysql_query("SELECT * FROM `$user` WHERE user_name='$user_name' AND user_password='$userPswd'" ));
    $check_ad = mysql_query("SELECT * FROM `$user` WHERE userlevel=0");
        $check_us = mysql_query("SELECT * FROM `$user` WHERE userlevel=1");
    
    //echo("DEBUG:\r\n");
    //echo("login_check:".$login_check."\r\n"."check_ad:".$check_ad."\r\n"."check_us:".$check_us."\r\n\r\n");
    
        if ($login_check == 1 && $check_ad) {
    
    echo "Logged In Sucessfully. Please wait while you are redirected";    
    echo "<meta http-equiv='refresh' content='2; url=setadmincookie.php?u=$username&p=$user_password'>";
    
        } elseif ($login_check == 1 && $check_us) {    
        
    echo "Logged In Sucessfully. Please wait while you are redirected";    
    echo "<meta http-equiv='refresh' content='2; url=setcookie.php?u=$username&p=$user_password'>";
    
        } else {
    
    echo 'Login failed. Username and Password did not match database entries.';    
    
        }
    }
    
    else    
    {
        echo "Form was not completed. Please go back and make sure that the form was fully completed.";    
    }
    
    
    mysql_close();
    ?>
    

    this code is ment to check the userlevel against the database and send them to one place or another depending on there level.

    How ever is isn't working, it is always sending to the admin area, and not the user area.

    i have two accounts made on the site, one user and one admin. Admin has userlevel 1, user has userlevel 2.

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