<?php
// signature_signature.php
// RJM Programming
// May, 2017
// Help out signature_signature.html with large data set signatures

$overridinghtml="";
$content="";
$th="";
$oursubj="Signature's Signature";
$htmlis="";
$divcont="";
$data=["",
";00000211.30.244.26;-148,176,148,175,148,173,146,168,138,152,133,140,130,125,128,112,128,102,128,92,128,85,132,77,137,71,141,66,146,63,152,60,161,58,165,57,170,56,173,56,176,56,178,55,180,55,187,62,191,72,195,83,196,90,196,95,196,97,196,100,193,102,187,106,178,111,168,116,161,120,153,123,147,123,145,125,142,125,143,125,145,125,147,125,151,125,157,123,166,123,175,123,186,126,193,128,196,128,202,132,206,136,208,140,211,143,213,147,216,150,216,151,217,152,-271,161,271,160,268,157,262,151,257,142,250,128,246,115,242,96,242,80,242,68,253,53,262,53,272,55,282,62,288,66,303,86,310,100,312,107,313,115,315,120,315,122,315,123,315,122,313,121,312,113,312,103,312,93,315,87,321,81,331,77,345,75,360,73,386,73,400,83,408,95,417,111,423,127,427,136,428,142,430,147,431,148,431,150,-446,138,448,138,465,130,475,123,486,113,496,103,501,96,506,90,507,86,508,82,508,80,506,78,501,78,497,78,492,78,491,80,488,81,487,86,486,93,485,101,485,110,485,116,485,121,488,123,506,130,526,131,546,126,553,111,557,96,561,76,563,55,565,32,565,12,565,3,565,6,565,13,563,28,563,60,565,112,568,135,571,155,575,170,577,177,578,178,580,178,582,177,585,175,588,168,593,160,598,150,603,141,608,133,613,125,618,121,622,118,630,115,633,115,637,113,638,113,641,112,640,112,638,111,633,110,628,107,623,105,620,105,618,105,616,105,613,106,612,111,612,117,612,123,615,130,622,141,625,142,640,148,650,150,655,150,665,146,676,140,686,132,693,125,698,117,701,111,703,107,703,106,705,105,706,105,706,103,707,103,706,103,705,103,702,105,700,106,697,110,695,113,693,118,693,123,692,130,690,135,688,140,687,146,686,147,686,148,686,150,687,150,688,150,691,150,693,150,697,150,698,146,703,135,703,132,705,126,705,123,705,122,705,121,705,120,705,118,705,115,705,112,705,111,705,112,705,121,705,127,705,131,705,135,705,136,706,138,706,140,707,141,707,142,707,143,708,143,710,142,711,138,712,133,715,128,716,125,717,121,718,116,720,108,720,92,720,68,721,35,721,23,721,15,721,11,721,10,721,16,721,31,721,53,720,75,720,112,720,122,721,127,-498,80,502,80,508,80,526,76,596,58,640,51,662,50,678,50,691,50,696,50,697,50,697,48",
";0211.30.244.26;-254,166,254,148,254,144,254,141,254,128,254,121,254,113,256,107,259,91,262,82,264,74,269,63,275,52,278,48,280,47,285,41,287,40,292,39,293,40,295,43,299,49,301,53,302,57,307,65,309,68,311,71,314,75,317,80,317,81,317,85,317,86,317,89,317,93,315,96,313,98,307,103,304,105,300,107,293,109,280,111,276,111,266,112,263,113,260,113,258,114,257,114,256,114,258,116,269,122,275,125,282,127,297,134,305,138,308,140,317,145,326,151,328,153,330,154,333,157,335,159,335,160,336,162,337,163,337,164,338,164,338,165,338,164,338,162,-387,158,387,156,386,152,385,149,383,141,382,138,381,134,378,114,378,86,378,77,378,62,378,58,380,54,382,51,385,50,387,50,392,50,398,55,403,61,407,70,410,76,416,89,418,94,421,99,424,105,426,107,427,109,429,111,430,113,432,113,433,111,442,95,446,87,450,78,458,59,461,55,465,48,472,36,476,32,481,28,486,28,488,30,498,45,501,51,509,64,521,81,540,106,550,122,556,131,558,134,565,147,566,148,567,151,568,151,568,146,568,147",
";00000144.139.112.210;-193,152,193,151,193,146,193,144,192,139,192,136,191,132,188,124,188,119,188,112,187,107,187,104,187,101,187,98,187,95,187,94,187,93,187,92,187,91,187,89,187,88,187,87,188,86,192,82,195,78,196,76,198,75,199,74,200,73,201,72,201,71,204,69,206,69,207,68,208,67,209,66,211,66,212,66,214,66,215,66,218,66,219,66,220,67,221,68,221,69,221,71,221,73,221,75,221,80,221,86,221,94,222,102,222,112,222,118,221,124,216,132,214,134,212,136,211,139,209,139,208,139,207,139,206,139,204,139,202,139,201,139,200,139,198,139,196,139,195,136,193,134,193,133,193,132,193,131,193,128,194,127,195,127,196,127,198,127,199,127,201,127,205,127,208,127,209,128,214,129,214,131,216,131,218,133,221,133,225,136,226,138,227,139,228,140,229,141,231,141,232,141,232,142,-247,144,246,142,246,141,247,136,248,129,249,124,253,113,253,106,253,98,255,91,256,84,256,80,256,76,258,75,258,73,260,71,261,69,262,67,262,65,265,62,265,60,265,58,266,55,267,54,267,52,268,52,268,54,268,55,269,60,272,66,274,73,275,79,276,87,276,89,278,93,279,95,279,96,280,98,281,99,282,99,284,99,285,99,286,98,292,92,298,85,304,79,309,73,316,66,322,60,329,53,334,47,340,41,345,38,347,34,349,32,352,31,352,32,352,34,351,38,348,42,347,51,346,68,345,78,341,91,340,102,339,114,335,126,334,136,333,146,332,155,331,159,331,161,329,164,329,165,332,166,333,166,-354,146,354,145,356,144,364,142,372,140,384,133,392,129,396,124,401,121,405,118,407,116,408,115,409,114,411,113,411,112,411,111,409,111,408,111,407,111,406,111,405,111,404,111,402,111,401,111,400,111,398,111,396,111,394,111,392,111,389,112,389,113,387,114,386,115,386,116,384,119,384,120,384,121,382,122,382,125,382,126,385,127,387,129,388,129,389,131,393,131,396,133,400,135,405,136,408,139,411,139,413,140,415,140,419,140,420,140,422,140,425,139,427,136,428,135,429,133,432,129,433,125,434,121,436,115,438,112,439,106,439,104,441,99,442,95,445,89,445,86,446,80,447,78,448,73,449,71,451,67,451,66,451,65,451,66,451,67,451,71,449,73,449,76,447,81,445,88,445,91,445,92,445,94,445,95,444,95,444,96,444,98,444,101,444,106,444,114,444,125,444,133,444,141,442,146,442,148,442,149,442,151,442,152,445,152,448,152,451,152,453,151,454,148,456,145,459,139,459,136,461,133,461,131,464,128,466,126,468,122,469,120,471,120,472,120,473,120,473,121,475,121,479,121,480,121,484,121,486,121,487,121,488,121,491,122,493,122,493,124,495,124,496,124,498,124,499,124,498,124,496,124,495,124,494,124,493,124,492,124,491,124,489,124,488,124,487,124,486,125,485,125,484,125,482,126,480,127,480,128,479,128,476,128,475,131,473,131,473,132,471,134,469,134,468,135,467,135,467,136,467,138,466,139,466,141,466,142,466,145,466,147,466,151,466,154,466,159,467,164,468,166,471,168,472,169,474,169,475,169,482,169,484,169,486,168,488,166,489,164,492,162,494,161,496,160,500,159,501,158,502,158,504,158,505,156,506,156,507,155",
";00000122.106.50.232;-28,29,28,28,28,27,28,25,28,22,28,21,28,19,28,18,28,16,28,14,28,13,43,0,44,0,44,1,45,1,45,2,45,3,46,4,47,5,47,6,47,7,47,8,47,9,46,9,45,10,44,11,43,12,42,13,41,14,40,14,39,15,38,15,37,15,36,15,35,15,34,15,31,15,29,15,27,15,26,15,25,15,25,16,26,16,27,16,28,16,29,17,30,17,32,18,33,18,34,19,35,19,37,20,39,20,41,21,43,21,44,22,45,22,45,23,45,24,46,25,46,26,46,27,-54,28,54,27,54,26,54,23,55,20,56,18,56,17,57,16,57,14,57,13,58,9,59,6,59,5,59,4,60,4,60,3,60,4,61,5,62,6,63,9,65,11,66,13,67,15,68,16,69,17,70,18,70,19,70,20,71,20,71,19,72,19,72,18,73,17,73,16,74,15,75,14,75,13,76,12,76,11,76,9,77,8,77,7,77,6,78,6,78,5,78,4,79,4,79,5,79,6,79,7,79,8,79,10,80,12,81,15,81,17,82,20,82,22,83,23,83,25,83,26,-88,24,89,24,90,24,91,24,93,24,95,24,97,24,100,24,102,24,104,24,105,24,106,24,106,23,107,23,108,22,109,21,110,19,110,18,110,17,110,16,110,15,110,13,110,11,110,10,109,9,109,8,108,8,107,9,106,10,106,11,105,12,104,13,103,14,102,14,102,15,101,15,101,16,101,17,101,18,101,19,102,20,103,20,103,21,104,21,105,21,106,22,107,22,107,23,108,23,109,23,110,23,111,23,112,23,113,23,114,23,115,22,116,22,117,22,118,21,119,21,119,20,119,19,119,17,119,16,119,14,120,13,120,12,121,11,121,10,122,9,122,8,123,7,124,6,124,5,124,4,124,3,124,2,124,1,124,0,124,2,124,6,124,10,124,12,124,13,124,14,124,15,124,16,124,17,124,18,123,18,124,19,125,19,127,20,128,22,129,22,130,22,131,22,132,22,133,22,134,22,135,22,136,20,137,19,138,18,138,17,138,16,139,15,139,14,139,13,140,11,140,10,140,9,140,8,140,7,141,7,142,7,143,7,144,7,145,8,145,9,146,9,146,10,146,11,146,12,147,12,147,11,147,10,147,9,147,8,146,8,145,8,144,8,143,8,143,9,142,9,142,10,141,10,141,11,140,11,140,12,139,12,139,13,138,13,138,14,137,15,137,16,137,17,137,18,137,19,138,20,139,21,140,21,140,22,141,22,142,22,143,22,144,23,145,23,146,23,147,23,148,23,149,23,149,22,150,22,151,21,151,20,152,19,152,18,153,18,153,17,153,16,154,15,154,14,154,13,155,13,155,12,156,12,157,12,158,12,159,13,160,13,161,13,161,12,162,13,163,14,163,15,163,14,163,13,163,12,163,11,162,11,161,11,160,11,158,11,157,11,156,11,155,11,154,11,153,11,152,11,151,12,151,13,150,14,149,15,149,16,148,16,148,17,147,17,147,18,147,19,147,20,147,21,147,22,148,22,149,22,150,22,151,22,152,22,153,22,154,22,155,22,156,22,157,22,158,22,158,21,159,21,159,20,160,20,160,19,161,19,162,19,162,18,163,17,164,17,164,16,164,15,164,14,164,12,164,11,164,10,164,9,163,9,162,10,161,11,161,13,160,14,159,15,159,16,159,17,159,18,159,19,159,20,160,20,160,21,161,21,161,22,162,22,163,23,163,24,164,25,165,25,165,26,166,26,167,25,168,25,169,24,169,23,170,23,170,22,171,22,171,21,172,21,172,20,173,19,173,18,173,16,174,15,174,14,174,13,174,12,174,11,174,9,174,8,174,6,174,5,174,4,175,3,175,2,175,1,175,0,175,2,175,5,175,8,175,11,175,12,175,14,175,15,175,16,175,17,175,18,175,19,175,20,175,21,175,22,175,23,175,24,176,24,176,25,177,25,178,25,179,25,182,25,183,24,184,24,184,23,185,21,185,20,185,18,186,16,186,13,186,12,187,11,187,10,187,9,187,8,187,7,187,6,188,5,188,4,188,3,189,2,190,0,200,0,200,1,200,2,200,3,200,4,199,4,199,3,198,3,197,2,196,1,195,0,194,0,189,0,188,0,188,1,187,1,186,2,186,3,186,4,186,5,186,7,186,8,186,9,186,10,186,11,186,12,186,13,186,14,186,15,186,16,186,17,187,19,187,21,187,22,187,23,188,24,188,25,188,26,188,27,188,28,188,29,188,30,188,31,187,31,187,32,186,32,186,33,185,33,185,34,184,34,183,34,182,34,181,34,180,35,179,35,178,35,177,35,176,35,175,35,174,35,173,34,173,33,-179,12,180,12,182,12,183,12,184,12,185,12,186,12,187,12,188,13,189,13,190,13,191,13,192,13,-188,28,190,28,192,28,194,28,197,26,198,26,199,25,201,25,202,24,203,24,204,23,204,22,205,20,206,20,206,19,206,18,206,17,206,16,206,15,206,14,206,13,207,13,207,12,206,12,205,12,204,12,204,13,203,13,202,13,202,14,201,14,200,15,199,15,199,16,197,17,197,18,196,18,196,19,196,20,196,21,196,22,196,23,196,24,196,25,196,26,196,27,196,28,196,29,197,29,198,29,199,29,200,29,201,29,202,29,202,30,203,30,204,31,206,31,207,31,208,31,209,31,210,31,211,31,211,30,213,28,213,27,214,26,214,25,214,24,215,24,215,23,-112,3,113,3,115,3,119,3,123,3,125,3,127,3,129,3,130,3,131,3,133,3,134,3,136,3,137,3",
";00000114.73.216.233;-62,95,62,94,62,90,60,75,56,60,55,47,55,35,55,28,55,20,59,11,66,4,126,0,130,4,135,14,140,28,140,39,140,50,135,62,124,72,115,79,102,83,91,84,82,84,74,84,71,84,69,83,69,81,69,79,69,77,69,75,70,72,76,70,85,69,94,69,109,70,117,75,123,80,125,82,131,89,134,93,137,96,139,98,141,100,144,101,144,102,-173,89,173,85,173,81,173,74,173,56,173,41,176,26,180,13,183,7,184,4,186,3,188,6,191,15,193,25,196,38,200,50,201,54,203,59,206,63,209,70,211,72,213,74,214,75,215,75,216,75,217,73,220,66,225,58,228,51,232,43,235,37,237,31,238,25,238,20,239,16,239,15,240,15,241,15,242,15,244,16,247,25,251,34,255,43,258,51,262,58,266,68,270,74,274,81,275,82,276,84,276,85,-284,69,286,69,292,69,296,69,302,69,312,65,318,57,323,49,326,40,328,34,329,28,329,25,329,22,327,21,326,21,323,21,318,21,311,21,308,24,306,26,304,27,302,29,300,32,298,35,298,39,298,42,298,45,305,49,320,53,333,58,348,62,358,66,364,68,368,68,370,68,371,62,371,40,371,21,371,6,364,8,364,18,364,38,364,49,364,58,364,64,364,68,366,71,367,73,368,75,369,76,369,77,370,77,371,77,372,77,373,77,374,77,378,77,382,77,386,74,390,72,392,70,394,66,396,62,400,58,403,54,407,51,410,49,412,48,414,48,416,48,417,48,418,48,419,48,422,48,427,50,430,53,432,55,434,56,434,57,435,57,434,55,432,52,426,48,421,45,418,44,416,44,414,44,412,44,410,45,406,50,404,53,402,55,401,57,401,59,401,64,401,70,401,74,401,76,401,80,401,82,406,83,413,85,426,88,435,90,445,90,450,90,453,86,455,82,458,75,459,73,460,69,461,65,461,62,462,61,462,60,463,59,463,58,464,57,464,55,466,54,468,52,474,52,481,52,484,52,486,52,488,52,489,52,489,53,491,54,493,56,494,57,495,58,495,59,494,59,491,59,485,59,478,59,472,56,467,56,465,56,463,56,462,56,461,56,460,56,460,58,459,61,459,63,459,64,459,66,460,68,464,70,470,73,471,74,475,75,477,75,478,75,478,73,478,71,478,68,478,63,478,60,478,57,478,54,478,52,478,51,478,50,478,53,478,56,480,63,482,69,484,74,485,77,486,79,487,80,488,80,489,80,490,80,492,80,494,80,498,78,501,75,504,69,509,59,511,50,513,37,513,26,513,17,513,7,513,1,511,2,511,4,512,10,514,15,516,19,516,24,517,27,517,32,517,36,519,44,520,51,522,57,523,60,524,63,525,66,529,70,532,72,534,73,535,74,536,74,537,74,538,74,539,74,540,74,542,74,545,74,547,73,550,67,552,60,555,52,557,43,561,33,563,29,565,24,568,18,571,13,573,10,576,8,577,6,579,6,581,6,584,6,589,6,593,6,598,7,603,9,609,14,615,20,619,26,620,28,622,30,622,31,621,29,618,27,616,26,610,19,604,15,599,8,593,5,589,3,586,3,584,3,582,3,581,3,580,3,577,9,575,16,574,24,574,31,572,42,572,51,572,59,571,63,571,68,571,71,571,73,571,74,571,75,570,76,570,77,568,83,563,95,560,101,559,103,558,105,556,108,554,110,551,111,546,113,515,115,514,110,511,106,509,102,507,99,506,96,506,95,506,94,506,92,508,90,-530,48,531,48,539,48,545,48,556,48,567,48,576,48,581,48,583,48,586,48,588,47,589,47,591,44,592,44,593,44,595,44,-561,90,563,87,571,80,579,74,586,68,592,62,598,57,603,52,604,50,609,42,612,35,615,31,617,29,618,27,619,27,619,26,616,26,613,26,602,26,597,26,592,28,591,29,589,31,588,32,586,34,584,36,582,38,582,40,582,41,582,42,586,46,592,52,597,58,600,63,602,65,603,67,603,69,604,69,606,69,608,70,613,71,614,71,617,71,618,71,619,71,621,71,623,71,628,66,630,63,633,61,635,60,636,59,-340,22,342,22,347,22,361,22,380,22,402,22,408,22,422,22,429,22,433,22,434,22,435,22,436,22",
";069.59.121.196;-51,96,56,92,62,87,73,80,88,71,105,60,117,54,128,50,133,50,137,49,143,47,152,46,162,46,170,46,173,47,173,48,176,48,178,50,180,54,182,59,183,62,184,67,184,73,183,80,182,89,178,98,175,107,172,115,169,121,167,125,166,125,167,125,173,116,185,104,200,90,213,78,226,71,236,65,245,62,250,62,251,61,254,61,257,61,263,64,270,68,277,73,281,76,284,81,289,87,292,94,293,98,293,102,294,108,294,112,294,114,295,114,295,115,295,118,295,120,296,122,296,125,298,129,299,132,302,136,303,139,304,140,305,140,310,136,317,128,326,119,335,110,343,103,348,99,354,95,359,92,362,91,365,89,368,88,370,88,371,88,370,87,367,87,361,87,354,87,348,89,341,93,337,96,332,100,327,104,324,109,322,111,320,115,320,119,320,124,323,130,331,134,338,136,343,137,346,137,349,137,351,136,356,131,362,120,368,104,374,88,375,78,375,75,375,74,375,80,375,90,380,103,385,113,392,120,396,124,400,125,402,126,404,126,406,125,413,116,422,101,433,80,440,59,443,48,443,44,443,42,443,41,440,48,437,65,436,89,439,115,449,136,458,151,463,156,464,156,469,150,477,134,486,116,497,94,506,71,509,56,509,47,510,41,510,38,510,37,509,37,506,37,503,36,497,36,491,38,482,44,472,55,461,71,452,92,450,113,450,128,453,139,455,143,456,143,459,144,462,146,466,147,472,151,476,153,482,158,486,160,489,162,491,162,490,161,489,158,-411,78,412,78,419,78,434,80,454,85,478,89,501,95,518,98,533,102,558,108,591,115,621,121,635,122,635,123,635,124,634,124,634,122,626,113,614,102",
";0103.79.106.236;-335,76,335,80,337,90,340,101,342,112,342,124,343,135,342,142,340,147,337,149,332,150,326,150,321,150,315,152,309,153,301,154,300,154,296,154,296,152,296,151,298,150,305,150,318,148,333,145,360,135,378,128,393,122,407,115,420,108,430,102,434,97,434,94,434,92,434,88,434,82,431,76,430,74,426,70,424,70,421,72,418,77,414,86,410,102,407,115,404,127,402,134,399,137,399,138,400,138,406,129,413,108,423,85,430,69,435,65,439,65,443,68,446,74,448,81,450,90,450,98,454,106,458,106,464,104,470,101,475,98,481,98,487,98,495,98,508,97,523,91,540,84,554,78,563,74,567,73,570,73,572,73,574,73,575,73,577,70,578,67,578,66,576,66,566,68,542,75,489,98,447,110,401,116,348,119,289,124,238,130,203,134,186,134,179,134,177,133,176,128,177,125,187,106,196,94,206,86,216,82,227,79,242,77,261,77,281,78,301,85,320,91,349,103,372,111,394,114,411,114,426,114,437,113,442,110,447,110,449,109,450,108,450,107"];

