Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 3 of 3

Thread: A bit of help?

  1. #1
    Join Date
    Feb 2006
    Location
    Scotland
    Posts
    2,087
    Tokens
    138

    Latest Awards:

    Default A bit of help?

    Hey,

    I haven't coded in a while but since I am working on my new fansite I am trying to do some form of coding for it.

    Anyway, the page: http://www.studiohabbo.net/pages/test.phps (Its a .phps so you can see the code - Running version is at the same url only .php) does not work right.

    I get "
    Parse error: syntax error, unexpected T_ELSE in /home/sh/public_html/pages/test.php on line 39"

    Undoubtedly, I'm probably doing something very stupid but I cant seem to see whats wrong.

    I know my code isn't very clean, any ideas what is up?

  2. #2
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default

    Try this

    PHP Code:
    <?php

    /**
     * @author StudioHabbo.NET
     * @copyright 2008
     */

    include_once '../includes/php/config.php';

        if (
    $_POST[submit]) {
            
    // Checks to see if the form has been submitted
            
    $username $_POST[username];
            
    $habboname $_POST[habboname];
            
    $position $_POST[position];

                if(
    $username==NULL|$habboname==NULL|$position==NULL) {
                    
    //Checks inputs to see if any fields were left blank
                    
    echo "A field was left blank.";
                }
                else{
                    
    $checkname mysql_query("SELECT username FROM stafflist WHERE username='$username'");
                    
    $checknamemysql_num_rows($checkname);
                    
    $checkhname mysql_query("SELECT habboname FROM stafflist WHERE habboname='$habboname'");
                    
    $checkhname mysql_num_rows($checkhname);
                        if (
    $checkemail>0|$checkname>0) {
                            
    // Whoops, This person is already on the staff list!
                            
    echo "This user is already on the staff list!";
                        }
                        else{
                            
    // Not on the staff list, So we continue
                            
    $username htmlspecialchars($username);
                            
    $habboname htmlspecialchars($habboname);
                            
    $position htmlspecialchars($position);
                            
    // Checks for HTML, If there is any it gets rid of it!
                            // Everything seems good, lets insert into the database
                            
    $query mysql_query("INSERT INTO stafflist (username, habboname, password) VALUES('$username','$habboname','$position')");
                            
    // Everything is inserted!
                            
    echo "$habboname has been added to the staff list!";
                        }
                }
        }
        else
        {
        
    // the form has not been submitted...so now we display it.
    ?>
    <span class="style1">Add User to Staff List<br />
    </span>
    <span class="style3"><em>Submit an existing user to the Staff List</em></span>
    <form method="POST">
      <table width="298" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="133" class="style3">SH Username:</td>
          <td width="202"><span class="style3">
            <input type="text" maxlength="30" name="username" />
          </span></td>
        </tr>
        <tr>
          <td height="23" class="style3">Habbo Name:</td>
          <td><span class="style3">
            <input name="habboname" type="text" id="habboname" maxlength="20" />
          </span></td>
        </tr>
        <tr>
          <td class="style3">Position:</td>
          <td><span class="style3">
            <input name="position" type="text" id="position" maxlength="25" />
          </span></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td><input name="submit" type="submit" id="submit" value="Submit" /></td>
          <td>&nbsp;</td>
        </tr>
      </table>
    </form>
    <?php
        
    }
    ?>
    Its best to tab your code, as its easyer to find errors.
    Lets set the stage on fire, and hollywood will be jealous.

  3. #3
    Join Date
    Feb 2006
    Location
    Scotland
    Posts
    2,087
    Tokens
    138

    Latest Awards:

    Default

    Thanks

    Works now +Rep

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •