Jump to content

Andy11548

Members
  • Posts

    163
  • Joined

  • Last visited

Posts posted by Andy11548

  1. I've made a page which lists information from a database like:

     

    1 Andy

    2 James

    3 Bob

     

    But if James over takes Andy it goes

     

    1 James

    2 Andy

    3 Bob.

     

    I have that working.

     

    However, I've added multi pages into my website [1, 2, 3, 4, 5] etc, however, when you go onto a new page, it starts back at number 1. It doesn't continue adding 1 on.

     

    Does anyone know how to make this work?

     

    Thanks in advance,

    Andy.

  2. I don't understand your database...

     

    If its like:

     

    user_id | username | password | email | fullname | number

     

    when you do the insert you would leave the fields they fill in later black like:

     

    mysql_query("INSERT INTO `users` VALUES ('', '$username', '$password', '$email', '', '')");

     

    as you can see I left the fields "Fullname" and "Number" blank.

     

    When you use the update, you just define what field you want updating with what value.

  3. Yeah, you will want to use the UPDATE for when they update thier account.

     

    It'll be like

    $update = mysql_query("UPDATE `users` SET `email`='$newEmail', `fullname`='$fullname' WHERE `username`='$_SESSION['username']'");
    

  4. I've tried joining querys, but I have no bloody clue what I'm doing lol.

     

    I'm using 2 querys, one to show the news, and one to pull the username from the id.

     

    If anyone could help, it'd be great.

     

    <?php include './includes/mysql/connect.php'; ?>
    <!DOCTYPE HTML>
    <head>
    <meta http-equiv="content-type" content="text/html" />
    <meta name="author" content="Andy" />
        <link href="./includes/css/css.css" rel="stylesheet" type="text/css" />
    
    <title>Project Desination</title>
    </head>
    <body>
    <div id="wrapper">
        <div id="header">
            <div id="logo"></div>
            <div id="navMenu">
                <ul>
                    <li><a href="index.php">Home</a></li>
                    <li><a href="./forums/">Forums</a></li>
                </ul>
            </div>
        </div>
        <div id="contentHolder">
            <div id="content">
                <?php
                $query = mysql_query("
                SELECT
                t1.post_id as PostID
                t1.poster_id as User
                t1.forum_id as Forum
                t1.post_subject as Title
                t1.post_text as Content
                (SELECT COUNT(*) FROM `phpbb_posts` as t2 WHERE t2.forum_id = '8') as NewsCount
                
                FROM 
                
                phpbb_posts as t1
                    INNER JOIN phpbb_users as t2
                        ON t2.user_id = t1.poster_id
                
                ORDER BY t1.post_id DESC
                ");
                
                if(mysql_num_rows($query) != 0)
                {
                    while($newsF = mysql_fetch_assoc($query))
                    {
                        echo '<div id="title">'.$newsF['post_subject'].'</div>';
                        echo '<div id="text">'.$newsF['post_text'].'</div>';
                        echo '<div id="author"></div><br /><br />';
                    }
                } else {
                    echo 'There is no news to be displayed.';
                }
                ?>
            </div>
            <div id="recent">Testing</div>
        </div>
        <div class="clearFloat"></div>
        <div id="push"></div>
    </div>
        <div id="footer">
            <span class="middle"></span>
        </div>
    </body>
    </html>
    

  5. How would I show the PHP code on the website page?

     

    I'm not sure if this should be under PHP or HTML or what, but, like on the forums where you see the

     

    <?php

     

    echo 'sdfjksdf';

     

    ?>

     

    etc. How do I make it so I can write PHP on the website?

  6. I've made a Login Script and I'm trying to make it re-direct me to the Homepage after the login is complete. However, it's doing nothing at all...

     

    <?php
    require('./includes/header.php');
    require('./includes/functions.php');
    ?>
    <div id="loginHolder">
       <div id="title"></div>
       <h2>Login</h2>
       <hr />
       <?php
          if(@$_POST['submit_login'])
          {
             echo '<div id="loginBox">';
             $username = protect($_POST['username']);
             $password = protect(encrypt($_POST['password']));
             
             $loginCheckQ = mysql_query("SELECT * FROM `users` WHERE `username`='".$username."'");
             $loginCheckF = mysql_fetch_assoc($loginCheckQ);
             
             $dbusername = $loginCheckF['username'];
             $dbpassword = $loginCheckF['password'];
             
             if($username == $dbusername && $password == $dbpassword)
             {
                $_SESSION['loggedUser']=$username;
                echo '<font color="green">You have successfully logged in as '.$username.'.</font>';
                header('location: index.php');
             } else {
                echo '<span>Incorrect Username or Password.</span>';
             }
             echo '</div>';
          }
       ?>
       <form action="login.php" method="POST" autocomplete="off">
          <table cellspacing="0" cellpadding="0">
             <tr>
                <td>Username: </td><td><input type="text" name="username" /></td>
             </tr>
             <tr>
                <td>Password: </td><td><input type="password" name="password" /></td>
             </tr>
             <tr>
                <td colspan="2"><input type="submit" value="Login" class="submit" name="submit_login" /></td>
             </tr>
          </table>
       </form>
    </div>
    <?php
    require('./includes/footer.php');
    ?>

     

    It works perfectly fine on Localhost, but when I upload it, it doesn't work.

  7. Yeah, but passwords can be harder to get back to its origional state than others.

     

    I can decrypt a MD5 hash in seconds, so MD5 isn't too good to use on its own.

     

    I know the security is about your other things, but I want to know if it's a good way to hash a password for extra security.

  8. When the confirm its the one they want to select, it will send the value (being the ID of the post) to a PHP script that will delete it.

     

    I just need to get it to recognise the values independantly.

     

    Also, each delete link has a ID that is like

    <input type="submit" value="Test button" id="test_'.$testF['id'].'" />

     

    So, each link has a different number after the "test_" part.

  9. Sorry for the double topic. I realised that I didn't explain it right in the other topic.

     

    Right, I have multiple values comming from the same class name.

     

    How would I go around retrieving all the values from the same class name.

     

    <input type="hidden" class="test" value="1" />
    
    <a href="#">Delete</a>
    
    -----------------------------------------------------------
    
    <input type="hidden" class="test" value="2" />
    
    <a href="#">Delete</a>
    
    -----------------------------------------------------------
    
    <input type="hidden" class="test" value="3" />
    
    <a href="#">Delete</a>
    
    -----------------------------------------------------------
    
    <input type="hidden" class="test" value="4" />
    
    <a href="#">Delete</a>

     

    Right, thats pretty much it (not exactly how it is). However, when I try and retrieve the values, it only lets me click on the first "Delete" link. The others will not work as it's only picking up the first Value.

     

    If I deleted the first topic (value="1"), the Delete Link then works for Value 2.

     

    How do I make them ALL work?

  10. Hello, I'm trying to retrieve multiple ID's from the same class name.

     

    EXAMPLE:

     

    <input type="hidden" class="test" id="1" />

    <input type="hidden" class="test" id="2" />

    <input type="hidden" class="test" id="3" />

    <input type="hidden" class="test" id="4" />

     

    However, I'm not too sure how to retrieve each one independantly.

     

    When I click the button under id=1, it shows up how it should,

     

    however, when I click it under any of the other ID's it doesn't work.

     

    How can I solve this?

     

     

  11. I know that.

     

    I have the hover working, however, when I hover over the main tab and go through the subtabs, I want the main one to stay as if its hovered over.

     

    Example:

     

    - Community

        - Link Here

        - Link Here

        - Link Here

     

    If I hover over Community, the background turns black.

     

    If I move onto the "Link Here", It goes back to normal, whereas I want the "Community" part to always stay black until they've either clicked one of the links or gone off it.

  12. Hello,

     

    I'm trying to make it so that when I hover over the Main Tab on a drop down menu it changes color, and while you're going through the other options on the drop down, the main tab still stays coloured.

     

    Thats probably the best way I can explain it.

     

    If you can help me, it would be greatly appriciated.

     

    Thanks,

    Andy.

  13. Right, example:

     

    <input type="hidden" value="3" class="news_id" />
    <input type="hidden" value="7" class="news_id" />
    <input type="hidden" value="8" class="news_id" />
    

     

    I want to get each of the ID's from the input fields and put them into a div tag where the hidden ID is the same as the Div ID:

     

    <div id="delete_news_3">3</div>
    <div id="delete_news_7">7</div>
    <div id="delete_news_8">8</div>
    

     

    The Javascript code I'm using is:

     

         $('.delete_news_button').click(function() {
               var id = $('.news_id').val();
    
               $('#delete_id_'+id).append(id);
         });
    

     

    But, when I click the button "delete" it only does shows the ID appended in the top div tag (<div id="delete_news_3"></div>).

  14. Pretty much, for all the new topics that get placed on the homepage, it creates a form accordingly:

     

    <div id="delete_id_'.$newsF['id'].'"></div>
                   <form name="news_delete" action="" onsubmit="return false">
                      <input type="hidden" class="news_id" value="'.$newsF['id'].'" />
                      <input type="submit" class="delete_news_button" value="Delete '.$newsF['id'].'" />
                   </form></div><br />
    

     

    Each of the Hidden Id's have a value, according to the News_ID. They way you said, I've tried already, but it only works for the top one, not for all of them.

     

    I need it to get each ID from the same class value.

  15. Hey, I'm very new to Javascript/jQuery.

     

    How would I make this work:

     

         $('.delete_news_button').click(function() {
         var id = document.getElementsByClassName(news_id);
    
            $('#delete_id_'+id).append(id);
         });
    

  16. Hey,

     

    I'm trying to make a delete button for each post made to my site, how would I construct this to work?

     

    I'm holding a hidden input field with the value of the ID, how would I retrive all the ID's from the input field.

     

    EXAMPLE:

     

    <input type="hidden" class="news_id" value="8" />

    <input type="hidden" class="news_id" value="4" />

    <input type="hidden" class="news_id" value="2" />

     

    How would I get all of the different ID's from the input fields, with the same class name?

     

    Thanks,

    Andy.

  17. This is the full error:

     

    Warning: mail() [function.mail]: SMTP server response: 550 The address is not valid. in C:\wamp\www\test.php on line 17

     

    And this is my code:

     

    <?php
    if(@$_POST['submit'])
    {
       //Get data from form
       $name = $_POST['name'];
       $message = $_POST['message'];
    
       if(!empty($name)&&!empty($message))
       {
          $to = "Andy11548@aol.com";
          $subject = "Activation Email from Andy Websites";
          $from = "Andy11548@live.co.uk";
          $headers = "From: Andy11548@live.co.uk";
    
          $body = "This is a email from ".$name."\n\n".$message;
    
          mail($to, $subject, $body, $headers); // LINE 17
    
       } else {
          echo 'Please fill out all fields.';
       }
    }
    ?>
    

     

    I'm really confused :S

  18. It uses HTML, PHP and Javascript/Ajax. I have a Shoutbox/Chatroom on my forums I'm creating, youtube is a good place to check, although, codes on there are outdated nevertheless, but they work. Just use thoes as a starter then fix them up as much you can or ask others to help you with 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.