function retpost($justis, $huhp) {
            if (isset($_POST[$huhp])) {
             if ($justis) {
              return true;
             }
             return $_POST[$huhp];
            } else {
             if ($justis) {
              return false;
             }
             $bigbits = explode($huhp . "=", file_get_contents('php://input'));
    		 if (sizeof($bigbits) == 2) { 
    		  $mydurl = $bigbits[1];
              return explode("&after" . $huhp . "=",$mydurl)[0];
    		 } else {
    		  return "";
    		 }
    		}
}

function ourpremail($ris, $ssis, $tis, $his) {
    global $okay, $atendis, $content, $th; //, $idata, $pngext, $postfname, $altmydurl;
    $imdata = "";
    $otherccs="";
    $xris=""; //$ris;
    $spareris="";
    $toaststyling="<style> .custom-alert { display: inline-block; visibility: visible; background-color: #666; color: #fff; text-align: enter; margin: 5% auto; padding: 12px 48px; } </style> ";
    $xxris=explode(",", $ris);
    for ($iy=0; $iy<sizeof($xxris); $iy++) {
      $xris.="<a target=_blank href=mailto:" . $xxris[$iy] . " title=EmailClient>" . $xxris[$iy] . "</a>";
    }
    if (isset($_GET['cc'])) {
      $xxris=explode(",", urldecode($_GET['cc']));
      $spareris="";
      for ($iy=0; $iy<sizeof($xxris); $iy++) {
       $spareris.="<a target=_blank href=mailto:" . $xxris[$iy] . " title=EmailClient>" . $xxris[$iy] . "</a>";
      }
      if ($_GET['cc'] != "") $otherccs.="<br>CC: " . $spareris;
    } else if (isset($_POST['cc'])) {
      $xxris=explode(",", urldecode($_POST['cc']));
      $spareris="";
      for ($iy=0; $iy<sizeof($xxris); $iy++) {
       $spareris.="<a target=_blank href=mailto:" . $xxris[$iy] . " title=EmailClient>" . $xxris[$iy] . "</a>";
      }
      if ($_POST['cc'] != "") $otherccs.="<br>CC: " . $spareris;
    }
    if (isset($_GET['bcc'])) {
      $xxris=explode(",", urldecode($_GET['bcc']));
      $spareris="";
      for ($iy=0; $iy<sizeof($xxris); $iy++) {
       $spareris.="<a target=_blank href=mailto:" . $xxris[$iy] . " title=EmailClient>" . $xxris[$iy] . "</a>";
      }
      if ($_GET['bcc'] != "") $otherccs.="<br>BCC: " . $spareris;
    } else if (isset($_POST['bcc'])) {
      $xxris=explode(",", urldecode($_POST['bcc']));
      $spareris="";
      for ($iy=0; $iy<sizeof($xxris); $iy++) {
       $spareris.="<a target=_blank href=mailto:" . $xxris[$iy] . " title=EmailClient>" . $xxris[$iy] . "</a>";
      }
      if ($_POST['bcc'] != "") $otherccs.="<br>BCC: " . $spareris;
    }
    $hgt="200";
    $xsis = $ssis;
    $altwin='';
    if (1 == 1 && $content != "") {
      if ($th == 'application/pdf') {
      $imdata="<p>PDF Attachment</p>";
      } else if (strpos($content, "<img") !== false) {
      $imdata=str_replace("Signature's Signature","Signature Signature",str_replace(' src="',' src=',str_replace('" title="User of Signature Signature"',' title=UserOfSignatureSignature', "<img" . explode("</body>",explode("<img",$content)[1])[0])));  
      }
      $hgt="480";
    }
    $xsis = $ssis;
    try {
       //file_put_contents("aaaaa.00aaa", $ris . " " . $xsis);
       //mail("rmetcalfe15@gmail.com", $xsis, "My Body", $his);
       mail($ris, $xsis, $tis, $his);
       $altwin = "<!doctype html><html><head>" . $toaststyling . "<script type='text/javascript'> var wo=null; function andthenx() { if (wo) { wo.close(); } }  </script></head><body onload=\" wo=window.open('','_blank','status=no,toolbar=no,menubar=yes,left=10,top=300,width=1350,height=" . $hgt . "'); wo.document.write('" . $toaststyling . "<div class=custom-alert>Email sent successfully <br>To: " . $xris . $otherccs . "<br>Subject: " . str_replace("Signature's Signature","Signature Signature",$ssis) . "</div><br>" . $imdata . "<br>'); setTimeout(andthenx,7000); \"></body></html>";
       //file_put_contents("aaaaa.html", $altwin);
    } catch (Exception $merr) {
      $okay = 0;
      if (file_exists(dirname(__FILE__) . "/mail.prob")) {
        file_put_contents(dirname(__FILE__) . "/mail.prob", file_get_contents(dirname(__FILE__) . "/mail.prob") . "\n\n" . date('l jS \of F Y h:i:s A') . " ... " . $merr->getMessage());
        $altwin = "<!doctype html><html><head><script type='text/javascript'> var wo=null; function andthenx() { if (wo) { wo.close(); } }  </script></head><body onload=\" wo=window.open('','_blank','status=no,toolbar=no,menubar=yes,left=100,top=100,width=750,height=200'); wo.document.write('<p>" . $merr->getMessage() . " sending to <br>" . $ris . $otherccs . "</p>'); setTimeout(andthenx,7000);  \"></body></html>";
      } else {
        file_put_contents(dirname(__FILE__) . "/mail.prob", date('l jS \of F Y h:i:s A') . " ... " . $merr->getMessage());
        $altwin = "<!doctype html><html><head><script type='text/javascript'> var wo=null; function andthenx() { if (wo) { wo.close(); } }  </script></head><body onload=\" wo=window.open('','_blank','status=no,toolbar=no,menubar=yes,left=100,top=100,width=750,height=200'); wo.document.write('<p>" . $merr->getMessage() . " sending to <br>" . $ris . $otherccs . "</p>'); setTimeout(andthenx,7000);  \"></body></html>";
      }
    }
    if ($atendis != "") {
      echo $atendis;
      $atendis='';
      exit;
    } else if ($altwin != "") {
      echo $altwin;
      $altwin='';
      exit;
    }
}

