Jump to content

Spring

Members
  • Posts

    224
  • Joined

  • Last visited

Posts posted by Spring

  1. I have this website, and when I view a picture, it's positioned perfectly, but when my friend views the same picture it is poistioned much differently, how do I fix this?

     

    Here's the code i used.

     

     

    #gaara{
    position:absolute;
    padding-right: 1px;
    width: -20px;
    top: 454px;
    height: 202px;
    left: 815px;
    
    }

  2. Yes, this is one way.

     

    Another is to declare the variables you want to echo and then include your "view".

     

    Like this:

    theme.php

    <html>
    <head></head>
    <body>
    
    <form>
    </form>
    <?php echo $hellovar; ?>
    
    </body>
    </html>
    

     

    index.php

    <?php
    
    $hellovar = "Hello";
    
    include 'theme.php';
    
    ?>

     

    Dude, I love you. It worked!

  3. Split your html into a header and footer.

     

    Try this.

     

    themeheader.php

    <html>
    <head></head>
    <body>
    

     

    themefooter.php

    </body>
    </html>

     

    index.php

    <?php
    
    // include header
    include 'themeheader.php';
    
    //echo statement
    echo "Hello";
    
    //include footer
    include 'themefooter.php';
    ?>

     

    Oh that sort of fixes my problem, but say I want "hello" in a fixed position, like underneath a form, would I still go about doing it the same way?

  4. The domain is using my old domain until I have it working properly...so far the journey has been very very difficult. I've done registration, log in (kinda) and some other basic features.

     

    http://arzania.com/

     

    Please let me know what you think or what I can improve.  So, it has taken me a week to get this far, and I'm proud of what I have so far, PHP is harder than I thought without the help of PHPfreaks, I would have quit ages ago..

  5. This is the email verification script im using..

     

    //email verify
    $activationKey =  mt_rand() . mt_rand() . mt_rand() . mt_rand() . mt_rand();
    $sql="INSERT INTO account_info (activation_key, status) VALUES ('$activationKey', 'verify')";
    
    if (!mysql_query($sql)){
    
    exit('Error: ' . mysql_error());
    }
    
    else {
    
    
    
    //Send activation Email
    
    $to = $_POST['email'];
    $subject = "NarutoRPG.com Registration";
    $message = "Welcome to our website! You, or someone using your email address, has completed registration at narutoRPG.com. You can complete registration by clicking the following link:\rhttp://www.arzania.com/verify.php?$activationKey\r\r If this is an error, ignore this email and you will be removed from our mailing list.\r\rRegards,\ narutoRPG.com Team";
    $headers = 'From: ashyiscool2@gmail.com' . "\r\n" .
    'Reply-To: ashyiscool2@gmail.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
    mail($to, $subject, $message, $headers);
    
    //User isn't registering, check verify code and change activation code to null, status to activated on success
    
    $queryString = $_SERVER['QUERY_STRING'];
    $query = "SELECT * FROM account_info";
    $result = mysql_query($query) or die(mysql_error());
    while($row = mysql_fetch_array($result)){
    if ($queryString == $row["activation_key"]){
    echo "Congratulations!" . " " . $row["username"] . " is now the proud new owner of a NarutoRPG.com account. Login to begin to play.";
    $sql="UPDATE account_info SET activation_key = '', status='activated' WHERE (id = $row[id])";
    if (!mysql_query($sql))
    
    {
    
            die('Error: ' . mysql_error());
    
      }
    
        }
    
      }
    }
    }
    
    
    
    include "footer.php";
    ?>

     

    For some reason, when the person is registered it shows everyones name who registered, for example..

     

    You've been successfully registered!Congratulations! tonyhh is now the proud new owner of a NarutoRPG.com account. Login to begin to play.Congratulations! tonyh is now the proud new owner of a NarutoRPG.com account. Login to begin to play.Congratulations! tony is now the proud new owner of a NarutoRPG.com account. Login to begin to play.etc...etc..

     

    How can you make it only repeat the users name who registered, not everyone?

  6. Simply put, your form processing logic is off.  You need to see if errors have actually been encountered before attempting to insert field values.  Right now, you really only see if an email address exists before merrily inserting data. 

     

    In short, go through your script by hand.  Take note of exactly what your conditionals are doing (hint: it's not what you want them to do).  Let's say username is empty.  You create an error message, but do you actually test to see if that error condition exists before going to the db?  No.  That's one example of many in your script.

     

    Also, don't use the '@' when outputting.  Next to people using 'global', it's probably the most misused part of PHP.

    Thanks, I'll look it over a few times..

     

  7. Can we see the rest of your code

     

    GT

     

    I don't know why you would need all of it, but I guess so.  :shrug:

     

    <?php
    include "registertheme.php";
    include "database.php";
    
    
    //Check to see if someone pressed submit to start the whole script..
    
    if(isset($_POST['go'])){
    
      //Check if all three fields are submitted.
      
      if(empty($_POST['username']) || empty($_POST['password']) || empty($_POST['email']) || empty($_POST['Veremail'])){
        $required_info = "All three fields are required to continue!";
        
        
        }
      
      //Makes sure that the email field has a "@"
      
      if( strpos($_POST['email'], '@') || strpos($_POST['Veremail'], '@') === false ){
        $no_at = "Your email address is missing '@'";
        
       }
    
      $check ='SELECT username FROM account_info WHERE username ="'.strtolower($_POST['username']).'"';
      $result =  mysql_query($check);
         
    
      //checks the database to make sure that a username doesn't repeat
      if (mysql_num_rows($result) != 0) {
        $exist_username = "Username already exists!";
            }
    
    
      $check2 = 'SELECT email FROM account_info WHERE email = "' . $_POST['email'] . '"';
      $result2 = mysql_query($check2);
      
      //checks to see if email address is repeated
      if (mysql_num_rows($result2) != 0) {
        $exist_email = "Email address already exists!";
            }
      
      
      
      
      //inserts username into database if all of the fields above are correct.
          else{
             $sql = 'INSERT INTO account_info 
              (
              username,
              password,
              email,
              verify_email ) 
    
              VALUES 
              (
              "' .strtolower($_POST['username']). '",
              "' .strtolower($_POST['password']) . '",
              "' .$_POST['email'] .'",
              "'. $_POST['Veremail'] .'"
              )';
    
              $register = mysql_query($sql);
              
    
               if (!$register) {
                  exit("The query did not go through, lol'd");
              }       
              else {
                  $registered = 'You\'ve been successfully registered!';
              }
        
          }
    
       }
    
    
    echo'
    <html>
    <div id="error">
    '
    . @$no_at .  @$required_info . @$exist_username . @$exist_email . @$registered . ' 
    
    
    </div>
    </html>
    ';
    
    
    ?>

  8. Right now I'm working on a simple register form and I have included the theme. I set up a div and positioned the div below the register form to output any error in red text.

    If I were to use code like this

     

     if(empty($_POST['username']) || empty($_POST['password']) || empty($_POST['email']) || empty($_POST['Veremail'])){
        $required_info = "All three fields are required to continue!";
         }

     

    It will not work, because I don't have a die(); or end(); function, so it will display:

     

    " All three fields are required to continue! and You have been successfully registered! "

     

    BUT IT'S IN THE CORRECT PLACE UNDER THE FORM WHERE I PLACED THE DIV.

     

    So I made this change

     

     if(empty($_POST['username']) || empty($_POST['password']) || empty($_POST['email']) || empty($_POST['Veremail'])){
        $required_info = die("All three fields are required to continue!");
         }

     

    and it worked fine, but now, the words are not positioned under the form, but at the bottom of the page, I'm wondering how I would end that script, but align the text so it displays underneath the form, and not at the bottom of the page?

     

    If you don't understand ask me please.

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