Jump to content

True`Logic

Members
  • Posts

    59
  • Joined

  • Last visited

    Never

Posts posted by True`Logic

  1. the Modify button seems to have vanished from my previous psot so please excuse the doubble post..


    P.S.:

    before the obvious "answers" come in, I have uncommented the line, i have restarted the webserver, there are no extra gd2.dlls, i only have 1 php.ini on my comp, and no gd doesnt show up in phpinfo();, also gd_info is an undefined function. the extension_dir is correct and php_gd2.dll does exist in the extension dir

    hope you can help :(

    -Logic
  2. I'm having the exact same problem, php_gd2.dll is present in my extension_dir, and i have uncommented ;extension=php_gd2.dll, but gd functions do not work for me..

    Fatal error: Call to undefined function imageCreateFromJpeg() in E:\htdocs\test.php on line 16

    though the code is irrelevant to the problem at hand I'll post the code anyway (it's directly from php.net as a reference to get started learnign gd functions)

    [code]
    <?php
    $src_file = 'source.jpg';
    list($src_w, $src_h, $src_t, $src_a) = getimagesize($src_file);

    $ptr_file = 'pointer.png'; // must have no transparency, but white background
    list($ptr_w, $ptr_h, $ptr_t, $ptr_a) = getimagesize($ptr_file);

    // destination image dimensions:
    $dst_w = 400;
    $dst_h = 200;

    // pointer position:
    $ptr_x = 195;
    $ptr_y = 70;

    $srcImage = imageCreateFromJpeg($src_file) or die ('failed imageCreateFromJpg');
    $dstImage = imageCreateTrueColor($dst_w, $dst_h) or die ('failed imageCreateTrueColor');

    imageCopyResampled($dstImage, $srcImage, 0, 0, 0, 0, $dst_w, $dst_h, $src_w, $src_h) or die ('failed imageCopyResampled');

    $ptrImage = imageCreateFromPng($ptr_file) or die ('failed imageCreateFromPng');

    $ptr_white = imageColorAllocate($ptrImage,255,255,255);
    imageColorTransparent($ptrImage,$ptr_white);

    imageCopyMerge($dstImage, $ptrImage, $ptr_x, $ptr_y, 0, 0, $ptr_w, $ptr_h, 100) or die ('failed imageCopyMerge');

    imageJpeg($dstImage,'',100) or die ('failed imageJpeg');

    imageDestroy($srcImage) or die ('failed imageDestroy(1)');
    imageDestroy($dstImage) or die ('failed imageDestroy(2)');
    imageDestroy($ptrImage) or die ('failed imageDestroy(3)');
    ?>
    [/code]
  3. Yes im wondering the same thing, I wish to add a footer with google ads to my site, Mod layout looks like it would work and quite simpol, but I'd like to use mod_include which comes with apache 2.2 before compiling and adding a new module.. I have Includes in the options but cant figure out how to force it to put
    <!--#include virtual="/footer.html" -->
    on the bottom of all my pages, some help would be appreciated with mod_include or mod_layout..
  4. it's image upload... why use SQL? you can do that with plain old PhP, easier, quicker, more efficient, less errored...
    try this maybe?

    [code]
    <?php
    function GetFile() {
    $num = 0;
    while(file_exists($num . ".jpg")){
    $num++;
    }
    return $num;
    }
    $num2 = 0;
    $e = "";
    while ($num2 < GetFile()) {
    $e .= "Image number: #$num2<br><a href=$num2.jpg><img src='$num2.jpg' width=180 height=180 title='click for full size'></a><br>";
    $e .= fread(fopen("$num2.txt", "r"), filesize("$num2.txt"));
    $e .= "<br><hr><br>";
    $num2++;
    }

    if(!isset($img_name)) {
    echo "
    <html>
    <head>
    <title>Picture Uploader</title>
    </head>
    <body>
    " . $e . "
    <br>
    <hr>

    NOTE: Security is taken very seriously here, it is tight enough to cause one small bug, while filename.jpg and filename.gif are acceptable<br>
    file.name.jpg and file.name.gif are NOT, sorry for the inconvinience.. just deal with it.<br>
    <u>Rules For Uploading</u>:<br>
    <p>
    <li> .jpg's and .gif's only<br>
    <li> picture must be 150kb (153600 Bytes) or less
    </p>
    <br>
    <form method=POST action=test2.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>Image Comments</td>
    </tr><tr>
    <td><input type=\"submit\" name=\"submit\" value=\"Upload\"></td><td><input type=reset value=Clear></td>
    </tr></table>
    </form>
    <br>
    <form name=del action=del.php method=post>
    <input type=text name=numba>Image Number<br>
    <input type=password name=password>Deletion password<br>
    <input type=submit value=delete><br>
    </form>
    </body>
    </html>";
    }
    else {
    $a = strstr($img_name, ".");
    if ($a != ".jpg" && $a != ".gif") {
    echo "only formats accepted are .jpg and .gif!<input type='button' value='back' onclick='history.go(-1)'>";
    } elseif ($img_size > 153600) {
    echo "Cannot upload above a 150kb file (153600 bytes)<input type='button' value='back' onclick='history.go(-1)'>";
    } else {
    $log = "";
    $abpath = "./";
    $moo = GetFile();
    @copy($img, "$abpath/" . $moo . ".jpg") or $log .= "Couldn't copy file to server<br><input type='button' value='back' onclick='history.go(-1)'>";
    if (file_exists("$abpath/" . $moo . ".jpg")) {
    $log .= "File was uploaded<br><input type='button' value='back' onclick='history.go(-1)'>";
    $fp = fopen($moo . ".txt", "a");
    fwrite($fp, $_POST["comment"]);
    fclose($fp);
    }
    echo $log;
    }
    }
    ?>
    [/code]

    del.php:
    [code]
    <?php
    $ps = $_POST["password"];
    $psw = "*******";  //--- replace *'s with your pass
    $imagenumber = $_POST["numba"];
    if ($ps != $psw) {
    echo "incorrect password";
    } elseif(!file_exists($imagenumber . ".jpg")) {
    echo "Invalid Id #";
    } else {
    unlink($imagenumber . ".jpg");
    unlink($imagenumber . ".txt");
    $num = $imagenumber;
    $num++;
    while(file_exists($num . ".jpg")){
    $num++;
    }
    $num2 = $imagenumber;
    $num2++;
    if (file_exists($num2 . ".jpg")) {
    while($num2 < $num) {
    $num3 = $num2;
    $num3--;
    rename($num2 . ".jpg", $num3 . ".jpg");
    rename($num2 . ".txt", $num3 . ".txt");
    $num2++;
    }
    }
    echo "Succesful.";
    }
    ?>
    [/code]
  5. i had to figure out how to sort arrays for my little mmorpg project, so i know where your coming from in the confusion, here's the part of my code that handles the sorting, see if you can learn from it maybe?

    [code]
    while ($sPC < $mPC) {
    $order[$sPC] = read_key("PC", $sPC, "", "users.ini");
    $orderL[$sPC] = read_key("INFO", "level", 0, read_key("PC", $sPC, "", "users.ini") . "MEEP.ini");
    $sPC++;
    }
    array_multisort($order, SORT_NUMERIC, $orderL);
    [/code]


    for further reference:

    http://us3.php.net/manual/en/function.array-multisort.php

    and

    http://us3.php.net/manual/en/ref.array.php





    hope this helped - TL
  6. basically youll need to include a file which has an array of the english word into the other language, then split your dialogues into an array on chr(32), after that you only need to use str_replace($words[$num], $lang[$words[$num]]) in a while statement =)
  7. try @copy()..

    your form:
    [code]
    <form method=POST action=test2.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>Image Comments</td>
    </tr><tr>
    <td><input type="submit" name="submit" value="Upload"></td><td><input type=reset value=Clear></td>
    </tr></table>
    </form>
    <br><hr>
    <?php
    if(file_exists("uploaded_files.html")) {
    echo "<a href=uploaded_files.html>Uploaded Files</a>";
    }
    ?>
    [/code]

    test2.php:
    [code]
    <?php
    $a = strstr($img_name, ".");
    if ($a != ".jpg" && $a != ".gif") {
    echo "only formats accepted are .jpg and .gif!<input type='button' value='back' onclick='history.go(-1)'>";
    } elseif ($img_size > 153600) {
    echo "Cannot upload above a 150kb file (153600 bytes)<input type='button' value='back' onclick='history.go(-1)'>";
    } else {
    $log = "";
    $abpath = "./";
    function GetFile() {
    $num = 0;
    while(file_exists($num . ".jpg")){
    $num++;
    }
    return $num;
    }
    $moo = GetFile();
    @copy($img, "$abpath/" . $moo . ".jpg") or $log .= "Couldn't copy file to server<br><input type='button' value='back' onclick='history.go(-1)'>";
    if (file_exists("$abpath/" . $moo . ".jpg")) {
    $log .= "File was uploaded<br><input type='button' value='back' onclick='history.go(-1)'>";
    $fp = fopen($moo . ".txt", "a");
    fwrite($fp, $_POST["comment"]);
    fclose($fp);
    /* $filename = "uploaded_files.html";
    $fp = fopen($filename, "a");
    fwrite($fp, "<hr>
    Image Number: #" . $moo . "<br><a href=$abpath/" . $moo . ".jpg><img src='$abpath/" . $moo . "' width=90 height=90 title='click for fullsize'></a><br>
    ". $_POST["comment"] . "<br>
    ");
    fclose($fp);
    */
    }
    echo $log;
    }
    ?>
    [/code]


    seems easier ^.^

    hope this helped - TL
  8. just make a lil bool isin() function using mid() to automatically check a passage of text for the queried string, i think PhP migh thave such a function built in, but im not quite sure.. if not, it's quite easy to make and seems to me to be self explanitroy, then jus torganise your database in a numerical fassion and use a little for() { } or while() { } loop to search database 1 entry at a time for if(isin(current_cell, $_GET["query"]))


    hope this helped... works better and much easier with Ini's than SqL Db's i think
  9. [code]{
    ?>

    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    <table border="0">
    <tr><td>Username:</td><td>
    <input type="text" name="username" maxlength="60">
    </td></tr>
    <tr><td>Password:</td><td>
    <input type="password" name="pass" maxlength="10">
    </td></tr>
    <tr><td>Confirm Password:</td><td>
    <input type="password" name="pass2" maxlength="10">
    </td></tr>
    <tr><th colspan=2><input type="submit" name="submit" value="Register"></th></tr> </table>
    </form>

    <?php
    }
    [/code]


    :P try..

    [code]
    {
    echo "
    <form action=" . $_SERVER['PHP_SELF'] . " method=\"post\">
    <table border=\"0\">
    <tr><td>Username:</td><td>
    <input type=\"text\" name=\"username\" maxlength=\"60\">
    </td></tr>
    <tr><td>Password:</td><td>
    <input type=\"password\" name=\"pass\" maxlength=\"10\">
    </td></tr>
    <tr><td>Confirm Password:</td><td>
    <input type=\"password\" name=\"pass2\" maxlength=\"10\">
    </td></tr>
    <tr><th colspan=2><input type=\"submit\" name=\"submit\" value=\"Register\"></th></tr> </table>
    </form>";
    }
    [/code]
  10. [quote]
    Really? So the second I attempt to connect you somehow manage to download the entire contents of my 250gb hard drive instantly over my 512Kbps/up DSL? Must be magic.
    [/quote]
    its not hard to scan an outside comp and know every file name in every directory in a  "Tree" template

    (
    C
    ---Documents and settings
    ------User
    ---------my documents
    ------------my pictures
    ----------------summer vac01.jpg
    ----------------summer vac02.jpg
    ----------------summer vac03.jpg
    )
    etc.. and have a simple text file of everything, 512kb/s could send a little 3-10kb text file pretty instantly.... and it wouldnt increase the size to much to have a desc added..
    (
    ----------------summer vac01.jpg
                              Author: So&So
                              Ctime: july 4, 1994
                              Format: jpeg/Image File
                              etc..
    )

    so yes thats monitorable, also, a miniscule packet sniffer could be upoaded to your comp, which would monitor all data sent on your network, a keylogger to watch what you type on and offline, and of course a little trojan to upload your files slowly over time.. and no, just because these little virants are "viruses" doesnt mean your multitude of scanners will pick them up.

    jsut clarifying things, back on topic now.. XD
  11. x[) this is why i don't use MySQL, just enumerate file names (0.jpg, 1.jpg, etc), put security on ur uploader so only certain file types are allowed, then enumerate displays with a function (a little while(file_exists("$num.jpg")) { } loop) and bam, you've avoided your problem
×
×
  • 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.