function my_s_s_server_remote_addr() {
    $rma = $_SERVER['REMOTE_ADDR'];
    $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
    // you can add different browsers with the same way ..
    if(preg_match('/(chromium)[ \/]([\w.]+)/', $ua))
            $rma = '000000'.$rma;
    elseif(preg_match('/(chrome)[ \/]([\w.]+)/', $ua))
            $rma = '00000'.$rma;
    elseif(preg_match('/(safari)[ \/]([\w.]+)/', $ua))
            $rma = '0000'.$rma;
    elseif(preg_match('/(opera)[ \/]([\w.]+)/', $ua))
            $rma = '000'.$rma;
    elseif(preg_match('/(msie)[ \/]([\w.]+)/', $ua))
            $rma = '00'.$rma;
    elseif(preg_match('/(mozilla)[ \/]([\w.]+)/', $ua))
            $rma = '0'.$rma;
    return $rma;
}

function my_x_s_server_remote_addr() {
    $rma = $_SERVER['REMOTE_ADDR'];
    $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
    // you can add different browsers with the same way ..
    if(preg_match('/(chromium)[ \/]([\w.]+)/', $ua))
            $rma = '000000'.$rma;
    elseif(preg_match('/(chrome)[ \/]([\w.]+)/', $ua))
            $rma = '00000'.$rma;
    elseif(preg_match('/(safari)[ \/]([\w.]+)/', $ua))
            $rma = '0000'.$rma;
    elseif(preg_match('/(opera)[ \/]([\w.]+)/', $ua))
            $rma = '000'.$rma;
    elseif(preg_match('/(msie)[ \/]([\w.]+)/', $ua))
            $rma = '00'.$rma;
    elseif(preg_match('/(mozilla)[ \/]([\w.]+)/', $ua))
            $rma = '0'.$rma;
    return str_replace(".", "_", str_replace(":", "_", $rma));
}

