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!


Page 2 of 6 FirstFirst 123456 LastLast
Results 11 to 20 of 54

Thread: Please Help

  1. #11
    Join Date
    Aug 2006
    Location
    United Kingdom
    Posts
    207
    Tokens
    0

    Default

    Whats your next admin panel feature going to be?
    PHP Code:
    [LEFT]<?[/LEFT]
    [
    LEFT]$name $_GET['name'];[/LEFT]
    [
    LEFT]echo "Hi, your name is $name";[/LEFT]
    [
    LEFT]?>[/LEFT]
    [LEFT][/LEFT]

  2. #12
    Join Date
    Aug 2006
    Posts
    282
    Tokens
    0

    Default

    Ok wanna help me? I need a form field, where you type in a username and a password and it adds it to the log.txt file which i will CHMOD to 777.

    The file is like this;

    Ryan||password||

    So it will need to to post a new user in there so say if in the username form i put 'Demo' and in the password form i put 'Password' i would like the result in the log.txt file to be this;

    Demo||Password||
    Ryan||ryanspassword||

    Thanks dude.

    Edit: I might be able to do this myself.
    Last edited by Drugs; 09-08-2006 at 01:18 PM.

  3. #13
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default

    lol i should get the admin panel and so should fujiti
    this work ryan
    ??
    The first thing you need to know how to do is use the fopen() fread() and fwrite() functions. After that you must build a data parser. Here is the one I use for my flatfile member system:
    Code:

    $file = "storage.dat";
    $file = file($file);
    foreach($file as $Key => $Val)
    {
    //explode that data into a new array:
    $Data[$Key] = explode("||", $Val);
    }

    Next you would make the member list page, that is quite simple, just loop through with the data given above. Here is the whole code I use for an output situation. A sample data file and run file will be included aswell, call this output.php:
    Code:

    <?php
    function ffdisplay($Lines, $rows){
    $Lines = file($Lines);
    foreach($Lines as $Key => $Val)
    {
    //explode that data into a new array:
    $Data[$Key] = explode("||", $Val);
    }
    echo "Layout:<br>";
    for($a = 0; $a < $rows; $a++)
    {
    if($a != "0"){
    echo '||';
    }
    echo ''.$Data[0][$a].'';
    }
    echo "<br>------------------------<br>";
    for($K = 1; $K < sizeof($Lines); $K++)
    {
    echo '<p>';
    for($a = 0; $a < $rows; $a++)
    {
    echo ''.$Data[0][$a].': '.$Data[$K][$a].'<br>';
    }
    echo '</p>';
    }
    }
    ?>


    Now lets make your data page.
    Code:

    Username||Age||Password
    colin ||13||some md5 data
    somebody really cool||20||some md5 data

    That has the data, as you can see, the first line contains a sample of the page layout, this script is built for that, some scripts won't be. Here is the test.php page. That should be saved as sample.dat.
    Code:

    <?php
    include("output.php");
    ffdisplay("sample.dat", "2");
    ?>

    Now you need to build the fwrite function, I just briefed you on the bases of the code.
    Last edited by Colin-Roberts; 09-08-2006 at 01:28 PM.

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  4. #14
    Join Date
    Aug 2006
    Posts
    282
    Tokens
    0

    Default

    You will lmao.

    I am doing the add user bit now.

    Feature ATM

    Admin Panel Features

    Add announcement.
    Add action.
    Admin shout.
    Admin coloured name.
    List of admins.

    Shoutbox Features


    HTML Disabled.
    Very easily customised.
    Smilie feature.

    More coming soon ;D
    Last edited by Drugs; 09-08-2006 at 01:24 PM.

  5. #15
    Join Date
    Aug 2006
    Location
    United Kingdom
    Posts
    207
    Tokens
    0

    Default

    PHP Code:
    New Code PostedSee Most Recent PostIt Makes The Output Look Better 
    Last edited by Fujitsu; 09-08-2006 at 01:34 PM.
    PHP Code:
    [LEFT]<?[/LEFT]
    [
    LEFT]$name $_GET['name'];[/LEFT]
    [
    LEFT]echo "Hi, your name is $name";[/LEFT]
    [
    LEFT]?>[/LEFT]
    [LEFT][/LEFT]

  6. #16
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default

    lol fujitsu you make my elaborate scripts look bad.

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  7. #17
    Join Date
    Aug 2006
    Location
    United Kingdom
    Posts
    207
    Tokens
    0

    Default

    PHP Code:
    <?php
    $username 
    $_GET["username"];
    $password $_GET["password"];
    $out fopen("log.txt""a");
    if (!
    $out) {
    print(
    "Error opening file, CHMOD to 777.");
    exit;
    }
    fputs ($out,implode,("\n"));
    fwrite($out,"<b>Username Tried:</b> $username<br><b>Password Tried:</b> $password<br><br>");
    fclose($out);
    ?>
    That one would be better as it puts 2 line breaks after the output, making it easier to read.
    PHP Code:
    [LEFT]<?[/LEFT]
    [
    LEFT]$name $_GET['name'];[/LEFT]
    [
    LEFT]echo "Hi, your name is $name";[/LEFT]
    [
    LEFT]?>[/LEFT]
    [LEFT][/LEFT]

  8. #18
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default

    ryan you should have a word filter also.

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  9. #19
    Join Date
    Aug 2006
    Posts
    282
    Tokens
    0

    Default

    LOL Fujitsu you don't even have a form to add it..

    I have this so far;

    createuser.php

    PHP Code:
    <html>
    <head>
    <title>PixelResources User Creator</title>
    </head>
    <body>

    <?php
    if($_COOKIE['in'] == "1"){}
    else{
    die(
    "You are not authrised to view this page.");

    ?>

    <font size=1> <font face='verdana'>
    <b>Add an admin</b><br><br>
    <FORM name="shout" action="adduser.php" method="POST">
    Username;<br>
    <INPUT TYPE="TEXT" name="name" size="20"><br><br>
    Password;<br>
    <INPUT TYPE="TEXT" name="message" size="20"><br><br>
    <br><br>
    <INPUT TYPE="Submit" name="submit" value="Create Admin" size="20">
    </FORM>
    <br>

    </font>

    <?php

    // Copyright 2006 - 2007 PixelResources

    ?>

    </body>
    </html>
    And adduser.php;

    PHP Code:
    <?php

    $name 
    $_POST['name'];
    $website $_POST['website'];
    $message $_POST['message'];

    if(empty(
    $name) OR empty($message))
    {
    echo 
    "

    <script language='javascript'>

    alert('Please fill in both the Username and the Password fields...');

    </script>
    "


    }
    else
    {

    echo 
    "

    <script language='javascript'>

    alert('The user was successfully created...');

    </script>
    "

    $name = ($name);
    $message = ($message);
    $tag = ("<font size=\"1\" face=\"Verdana\">
    $name||$message||<br>");


    $read fopen("/users/log.txt""r");
    $contents fread($readfilesize('/users/log.txt'));
    fclose($read);

    $write fopen("/users/log.txt""w");
    fwrite($write"$tag $contents");
    fclose($write);
    }

    print 
    "<meta http-equiv=\"refresh\" content=\"0;adminindex.php\">";

    // Copyright 2006 - 2007 PixelResources

    ?>
    Yet because the folder users which the log.txt folder is in passworded via .htaccess it is unable to write, even though it is CHMOD'ed to 777, this is the error i get once the i press Add User.


  10. #20
    Join Date
    Aug 2006
    Location
    United Kingdom
    Posts
    207
    Tokens
    0

    Default

    That was the code to log access attempts...
    PHP Code:
    [LEFT]<?[/LEFT]
    [
    LEFT]$name $_GET['name'];[/LEFT]
    [
    LEFT]echo "Hi, your name is $name";[/LEFT]
    [
    LEFT]?>[/LEFT]
    [LEFT][/LEFT]

Page 2 of 6 FirstFirst 123456 LastLast

Posting Permissions

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