Jump to content

DeanWhitehouse

Members
  • Posts

    2,527
  • Joined

  • Last visited

Posts posted by DeanWhitehouse

  1. ok, so it is now working with this code,

    <?php
    require_once 'includes/header.php';
    require_once 'includes/db_connect.php';
    ?><div class="bg"></div>
    <div class="clock"><?php echo gmdate('l, jS F Y');?> <span id="txt"></span></div> 
    <div class="member">
    <?php
    if ($_SESSION['is_valid'] == true){
    if (isset($_GET['id'])) {
    if ((int) $_GET['id'] > 0) {
    $userid = $_GET['id'];
    $sql = "SELECT * FROM $user WHERE `user_id`='{$userid}' LIMIT 0,1;";
    $result = mysql_query($sql);
    $row = mysql_fetch_assoc($result);
    $userprofname = $row['user_name'];
    $profemail = $row['user_email'];
    echo "$userprofname<br>";
    $show_email = $row['show_email'];
    if (mysql_num_rows($result) < 1) {
         echo 'This ID does not exist in the database';
    }
    if ($show_email == 1)
    { 
    echo 'Email:<a href="mailto:'.$profemail.'">    Email Me</a>';
    }
    elseif ($show_email == 0)
    {
    echo "Email:   Hidden";
    }
    exit();
    }
    else {
    echo "Unknown User ID! <br />";
    echo "<a href=\"members.php\">Return to Members Page</a>";
    exit();
    }
    }
    //No ID passed to page, display user list:
    $query = "SELECT user_id, user_name FROM $user";
    $result = mysql_query($query) or die("Error:" . mysql_error());
    if (mysql_num_rows($result) > 0) {
    echo "User List:<br />";
    while ($row = mysql_fetch_assoc($result)) {
      echo '<a href="?id=' . $row['user_id'] . '">' . $row['user_name'] . '</a><br />';
    }
    }
    }
    else
    {
    echo "Please login to view this page.";
    }
    ?>
    </div>
    <?php
    mysql_close();
    require_once 'nav_bar.php';
    require_once 'includes/footer.php';
    ?>

     

    but it is still showing the Email: Hidden

  2. ok, i tried this , but it still does the same

     

    <?php
    require_once 'includes/header.php';
    require_once 'includes/db_connect.php';
    ?><div class="bg"></div>
    <div class="clock"><?php echo gmdate('l, jS F Y');?> <span id="txt"></span></div> 
    <div class="member">
    <?php
    if ($_SESSION['is_valid'] == true){
    if (isset($_GET['id'])) {
    if ((int) $_GET['id'] > 0) {
    $userid = $_GET['id'];
    $sql = "SELECT * FROM $user WHERE `user_id`='{$userid}' LIMIT 0,1;";
    $result = mysql_query($sql);
    $row = mysql_fetch_assoc($result);
    $userprofname = $row['user_name'];
    $profemail = $row['user_email'];
    echo "$userprofname<br>";
    $show_email = $row['show_email'];
    if ($show_email == 1)
    { 
    echo 'Email:<a href="mailto:'.$profemail.'">    Email Me</a>';
    }
    elseif ($show_email == 0)
    {
    echo "Email:   Hidden";
    }
    exit();
    }
    }
    //No ID passed to page, display user list:
    $query = "SELECT user_id, user_name FROM $user";
    $result = mysql_query($query) or die("Error:" . mysql_error());
    if (mysql_num_rows($result) < 1) {
         echo 'This ID does not exist in the database';
      echo "<a href=\"members.php\">Return to Members</a>";
    }if (mysql_num_rows($result) > 0) {
    echo "User List:<br />";
    while ($row = mysql_fetch_assoc($result)) {
      echo '<a href="?id=' . $row['user_id'] . '">' . $row['user_name'] . '</a><br />';
    }
    }
    }
    else
    {
    echo "Please login to view this page.";
    }
    ?>
    </div>
    <?php
    mysql_close();
    require_once 'nav_bar.php';
    require_once 'includes/footer.php';
    ?>

  3. i have this code for a members page,

    and when someone enters an invalid URL with an id that doesn't exist it should echo a message, but it doesn't work, it just says email: hidden.

     

     

    any ideas

     

    <?php
    if ($_SESSION['is_valid'] == true){
    if (isset($_GET['id'])) {
    if ((int) $_GET['id'] > 0) {
    $userid = $_GET['id'];
    $sql = "SELECT * FROM $user WHERE `user_id`='{$userid}' LIMIT 0,1;";
    $result = mysql_query($sql);
    $row = mysql_fetch_assoc($result);
    $userprofname = $row['user_name'];
    $profemail = $row['user_email'];
    echo "$userprofname<br>";
    $show_email = $row['show_email'];
    if ($show_email == 1)
    { 
    echo 'Email:<a href="mailto:'.$profemail.'">    Email Me</a>';
    }
    elseif ($show_email == 0)
    {
    echo "Email:   Hidden";
    }
    exit();
    }
    else {
    echo "Invalid user! <br />";
    echo "<a href=\"members.php\">Return to Members</a>";
    exit();
    }
    }
    //No ID passed to page, display user list:
    $query = "SELECT user_id, user_name FROM $user";
    $result = mysql_query($query) or die("Error:" . mysql_error());
    if (mysql_num_rows($result) > 0) {
    echo "User List:<br />";
    while ($row = mysql_fetch_assoc($result)) {
      echo '<a href="?id=' . $row['user_id'] . '">' . $row['user_name'] . '</a><br />';
    }
    }
    }
    else
    {
    echo "Please login to view this page.";
    }
    ?>

  4. this is a code i found in a template system

    <span style="float: right; text-align: right;"><a target="_blank" rel="external" href='javascript:window.location="mai"+"lto:"+"admin"+"@"+"randomgamedesign.uk.tt";self.close();' onmouseover='window.status="mai"+"lto:"+"admin"+"@"+"randomgamedesign.uk.tt"; return true;' onmouseout='window.status="";return true;'>Email </a></span>

     

    how can i use this code or something similar so you can only email them, and not see there email when you mouseover?

  5. ok, i tried the wordwrap code, and it doesn't seem to apply wrap to the second line.

     

    $intro = "Welcome, this is a test of the sites features.Please go to the admin centre to cutomise the site.TEXTTEXTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT";
    $welcome = wordwrap($intro, 60, "<br />\n");
    
    
    <p class="welcome"><?php echo"$welcome"; ?></p>

  6. i have a piece of text in a variable(which people can edit)

    this text needs to be displayed down the page and should stay within the bounderies i set, but it isn't. here are some snippets from my code.

    $intro = "Welcome, this is a test of the sites features.Please go to the admin centre to cutomise the site.";
    
    <p class="welcome"><?php echo"$intro"; ?></p>
    
    

     

    p.welcome
    {
    color:#000;
    font-size:14px;
    text-align:center;
    margin-left:425px;
    margin-top:40px;
    width:400px;
    border:ridge #0000FF;
    }

  7. how can i get the echo's to display below the form instead of above, will i need to postition using CSS??

     

    <div class="login">
    <?php
    
    
    if ($_SESSION['is_valid'] == false) {
        if (isset($_POST['login'])) { 
    
            $user_name = mysql_real_escape_string($_POST["user_name"]);
            $user_password = mysql_real_escape_string($_POST["user_password"]);
            $cookiename = forumcookie;
            $verify_username = strlen($user_name);
            $verify_pass = strlen($user_password);
            if ($verify_pass > 0 && $verify_username > 0) {
                $userPswd = md5($user_password);
                $userpwsd = sha1($userPswd);
                $sql = "SELECT * FROM $user WHERE user_name='$user_name' AND user_password='$userpwsd' LIMIT 1;";
                $result = mysql_query($sql) or die(mysql_error() . " in $sql");
                if (mysql_num_rows($result) == 1) {
                    $row = mysql_fetch_assoc($result);
                    $s_userpass = serialize($userpass);
                    $_SESSION['id_username'] = $row['user_name'];
                    $_SESSION['id_user_password'] = $row['user_password'];
                    $_SESSION['user_level'] = $row['userlevel'];
                    $_SESSION['user_id'] = $row['user_id'];
                    $_SESSION['is_valid'] = true;
                    if (isset($_POST['remember'])) {
                      $checked = "checked='checked'";
    		         setcookie("uname", $_SESSION['id_username'], time() + 86400*100);
                      setcookie("userpw", $user_password, time() + 86400*100);
    			  setcookie("check",$checked, time() + 86400*100);
                 }
                  header("Location:http://".$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI]);
                } else {
                    echo "Login failed. Username or Password are not correct.";
                }
            } else {
                ?>
    		<p><font style="font-size:small;">You left required field(s) blank</p>
    		<?php
            }
        }
    $server = str_replace("?logout","",$_SERVER['PHP_SELF']);
    ?>
    <table class="log_in"><form action="<?php echo "$server"; ?>" method="post">
    <th>Welcome</th>
    <tr><td align="center">Username:</td></tr><tr><td align="center"><input type="text" name="user_name"  size="16" value="<?php echo $_COOKIE['uname']; ?>" /><br /></td></tr>
    <tr><td align="center">Password:</td></tr><tr><td align="center"> <input type="password" name="user_password"  size="16" value="<?php echo $_COOKIE['userpw'] ?>" /><br /></td></tr>
    <tr><td align="center"><input type="hidden" name="login" value="true"><input type="submit" value="Submit"></td></tr>
    <tr><td align="centre"><input type="checkbox" name="remember" <?php echo $_COOKIE['check'] ?>> Remember Me </td></tr><tr><td align="center"><a href="register.php">[Register]</a></td></tr><tr><td align="center"><a href="forgot_password.php">[Forgot Password?]</a></td></tr></table>
    </form>
    </div>
    <?php 
    mysql_close();
    }
    }
    ?>
    </div>

  8. I think i have coded this wrong , because when i submit the form and it echoes something the background above it moves down, this is my CSS

    body
    {
    background-color:#FFFFFF;
    font-family:"Times New Roman", Times, serif;
    font-style:normal;
    color:#990000;
    }
    
    /*link styles*/
    /******************************************************************/
    /*Title Links*/
    a.title:link:{color:#FF0000; text-decoration:none;}
    a.title:visited {color:#0000FF; text-decoration:none;}
    a.title:hover {color:#FFFF00; text-decoration:none;}
    a.title:active {color:#00FF33; text-decoration:none;}
    
    /*Nav Bar Links*/
    a.nav_bar:link:{color: #000066; text-decoration:none;}
    a.nav_bar:visited {color: #00FF33; text-decoration:none;}
    a.nav_bar:hover {color: #FF0000; text-decoration:underline;}
    a.nav_bar:active {color: #FFFF00;}
    
    /*Table Styles*/
    /******************************************************************/
    /*Title Bar*/
    table.title
    {
    width:800px;
    table-layout:auto;
    height:100px;
    margin-left:225px;
    color:#FF0000;
    border:ridge #0000FF;
    text-align:center;
    background-color:#000000;
    }
    /*Logged In Section*/
    table.logged_in
    {
    
    }
    /*Forum Main Page*/
    table.forum_main
    {
    background-color:#0000CC;
    width:900px;
    }
    /**/
    table.admin
    {
    border:#0000FF;
    }
    
    /*Div Styles*/
    /******************************************************************/
    /*Left Menu*/
    div.left_bar
    {
    width:150px;
    border:ridge #0000FF;
    margin-left:225px;
    margin-top:20px;
    }
    
    /*Navigation Bar*/
    div.nav_bar
    {
    table-layout:auto;
    }
    
    /*Login Menu(Side Bar)*/
    div.login
    {
    }
    
    /*Time*/
    div.clock
    {
    margin-left:615px;
    margin-top:-302px;
    width:179px;
    }
    /*background area under title*/
    div.bg
    {
    margin-left:225px;
    margin-top:1px;
    background:repeat-x #00FF33;
    width:794px;
    height:20px;
    border-left:ridge #0000FF;
    border-right:ridge #0000FF;
    border-bottom:ridge #0000FF;
    }
    
    /*P Styles*/
    /******************************************************************/
    
    /*File Exists*/
    p.exists
    {
    color:#FF00FF;
    font-size:xx-large;
    }
    
    /*Welcome Message*/
    p.welcome
    {
    color:#000;
    font-size:14px;
    text-align:center;
    margin-left:10px;
    margin-right:30px;
    margin-top:40px;
    width:400px;
    border:#666666 thin solid;
    height:auto;
    }
    
    /*Disclaimer(footer)*/
    p.disclaimer
    {
    font-size:small;
    }
    

     

    and this is my page, i have removed some of the PHP code,

    <div class="bg"><div class="clock"><?php echo gmdate('l, jS F Y');?> <span id="txt"></span></div></div>

    bg is the bit that moves,

     

    this is the link to the page, please say if you need to see more code

    http://deanwhitehouse.awardspace.co.uk/home.php

    when you click submit, when the fields blank the echo moves the bit above.

  9. what i had tried was this

    <script type="text/javascript">
    function startTime()
    {
    var today=new Date();
    var h=today.getHours();
    var m=today.getMinutes();
    // add a zero in front of numbers<10
    m=checkTime(m);
    document.getElementById('txt').innerHTML=h+":"+m+";
    t=setTimeout('startTime()',500);
    }
    
    function checkTime(i)
    {
    if (i<10)
      {
      i="0" + i;
      }
    return i;
    }
    </script>

  10. I need a clock code that just shows hours and minutes and always updates,

    e.g

    you shouldn't need to refresh to show the current time.

    I was given this code a while ago

    <script type="text/javascript">
    function startTime()
    {
    var today=new Date();
    var h=today.getHours();
    var m=today.getMinutes();
    var s=today.getSeconds();
    // add a zero in front of numbers<10
    m=checkTime(m);
    s=checkTime(s);
    document.getElementById('txt').innerHTML=h+":"+m+":"+s;
    t=setTimeout('startTime()',500);
    }
    
    function checkTime(i)
    {
    if (i<10)
      {
      i="0" + i;
      }
    return i;
    }
    </script>

    but this shows seconds, and i don't no how to change it.

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