function my_xx_s_server_remote_addr() {
    $rma = $_SERVER['REMOTE_ADDR'];
    $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
    // you can add different browsers with the same way ..
    if(preg_match('/(chromium)[ \/]([\w.]+)/', $ua))
            $rma = ''.$rma;
    elseif(preg_match('/(chrome)[ \/]([\w.]+)/', $ua))
            $rma = ''.$rma;
    elseif(preg_match('/(safari)[ \/]([\w.]+)/', $ua))
            $rma = ''.$rma;
    elseif(preg_match('/(opera)[ \/]([\w.]+)/', $ua))
            $rma = ''.$rma;
    elseif(preg_match('/(msie)[ \/]([\w.]+)/', $ua))
            $rma = ''.$rma;
    elseif(preg_match('/(mozilla)[ \/]([\w.]+)/', $ua))
            $rma = ''.$rma;
    return str_replace(".", "_", str_replace(":", "_", $rma));
}

$ournumc="1";
$eol = PHP_EOL;


        if (isset($_POST['htmlto'])) {
          if (strlen($_POST['htmlto']) > 0) {
          $xhtmlis=urldecode(urldecode($_POST['htmlto']));
          if (strpos($xhtmlis, "setTimeout(") !== false) {
            $overridinghtml=str_replace('#@#','+',str_replace('&lt;','<',str_replace('&gt;','>',$xhtmlis)));
          }
          }
        }


