[2] | 1 | <?php
|
---|
| 2 | //=======================================================================
|
---|
[265] | 3 | // File: JPGRAPH_ANTISPAM.PHP
|
---|
| 4 | // Description: Genarate anti-spam challenge
|
---|
| 5 | // Created: 2004-10-07
|
---|
| 6 | // Ver: $Id: jpgraph_antispam-digits.php 1930 2010-01-22 20:19:27Z ljp $
|
---|
[2] | 7 | //
|
---|
[265] | 8 | // Copyright (c) Asial Corporation. All rights reserved.
|
---|
[2] | 9 | //========================================================================
|
---|
| 10 |
|
---|
| 11 | class HandDigits {
|
---|
| 12 | public $digits = array();
|
---|
| 13 | public $iHeight=30, $iWidth=30;
|
---|
| 14 |
|
---|
[265] | 15 | function __construct() {
|
---|
| 16 | //==========================================================
|
---|
| 17 | // d6-small.jpg
|
---|
| 18 | //==========================================================
|
---|
| 19 | $this->digits['6'][0]= 645 ;
|
---|
| 20 | $this->digits['6'][1]=
|
---|
| 21 | '/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
---|
| 22 | 'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
---|
| 23 | 'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEgMBIgACEQEDEQH/xAAZAAEBAAMBAAAAAAAAAAAAAAAABgMEBwX/xAAvEAABAwMC'.
|
---|
| 24 | 'BAQEBwAAAAAAAAABAgMEAAURBiESIjFRBxMUQRUWMmFTYnGRkrHC/8QAFgEBAQEAAAAAAAAAAAAAAAAAAAEC/8QAFhEBAQEAAAAA'.
|
---|
| 25 | 'AAAAAAAAAAAAAAER/9oADAMBAAIRAxEAPwDslwiR3oDku8ONttsAvDiVyMcO/ET7ke5/aoOz6k1Vr5htNjW7a7M1yO3NTQU9JUDu'.
|
---|
| 26 | 'GgrlSn8xyf6p4gXaHJvNps9/mKZtSkGdMjRwpfqAFBLLACRlZUrJONsI2717No1lbZ10kx7XGnRpKWQ/6GVGMfzEJ5VFIVtsOH6e'.
|
---|
| 27 | 'wyKVhYsia0y22pLThSkJK1uniVgdThOM0ol+StIUhpopIyCFq3H8aUVCwnG3PGe4Rp6fLXJtMdyM0ojcIWvIz3HFnAPfrWTXb6GN'.
|
---|
| 28 | 'WaLXDwZjVz8pKEfhuIUFg/bAz9sVJ61nt61mxJFslLtq7e5yPqiBT4UDklKw4MDpt+u+9bFiu9riXNu83R+fcr6tohuQ5HQhmK37'.
|
---|
| 29 | 'paaC8DruScmg6X8KkjZEhbaB9KEyFYSOw26Uqd+e7Qerl5z74DY/1SomP//Z' ;
|
---|
[2] | 30 |
|
---|
[265] | 31 | //==========================================================
|
---|
| 32 | // d2-small.jpg
|
---|
| 33 | //==========================================================
|
---|
| 34 | $this->digits['2'][0]= 606 ;
|
---|
| 35 | $this->digits['2'][1]=
|
---|
| 36 | '/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
---|
| 37 | 'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
---|
| 38 | 'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEQMBIgACEQEDEQH/xAAYAAEBAQEBAAAAAAAAAAAAAAAFAAQHAv/EACsQAAEDBAEC'.
|
---|
| 39 | 'BAYDAAAAAAAAAAIBAwQABQYRIRIxQVFhcQcTFSJSU5GU0f/EABcBAAMBAAAAAAAAAAAAAAAAAAECAwT/xAAZEQACAwEAAAAAAAAA'.
|
---|
| 40 | 'AAAAAAAAARESUUH/2gAMAwEAAhEDEQA/AOqXm/Q8dxmOL4PPSnCSNFixx6nXnkXgRT3Te17JWbGsveueSyLZdbPItNxOKLzTLjou'.
|
---|
| 41 | 'gYCSoSoY8ISKSbFeUrzkdlnTL1YshskiErkQnFEZaF8kkdBBVdjyi6RNL5+9F486eS/ECVkcBtDt1vZcho5viS8ZCp9C9tAIAm/F'.
|
---|
| 42 | 'VoPRU+HRtJ5JVRP1kP0PfwP+1VKrHBMliXG4Nw8VgE4xGkuqk2S1wTUNEVdIvgpL9iL6KtNxY7WOwo9tt0RCitj0sR2uCbFPPzH1'.
|
---|
| 43 | '7+6rRuSRcljMBMsUy2tky045KOawZk5xtEFBJEROO3hx61kh2rPCIX3MhsyC4QmfTbC6lH8dq5212qwkiG5H6Y/9R2qm+ofxqqsL'.
|
---|
| 44 | 'DLZ6f//Z' ;
|
---|
[2] | 45 |
|
---|
[265] | 46 | //==========================================================
|
---|
| 47 | // d9-small.jpg
|
---|
| 48 | //==========================================================
|
---|
| 49 | $this->digits['9'][0]= 680 ;
|
---|
| 50 | $this->digits['9'][1]=
|
---|
| 51 | '/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
---|
| 52 | 'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
---|
| 53 | 'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEgMBIgACEQEDEQH/xAAZAAACAwEAAAAAAAAAAAAAAAAABAUGBwP/xAArEAABAwMD'.
|
---|
| 54 | 'AgYBBQAAAAAAAAABAgMEBQYRABIhE1EUIjEzQUIHMlJhcdH/xAAWAQEBAQAAAAAAAAAAAAAAAAACAQD/xAAYEQEAAwEAAAAAAAAA'.
|
---|
| 55 | 'AAAAAAAAAREhQf/aAAwDAQACEQMRAD8AkK7brF6X7XpMeGoKhFMLEeT4ZUheEhanF4OcZ2pTgDykk92bZpdCsi7aezLjxkIPUZiV'.
|
---|
| 56 | 'RSCy8hah7EkZ27yM7V+iscal5bE22Lon1qNDmSKROd8Sl+Ix1lMOlIS4HGgQpbStoUCnlJz8HmsXtW3Lst2rmBAelLMRRekOwnYz'.
|
---|
| 57 | 'Edls9QKKnOVLyk7UgcbzzrdBthqEJJwZbAI4x1U/7o1TaFa9lG36aXaZTy54VrcXUgrzsGdx+T30aNydweqVw1GS87T6Lb86Q4ha'.
|
---|
| 58 | 'my/IAYjZBx+snKk99oOQMf1AViE65SY348hzFy6hPKnqtKz7DC1lbqyPrvJKUJ7H+M6Wrt3InP7o1brFNp4bCDGhxGAsqz69VSiQ'.
|
---|
| 59 | 'ORwBxrrQ7itm1ac7Hp0WoGTIc3PSn0pccdcP2WorycfA1RaRHjxosZqOyhtDTSAhCf2gDAGjVHTd9sKSCumynFEZK1tIJUe58/ro'.
|
---|
| 60 | '1V1//9k=' ;
|
---|
[2] | 61 |
|
---|
[265] | 62 | //==========================================================
|
---|
| 63 | // d5-small.jpg
|
---|
| 64 | //==========================================================
|
---|
| 65 | $this->digits['5'][0]= 632 ;
|
---|
| 66 | $this->digits['5'][1]=
|
---|
| 67 | '/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
---|
| 68 | 'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
---|
| 69 | 'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEgMBIgACEQEDEQH/xAAZAAACAwEAAAAAAAAAAAAAAAAABgIFBwT/xAAoEAABAwME'.
|
---|
| 70 | 'AQQCAwAAAAAAAAABAgMEBQYRABIhIkEUMVFhBxNCgaH/xAAVAQEBAAAAAAAAAAAAAAAAAAAAAv/EABcRAQEBAQAAAAAAAAAAAAAA'.
|
---|
| 71 | 'AAABEUH/2gAMAwEAAhEDEQA/ANGvW4YVOeiRX5b4mv5Sin05IdlupPKdo/j2SO3+6TbPNQvOsTVz33KRT4csR3YUF7Dsh5OSFvug'.
|
---|
| 72 | 'kqG4FPBxnjxpvvi4KZb1pTpU+QwxUi2Y7ZIAefUk5ATxnB9/gbtL/wCH1UpuhPUlZlMVaQ0mS8zJjqZOPfc2TwpIUonI9tw40R1r'.
|
---|
| 73 | 'WNGq/wBdJR1XT3lqHBUnGCfkfWjRWs1ve249erQqQYjOtN1FqPUpCXQ4WIzQSsJwT0UpRwQPG0nzqyuNHobjsl9kBuWqoOoXtT1/'.
|
---|
| 74 | 'WppZcA8lKRj64HxqU+3KpAr6plElRVKef3S4E0K9O8pLXVzKcqSsJAB9wSAca6bSoNXeuA1+5pEV+SGFNU1iKVFqI0Vdx2AJUeoz'.
|
---|
| 75 | '8DGlTDwG3CAf3q/pI0ah6MDhLz6U+EpXwPoaNMU//9k=' ;
|
---|
[2] | 76 |
|
---|
[265] | 77 | //==========================================================
|
---|
| 78 | // d1-small.jpg
|
---|
| 79 | //==========================================================
|
---|
| 80 | $this->digits['1'][0]= 646 ;
|
---|
| 81 | $this->digits['1'][1]=
|
---|
| 82 | '/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
---|
| 83 | 'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
---|
| 84 | 'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEwMBIgACEQEDEQH/xAAZAAADAAMAAAAAAAAAAAAAAAAABQYCBAf/xAApEAACAQMD'.
|
---|
| 85 | 'AwQBBQAAAAAAAAABAgMEBREABiESMUEHEyJRkSNCYXGB/8QAFgEBAQEAAAAAAAAAAAAAAAAAAAEC/8QAFxEBAQEBAAAAAAAAAAAA'.
|
---|
| 86 | 'AAAAAAEREv/aAAwDAQACEQMRAD8A6jdd4WLbstILnc4Uq0VoWpkJknb6IjXLHJUePOlez923fcW4r1SxWlqC2UbdKirQif3Xw3yA'.
|
---|
| 87 | 'OFAGT09/kO3OmV3a20MFRf6lIYPcpy7yRRAzgxjIy2M8YwcdiBzpX6d22VNvUlTXsFkuwkrKqNSfnK7F8OTzwrAY+l5zoxKskudN'.
|
---|
| 88 | 'EgQPUT9PBkWF3DH+1GPxo1mLnRoAqF2VRgGOFmX/AAgY/GjRUP6hVMFv2FuFqUvUGrpDFJMBnpdyF5bsAQew7Hxzp6LZNT0yQ1DI'.
|
---|
| 89 | 'wp0QCFBhD0jCsfLZHxbx5xxpTuvb1+v9PV7Ztk9roLPLCjmSSN3mX5ZwqjCgZX7PfWxDQb2in96pv9qq46aTE0bW4x9ceAWAYPwS'.
|
---|
| 90 | 'PsYzoixgmheBGjIVcYCnjp/jHjHbRpe1JLn9OnopE/a0ykvjwDx47aNMXqP/2Q==' ;
|
---|
[2] | 91 |
|
---|
[265] | 92 | //==========================================================
|
---|
| 93 | // d8-small.jpg
|
---|
| 94 | //==========================================================
|
---|
| 95 | $this->digits['8'][0]= 694 ;
|
---|
| 96 | $this->digits['8'][1]=
|
---|
| 97 | '/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
---|
| 98 | 'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
---|
| 99 | 'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AFQMBIgACEQEDEQH/xAAYAAADAQEAAAAAAAAAAAAAAAAABgcEBf/EACsQAAEDAwMD'.
|
---|
| 100 | 'AwMFAAAAAAAAAAECAwQFBhEAEiEUMVEHE0EVYYEiIzJCsf/EABYBAQEBAAAAAAAAAAAAAAAAAAIAAf/EABcRAQEBAQAAAAAAAAAA'.
|
---|
| 101 | 'AAAAAAABERL/2gAMAwEAAhEDEQA/AKL6gVVUa0i1T5QjvTprUJMlxW4R9zgQXe/AH+kaWrntqlWjaq7gpcmotXAw82ht9yY4tch8'.
|
---|
| 102 | 'uAFC0k7VBXPGMY51ruiaue+bThIj+7NbWqS+7HDxajFf6AlB/k44o8ZOABk4xkL0X0tZiojKrlRuGRJjugqldSlKGf6t7BuUQe3J'.
|
---|
| 103 | '44xxxrA1a4KVJipLidri8uLHgqOcfjOPxo0o2hdDvS1CmV2Yl6fS5ioipIQR1CAlKkLKR2UUqAI8g6NRSwuuyHab6s1ufLI/Zai7'.
|
---|
| 104 | 'UBJOxhTS0+6B32pWSFH4CidOdWU0ukLiN1BLr0zG5Sdm3GRvcPhIT858DvjXNrVsSLnm/VIdTXS6tTnFsxZTSN3jchaTwps+O/z9'.
|
---|
| 105 | 'tcBVq3hIX0tYqlIiQHdy5CqRHKHXEjAOMgBKjnvyRk4xrQa7OiGt1K5biYZL8SoVEpjOqkFsONtJCNwASeCQrn7aNUKnQYtLp7EC'.
|
---|
| 106 | 'EylmLHQltptPZKQOBo1FzH//2Q==' ;
|
---|
[2] | 107 |
|
---|
[265] | 108 | //==========================================================
|
---|
| 109 | // d4-small.jpg
|
---|
| 110 | //==========================================================
|
---|
| 111 | $this->digits['4'][0]= 643 ;
|
---|
| 112 | $this->digits['4'][1]=
|
---|
| 113 | '/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
---|
| 114 | 'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
---|
| 115 | 'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEgMBIgACEQEDEQH/xAAYAAADAQEAAAAAAAAAAAAAAAAABAYHAv/EAC0QAAIBAwQA'.
|
---|
| 116 | 'BAMJAAAAAAAAAAECAwQFEQAGEiETFDFBUmGBByIjUVNxobHR/8QAFgEBAQEAAAAAAAAAAAAAAAAAAAIB/8QAGBEBAAMBAAAAAAAA'.
|
---|
| 117 | 'AAAAAAAAAAERIVH/2gAMAwEAAhEDEQA/ANjM00Nxmt1xiWW31CZp5uJwoAAaOQ/n7qfcZHqO5my3q5XX7R6ijiqnNut9u4NyJ4yv'.
|
---|
| 118 | 'JJyjYr8Xhrn5g599J7x3ulBNU7Zo7dXXXcLQ8kURYi4epYtkALjOePv1nUvbLvV7P3BZm3DR3eh88Kp7pVzBZI6iUhGWRRGWwE44'.
|
---|
| 119 | 'HX3V+uiL1uHgt+vL/H+aNJQ3CSeCOaFqSaJ1DJKs/TqRkMOvQjvRorHE4pRDLNWLGlRHGUeYIORXs9e5B7OP31E0fmdyb/t0DJ4Q'.
|
---|
| 120 | '27bfx3YZzPUIoAAz7IpOD6cuxq0uNumqLfVNDOqXBoZEjnZcqhIPXH4c46+WkdoWOltu3IDDLLLVVR83UVcuPEmmcZZ2/rHoAANG'.
|
---|
| 121 | 'GI7KIY1ijoLeEQBVCwIoAHpgY6Hy0aZe7mJ2jeHLKcEhusj6aNKgzr//2Q==' ;
|
---|
[2] | 122 |
|
---|
[265] | 123 | //==========================================================
|
---|
| 124 | // d7-small.jpg
|
---|
| 125 | //==========================================================
|
---|
| 126 | $this->digits['7'][0]= 658 ;
|
---|
| 127 | $this->digits['7'][1]=
|
---|
| 128 | '/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
---|
| 129 | 'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
---|
| 130 | 'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEgMBIgACEQEDEQH/xAAZAAACAwEAAAAAAAAAAAAAAAAABgEFBwT/xAAuEAABAwIE'.
|
---|
| 131 | 'BAQGAwAAAAAAAAABAgMEBREABiExEhMiQSMyUXEHFBclVJFhk9L/xAAXAQADAQAAAAAAAAAAAAAAAAAAAQID/8QAGREBAQEAAwAA'.
|
---|
| 132 | 'AAAAAAAAAAAAAAEREiFR/9oADAMBAAIRAxEAPwDXq9mCjZeQ05VZ5ZST4bfEpa3VdglCbqUe+g9MZ5Uq7V8415WXoMSdQ6etgSps'.
|
---|
| 133 | '19wpkCMDZKUpv0FZvbi1NzpYasMDLDUbMVXrtQdbeeU23xLWkj5RlLYK0J7anW9gbAjCzkOtsVSUJUdtc6dVZK51UeaFm4LKbhpC'.
|
---|
| 134 | 'l7EhIFkDW974GbRI2XorUVls1OTdKAOqUpR0Hc3198GITQ6k+hLwrEpoODiDenRfW23bBicg78JXxPpD0mgVOW5PAivNNpahsPW5'.
|
---|
| 135 | '8xxQaSVkboQnhsnYm5OHqDGp1IpsalMKjMsMIC3+XZKbJFth62/QOEfMOZqZXp9JcKZTcGmTky3meSi7xQklI81vMR+sXIz/AEgp'.
|
---|
| 136 | 'Q0qPNu6ea8Q2jqtbp8+2w9h/OKORc/cpHjt1dDSHOtLZ4ekHW23bBjj+o9H/AB539aP94MG0+L//2Q==' ;
|
---|
[2] | 137 |
|
---|
[265] | 138 | //==========================================================
|
---|
| 139 | // d3-small.jpg
|
---|
| 140 | //==========================================================
|
---|
| 141 | $this->digits['3'][0]= 662 ;
|
---|
| 142 | $this->digits['3'][1]=
|
---|
| 143 | '/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
---|
| 144 | 'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
---|
| 145 | 'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEgMBIgACEQEDEQH/xAAZAAACAwEAAAAAAAAAAAAAAAAABAUGBwL/xAArEAABBAED'.
|
---|
| 146 | 'AwMDBQEAAAAAAAABAgMEBREABhIhMUEiMmETFZEHFkJDUdH/xAAWAQEBAQAAAAAAAAAAAAAAAAABAAL/xAAYEQEBAQEBAAAAAAAA'.
|
---|
| 147 | 'AAAAAAAAEQExQf/aAAwDAQACEQMRAD8A0vclruBdk3VVLLUNssGRJsZSCtqOjlgJAHvcOD6c4HnOdIbcttw1W5P29cFEhuawqTXS'.
|
---|
| 148 | 'VsJjnCMBxKkJJx7goAde+ceJfdNxU0UNlyymyXHi6kxWUNl1S3EnkAEIHX2nv86qtTuZr9Q9+1VhRsOoYpYcgSVyAE/TdewkJxnK'.
|
---|
| 149 | 'sBCjkdPGpnOtFMd3PqsXgfOAgD8Y0aX+11H9rDDjn8lr9yj5J+dGqsqxaw6Cc9cQZU4Sp7zTJsIrKlcUEKwhSin1JABI45GUjqOu'.
|
---|
| 150 | 'lbOvjbc3Ts9ynjGCy445UuFLYRzbWgrT6fhSCQSMDke+pew2zYVly/d7YchNqkMJZnQpgV9J8IzwWFJyUrAJHYgjvpLbu37G5nR7'.
|
---|
| 151 | 'vck5C3YRKYEOEVJZj8kjKypXqWvirjk9h+dB9i4faa89TDZUfKlIyT8k+To10a6KTkpcJ/0vL/7o0TS//9k=' ;
|
---|
| 152 | }
|
---|
[2] | 153 | }
|
---|
| 154 |
|
---|
| 155 | class AntiSpam {
|
---|
| 156 |
|
---|
[265] | 157 | private $iNumber='';
|
---|
[2] | 158 |
|
---|
[265] | 159 | function __construct($aNumber='') {
|
---|
| 160 | $this->iNumber = $aNumber;
|
---|
[2] | 161 | }
|
---|
| 162 |
|
---|
| 163 | function Rand($aLen) {
|
---|
[265] | 164 | $d='';
|
---|
| 165 | for($i=0; $i < $aLen; ++$i) {
|
---|
| 166 | $d .= rand(1,9);
|
---|
| 167 | }
|
---|
| 168 | $this->iNumber = $d;
|
---|
| 169 | return $d;
|
---|
[2] | 170 | }
|
---|
| 171 |
|
---|
| 172 | function Stroke() {
|
---|
| 173 |
|
---|
[265] | 174 | $n=strlen($this->iNumber);
|
---|
| 175 | for($i=0; $i < $n; ++$i ) {
|
---|
| 176 | if( !is_numeric($this->iNumber[$i]) || $this->iNumber[$i]==0 ) {
|
---|
| 177 | return false;
|
---|
| 178 | }
|
---|
| 179 | }
|
---|
[2] | 180 |
|
---|
[265] | 181 | $dd = new HandDigits();
|
---|
| 182 | $n = strlen($this->iNumber);
|
---|
| 183 | $img = @imagecreatetruecolor($n*$dd->iWidth, $dd->iHeight);
|
---|
| 184 | if( $img < 1 ) {
|
---|
| 185 | return false;
|
---|
| 186 | }
|
---|
| 187 | $start=0;
|
---|
| 188 | for($i=0; $i < $n; ++$i ) {
|
---|
| 189 | $size = $dd->digits[$this->iNumber[$i]][0];
|
---|
| 190 | $dimg = imagecreatefromstring(base64_decode($dd->digits[$this->iNumber[$i]][1]));
|
---|
| 191 | imagecopy($img,$dimg,$start,0,0,0,imagesx($dimg), $dd->iHeight);
|
---|
| 192 | $start += imagesx($dimg);
|
---|
| 193 | }
|
---|
| 194 | $resimg = @imagecreatetruecolor($start+4, $dd->iHeight+4);
|
---|
| 195 | if( $resimg < 1 ) {
|
---|
| 196 | return false;
|
---|
| 197 | }
|
---|
| 198 | imagecopy($resimg,$img,2,2,0,0,$start, $dd->iHeight);
|
---|
| 199 | header("Content-type: image/jpeg");
|
---|
| 200 | imagejpeg($resimg);
|
---|
| 201 | return true;
|
---|
[2] | 202 | }
|
---|
| 203 | }
|
---|
| 204 |
|
---|
| 205 | ?>
|
---|