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 5 of 5
  1. #1
    Join Date
    Jul 2005
    Location
    Belgium
    Posts
    2,492
    Tokens
    147

    Latest Awards:

    Default PowerPanel Profiles.

    Hi,

    On PowerPanel's Profile system i'm having a tiny problem.

    You see, when I click "update your profile", i see the form.

    So i enter my email, habbo name, avatar link (avatar has right type&size)

    and when i click save your settings, it gives me this reply:

    Code:
    Sorry! You either have a too small image or have chosen an image with an invalid type
    But its all correct.
    I can edit the max. sizes as admin, and it auto changes the sizes on the update profile page so it sais (100 x 100) like i had set. my avatar = 100 x 100 and .gif, i've already tried .png too & .jpg but it keeps giving that error.

    heres the bit from the code:
    PHP Code:
    <?php

    if(isset($_POST['email']) && isset($_POST['habbo']) && isset($_POST['favhab']) && isset($_POST['avatar']) && !empty($_POST['email'])) {

    $email $_POST['email'];
    $habbo $_POST['habbo'];
    $favhab $_POST['favhab'];
    $avatar $_POST['avatar'];
    $email clean($email);
    $habbo clean($habbo);
    $favhab clean($favhab);
    $avatar clean($avatar);
    $email censor($email);
    $habbo censor($habbo);
    $favhab censor($favhab);
    $avatar censor($avatar);

    if(
    $avatar == "") {
    $avatar "images/no_ava.gif";
    }
    elseif(
    $avatar == "Default Avatar") {
    $avatar "images/no_ava.gif";
    }
    ###
    $query mysql_query("SELECT * FROM config");
    while(
    $rows = @mysql_fetch_array($query)) {

    $maxh $rows[avah];
    $maxw $rows[avaw];

    }
    ###
    list($width$height$type$attr) = @getimagesize($avatar);
     
     
     
    $mhm explode("\""$attr);
     
    $height $mhm[1];
     
    $width $mhm[3];

    if(
    $height == "0" || $width == "0" || $height == "" || $width == "") {
    echo(
    "<br /><strong>Sorry!</strong> You either have a too small image or have chosen an image with an invalid type");
    }
    elseif(
    $height $maxh || $width $maxw) {
    echo(
    "<br /><strong>Sorry!</strong> You either have a too big image or have chosen an image with an invalid type");
    }

    else {


    if(!
    check_email_address($email)) {
    echo(
    "<br /><strong>Error:</strong> The email you entered is <strong>not</strong> valid!<br /><br /><div id='link'><a href='?page=uprofile'>Go back</a></div>");
    }

    else {

    $update mysql_query("UPDATE users SET email = '$email', habbo = '$habbo', favhab = '$favhab', avatar = '$avatar'  WHERE username = '$_SESSION[username]'") or die('Could not update email, Error: 'mysql_error());

    echo(
    "<br /><strong>Thanks!</strong> Your profile has been updated!<br /><br /><div id='link'><a href='?page=uprofile'>Go back</a></div>");
    }

    }

    } elseif(isset(
    $_POST['email']) && empty($_POST['email'])) {
    echo(
    "<br /><strong>Error:</strong> You must fill in all fields!</strong><br /><br /><div id='link'><a href='?page=uprofile'>Go back</a></div>");
    } else {
    ?><br />Click <strong><a onClick="toggle('form');" style="cursor: pointer;">here</a></strong> to display the form.
              <br /><br />
    <div id="form" style="display: none"><form action="" method="POST"><strong>Email:</strong><br /><input type="text" name="email" value="<?php $data mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '$_SESSION[username]'")); echo(""$data[email] .""); ?>" />
        <br />
        <br />
    <strong>Habbo Name:</strong><br />
        <label>
        <input name="habbo" type="text" id="habbo" value="<?php $data = @mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '$_SESSION[username]'")); echo(""$data[habbo] .""); ?>" />
        </label> 
        <br />
        <br />
    <strong>Favourite Habbo: </strong><br />
    <label>
    <input name="favhab" type="text" id="favhab" value="<?php $data = @mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '$_SESSION[username]'")); echo(""$data[favhab] .""); ?>" />
    </label>
    <br />
    <br />
    <strong>DJ Avatar</strong><em> (optional)</em><strong> :</strong><br />
        <label>
        <input name="avatar" type="text" id="avatar" value="<?php $data = @mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '$_SESSION['username']'")); if($data[avatar] == "images/no_ava.gif") {
        echo(
    "Default Avatar");
        }
        else {
        echo(
    ""$data[avatar] ."");
        } 
    ?>" />
        </label> 
        <br />
        (<?php $data = @mysql_fetch_array(mysql_query("SELECT * FROM config")); echo(""$data[avaw] .""); ?> (W) x <?php $data = @mysql_fetch_array(mysql_query("SELECT * FROM config")); echo(""$data[avah] .""); ?> (H) max) <br />
        <br /><input type="submit" value="Update My Profile" /></form
    ></div>

    <? ?></div>
            <?php
    } else {
    header('location: index.php');
    die();
    }
    ?>
    Anyone capeble of helping me? or sending my your working uprofile.php so i can find out what went wrong.

  2. #2
    Join Date
    Jun 2007
    Location
    Kilmarnock
    Posts
    3,227
    Tokens
    50

    Latest Awards:

    Default

    Im also having the same issue
    CPU i5 3570 @ 4.2 GHz | Mobo GigaByte Z77D3H | RAM 8GB | GPU AMD Radeon 6870 | OS Win 8 64-bit | HD 1TB HD and 128GB SSD | Wheel Logitech G27

  3. #3
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    Try this:

    Not tested and I don't know how PowerPanel works.. but I do know that the getimagesize stuff is coded incorrectly.

    Also I am assuming that the height is in pixels and is a number in the config table.

    Furthermore, I would like to point out that is does not check the file type as well nor the actual diskspace size of the image.
    PHP Code:
    <?php

    if(isset($_POST['email']) && isset($_POST['habbo']) && isset($_POST['favhab']) && isset($_POST['avatar']) && !empty($_POST['email'])) {

    $email $_POST['email'];
    $habbo $_POST['habbo'];
    $favhab $_POST['favhab'];
    $avatar $_POST['avatar'];
    $email clean($email);
    $habbo clean($habbo);
    $favhab clean($favhab);
    $avatar clean($avatar);
    $email censor($email);
    $habbo censor($habbo);
    $favhab censor($favhab);
    $avatar censor($avatar);

    if(
    $avatar == "") {
    $avatar "images/no_ava.gif";
    }
    elseif(
    $avatar == "Default Avatar") {
    $avatar "images/no_ava.gif";
    }
    ###
    $query mysql_query("SELECT * FROM config");
    while(
    $rows = @mysql_fetch_array($query)) {

    $maxh $rows[avah];
    $maxw $rows[avaw];

    }
    ###
    $imgdata = @getimagesize($avatar);
     
    $width $imgdata[1];
    $height $imgdata[2];

    if(
    $height == "0" || $width == "0" || $height == "" || $width == "") {
    echo(
    "<br /><strong>Sorry!</strong> You either have a too small image or have chosen an image with an invalid type");
    }
    elseif(
    $height $maxh || $width $maxw) {
    echo(
    "<br /><strong>Sorry!</strong> You either have a too big image or have chosen an image with an invalid type");
    }

    else {


    if(!
    check_email_address($email)) {
    echo(
    "<br /><strong>Error:</strong> The email you entered is <strong>not</strong> valid!<br /><br /><div id='link'><a href='?page=uprofile'>Go back</a></div>");
    }

    else {

    $update mysql_query("UPDATE users SET email = '$email', habbo = '$habbo', favhab = '$favhab', avatar = '$avatar'  WHERE username = '$_SESSION[username]'") or die('Could not update email, Error: 'mysql_error());

    echo(
    "<br /><strong>Thanks!</strong> Your profile has been updated!<br /><br /><div id='link'><a href='?page=uprofile'>Go back</a></div>");
    }

    }

    } elseif(isset(
    $_POST['email']) && empty($_POST['email'])) {
    echo(
    "<br /><strong>Error:</strong> You must fill in all fields!</strong><br /><br /><div id='link'><a href='?page=uprofile'>Go back</a></div>");
    } else {
    ?><br />Click <strong><a onClick="toggle('form');" style="cursor: pointer;">here</a></strong> to display the form.
              <br /><br />
    <div id="form" style="display: none"><form action="" method="POST"><strong>Email:</strong><br /><input type="text" name="email" value="<?php $data mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '$_SESSION[username]'")); echo(""$data[email] .""); ?>" />
        <br />
        <br />
    <strong>Habbo Name:</strong><br />
        <label>
        <input name="habbo" type="text" id="habbo" value="<?php $data = @mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '$_SESSION[username]'")); echo(""$data[habbo] .""); ?>" />
        </label> 
        <br />
        <br />
    <strong>Favourite Habbo: </strong><br />
    <label>
    <input name="favhab" type="text" id="favhab" value="<?php $data = @mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '$_SESSION[username]'")); echo(""$data[favhab] .""); ?>" />
    </label>
    <br />
    <br />
    <strong>DJ Avatar</strong><em> (optional)</em><strong> :</strong><br />
        <label>
        <input name="avatar" type="text" id="avatar" value="<?php $data = @mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '$_SESSION['username']'")); if($data[avatar] == "images/no_ava.gif") {
        echo(
    "Default Avatar");
        }
        else {
        echo(
    ""$data[avatar] ."");
        } 
    ?>" />
        </label> 
        <br />
        (<?php $data = @mysql_fetch_array(mysql_query("SELECT * FROM config")); echo(""$data[avaw] .""); ?> (W) x <?php $data = @mysql_fetch_array(mysql_query("SELECT * FROM config")); echo(""$data[avah] .""); ?> (H) max) <br />
        <br /><input type="submit" value="Update My Profile" /></form
    ></div>

    <? ?></div>
            <?php
    } else {
    header('location: index.php');
    die();
    }
    ?>
    Last edited by Tomm; 05-07-2007 at 07:09 AM.

  4. #4
    Join Date
    Jul 2005
    Location
    Belgium
    Posts
    2,492
    Tokens
    147

    Latest Awards:

    Default

    Quote Originally Posted by Tomm View Post
    Try this:

    Not tested and I don't know how PowerPanel works.. but I do know that the getimagesize stuff is coded incorrectly.

    Also I am assuming that the height is in pixels and is a number in the config table.

    Furthermore, I would like to point out that is does not check the file type as well nor the actual diskspace size of the image.
    PHP Code:
    <?php

    if(isset($_POST['email']) && isset($_POST['habbo']) && isset($_POST['favhab']) && isset($_POST['avatar']) && !empty($_POST['email'])) {

    $email $_POST['email'];
    $habbo $_POST['habbo'];
    $favhab $_POST['favhab'];
    $avatar $_POST['avatar'];
    $email clean($email);
    $habbo clean($habbo);
    $favhab clean($favhab);
    $avatar clean($avatar);
    $email censor($email);
    $habbo censor($habbo);
    $favhab censor($favhab);
    $avatar censor($avatar);

    if(
    $avatar == "") {
    $avatar "images/no_ava.gif";
    }
    elseif(
    $avatar == "Default Avatar") {
    $avatar "images/no_ava.gif";
    }
    ###
    $query mysql_query("SELECT * FROM config");
    while(
    $rows = @mysql_fetch_array($query)) {

    $maxh $rows[avah];
    $maxw $rows[avaw];

    }
    ###
    $imgdata = @getimagesize($avatar);
     
    $width $imgdata[1];
    $height $imgdata[2];

    if(
    $height == "0" || $width == "0" || $height == "" || $width == "") {
    echo(
    "<br /><strong>Sorry!</strong> You either have a too small image or have chosen an image with an invalid type");
    }
    elseif(
    $height $maxh || $width $maxw) {
    echo(
    "<br /><strong>Sorry!</strong> You either have a too big image or have chosen an image with an invalid type");
    }

    else {


    if(!
    check_email_address($email)) {
    echo(
    "<br /><strong>Error:</strong> The email you entered is <strong>not</strong> valid!<br /><br /><div id='link'><a href='?page=uprofile'>Go back</a></div>");
    }

    else {

    $update mysql_query("UPDATE users SET email = '$email', habbo = '$habbo', favhab = '$favhab', avatar = '$avatar'  WHERE username = '$_SESSION[username]'") or die('Could not update email, Error: 'mysql_error());

    echo(
    "<br /><strong>Thanks!</strong> Your profile has been updated!<br /><br /><div id='link'><a href='?page=uprofile'>Go back</a></div>");
    }

    }

    } elseif(isset(
    $_POST['email']) && empty($_POST['email'])) {
    echo(
    "<br /><strong>Error:</strong> You must fill in all fields!</strong><br /><br /><div id='link'><a href='?page=uprofile'>Go back</a></div>");
    } else {
    ?><br />Click <strong><a onClick="toggle('form');" style="cursor: pointer;">here</a></strong> to display the form.
              <br /><br />
    <div id="form" style="display: none"><form action="" method="POST"><strong>Email:</strong><br /><input type="text" name="email" value="<?php $data mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '$_SESSION[username]'")); echo(""$data[email] .""); ?>" />
        <br />
        <br />
    <strong>Habbo Name:</strong><br />
        <label>
        <input name="habbo" type="text" id="habbo" value="<?php $data = @mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '$_SESSION[username]'")); echo(""$data[habbo] .""); ?>" />
        </label> 
        <br />
        <br />
    <strong>Favourite Habbo: </strong><br />
    <label>
    <input name="favhab" type="text" id="favhab" value="<?php $data = @mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '$_SESSION[username]'")); echo(""$data[favhab] .""); ?>" />
    </label>
    <br />
    <br />
    <strong>DJ Avatar</strong><em> (optional)</em><strong> :</strong><br />
        <label>
        <input name="avatar" type="text" id="avatar" value="<?php $data = @mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '$_SESSION['username']'")); if($data[avatar] == "images/no_ava.gif") {
        echo(
    "Default Avatar");
        }
        else {
        echo(
    ""$data[avatar] ."");
        } 
    ?>" />
        </label> 
        <br />
        (<?php $data = @mysql_fetch_array(mysql_query("SELECT * FROM config")); echo(""$data[avaw] .""); ?> (W) x <?php $data = @mysql_fetch_array(mysql_query("SELECT * FROM config")); echo(""$data[avah] .""); ?> (H) max) <br />
        <br /><input type="submit" value="Update My Profile" /></form
    ></div>

    <? ?></div>
            <?php
    } else {
    header('location: index.php');
    die();
    }
    ?>
    Thanks for trying to help out, even if you don't know how powerpanel works (il +rep you).(EDIT: g2spread first.. i'l rep you as soon as i can )

    but with your edit i get this;
    Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/planonet/public_html/phpanel/uprofile.php on line 96
    now i'll get the line:
    ...
    PHP Code:
    <input name="avatar" type="text" id="avatar" value="<?php $data = @mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '$_SESSION['username']'")); if($data[avatar] == "images/no_ava.gif") {
        echo(
    "Default Avatar");
        }
        else {
        echo(
    ""$data[avatar] ."");
        } 
    ?>" />
    I'll look too now, see if i can find something.

  5. #5
    Join Date
    Jul 2005
    Location
    Belgium
    Posts
    2,492
    Tokens
    147

    Latest Awards:

    Default

    sorry for 2x post but i fixed the error:

    Avatar has to be right size, and seems like it has to be a .gif
    my .png doesn't work.

    Find: (line: 96);
    PHP Code:
    <input name="avatar" type="text" id="avatar" value="<?php $data = @mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '$_SESSION['username']'")); if($data[avatar] == "images/no_ava.gif") {
        echo(
    "Default Avatar");
        }
        else {
        echo(
    ""$data[avatar] ."");
        } 
    ?>" />
    Replace with:
    PHP Code:
        <input name="avatar" type="text" id="avatar" value="<?php $data = @mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username = '{$_SESSION['username']}'")); if("{$data['avatar']}== "images/no_ava.gif") {
        echo(
    "Default Avatar");
        }
        else {
        echo(
    ""$data[avatar] ."");
        } 
    ?>" />
    Edit, hmm it doesn't seem to save the avatar though.

    EDIT2= Ok, it does save the avatar link, it just shows the default avatar on dj list, so that problem would be with the dj list file then, i think.

    EDIT3: Ok, it Dj pofile works in frontend file.
    but the avatar doesn't show on the profile page inside the panel..

    Here's how to fix (easy but ah well..)
    Open djprofile.php from your powerpanel folder. (not frontend folder)

    Find: (line 62
    PHP Code:
    $avatar $account["frontend/avatar"]; 
    Replace with:
    PHP Code:
    $avatar $account["avatar"]; 
    Now it should all work
    Last edited by [Oli]; 05-07-2007 at 12:10 PM.

Posting Permissions

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