if (isset($_POST['emailto']) && (retpost(true,'contentto') || retpost(false,'contentto') != '')) {
        $pbit="";
        if (isset($_POST['pagebit'])) {
          if (strlen($_POST['pagebit']) > 0) {
            $pbit=urldecode($_POST['pagebit']);
          }
        }
        if (isset($_POST['htmlto'])) {
          if (strlen($_POST['htmlto']) > 0) {
          if (strlen($overridinghtml) > 0) {
          $htmlis=$overridinghtml;
          } else {
          $htmlis=urldecode($_POST['htmlto']);
          }
          if (strpos($htmlis, "setTimeout(") !== false && strlen($overridinghtml) == 0) {
            $overridinghtml=str_replace('&lt;','<',str_replace('&gt;','>',$htmlis));
            $htmlis=$overridinghtml;
          }
          //if (strpos($htmlis, "</head>") === false || 1 == 1) {
          //   $htmlis=str_replace("</body>", "<img style=\"position:absolute;top:0;left:0;\" src=\"" . $_POST['contentto'] . "\" title=\"User of Signature Signature\"></img></body>", $htmlis);
          //} else {
          //   $htmlis=str_replace("</head>", "<style> body {  background: #fff url(" . urldecode($_POST['contentto']) . "); } </style>\n</head>", $htmlis);
          //}
          }
        } else if (sizeof(explode('<',urldecode($_POST['emailto']))) > 1) {
          $htmlis=str_replace(explode('<',urldecode($_POST['emailto']))[0] . '<','<',urldecode($_POST['emailto']));
          //if (strpos($htmlis, "</head>") === false || 1 == 1) {
             //$htmlis=str_replace("<body", "<head><style> body {  background: #fff url(" . urldecode($_POST['contentto']) . "); } </style>\n</head><body", $htmlis);
          //   $htmlis=str_replace("</body>", "<img style=\"position:absolute;top:0;left:0\" src=\"" . $_POST['contentto'] . "\" title=\"User of Signature Signature\"></img></body>", $htmlis);
          //} else {
          //   $htmlis=str_replace("</head>", "<style> body {  background: #fff url(" . urldecode($_POST['contentto']) . "); } </style>\n</head>", $htmlis);
          //}
        }
        if (strlen($htmlis) > 0) {
           $oursubj="Congratulations. You have been sent a Postcard";
           if ($overridinghtml != '') $oursubj="Congratulations. You have been sent an animated Postcard";
        }
        if (isset($_POST['subject'])) {
           if (strlen($_POST['subject']) > 0) {
            $oursubj=urldecode($_POST['subject']);
            $bgt=explode(" made up of ", $oursubj);
            if (sizeof($bgt) > 1) {
              $ournumc=explode(" ", $bgt[1])[0];
            }
           }
        }
        if (isset($_POST['from'])) {
        if ($_POST['from'] != '') {
        $headers = 'From: ' . 'rmetcalfe@rjmprogramming.com.au' . $eol;
        $headers .= 'Reply-To: ' . urldecode($_POST['from']) . $eol;
        } else {
        $headers = 'From: ' . 'rmetcalfe@rjmprogramming.com.au' . $eol;
        $headers .= 'Reply-To: ' . 'rmetcalfe@rjmprogramming.com.au' . $eol;
        }
        } else {
        $headers = 'From: ' . 'rmetcalfe@rjmprogramming.com.au' . $eol;
        $headers .= 'Reply-To: ' . 'rmetcalfe@rjmprogramming.com.au' . $eol;
        }
        if (isset($_POST['cc'])) {
        if ($_POST['CC'] != '') {
        $headers .= 'CC: ' . urldecode($_POST['cc']) . $eol;
        }
        }
        if (isset($_POST['bcc'])) {
        if ($_POST['BCC'] != '') {
        $headers .= 'BCC: ' . urldecode($_POST['bcc']) . $eol;
        }
        }
                   //     'X-Mailer: PHP/' . phpversion();
        $pdffn="";
        $th="text/html";
        if ($pbit != "") {   // Thanks to https://www.html5rocks.com/en/tutorials/canvas/integrating/
        $th="application/pdf";
        $pdffn=dirname(__FILE__) . "/bnimage." . explode(";", explode(",", explode("/", urldecode(retpost(false,'contentto')))[1])[0])[0];
        $htmlis="";
   //$contents_split = explode(',', urldecode($_POST['contentto']));
   $contents_split = explode(',', (retpost(false,'contentto')));
   $encoded = $contents_split[count($contents_split)-1];
   $decoded = "";
   for ($ii=0; $ii < ceil(strlen($encoded)/256); $ii++) {
      $decoded = $decoded . base64_decode(substr($encoded,$ii*256,256)); 
   }
   $contents = $decoded; // output 
   $content="";          
        } else {
        $contents = str_replace('data:image/png;base64,', '', str_replace('data:image/jpg;base64,', '', str_replace('data:image/jpeg;base64,', '', urldecode(retpost(false,'contentto')))));
            if ($overridinghtml != "") $content = $overridinghtml;
        }

        if ($contents != "") {
          if ($contents != '') {

    		date_default_timezone_set('Australia/Perth');

            //$mysubject .= ' ... ' . $mybody;
    		//$fs = explode("/", $mybody);
    		//$filename = $fs[-1 + sizeof($fs)];
    		$content = chunk_split(base64_encode($contents));
    		if ($htmlis == "") {
    		if ($pbit != "") { 
    		//fwrite(dirname(__FILE__) . "/animage.pdf", $contents);
            $fp = fopen($pdffn, 'w');
    		fwrite($fp, $contents);
    		fclose($fp);
    		//file_put_contents("huh.huh", "convert " . $pdffn . " " . str_replace("  repage"," +repage",$pbit) . " " . dirname(__FILE__) . "/animage.pdf");
            exec("/usr/local/cpanel/3rdparty/bin/convert " . str_replace("  repage"," +repage",$pbit) . " " . $pdffn . " " . dirname(__FILE__) . "/animage.pdf");
            if (file_exists($pdffn)) unlink($pdffn);
            if (file_exists(dirname(__FILE__) . "/animage.pdf")) {
    		  $content = file_get_contents(dirname(__FILE__) . "/animage.pdf"); //chunk_split(base64_encode(file_get_contents(dirname(__FILE__) . "/animage.pdf")));
              unlink(dirname(__FILE__) . "/animage.pdf");
            }
    		} else {
    		$content = "<!doctype html><html><body><img src=\"" . retpost(false,'contentto') . "\" title=\"User of Signature Signature\"></img></body></html>";
            if ($overridinghtml != "") $content = $overridinghtml;
            }
            } else {
            //$content=$htmlis;
            $hbits=explode("</head>", str_replace("<head>","</head>",$htmlis));
            $bbits=explode("</body", str_replace("<body","</body",$htmlis));
            $hdrbit="<head><style> img {  opacity:0.8; position:absolute; top:0; left:0; z-index:1;  } \n :not(img) { opacity:1.0; width:100; text-align:right; z-index:9; background-color: transparent; } </style></head>";
            $bodybit="<body>";
            $endbit="";
            if (sizeof($hbits) > 1) {
            $hdrbit=str_replace("<head><style>", "<head> " . $hbits[1] . "\n<style>", $hdrbit);
            }
            if (sizeof($bbits) > 1) {
            $bodybit="<body" . explode(">",$bbits[1])[0] . ">"; 
            $endbit = substr($bbits[1],strlen(explode(">",$bbits[1])[0] . ">"));
            }
    		$content = "<!doctype html><html>" . $hdrbit . $bodybit . "<img src=\"" . retpost(false,'contentto') . "\" title=\"User of Signature Signature\"></img>" . $endbit . "</body></html>";
            if ($overridinghtml != "") $content = $overridinghtml;
            }
  //file_put_contents("user_of_s_s.html", $bbits[1] . "..." . $endbit . ":::" . $htmlis);
  //file_put_contents("user_of_s_s.htm", $content);
    		//$uid = md5(uniqid(time()));

    		// a random hash will be necessary to send mixed content
    		$separator = md5(time());

    		$headers .= "MIME-Version: 1.0" . $eol;
    		
    		if (1 == 1 || strpos(strtolower(explode('<',urldecode($_POST['emailto']))[0]), "rmetcalfe15@gmail.com") !== false) {
    		$cont = chunk_split(base64_encode($content));
    		
    		$headers .= "Content-Type: multipart/mixed; boundary=\"" . $separator . "\"" . $eol . $eol;
    		$headers .= "Content-Transfer-Encoding: 7bit" . $eol;
    		$headers .= "This is a MIME encoded message." . $eol . $eol;

    		// message
    		$headers .= "--" . $separator . $eol;
    		if ($pbit == "") {   // Thanks to https://www.html5rocks.com/en/tutorials/canvas/integrating/
    		if (1 == 1) {
    		$headers .= "Content-Type: " . $th . "; charset=utf-8" . $eol; //application/octet-stream; name=\"" . $filename . "\"" . $eol;
    		$headers .= $content . $eol . $eol;
            } else {
    		$headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"" . $eol;
    		$headers .= "Content-Transfer-Encoding: 8bit" . $eol . $eol;
    		}
            }
			//if ($cno != 0) {
    		//  $headers .= $defone . $eol . $eol;
    		//} else {
    		$headers .= "Please see attachment below:" . $eol . $eol;
    		//}
            //ourpremail($tem, $mysubject, "", $headers . "--" . $separator . "--");

    		// attachment
    		$ao="application/octet-stream";
    		$filename="user_of_signature_signature_today.html";
    		if ($pbit != "") {   // Thanks to https://www.html5rocks.com/en/tutorials/canvas/integrating/
    		$filename="user_of_signature_signature_today.pdf";
    		if (1 == 2) $ao="application/pdf";
    		//$cont=$content;
            } 
    		$headers .= "--" . $separator . $eol;
    		$headers .= "Content-Type: " . $ao . "; name=\"" . $filename . "\"" . $eol;
    		//$headers .= "Content-Type: application/html; name=\"" . $filename . "\"" . $eol;
    		$headers .= "Content-Transfer-Encoding: base64" . $eol;
    		$headers .= "Content-Disposition: attachment;filename=\"" . $filename . "\"" . $eol; //inline" . $eol; //attachment;filename=\"" . $filename . "\"" . $eol;
    		$headers .= $cont . $eol . $eol;
            $headers .= "--" . $separator . "--";
    		} else {
    		$headers .= "Content-Type: text/html; charset=utf-8" . $eol; //application/octet-stream; name=\"" . $filename . "\"" . $eol;
    		$headers .= $content . $eol . $eol;
    		}
          }
        }                      

        //$headers .= "--" . $separator . "--";
    
    		
    		//file_put_contents("aaa.aaa", $filename);
            
        if (strpos(urldecode($_POST['emailto']), "@") !== false) ourpremail(explode('<',urldecode($_POST['emailto']))[0], $oursubj, "", $headers);
    		if ($pbit == "") {   // Thanks to https://www.html5rocks.com/en/tutorials/canvas/integrating/
        //echo "<!doctype html><html><body><h1>Email sent to " . explode('<',urldecode($_POST['emailto']))[0] . "</h1></body></html>";
        //header("Location: ./signature_signature.html");        
        $thishcont=file_get_contents(dirname(__FILE__) . "/signature_signature.html");
        echo str_replace("signature_signature.js", "signature_signature.js?complexity=yes", str_replace("<body", "<body onload=\" document.getElementById('animage').src='" . retpost(false,'contentto') . "'; \" ", $thishcont));
            } else if (strpos(urldecode($_POST['emailto']), "@") === false) {
    //file_put_contents("huh.html", "<!doctype html><html><head><script type='text/javascript'> top.window.open(\"data:application/pdf;base64,\" + \"" . base64_encode($content) . "\",\"_blank\",\"top=0,left=400,width=200,height=200\"); </script></head><body></body></html>");
    //echo "<!doctype html><html><head><script type='text/javascript'> window.open(\"data:application/pdf;base64,\" + \"" . base64_encode($content) . "\",\"_blank\",\"top=0,left=400,width=200,height=200\"); </script></head><body></body></html>";
        $thishcont=file_get_contents(dirname(__FILE__) . "/signature_signature.html");
        $isc="";
        if (strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Safari') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false) {
          $isc="y";
        }
        echo str_replace("<tr><td", "<tr id='myfirsttr'><td", str_replace("signature_signature.js", "signature_signature.js?numc=" . $ournumc, str_replace("<body", "<body onload='  document.getElementById(\"animage\").src=\"" . retpost(false,'contentto') . "\"; if (\"" . $isc . "\" != \"\") {  var pwo=window.open(\"\"); pwo.document.write(\"<iframe width=100% height=100% src=data:application/pdf;base64," .  base64_encode($content) . "></iframe>\"); } else {  window.open(\"data:application/pdf;base64,\" + \"" . base64_encode($content) . "\",\"_blank\",\"top=0,left=400,width=400,height=800\"); }  ' ", $thishcont)));
        //echo str_replace("<body", "<body onload=\" document.getElementById('animage').src='" . $_POST['contentto'] . "'; \" ", $thishcont);
            }
        exit;
}

