Jump to content

Search the Community

Showing results for tags 'ascii'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 2 results

  1. Hey everyone, I wrote a Caesar cipher (a script where, given a message, the letters in the message are shifted x number of places; e.g. A => D, B => E, C => F, X => A, Y => B, Z => C, etc.). It works but it shifts all ASCII characters. I want to exclude characters that are not A-Z or a-z (outside the ASCII values of 65 - 90 and/or 97 - 122) so that spaces, punctuation, numbers all remain the same instead of shifting as well. Here's the form on index.html <form class="form-inline" role="form" method="post"> <div class="table-responsive"> <table> <tr class="tr_top"> <td class="td_top"><textarea class="form-control" rows="4" name="msg" placeholder="Your message here." onfocus='this.select()'><?php require ('encode.php'); require ('decode.php'); if (isset($_POST['encode'])) { echo $encstring; } elseif (isset($_POST['decode'])) { echo $decstring; } ?></textarea></td> </tr> <tr class="tr_mid"> <td class="td_mid"><input type=text class="form-control input_mid" name="offset" value="<?php if (isset($_POST['encode']) || isset($_POST['decode'])) { echo htmlspecialchars($_POST['offset']);} ?>" placeholder="Enter a number." pattern="[0-9]{0,3}" oninvalid="setCustomValidity('Please enter a number between 1 and 999.')" oninput="setCustomValidity('')"></td> </tr> <tr class="tr_bottom"> <td class="td_bottom"> <input class="input_bottom btn btn-default submit" type="submit" name="encode" value="Encode"> <input class="input_bottom btn btn-default submit" type="submit" name="decode" value="Decode"> <input class="input_bottom btn btn-default" type="button" value="Clear"</td> </tr> </table> </div><!-- close table-responsive --> </form> <?php //encode require ('encode.php'); if (isset($_POST['encode'])) { echo "<p>Original message:</p>"; echo "<p class='string ital'>" . $string . "</p>"; echo "<p>Encoded message:</p>"; echo "<p class='string ital'>" . $newstring . "</p>"; } //decode require ('decode.php'); if (isset($_POST['decode'])) { echo "<p>Encoded message:</p>"; echo "<p class='string ital'>" . $string . "</p>"; echo "<p>Decoded message:</p>"; echo "<p class='string ital'>" . $newstring . "</p>"; } ?> and here is encode.php <?php $string = $_POST['msg']; $newstring = $string; $sp = $_POST['offset']; for ($i=0; $i < strlen($string); $i++) { $ascii = ord($string[$i]); for ($j=0; $j < $sp; $j++) { if ($ascii == 90) { //uppercase bound $ascii = 65; //reset back to 'A' } else if ($ascii == 122) { //lowercase bound $ascii = 97; //reset back to 'a' } else { $ascii++; } } $newstring[$i] = chr($ascii); $encstring = $newstring; } ?> Any help would be appreciated as I can't figure it out. If you want to see it in action it's here.
  2. Hi all Basically, I'm looking for a way in PHP to read plain ascii text from out of any .pdf file I've Googled around a bit, but so far everything I've found suffers from either one of two drawbacks : 1. It requires me to install something on the server, which I'd rather not do, I'm looking for some PHP classes ideally 2. The recommended code, despite its promises, just doesn't work in practice! So basically, I'm asking does anybody know of anything to read text from a PDF file which they have used for themselves and can recommend. Many thanks.
  • 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.