Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Anyone want a small web app written in PHP? - Page 2
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Anyone want a small web app written in PHP?

2

Comments

  • perennateperennate Member, Host Rep
    edited April 2013

    @twain said: Maybe you could help answer this:

    Try pwgen -yn1 12 100.

    Edit: like if you do the command you wrote and redirect output to file, it'll only have a single password in the file.

  • I second the idea of a solid, working PHP shell. Would be SO useful for running stuff when putty is not available (even just logged in as a temporary user I could create for such a purpose).

    I'd also like to add a request for a simple file uploader/manager that could function with just a flat database and easily backed up just by tarring the folder, not one like SQL. Being able to create/delete/modify permissions for user accounts and upload/rename/move/delete/download files would be awesome. Basically, a private file upload/storage equivalent of DokuWiki to be used on a small scale :P.

  • joepie91joepie91 Member, Patron Provider

    @user123 said: I second the idea of a solid, working PHP shell. Would be SO useful for running stuff when putty is not available (even just logged in as a temporary user I could create for such a purpose).

    This already exists.

  • raindog308raindog308 Administrator, Veteran

    @user123 said: I second the idea of a solid, working PHP shell. Would be SO useful for running stuff when putty is not available (even just logged in as a temporary user I could create for such a purpose).

    Why not Ajaxterm?

  • twaintwain Member

    @perennate said: Try pwgen -yn1 12 100

    Tried, still getting only one password in the png.

  • @twain said: Tried, still getting only one password in the png

    Ahm, this is getting offtopic...

    But try using other thing like shell_exec, and no backticks

    Also, why do you use a relative path to pwgen?

  • twaintwain Member

    @yomero said: Also, why do you use a relative path to pwgen?

    Had to build it from source, pwgen command was not on Koding.. will try with shell_exec thanks

  • Simple CMS with flat-file database and good permalink.
    So we can move/clone our site wihout any configuration. Think like quickCMS but not that complicated (and expensive).

  • DrukpaDrukpa Member
    edited April 2013

    @twain said: Maybe you could help answer this:

    http://stackoverflow.com/questions/15711639/make-imagettftext-accept-the-whole-pwgen-ny-input-not-just-the-first-password

    You are setting a smaller width and height for imagecreatetruecolor(). The image you created is small to fit all your passwords. Only the first password seem to fit in it.

    So pass a larger width and height values to imagecreatetruecolor() and imagefilledrectangle().

    I don't know how you would dynamically get the width and height of the text you are using, but if the output from pwgen is consistent and same, then you would have to try checking what the perfect height/width values are.

  • @Rikimaru90 said: Simple CMS with flat-file database and good permalink.

    So we can move/clone our site wihout any configuration. Think like quickCMS but not that complicated (and expensive).

    There are many already there.

    http://www.razorcms.co.uk/
    http://getkirby.com/

  • @Drukpa : Already know it, just thinking about a simple form.. maybe can be implemented/modified as a ticketing system using flat-file database..

  • twaintwain Member
    edited April 2013

    @Drukpa - Thanks, better now! http://indigodaddy.koding.com/

    As far as your project, how about make a commenting script (there is Juvia but many think it is lacking) as an alternative to Disqus for those that use static site generators.

  • Do you also do front end devt?

  • DrukpaDrukpa Member
    edited April 2013

    @Rikimaru90 said: @Drukpa : Already know it, just thinking about a simple form.. maybe can be implemented/modified as a ticketing system using flat-file database..

    You really should use a database with your ticketing system. Flat-file DBs can become unmanageable and inefficient as it grows. Also, I can see walking through flat-files seeking certain information can be quite tricky. But you probably know it yourself.

    @yowmamasita said: Do you also do front end devt?

    My regular work involves both frontend/backend, but am not gonna do frontend besides a simple bootstrap mashup for this project. Like I said, I don't really like enjoy doing frontend, more so when you're doing it for free.

  • @Drukpa said: My regular work involves both frontend/backend,

    @Drukpa said: Like I said, I don't really like enjoy doing frontend, more so when you're doing it for free.

    Same here!
    u_u

  • Ok guys, I have decided to do the following:

    An app to check against various blacklists for IPs, and notify you if an IP you own is blacklisted.

    Following features will be provided:

    • Secure user login
    • IP management (Add single IP/IP range)
    • Hourly cron job that checks your IPs against various blacklists, and notifies (mail) you if any IPs are listed

    WIll probably finish it by tomorrow or day after.

  • twaintwain Member

    @Drukpa - this would be quite quite useful, good idea.

  • @twain said: @Drukpa - this would be quite quite useful, good idea.

    As long as it's free

  • @yowmamasita said: As long as it's free

    Ofcourse it will be free, and it's @john 's idea. He thinks it will be of use to hosting providers.

  • Following anything free here.. :D

  • jeffjeff Member

    How about a simple text only classified script that uses bitcoin?

  • @jeff said: How about a simple text only classified script that uses bitcoin?

    bitcoin to do what? for transaction? You want users to buy from each other by paying in bitcoins?

  • jeffjeff Member

    @Drukpa said: bitcoin to do what? for transaction? You want users to buy from each other by paying in bitcoins?

    Yes, for transactions. Also for listing ads and for "private" ads you may have to pay to view them.

  • yes @Drukpa that will be interesting and useful

  • bnmklbnmkl Member
    edited April 2013

    I have made an example class for you @twain :
    (code, font, etc)
    http://ompldr.org/vaTFxdQ/twain.tar.gz

    Preview
    image

    index.php

    <?php
    
    require('./class.TextImage.php');
    
    $text = file_get_contents('./strings.txt');
    
    try {
        $image = new TextImage();
    //  $image->setFontSize(14);
    //  $image->setBackgroundColour('000');
    //  $image->setTextColour('d4d4d4');
        $image->setText($text);
        $image->render();
    } catch (Exception $e) {
        die($e->getMessage());
    }
    
    // END
    
    

    class.TextImage.php

    <?php
    
    class TextImage
    {
        private $fontSize,
                $backgroundColour,
                $textColour,
                $text;
    
        private $FONT,
                $MAX_FONT_SIZE,
                $PADDING_WIDTH,
                $PADDING_HEIGHT,
                $VALID_INT_REGEX,
                $VALID_HEX_REGEX,
                $CACHE_EXPIRES;
                        
        public function __construct()
        {
            $this->fontSize         = 12;
            $this->backgroundColour = 'd4d4d4';
            $this->textColour       = '000';
    
            $this->FONT             = './VeraMono.ttf';
            $this->MAX_FONT_SIZE    = 144;
            $this->PADDING_WIDTH    = 0.1;
            $this->PADDING_HEIGHT   = 0.1;
            $this->VALID_INT_REGEX  = '/^\d+$/';
            $this->VALID_HEX_REGEX  = '/^[a-f0-9]{3}$|^[a-f0-9]{6}$/i';
            $this->CACHE_EXPIRES    = 4;
        }
    
        public function setFontSize($size)
        {
            if (preg_match($this->VALID_INT_REGEX, $size)) {
                if ($size <= $this->MAX_FONT_SIZE) {
                    if ($size > 0) {
                        $this->fontSize = $size;
                    } else {
                        throw new InvalidArgumentException('Font size must be greater than zero.');
                    }
                } else {
                    throw new InvalidArgumentException('Font size must not exceed ' . $this->MAX_FONT_SIZE);
                }
            } else {
                throw new InvalidArgumentException('Font size must be an integer.');
            }
        }
    
        public function setBackgroundColour($colour)
        {
            if (preg_match($this->VALID_HEX_REGEX, $colour)) {
                $this->backgroundColour = $colour;
            } else {
                throw new InvalidArgumentException('Background colour must be a valid hex value.');
            }
        }
    
        public function setTextColour($colour)
        {
            if (preg_match($this->VALID_HEX_REGEX, $colour)) {
                $this->textColour = $colour;
            } else {
                throw new InvalidArgumentException('Text colour must be a valid hex value.');
            }
        }
    
        public function setText($text)
        {
            $this->text = $text;
        }
    
        public function render()
        {
            if ($this->text) {
                $TOP_RIGHT_X    = 4;
                $TOP_LEFT_X     = 6;
                $BOTTOM_LEFT_Y  = 1;
                $TOP_LEFT_Y     = 7;
    
                $textBox    = imagettfbbox($this->fontSize, 0, $this->FONT, $this->text);
                $textWidth  = abs($textBox[$TOP_RIGHT_X] - $textBox[$TOP_LEFT_X]);
                $textHeight = abs($textBox[$BOTTOM_LEFT_Y] - $textBox[$TOP_LEFT_Y]);
    
                $imageWidth = $textWidth + ceil($textWidth * $this->PADDING_WIDTH);
                $imageHeight= $textHeight + ceil($textHeight * $this->PADDING_HEIGHT);
    
                $textX = ($imageWidth / 2) - ($textWidth / 2);
                $textY = ($imageHeight / 2) - ($textHeight / 2) + $this->fontSize;
    
                $image = imagecreatetruecolor($imageWidth, $imageHeight);
                imagefill($image, 0, 0, $this->hexToDec($this->backgroundColour));
                imagefttext($image, $this->fontSize, 0, $textX, $textY, $this->hexToDec($this->textColour), $this->FONT, $this->text);
    
                header('Content-Type: image/png');
                header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + $this->CACHE_EXPIRES));
                header('Cache-Control: public');
                imagepng($image);
                imagedestroy($image);
            } else {
                throw new RuntimeException('Text is required.');
            }
        }
    
        private function hexToDec($hex)
        {
            if (strlen($hex) === 3) {
                $hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
            }
            return hexdec($hex);
        }
    }
    
    // END
    
    

    Thanks for the Action.io post.

  • @Drukpa said: Running shell commands via php is tricky I think. If you want to run privileged commands, you'd have to give "root" privileges to apache which poses a lot of security risk. If you have other users/sites, they will be able to run those commands too.

    Trust me, it is tough i am building a mail server install script with php web interface and it is definitely a learning curve.

  • @bnmkl said: I have made an example class for you @twain :

    Huh, I miss the thanks button

  • twaintwain Member

    @bnmkl - wow that looks like a lot of work you put in to that. I will have to try your solution later on today. If I throw this up on a live domain you will certainly be credited in whatever way you wish.

Sign In or Register to comment.