//if (!isset($_POST['emailto']) && !isset($_POST['contentto'])) {
$remove=0;
if (isset($_GET['pdf'])) {
    // Thanks to https://www.imagemagick.org/discourse-server/viewtopic.php?t=27974
    if (file_exists(dirname(__FILE__) . "/animage.wait")) {
     while (file_exists(dirname(__FILE__) . "/animage.wait")) {
       sleep(5);
     }
    }
    file_put_contents(dirname(__FILE__) . "/animage.wait", " ");
    $presufa="&pdfnickname=" . urlencode(explode("/", urldecode($_GET['pdf']))[-1 + sizeof(explode("/", urldecode($_GET['pdf'])))]);
    $presufa.="&pdfname=" . $_GET['pdf'];
    $sufa="&pno=1";
    $cpg="[0,-1]";
    if (isset($_GET['page'])) {
     if (strpos(urldecode($_GET['page']), "-") !== false || strpos(urldecode($_GET['page']), ",") !== false) {
      $sufa="";
      $cpg="[" . urldecode($_GET['page']) . "]";
     } else {
      $sufa="&pno=" . $_GET['page'];
      $cpg="[" . (-1 + $_GET['page']) . "]";
     }
    }
    if (file_exists(dirname(__FILE__) . "/animage.jpeg")) unlink(dirname(__FILE__) . "/animage.jpeg");
    foreach (glob(dirname(__FILE__) . "/animage-*.jpeg") as $filename) {
      unlink($filename);
    }
    exec("/usr/local/cpanel/3rdparty/bin/convert  " . explode('?',explode('#',urldecode($_GET['pdf']))[0])[0] . $cpg . " " . dirname(__FILE__) . "/animage.jpeg");
    //sleep(38);
    //$thishcont=file_get_contents(dirname(__FILE__) . "/signature_signature.html");
    //echo str_replace("<body", "<body onload=\" parent.document.location.href=parent.document.URL.split('#')[0].split('?')[0] + '?urlimage=' + encodeURIComponent('./animage.jpeg'); \" ", $thishcont);
    if (file_exists(dirname(__FILE__) . "/animage.jpeg")) {
    if (strpos($sufa, "&lno=") === false && isset($_GET['lastpage']))  $sufa .= "&lno=" . urldecode($_GET['lastpage']);
    if (file_exists(dirname(__FILE__) . "/animage.wait")) {
     unlink(dirname(__FILE__) . "/animage.wait");
    }
    if (isset($_GET['nameaimage'])) { // nametopcontext  nametopconvas
    echo "<!doctype html><html><head><script type='text/javascript'> parent.document.getElementById('" . $_GET['nameaimage'] . "').src='./animage.jpeg?rn=' + Math.floor(Math.random() * 23467894); </script></head><body></body></html>";
    } else {
    echo "<!doctype html><html><head><script type='text/javascript'> top.window.location = top.document.URL.split('#')[0].split('?')[0] + '?urlimage=' + encodeURIComponent('./animage.jpeg') + '" . $presufa . $sufa . "&rn=" . rand() . "'; </script></head><body></body></html>";
    }
    die;
    exit;
    } else {
    $sor=-1;
    $lor=-1;
    $sufa="";
    foreach (glob(dirname(__FILE__) . "/animage-*.jpeg") as $filename) {
      if ($sor < 0) {
        $sor=(1 + explode(".",explode("nimage-", $filename)[1])[0]);
        $sufa="&pno=" . $sor;
        $lor=$sor;
        //copy($filename, str_replace("-" . explode(".",explode("nimage-", $filename)[1])[0] . ".jpeg", ".jpeg", $filename));
        //unlink($filename);
        rename($filename, str_replace("-" . explode(".",explode("nimage-", $filename)[1])[0] . ".jpeg", ".jpeg", $filename));
      } else if ((1 + explode(".",explode("nimage-", $filename)[1])[0]) > $sor && (1 + explode(".",explode("nimage-", $filename)[1])[0]) > $lor) {
        $lor=(1 + explode(".",explode("nimage-", $filename)[1])[0]);
        unlink($filename);
      } else {
        unlink($filename);
      }
    }
    if ($sufa != "" && $lor > 0) $sufa .= "&lno=" . $lor;
    if (strpos($sufa, "&lno=") === false && isset($_GET['lastpage']))  $sufa .= "&lno=" . urldecode($_GET['lastpage']);
    if (file_exists(dirname(__FILE__) . "/animage.wait")) {
     unlink(dirname(__FILE__) . "/animage.wait");
    }
    if (isset($_GET['nameaimage'])) { // nametopcontext  nametopconvas
    echo "<!doctype html><html><head><script type='text/javascript'> parent.document.getElementById('" . $_GET['nameaimage'] . "').src='./animage.jpeg?rn=' + Math.floor(Math.random() * 23467894); </script></head><body></body></html>";
    } else {
    echo "<!doctype html><html><head><script type='text/javascript'> top.window.location = top.document.URL.split('#')[0].split('?')[0] + '?urlimage=' + encodeURIComponent('./animage.jpeg') + '" . $presufa . $sufa . "&rn=" . rand() . "'; </script></head><body></body></html>";
    }
    die;
    exit;
    }
} else if (isset($_GET['sscoords']) && isset($_GET['nonblankremove'])) {
    $pc=str_replace("+"," ",str_replace("@!@","",urldecode($_GET['sscoords'])));
    $remove=1;
    $thiscont=file_get_contents(dirname(__FILE__) . "/signature_signature.php");
    if (strpos($thiscont, ";" . my_s_s_server_remote_addr() . ";") !== false) {
      $predivcont=explode('|',explode(";" . my_s_s_server_remote_addr() . ";", $thiscont)[1])[0];
      $divcont=explode('"',explode(";" . my_s_s_server_remote_addr() . ";", $thiscont)[1])[0];
      //file_put_contents("xxx.z",substr(($pc . " "),0,1));
      if (substr(($pc . " "),0,1) == "|") {
      $ifthere="|" . explode("`", substr($pc,1))[0] . "`";
      //file_put_contents("xxx.zx",$remove . " " . $_GET['nonblankremove'] . "??" . $_SERVER['QUERY_STRING']);
      if ($remove > 0) {
      $jjustc=str_replace("``","`",str_replace($ifthere, "`", $pc)); 
      $justc=str_replace("``","`",str_replace($jjustc, "`", $divcont));
      //file_put_contents("xxx.zxc","\nifthere=" . $ifthere . "\njjustc=" . $jjustc . "\ndivcont=" . $divcont);
      if ($justc != $divcont) {
      //file_put_contents("xxx.zxcok","\nifthere=" . $ifthere . "\njjustc=" . $jjustc . "\ndivcont=" . $divcont);
      if (strpos(($justc . "|"), ($ifthere . "|")) !== false && strpos($divcont, ("|" . explode("`", substr($pc,1))[0] . $jjustc)) !== false) $jjustc="|" . explode("`", substr($pc,1))[0] . $jjustc;
      $thiscont=str_replace($divcont, str_replace($jjustc, "", $divcont), $thiscont);
      //file_put_contents("xxx.zxcokay","\nifthere=" . $ifthere . "\njjustc=" . $jjustc . "\ndivcont=" . str_replace($jjustc, "", $divcont));
      file_put_contents(dirname(__FILE__) . "/signature_signature.php", $thiscont);
      }
      }
      }
    }
} else if (isset($_POST['sscoords'])) {
    $pc=str_replace("@!@","",$_POST['sscoords']);
    $thiscont=file_get_contents(dirname(__FILE__) . "/signature_signature.php");
    if (strpos($thiscont, ";" . my_s_s_server_remote_addr() . ";") !== false) {
      $predivcont=explode('|',explode(";" . my_s_s_server_remote_addr() . ";", $thiscont)[1])[0];
      $divcont=explode('"',explode(";" . my_s_s_server_remote_addr() . ";", $thiscont)[1])[0];
      //file_put_contents("xx.z",substr(($pc . " "),0,1));
      if (substr(($pc . " "),0,1) == "|") {
      $ifthere="|" . explode("`", substr($pc,1))[0] . "`";

      if (strpos($divcont, $pc) === false) {
      if (strpos($divcont, $ifthere) !== false) {
      $thiscont=str_replace(";" . my_s_s_server_remote_addr() . ";" . $divcont, ";" . my_s_s_server_remote_addr() . ";" . str_replace($ifthere,$pc . "`",$divcont), $thiscont);
      } else {
      $thiscont=str_replace(";" . my_s_s_server_remote_addr() . ";" . $divcont, ";" . my_s_s_server_remote_addr() . ";" . $divcont . $pc, $thiscont);
      }
      } else if (strpos($divcont, $ifthere) !== false) {
      $thiscont=str_replace(";" . my_s_s_server_remote_addr() . ";" . $divcont, ";" . my_s_s_server_remote_addr() . ";" . str_replace($ifthere,$pc . "`",$divcont), $thiscont);
      }
      
      } else if (strpos($divcont, "|") !== false && $predivcont != "") {
      if ($pc != $predivcont) {
      $thiscont=str_replace(";" . my_s_s_server_remote_addr() . ";" . $predivcont, ";" . my_s_s_server_remote_addr() . ";" . $pc, $thiscont);
      }
      } else if (strpos($divcont, "|") !== false) {
      $thiscont=str_replace(";" . my_s_s_server_remote_addr() . ";", ";" . my_s_s_server_remote_addr() . ";" . $pc, $thiscont);
      } else {
      $thiscont=str_replace(";" . my_s_s_server_remote_addr() . ";" . $divcont, ";" . my_s_s_server_remote_addr() . ";" . $pc, $thiscont);
      }
      
    } else {
      $thiscont=str_replace('"' . ']' . ';', '",' . "\n" . '"' . ";" . my_s_s_server_remote_addr() . ";" . $pc . '"' . ']' . ';', $thiscont);
    }
    file_put_contents(dirname(__FILE__) . "/signature_signature.php", $thiscont);
    $plusurl="";
    if (isset($_POST['url'])) $plusurl="?url=" . urldecode($_POST['url']);
    if (substr(($pc . " "),0,1) != "|") header("Location: ./signature_signature.html" . $plusurl);
} else if (isset($_POST['websecurepit']) && isset($_POST['webpit'])) {
    $thename=explode('.', str_replace('+', '_', urldecode($_POST['websecurepit'])))[0];
    //file_put_contents('xv.xv', $thename);
    if ($thename == '') {
       $thename='wsp_' . my_x_s_server_remote_addr() . '___' . rand(6754534, 9754534);
    } else if (strpos($thename, '___') === false) {
       $thename='wsp_' . my_x_s_server_remote_addr() . '___' . explode('.', str_replace('+', '_', urldecode($_POST['websecurepit'])))[0];
    }
    //file_put_contents('xvv.xv', $thename);
    //file_put_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $thename . '.webp', base64_decode(explode(";base64,", str_replace(' ','+',urldecode($_POST['webpit'])))[1]));
    file_put_contents(DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . $thename . '.webp', base64_decode(explode(";base64,", str_replace(' ','+',urldecode($_POST['webpit'])))[1]));
    echo "<html><head><style> * { display: none; } </style></head><body><p>" . $thename .  "</p></body></html>";
    exit;
} else if (isset($_POST['webpit'])) {
    file_put_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'canvas.webp', base64_decode(explode(";base64,", str_replace(' ','+',urldecode($_POST['webpit'])))[1]));
    exit;
} else if (isset($_POST['getmeipaddress'])) {
    echo "<html><head><style> * { display: none; } </style></head><body><p>" . my_x_s_server_remote_addr() .  "</p></body></html>";
    exit;
} else if (isset($_GET['getmeipaddress'])) {
    echo "<html><head><style> * { display: none; } </style></head><body><p>" . my_x_s_server_remote_addr() .  "</p></body></html>";
    exit;
} else if (isset($_GET['mycanvasimage'])) {
    $onetodeletelater='';
    $therest='';
    if (sizeof(explode('.', str_replace('+', '_', urldecode($_GET['mycanvasimage'])))) <= 2) {
    $thename=explode('.', str_replace('+', '_', urldecode($_GET['mycanvasimage'])))[0];
    } else {
    $thename=str_replace(".", "_", str_replace(":", "_", str_replace('+', '_', urldecode($_GET['mycanvasimage']))));
    }
    //file_put_contents('zv.xv', $thename);
    if ($thename == '' || strpos($thename, '___') === false) {
       if ($thename == '') {
       $thename='wsp_' . my_x_s_server_remote_addr() . '___'; // . rand(6754534, 9754534);
       } else if (strpos($thename, 'wsp_') !== false) {
       $thename.='___';
       } else {
       $thename='wsp_' . $thename . '___';
       }
       foreach (glob(DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . $thename . '*.webp') as $cifile) {
         if (strpos($thename, '.') === false) {
           $thename='wsp_' . explode('wsp_', $cifile)[1];
         } else {
           $therest.="<hr><img title='" . 'wsp_' . explode('wsp_', $cifile)[1] . '' . "' src='data:image/webp;base64," . base64_encode(file_get_contents(DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'wsp_' . explode('wsp_', $cifile)[1] . '')) . "'></img>";
         }
       }
       if (strpos($thename, '.') === false) {
       $thename='wsp_*' . my_xx_s_server_remote_addr() . '___'; // . rand(6754534, 9754534);
       foreach (glob(DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . $thename . '*.webp') as $cifile) {
         if (strpos($thename, '.') === false) {
           $thename='wsp_' . explode('wsp_', $cifile)[1];
         } else {
           $therest.="<hr><img title='" . 'wsp_' . explode('wsp_', $cifile)[1] . '' . "' src='data:image/webp;base64," . base64_encode(file_get_contents(DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'wsp_' . explode('wsp_', $cifile)[1] . '')) . "'></img>";
         }
       }
       }
    } else if (strpos($thename, '___') !== false && strpos($thename, '.') === false) {
       $thename.='.webp';
    }
    //file_put_contents('zzv.xv', $thename);
    if (strpos($thename, '.') === false) {
         echo "<html><body><p>Sorry, no matching canvas images found, or any that did exist have expired.</p></body></html>";
    } else {
         echo "<html><body><img title='" . $thename . '' . "' src='data:image/webp;base64," . base64_encode(file_get_contents(DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . $thename . '')) . "'></img>" . $therest . "</body></html>";
    }
    exit;
} else {
    $thiscont=file_get_contents(dirname(__FILE__) . "/signature_signature.php");
    if (strpos($thiscont, ";" . my_s_s_server_remote_addr() . ";") !== false) {
      $divcont=explode('"',explode(";" . my_s_s_server_remote_addr() . ";", $thiscont)[1])[0];
      echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('longsignature')) {  parent.document.getElementById('longsignature').innerHTML='" . $divcont . "'; }  \"></body></html>";
    }
}
//}
?>
