Jump to content

True`Logic

Members
  • Posts

    59
  • Joined

  • Last visited

    Never

Posts posted by True`Logic

  1. javascriptkit.com  simplythebest.net  <-- these have great javascript scripts.. what you need is a simple <span id=blah></span>  and document.getElementByID("blah").innerHTML= x  and set up a little timer to reduce x by so often then read from like TheFile.js?fileID=XX when x=0
  2. [quote]
    do you even know what hacking is?
    [/quote]

    hacking is (to ME..) the flauciaucinahilipilificatious enterance into other systems, virtual\cyber areas, and operations that should otherwise be impossible for the soul purpose of exploration and gaining of knowledge with no intention or recourse of illicit or damaging activities

    those who do use hacking as a means to cause damage are not hackers.. they are criminals..

    [quote]
          Another one got caught today, it's all over the papers.  "Teenager
    Arrested in Computer Crime Scandal", "Hacker Arrested after Bank
    Tampering"... Damn kids.  They're all alike. But did you, in your three-
    piece psychology and 1950's technobrain, ever take a look behind the
    eyes of the hacker?  Did you ever wonder what made him tick, what forces
    shaped him, what may have molded him? I am a hacker, enter my world...
    Mine is a world that begins with school... I'm smarter than most of the
    other kids, this crap they teach us bores me...  Damn underachiever.
    They're all alike. I'm in junior high or high school.  I've listened to
    teachers explain for the fifteenth time how to reduce a fraction.
    I understand it.  "No, Ms. Smith, I didn't show my work.  I did it in
    my head..." Damn kid.  Probably copied it.  They're all alike.
    I made a discovery today.  I found a computer.  Wait a second, this is
    cool.  It does what I want it to.  If it makes a mistake, it's because I
    screwed it up.  Not because it doesn't like me...  Or feels threatened by
    me.. Or thinks I'm a smart ass.. Or doesn't like teaching and shouldn't be
    here... Damn kid.  All he does is play games.  They're all alike. And then
    it happened... a door opened to a world... rushing through the phone line
    like heroin through an addict's veins, an electronic pulse is sent out,
    a refuge from the day-to-day incompetencies is sought... a board is found.
    "This is it... this is where I belong..." I know everyone here... even
    if I've never met them, never talked to them, may never hear from them
    again... I know you all... Damn kid.  Tying up the phone line again.
    They're all alike... You bet your ass we're all alike... we've been
    spoon-fed baby food at school when we hungered for steak... the bits of
    meat that you did let slip through were pre-chewed and tasteless.
    We've been dominated by sadists, or ignored by the apathetic.  The few
    that had something to teach found us willing pupils, but those few are
    like drops of water in the desert.
       This is our world now... the world of the electron and the switch, the
    beauty of the baud.  We make use of a service already existing without
    paying for what could be dirt-cheap if it wasn't run by profiteering
    gluttons, and you call us criminals.  We explore... and you call us
    criminals.  We seek after knowledge... and you call us criminals.  We
    exist without skin color, without nationality, without religious bias...
    and you call us criminals. You build atomic bombs, you wage wars, you
    murder, cheat, and lie to us and try to make us believe it's for our
    own good, yet we're the criminals.
       Yes, I am a criminal.  My crime is that of curiosity.  My crime is
    that of judging people by what they say and think, not what they look like.
    My crime is that of outsmarting you, something that you will never
    forgive me for. I am a hacker, and this is my manifesto.  You may stop
    this individual,but you can't stop us all... after all, we're all alike.
                                +++The Mentor+++
    [/quote]
  3. ew, sessions for the loss... best way (easier than sql databases) is simple ini's... i even use ini's (encrypted) for my logins with autologin depending on IP (unless the user disables this feature, then they are logged in depending on IP for a certain interval of time, or untill they click Log Out)
  4. [code]
    <?php
    if(!isset($_GET["color"])) {
    echo "
    <script>
    function Change() {
    document.getElementById(\"moo\").innerHTML=document.getElementById(\"color\").value
    }
    </script>
    <form>
    <select name=color onChange=\"Change()\">
    <option value=Orange>Orange</option>
    <option value=Red>Red</option>
    <option value=Green>Green</option>
    <option value=Blue>Blue</option>
    </select>
    <input type=submit value=chose!>
    </form>
    <span id=moo>Orange</span>
    ";
    }
    else {
    echo "You chose: " . $_GET["color"];
    }
    ?>
    [/code]

    this does both live, and after submitting :)
  5. [code]<?php
    $testing; // declare without assigning
    print gettype ($testing ); //NULL
    print "<br />";
    $testing = 5;
    print gettype( $testing ); //integer
    print "<br />";
    $testing = "five";
    print gettype( $testing ); // string
    print "<br />";
    $testing = 5.0
    print gettype( $testing ); // double
    print "<br />";
    $testing = true;
    print gettype( $testing ); // boolean
    print "<br />";
    ?>[/code]

    print sucks for one, use echo.. for 2, you forgot a semicolon, 3, all that unneeded whitespace adds to your filesize, get rid of it..

    [code]
    <?php
    $testing = ""; // declare without assigning
    echo gettype($testing); //NULL
    echo "<br>";
    $testing = 5;
    echo gettype($testing); //integer
    echo "<br>";
    $testing = "five";
    echo gettype($testing); // string
    echo "<br>";
    $testing = 5.0;
    echo gettype($testing); // double
    echo "<br>";
    $testing = true;
    echo gettype($testing); // boolean
    echo "<br>";
    /* returns:
    string<br>integer<br>string<br>double<br>boolean<br>
    */
    ?>
    [/code]
  6. ill gives this to you in parts so it's easier to handle..

    Ini functions (do not edit, just use :) put in "inifunc.inc") :
    [code]
    <?php
    // write_key($section, $key, $value, $file_name)
    // write_section($section, $keys, $file_name)
    // delete_key($section, $key, $file_name)
    // delete_section($section, $file_name)
    // read_key($section, $key, $default, $file_name)
    // read_section($section, $default, $file_name)
    $empty = "";
    function write_key($section, $key, $value, $file_name)
    {
    if (!file_exists($file_name))
    {
    $content = "[$section]\r\n";
    $content .= "$key=$value";
    }
    else
    {
    $content = read_ini($file_name);
    $currentsection = find_section($content, $section, FALSE);
    if (!isset($currentsection))
    {
    $content .= "\r\n\r\n[$section]\r\n";
    $content .= "$key=$value";
    }
    else
    {
        $currentkey = find_key($currentsection, $key, FALSE);
        if (!isset($currentkey))
    {
    $newsection = $currentsection."\r\n$key=$value";
    $content = str_replace($currentsection, $newsection, $content);
    }
        else
        {
    $newsection = str_replace($currentkey, "$key=$value", $currentsection);
    $content = str_replace($currentsection, $newsection, $content);    
    }
    }
    }
    write_ini ($content, $file_name);
    }

    function write_section($section, $keys, $file_name)
    {
    if (!file_exists($file_name))
    {
    $content = "[$section]\r\n";
    foreach ($keys as $key=>$value)
    $content .="$key=$value\r\n";
    }
    else
    {
    $content = read_ini($file_name);
    $currentsection = find_section($content, $section, FALSE);
    if (!isset($currentsection))
    {
    $content .= "\r\n\r\n[$section]\r\n";
    foreach ($keys as $key=>$value)
    $content .="$key=$value\r\n";
    }
    else
    {
    $newsection = $currentsection;
    foreach ($keys as $key=>$value)
    {
    $currentkey = find_key($currentsection, $key, FALSE);
        if (!isset($currentkey))
    {
    $newsection .= "\r\n$key=$value";
    }
        else
        {
    $newsection = str_replace($currentkey, "$key=$value", $newsection);
    }
    }
    $content = str_replace($currentsection, $newsection, $content);
    }
    }
    write_ini ($content, $file_name);
    }

    function delete_key($section, $key, $file_name)
    {
    if (!file_exists($file_name))
    return (FALSE);
    $content = read_ini($file_name);
    $currentsection = find_section($content, $section, FALSE);
    if (!isset($currentsection))
    return (FALSE);
    $currentkey = find_key($currentsection, $key, FALSE);
    if (!isset($currentkey))
    return (FALSE);
    $newsection = str_replace("\r\n".$currentkey, "", $currentsection);
    $content = str_replace($currentsection, $newsection, $content);
    write_ini ($content, $file_name);
    return (TRUE);
    }
    function delete_section($section, $file_name)
    {
    if (!file_exists($file_name))
    return (FALSE);
    $content = read_ini($file_name);
    $currentsection = find_section($content, $section, FALSE);
    if (!isset($currentsection))
    return (FALSE);
    $content = str_replace($currentsection, "", $content);
    write_ini ($content, $file_name);
    return (TRUE);
    }
    function read_key($section, $key, $default, $file_name)
    {
    if (!file_exists($file_name))
    return($default);
    $content = read_ini($file_name);
    $currentsection = find_section($content, $section, TRUE);
    if (!isset($currentsection))
    return($default);
        $value = find_key($currentsection, $key, TRUE);
        if (!isset($value))
    return($default);
        return ($value);
    }
    function read_section($section, $default, $file_name)
    {
    if (!file_exists($file_name))
    return($default);
    $content = read_ini($file_name);
    $currentsection = find_section($content, $section, TRUE);
    if (!isset($currentsection))
    return($default);
        $lines = explode("\r\n" , $currentsection);
    foreach ($lines as $line)
    {
    list($key,$value)=explode('=',$line);
    $keys[$key]=$value;
    }
        return ($keys);
    }
    function read_ini ($file_name)
    {
    clearstatcache();
    $file = fopen($file_name, "r");
    flock($file, LOCK_SH);
    $content = trim(fread($file, filesize($file_name)));
    flock($file, LOCK_UN);
    fclose ($file);
    return ($content);
    }

    function write_ini ($content, $file_name)
    {
    $file = fopen($file_name, "w");
    flock($file, LOCK_EX);
    fwrite($file, $content);
    flock($file, LOCK_UN);
    fclose ($file);
    }

    function find_section ($content, $section, $just_keys)
    {
    $section = "[$section]\r\n";
    $currentsection = strstr($content, $section);
    if (!$currentsection)
    return($empty);
    $endpos = strpos($currentsection, "\r\n\r\n");
    if (!$endpos)
    $endpos = strpos($currentsection, "\r\n[");
    if (!$endpos)
    $endpos = strlen($currentsection);
    if ($just_keys)
    $currentsection = trim(substr($currentsection, strlen($section), $endpos-strlen($section)));
    else
    $currentsection = trim(substr($currentsection, 0, $endpos));
    return ($currentsection);
    }

    function find_key ($currentsection, $key, $just_value)
    {
        $key .= "=";
        $currentkey = strstr($currentsection, $key);
        if (!$currentkey)
    return($empty);
        $endpos = strpos($currentkey, "\r\n");
        if (!$endpos)
    $endpos = strlen($currentkey);
    if ($just_value)
    $currentkey = trim(substr($currentkey, strlen($key), $endpos-strlen($key)));
    else
    $currentkey = trim(substr($currentkey, 0, $endpos));

    return ($currentkey);
    }
    ?>
    [/code]
    the first few lines (commented ones) explain how to use it, if u dont understand, pm me..

    functions ("func.inc"):
    [code]
    <?php
    function enumUploads() {
    $num = 0;
    while(read_key("Files", $num, "", "files.ini") != "") {
    $num++;
    }
    return $num;
    }
    function clearUploads() {
    $num2 = 0;
    while(read_key("Files", $num2, "", "files.ini") != "") {
                              unlink(read_key("Files", $num2, "", "files.ini"));
                              unlink("$num2.txt");
                              write_key("Files", $num2, "", "files.ini");
    $num2++;
    }
    return echo "all uploads deleted!";
    }
    function deleteUpload($num4) {
    $num3 = 0;
                 $num5 = $num4;
                 unlink(read_key("Files", $num5, "", "files.ini"));
                 unlink("$num5.txt");
    while(read_key("Files", $num, "", "files.ini") != "") {
    $num3++;
    }
                 while($num4<=$num3) {
                              write_key("Files", $num4, read_key("Files",$num4+1, "", "files.ini"), "files.ini");
                              $num4++;
                 }
                 return echo "deleted upload $num5";
    }
    ?>
    [/code]

    whew, wrote that on the spot :o, u may wanna give it some testing ;)

    next for the upload script, upload.html:

    [code]
    <?php
    if(file_exists("links.html")) {
    echo "<a href=links.html>links</a>";
    }
    ?>
    <hr>
    <form method=POST action=ul.php enctype=multipart/form-data>
    <p>File to upload:<br>
    <table border=0 cellspacing=0 cellpadding=0>
    <tr>
    <td colspan=2><input type=file name=img size=20></td>
    </tr><tr>
    <td><textarea name="comment" cols=15 rows=5></textarea></td><td>File Comments</td>
    </tr><tr>
    <td><input type="submit" name="submit" value="Upload"></td><td><input type=reset value=Clear></td>
    </tr></table>
    </form>
    <hr>
    </body>
    </html>
    [/code]

    ul.php:

    [code]
    <?php
    include("inifunc.inc");
    include("func.inc");
    $log = "";
    $abpath = "./";
    $moo = enumUploads();
    if(@copy($img, "$abpath/" . $img_name)) {
    if (file_exists($img_name)) {
    $log .= "File was uploaded<br><input type='button' value='back' onclick='history.go(-1)'>";
    $fp = fopen($moo . ".txt", "a");
    $cmnt = $_POST["comment"];
    $cmnt = str_replace("\\", "", $cmnt);
    fwrite($fp, $cmnt);
    fclose($fp);
    write_key("Files", $moo, $img_name, "files.ini");
    }
    }
    else {
    $log .= "Error uploading file";
    }
    echo $log;
    ?>
    [/code]

    again, written on the spot, test it first, if there is errors then pm me and ill give it another once-over

    and finally, linking to the uploaded files, dunno where ur putting it but here it is, we'll say links.html:

    [code]
    <?php
    include("inifunc.inc");
    include("func.inc");
    $moo = enumUploads();
    $num = 0;
    $moo--;
    $links = "<p>
    ";
    while($num!=$moo) {
    $links .= "<li><a href=" . read_key("Files", $num, "404.html", "files.ini") . ">" . read_key("Files", $num, "404.html", "files.ini") . "</a><br><i>" . include("$num.txt") . "</i>
    ";
    $num++;
    }
    $links .= "
    </p>";
    echo $links;     //--- this goes where you want it.
    ?>
    [/code]

    change "404.html" to whatever your error404 page is (if read_key fails somehow it will link them there instead of crashing the script ^.^)

    that should do ya ;) (thats about $150 of my time, yours free, be happy :) )
×
×
  • 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.