|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: 310: 311: 312: 313: 314: 315: 316: 317: 318: 319: 320: 321: 322: 323: 324: 325: 326: 327: 328: 329: 330: 331: 332: 333: 334: 335: 336: 337: 338: 339: 340: 341: 342: 343: 344: 345: 346: 347: 348: 349: 350: 351: 352: 353: 354: 355: 356: 357: 358: 359: 360: 361: 362: 363: 364: 365: 366: 367: 368: 369: 370: 371: 372: 373: 374: 375: 376: 377: 378: 379: 380: 381: 382: 383: 384: 385: 386: 387: 388: 389: 390: 391: 392: 393: 394: 395: 396: 397: 398: 399: 400: 401: 402: 403: 404: 405: 406: 407: 408: 409: 410: 411: 412: 413: 414: 415: 416: 417: 418: 419: 420: 421: 422: 423: 424: 425: 426: 427: 428: 429: 430: 431: 432: 433: 434: 435: 436: 437: 438: 439: 440: 441: 442: 443: 444: 445: 446: 447: 448: 449: 450: 451: 452: 453: 454: 455: 456: 457: 458: 459: 460: 461: 462: 463: 464: 465: 466: 467: 468: 469: 470: 471: 472: 473: 474: 475: 476: 477: 478: 479: 480: 481: 482: 483: 484: 485: 486: 487: 488: 489: 490: 491: 492: 493: 494: 495: 496: 497: 498: 499: 500: 501: 502: 503: 504: 505: 506: 507: 508: 509: 510: 511: 512: 513: 514: 515: 516: 517: 518: 519: 520: 521: 522: 523: 524: 525: 526: 527: 528: 529: 530: 531: 532: 533: 534: 535: 536: 537: 538: 539: 540: 541: 542: 543: 544: 545: 546: 547: 548: 549: 550: 551: 552: 553: 554: 555: 556: 557: 558: 559: 560: 561: 562: 563: 564: 565: 566: 567: 568: 569: 570: 571: 572: 573: 574: 575: 576: 577: 578: 579: 580: 581: 582: 583: 584: 585: 586: 587: 588: 589: 590: 591: 592: 593: 594: 595: 596: 597: 598: 599: 600: 601: 602: 603: 604: 605: 606: 607: 608: 609: 610: 611: 612: 613: 614: 615: 616: 617: 618: 619: 620: 621: 622: 623: 624: 625: 626: 627: 628: 629: 630: 631: 632: 633: 634: 635: 636: 637: 638: 639: 640: 641: 642: 643: 644: 645: 646: 647: 648: 649: 650: 651: 652: 653: 654: 655: 656: 657: 658: 659: 660: 661: 662: 663: 664: 665: 666: 667: 668: 669: 670: 671: 672: 673: 674: 675: 676: 677: 678: 679: 680: 681: 682: 683: 684: 685: 686: 687: 688: 689: 690: 691: 692: 693: 694: 695: 696: 697: 698: 699: 700: 701: 702: 703: 704: 705: 706: 707: 708: 709: 710: 711: 712: 713: 714: 715: 716: 717: 718: 719: 720: 721: 722: 723: 724: 725: 726: 727: 728: 729: 730: 731: 732: 733: 734: 735: 736: 737: 738: 739: 740: 741: 742: 743: 744: 745: 746: 747: 748: 749: 750: 751: 752: 753: 754: 755: 756: 757: 758: 759: 760: 761: 762: 763: 764: 765: 766: 767: 768: 769: 770: 771: 772: 773: 774: 775: 776: 777: 778: 779: 780: 781: 782: 783: 784: 785: 786: 787: 788: 789: 790: 791: 792: 793: 794: 795: 796: 797: 798: 799: 800: 801: 802: 803: 804: 805: 806: 807: 808: 809: 810: 811: 812: 813: 814: 815: 816: 817: 818: 819: 820: 821: 822: 823: 824: 825: 826: 827: 828: 829: 830: 831: 832: 833: 834: 835: 836: 837: 838: 839: 840: 841: 842: 843: 844: 845: 846: 847: 848: 849: 850: 851: 852: 853: 854: 855: 856: 857: 858: 859: 860: 861: 862: 863: 864: 865: 866: 867: 868: 869: 870: 871: 872: 873: 874: 875: 876: 877: 878: 879: 880: 881: 882: 883: 884: 885: 886: 887: 888: 889: 890: 891: 892: 893: 894: 895: 896: 897: 898: 899: 900: 901: 902: 903: 904: 905: 906: 907: 908: 909: 910: 911: 912: 913: 914: 915: 916: 917: 918: 919: 920: 921: 922: 923: 924: 925: 926: 927: 928: 929: 930: 931: 932: 933: 934: 935: 936: 937: 938: 939: 940: 941: 942: 943: 944: 945: 946: 947: 948: 949: 950: 951: 952: 953: 954: 955: 956: 957: 958: 959: 960: 961: 962: 963: 964: 965: 966: 967: 968: 969: 970: 971: 972: 973: 974: 975: 976: 977: 978: 979: 980: 981: 982: 983: 984: 985: 986: 987: 988: 989: 990: 991: 992: 993: 994: 995: 996: 997: 998: 999: 1000: 1001: 1002: 1003: 1004: 1005: 1006: 1007: 1008: 1009: 1010: 1011: 1012: 1013: 1014: 1015: 1016: 1017: 1018: 1019: 1020: 1021: 1022: 1023: 1024: 1025: 1026: 1027: 1028: 1029: 1030: 1031: 1032: 1033: 1034: 1035: 1036: 1037: 1038: 1039: 1040: 1041: 1042: 1043: 1044: 1045: 1046: 1047: 1048: 1049: 1050: 1051: 1052: 1053: 1054: 1055: 1056: 1057: 1058: 1059: 1060: 1061: 1062: 1063: 1064: 1065: 1066: 1067: 1068: 1069: 1070: 1071: 1072: 1073: 1074: 1075: 1076: 1077: 1078: 1079: 1080: 1081: 1082: 1083: 1084: 1085: 1086: 1087: 1088: 1089: 1090: 1091: 1092: 1093: 1094: 1095: 1096: 1097: 1098: 1099: 1100: 1101: 1102: 1103: 1104: 1105: 1106: 1107: 1108: 1109: 1110: 1111: 1112: 1113: 1114: 1115: 1116: 1117: 1118: 1119: 1120: 1121: 1122: 1123: 1124: 1125: 1126: 1127: 1128: 1129: 1130: 1131: 1132: 1133: 1134: 1135: 1136: 1137: 1138: 1139: 1140: 1141: 1142: 1143: 1144: 1145: 1146: 1147: 1148: 1149: 1150: 1151: 1152: 1153: 1154: 1155: 1156: 1157: 1158: 1159: 1160: 1161: 1162: 1163: 1164: 1165: 1166: 1167: 1168: 1169: 1170: 1171: 1172: 1173: 1174: 1175: 1176: 1177: 1178: 1179: 1180: 1181: 1182: 1183: 1184: 1185: 1186: 1187: 1188: 1189: 1190: 1191: 1192: 1193: 1194: 1195: 1196: |
<?php
define("THIS_PAGE", "store_index");
include('admin/config.php');
include('templates/header.php');
$cardbg = $_POST["cardbg"];
echo "<input type=hidden name='cardbg' value=".$cardbg;">";
echo $cardbg;
?>
<?php
echo $_POST["cardbg"];
$url = $_GET["url"];
//echo '<pre>';
//echo htmlspecialchars(print_r($_POST, true));
//echo '</pre>';
$font = realpath('./fonts/');
putenv('GDFONTPATH='.$font);
$cardbg = $_POST["cardbg"];
echo $cardbg;
$_POST[cardbg] = $_POST["cardbg"];
//once the submit button has been clicked
if(isset($_POST["cardbg"])) {
$cardbg = $_POST["cardbg"];
header('Location: http://192.168.221.128/dvrg04222009/store/?card_id=$cardbg'); //the page to redirect to
}
elseif($_POST["cardbg"] == "") {
$cardbg = "";
header('_$GET["url"]);//Location: http://192.168.221.128/dvrg04222009/edstore/design.php');
}
/*
if (isset($_POST['submit'])) {
// This is the form processing to upload the file
$filename = $_FILES["name_1"]["name"];
echo "<input type='hidden' name='name_1' id='name_1' value=".$filename;">";
if ((($_FILES["name_1"]["type"] == "image/gif")
|| ($_FILES["name_1"]["type"] == "image/jpeg")
|| ($_FILES["name_1"]["type"] == "image/pjpeg")
|| ($_FILES["name_1"]["type"] == "image/x-png"))
&& ($_FILES["name_1"]["size"] < 20000))
{
if ($_FILES["name_1"]["name"]["error"] > 0)
{
echo "Return Code: " . $_FILES["name_1"]["name"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["name_1"]["name"] . "<br />";
echo "Type: " . $_FILES["name_1"]["type"] . "<br />";
echo "Size: " . ($_FILES["name_1"]["size"] / 1024) . " Kb<br />";
//echo "Temp file: " . $_FILES["name_1"]["tmp_name"] . "<br />";
if (file_exists("./upload/" . $_FILES["name_1"]["name"]))
{
echo $_FILES["name_1"]["name"] . " already exists. ";
//This function separates the extension from the rest of the file name and returns it
$filename = $_FILES["name_1"]["name"];
function findexts ($filename)
{
$filename = strtolower($filename) ;
$exts = split("[/\\.]", $filename) ;
$n = count($exts)-1;
$exts = $exts[$n];
return $exts;
}
//This applies the function to our file
$ext = findexts ($_FILES["name_1"]["name"]) ;
//This applies the function to our file
$ext = findexts ($_FILES["name_1"]["name"]);
//This line assigns a random number to a variable. You could also use a timestamp here if you prefer.
$ran = rand () ;
//This takes the random number (or timestamp) you generated and adds a . on the end, so it is ready of the file extension to be appended.
$ran2 = $ran.".";
//This assigns the subdirectory you want to save into... make sure it exists!
$target = "./upload/";
//This combines the directory, the random file name, and the extension
$target = $target . $ran2.$ext;
move_uploaded_file($_FILES["name_1"]["tmp_name"],"./upload/" . $_FILES["name_1"]["name"]);
if(move_uploaded_file($_FILES["name_1"]["tmp_name"], $target))
{
echo "The file has been uploaded as ".$ran2.$ext;
}
//else
//{
//echo "Sorry, there was a problem uploading your file.";
//}
}
else
{
move_uploaded_file($_FILES["name_1"]["tmp_name"],
"upload/" . $_FILES["name_1"]["name"]);
//echo "Stored in: " . "upload/" . $_FILES["name_1"]["name"];
}
}
}
//else
//
// echo "Invalid file";
// }
}
*/
?>
<input type="hidden" id="cardbg" name="cardbg" value='<?php echo $_POST["cardbg"]; ?>'></input>
<style>
* {
padding : 0px;
margin : 0px;
}
.box {
position: absolute;
height: 98px;
width: 98px;
background: #CCF;
border: 1px solid #AAD;
text-align: center;
font-size: 10px;
}
.handle {
cursor: move;
}
html, body {
font-family : verdana;
}
#container2 {
border : 1 px solid blue;
width : 500px;
margin : 0px auto;
}
#canvas {
border : 1px solid black;
height : 300px;
width : 500px;
}
#toolbar {
border : 1px solid black;
border-bottom : 0px;
height : 150px;
width : 100%;
background : lightgray;
}
.object {
display : table;
clear : both;
border : 1px dashed transparent;
}
.selected {
border : 1px dashed black;
}
ul#icons {margin: 0; padding: 0; position : relative; top : -37px; float : right;}
ul#icons li {margin: 2px; position: relative; padding: 4px 0; cursor: pointer; float: left; list-style: none;}
ul#icons span.ui-icon {float: left; margin: 0 4px;}
#tb_fontcolor {
position: relative;
width: 36px;
height: 36px;
background: url(images/select.png);
}
#tb_fontcolor div {
position: absolute;
top: 3px;
left: 3px;
width: 30px;
height: 30px;
background: url(images/select.png) center;
}
.progressBox {
width: 10em;
height: 1em;
position: relative;
float: right;
background: #cccccc;
.progressBar {
width: 0;
height: 100%;
position: absolute;
top: 0;
left: 0;
background: #00df00;
}
.fileToUpload {
float: right;
margin-right: .5em;
}
/* Style for IFRAME */
.loader {
border: 0;
height: 0;
width: 0;
padding: 0;
position: absolute;
visibility: hidden;
}
</style>
<link rel="stylesheet" href="jquery-ui-1.7.1.custom.css" type="text/css"></link>
<link rel="stylesheet" href="css/colorpicker.css" type="text/css" />
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.7.1.custom.min.js"></script>
<script type="text/javascript" src="js/jquery.selectboxes.min.js"></script>
<script type="text/javascript" src="js/jquery.checkboxes.min.js"></script>
<script type="text/javascript" src="js/colorpicker.js"></script>
<script type="text/javascript" src="js/eye.js"></script>
<script type="text/javascript" src="js/utils.js"></script>
<script type="text/javascript" src="js/layout.js?ver=1.0.2"></script>
<script type="text/javascript">
<!--
var card_id = gup('card_id');
var card_xml = 'cards/'+card_id+'.xml';
//document.write (card_xml);
//var card_xml = "cards/0000001.xml";
var canvas_width = 500;
var canvas_height = 300;
var timeout = undefined;
function gup( name ) {
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}
var cbloadcard = function() {
$.ajax({
type: "GET",
url: card_xml,
dataType: "xml",
success: function(xml) {
var $bg = $(xml).find('card').attr('background');
$("#canvas").css("background-image", "url(\'cardbg/" + $bg + "\')");
$(xml).find('object[type=text]').each(function(i) {
var content = $(this).find('content').text();
var color = $(this).find('color').text();
var size = $(this).find('size').text();
var font = $(this).find('font').text();
var bold = $(this).find('font').attr('bold');
var italic = $(this).find('font').attr('italic');
var top = $(this).find('top').text() / 100 * 300;
var left = $(this).find('left').text() / 100 * 500;
$('<span id="obj_'+i+'" class="object"></span>')
.attr("cb_content",content)
.attr("cb_color",color)
.attr("cb_size",size)
.attr("cb_font",font)
.attr("cb_bold",bold)
.attr("cb_italic",italic)
.attr("cb_type","text")
.css({'position' : 'relative', 'top' : top, 'left' : left})
.appendTo('#canvas');
imageFromObject($('#obj_'+i));
});
cbinit();
}
});
}
var cbinit = function() {
$(".object").draggable({ containment: '#canvas', scroll: false, cursor: 'crosshair', grid: [5, 5], opacity: 0.35 });
// trigger a select on click
$(".object").click(function () {
$("#tb_object").selectOptions($(this).attr("id"));
$(".object").removeClass("selected");
$(this).addClass("selected");
$('#tb_fontcolor div').css('backgroundColor', '#' + $(this).attr("cb_color"));
$('#tb_fontcolor').ColorPickerSetColor($(this).attr("cb_color"));
$("#tb_size").selectOptions($(this).attr("cb_size"));
$("#tb_font").selectOptions($(this).attr("cb_font"));
$("#tb_bold, #tb_italic").attr('checked', false);
if ($(this).attr("cb_bold") == 'true') $("#tb_bold").attr('checked', true);
if ($(this).attr("cb_italic") == 'true') $("#tb_italic").attr('checked', true);
$("#tb_content").val($(this).attr("cb_content"));
});
// trigger click on drag
$('.object').bind('dragstart', function(event, ui) {
$(this).click();
});
$('.object').bind('dragstop', function(event, ui) {
xmlOut();
});
// load objects in select box
populateObjectSelector();
// click first object
$("#canvas").children().eq("0").click();
/*
CHANGE TRIGGERS
*/
$("#tb_object").change(function () { $("#tb_object option:selected").each(function () { $("#"+$(this).val()).click(); }); });
$("#tb_font").change(function () { imageFromObject($('.selected').attr('cb_font',$('#tb_font option:selected').val())); });
$("#tb_bold").change(function () { if ($('#tb_bold').attr('checked')) { imageFromObject($('.selected').attr('cb_bold','true')); } else { imageFromObject($('.selected').attr('cb_bold','false')); } });
$("#tb_italic").change(function () { if ($('#tb_italic').attr('checked')) { imageFromObject($('.selected').attr('cb_italic','true')); } else { imageFromObject($('.selected').attr('cb_italic','false')); } });
$("#tb_size").change(function () { imageFromObject($('.selected').attr('cb_size',$('#tb_size option:selected').val())); });
$("#tb_content").bind('keyup', function() { clearTimeout(timeout); timeout = setTimeout(function() { imageFromObject($('.selected').attr('cb_content',$('#tb_content').val())); }, 500); });
/*
INITIALIZE COLOR PICJER
*/
$('#tb_fontcolor').ColorPicker({
onShow: function (colpkr) { $(colpkr).fadeIn(500); return false; },
onHide: function (colpkr) { $(colpkr).fadeOut(500); return false; },
onChange: function (hsb, hex, rgb) {
$('#tb_fontcolor div').css('backgroundColor', '#' + hex);
clearTimeout(timeout);
timeout = setTimeout(function() { imageFromObject($('.selected').attr('cb_color',hex)); }, 1000);
}
});
};
var imageFromObject = function(obj) {
var font = $(obj).attr('cb_font');
if ($(obj).attr('cb_bold') == 'true') font = font + '_Bold';
if ($(obj).attr('cb_italic') == 'true') font = font + '_Italic';
var imgurl = 'generator/file.drawtext2.php?'
+"text='"+$(obj).attr('cb_content')
+"'&"
+"font='"+'fonts/'+font+'.ttf'
+"'&"
+"color=0x"+$(obj).attr('cb_color')
+"&"
+"size="+$(obj).attr('cb_size')
+"&"
+"type=png"
+"&"
+"palette=256"
+"&"
+"antialias=1"
;
$(obj).html('<img src="'+imgurl+'" />');
xmlOut();
}
var px2pct = function(px,total) {
px = px.substr(0,px.length-2);
return Math.round(px / total * 100);
}
var xmlOut = function() {
$("#xml_out").val('');
var xml = '';
xml = xml+'<card>'+"\n\t"+'<objects>'+"\n";
$("#canvas").children().each(function (i) {
xml = xml+' <object type="'+$(this).attr("cb_type")+'">'+"\n";
xml = xml+' <content>'+$(this).attr("cb_content")+'</content>'+"\n";
xml = xml+' <size>'+$(this).attr("cb_size")+'</size>'+"\n";
xml = xml+' <color>'+$(this).attr("cb_color")+'</color>'+"\n";
xml = xml+' <font bold="'+$(this).attr("cb_bold")+'" italic="'+$(this).attr("cb_italic")+'">'+$(this).attr("cb_font")+'</font>'+"\n";
xml = xml+' <top>'+px2pct($(this).css("top"),canvas_height)+'</top>'+"\n";
xml = xml+' <left>'+px2pct($(this).css("left"),canvas_width)+'</left>'+"\n";
xml = xml+' </object>'+"\n";
});
xml = xml+"\t"+'</objects>'+"\n"+'</card>'+"\n";
$("#xml_out").val(xml);
};
var populateObjectSelector = function() {
$("#tb_object").removeOption(/./);
$("#canvas").children().each(function (i) {
$("#tb_object").addOption($(this).attr("id"), $(this).attr("id"));
});
};
$(document).ready(function () {
cbloadcard();
});
// -->
// Micox Upload Script 2
<!--
function micoxUpload2(form,timeout,loading,callback){
/**
* micoxUpload2 - Submete um form para um iframe oculto e pega o resultado. Consequentemente pode
* ser usado pra fazer upload de arquivos de forma assÃncrona.
* Versão: 2.0 - 02/01/2008
* Autor: Micox - www.elmicox.com - elmicox.blogspot.com
* Licença: Creative Commons - http://creativecommons.org/licenses/by/2.5/br/
* Some Rights Reserved - http://creativecommons.org/licenses/by/2.5/
**/
var $gE, addEvent, removeEvent, periodic, loadAnim, loaded, abortFrame; //small functions
var error_prog = []; //errors by programer
var new_form, loading_msg, loadpos=0; //the new form that will replace old form AND loading msg
var z, old_action, concat, timeload, timecounter=0, iframe, name;
var loads = [' ','. ','.. ','...']; //loading animation
/*** small functions */
$gE = function(quem){ return document.getElementById(quem) }
addEvent = function(obj, evType, fn){
if (obj.addEventListener){ obj.addEventListener(evType, fn, true) ; }
if (obj.attachEvent) { obj.attachEvent("on"+evType, fn);}
}
removeEvent = function( obj, type, fn ) {
if ( obj.detachEvent ) { obj.detachEvent( 'on'+type, fn ); }
if ( obj.removeEventListener ) { obj.removeEventListener( type, fn, false ); }
}
loadAnim = function(){ //get animation of array loads
if(loading.indexOf('<img')<0){ // 3 dots just if no image
if(loadpos>loads.length - 1){ loadpos = 0; }
return loads[loadpos++] + ' ';
}else{ return '';}
}
periodic = function(){
timecounter++ ;
if(timecounter/2 > timeout && timeout > 0){ //timeout expired (timeout = 0 is infinite)
clearInterval(timeload); //fim do contador
abortFrame(name);
loaded('timeout');
}
loading_msg.innerHTML = loading + ' ' + loadAnim();
}
abortFrame = function(o_frame){ //stop iframe
var o_frame = typeof(o_frame)=="string" ? $gE(o_frame):o_frame;
if(!o_frame){ return false; }
try{ o_frame.contentWindow.stop(); //FF e OP
}catch(e){
try{ o_frame.contentWindow.document.execCommand('stop');//IE
} catch(e){ o_frame.src = ''; /* tenta parar mermo */ }
}
}
cloneEvents = function(source2,target,recursive){
for(var p in source2){ //all params
try{if(source2[p].constructor==Function){
target[p] = source2[p]
}}catch(e){}
}
if(recursive){
for(var el=0; el<source2.childNodes.length; el++){
var elem = source2.childNodes[el]
var elem_target = target.childNodes[el]
if(elem.nodeType==1){
cloneEvents(elem,elem_target);
}
}
}
}
//testing callback
if(typeof(callback)!='function'){ error_prog.push("The 'callback' parameter must be a function") }
//testing if 'form' is a html object or a id string
form = typeof(form)=="string" ? $gE(form):form;
if(form.nodeName.toUpperCase()!='FORM'){
error_prog.push("The first parameter must be a form element ID or a form element reference") }
//testing if form have some input file
var input_file = false;
var infile = form.getElementsByTagName('input')
for(z in infile){
if(infile[z].type=='file'){
if(infile[z].value==''){
alert("The input is empty. I cant upload this.")
return true;
}else{
input_file = infile[z];
}
}
}
if(input_file==false){ error_prog.push("The form must be a input type file") }
//exit if programmer errors
if(error_prog.length>0) {
alert("Error in parameters of micoxUpload:\n\n" + error_prog.join('\n'));
/* uncoment this if you want use try-catch-throw
throw(error_prog.join('\n'))
return true; */
}
//random id for multiple calls
rand = (m=Math).round( 20 * m.random() );
//adding callback function to global scope
//window['micoxCallbackTemp' + rand] = callback
//creating the iframe
name = "micox-temp" + rand;
iframe = document.createElement("iframe");
iframe.setAttribute("id",name);
iframe.setAttribute("name",name);
iframe.setAttribute("width","0");
iframe.setAttribute("height","0");
iframe.setAttribute("border","0");
iframe.setAttribute("style","width: 0; height: 0; border: none;");
//add to document
form.parentNode.appendChild(iframe);
window.frames[name].name = name; //ie sucks
//event after load
loaded = function(){
//var iframe2 = $gE(name);
clearInterval(timeload); //fim do contador
//first, removing the event of iframe
removeEvent(iframe,'load',loaded)
//removind loading msg
loading_msg.parentNode.removeChild(loading_msg);
//removing old form
//form.parentNode.removeChild(form);
//calling callback with the return
if(arguments[0]!='timeout'){
callback(iframe.contentWindow.document.body.innerHTML);
}else{
callback('Timeout expired. ' + timeout + ' secs.');
}
//removing old iframe
abortFrame(iframe);
iframe.src=''; //to stop 'loadind' in FF. bug.
iframe.parentNode.removeChild(iframe);
delete iframe;
}
//adding the event
addEvent(iframe,'load',loaded)
//properties of form to a normal upload
form.setAttribute("target",name);
form.setAttribute("method","post");
form.setAttribute("enctype","multipart/form-data");
form.setAttribute("encoding","multipart/form-data");
//aditional information if micoxUpload
old_action = form.action;
if(form.action.indexOf('?')>1){ concat = '' } else { concat = '?' }
//form.setAttribute("action",form.action + concat + 'micoxUpload=1');
form.setAttribute("action",form.action + concat + '');
//submit
form.submit();
//make loading
loading_msg = document.createElement('div');
loading_msg.innerHTML = loading;
form.parentNode.insertBefore(loading_msg,form);
//making new form and hidden old form
input_file.value='';
form.reset();
new_form = form.cloneNode(true);
cloneEvents(form,new_form,true);
new_form.reset();
new_form.action = old_action;
form.style.display = 'none';
form.parentNode.insertBefore(new_form,form);
//if you want new input file before the 'loading div', use this above (invert the comment)
//form.parentNode.insertBefore(new_form,loading_msg);
timeload = setInterval(periodic,500);
//no submit default
return false;
}
//-->
</script>
<?php
if(isset($_SERVER["PHP_SELF"])){
$url = $_SERVER['REQUEST_URI'];
//echo $url;
$cardbg = $_POST["cardbg"];
//echo('var bg = $_POST["cardbg"];');
}
?>
<form action="<?php echo $url;?>" id='form_up3' method=post>
<?php
// Build Font List
$fonts = array();
foreach (glob("generator/fonts/*.ttf") as $filename) {
$path_parts = pathinfo($filename);
$fontname = str_replace('_Bold','',str_replace('_Italic','',str_replace('.ttf','',$path_parts['basename'])));
if (!in_array($fontname,$fonts)) $fonts[] = $fontname;
}
//print_r(pathinfo($filename));
//print_r($fonts);
?>
<div id="body">
<div id="body_container">
<div id="container2">
<h1><b>Card Builder</b></h1>
<div id="toolbar">
Object : <select id="tb_object"></select><br />
Font : <select id="tb_font"><?php foreach ($fonts as $font) echo "<option value='$font'>$font</option>"; ?></select>
<!--<?php echo $font;?>-->
Size : <select id="tb_size"><?php for($i=7; $i<=42; $i++) echo "<option value='$i'>$i</option>"; ?></select>
Bold : <input id="tb_bold" type="checkbox">
Italic : <input id="tb_italic" type="checkbox"><br />
Color : <div id="tb_fontcolor"><div style="background-color: #000000"></div></div>
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
<?//php include('ajaxfileupload.php');?>
<?//php include('upload_tester2.php');?>
<?php
if(isset($_SERVER["PHP_SELF"])){
$cardbg = $_POST["cardbg"];
//echo('var bg = $_POST["cardbg"];');
}
?>
<script type="text/javascript">
function end_upload3(data){
ge = document.getElementById('returnUp');
ge.style.display = "block";
ge.innerHTML = returnUp;
//document.getElementById('returnUp').innerHTML += returnUp + data;
//alert(data);
}
</script>
Logo:
<input type='file' name='name_1' onchange="micoxUpload2(this.form,0,'<img src=\'load.gif\' /> Loading...',end_upload3)" />
<div id='returnUp' name='returnUp'><br />
</div>
<div style="position:absolute; top: 293px; left: 580px;">
<br>Text : <input id="tb_content" />
</div>
<ul id="icons" class="ui-widget ui-helper-clearfix">
<li class="ui-state-default ui-corner-all" title=".ui-icon-circle-plus"><span id="tb_addtext" class="ui-icon ui-icon-circle-plus">Add New</span></li>
</ul>
</div>
<div id="canvas"></div>
<?php
if ($_FILES["name_1"]["name"] != "") {
// This is the form processing to upload the file
$filename = $_FILES["name_1"]["name"];
echo "<input type='hidden' name='name_1' id='name_1' value=".$filename;">";
if ((($_FILES["name_1"]["type"] == "image/gif")
|| ($_FILES["name_1"]["type"] == "image/jpeg")
|| ($_FILES["name_1"]["type"] == "image/pjpeg")
|| ($_FILES["name_1"]["type"] == "image/x-png"))
&& ($_FILES["name_1"]["size"] < 20000))
{
if ($_FILES["name_1"]["name"]["error"] > 0)
{
echo "Return Code: " . $_FILES["name_1"]["name"]["error"] . "<br />";
}
else
{
//This line assigns a random number to a variable. You could also use a timestamp here if you prefer.
$ran = rand () ;
//This takes the random number (or timestamp) you generated and adds a . on the end, so it is ready of the file extension to be appended.
$ran2 = $ran.".";
//This assigns the subdirectory you want to save into... make sure it exists!
$target = "./upload/";
//This combines the directory, the random file name, and the extension
$target = $target . $ran2.$ext;
move_uploaded_file($_FILES["name_1"]["tmp_name"],"./upload/" . $_FILES["name_1"]["name"]);
}
//This line assigns a random number to a variable. You could also use a timestamp here if you prefer.
$ran = rand () ;
//This takes the random number (or timestamp) you generated and adds a . on the end, so it is ready of the file extension to be appended.
$ran2 = $ran.".";
//This assigns the subdirectory you want to save into... make sure it exists!
$target = "./upload/";
//This combines the directory, the random file name, and the extension
$target = $target . $ran2.$ext;
if(move_uploaded_file($_FILES["name_1"]["tmp_name"], $target))
{
echo "The file has been uploaded as ".$ran2.$ext;
echo "Upload: " . $_FILES["name_1"]["name"] . "<br />";
echo "Type: " . $_FILES["name_1"]["type"] . "<br />";
echo "Size: " . ($_FILES["name_1"]["size"] / 1024) . " Kb<br />";
move_uploaded_file($_FILES["name_1"]["tmp_name"],"./upload/" . $_FILES["name_1"]["name"]);
}
if (file_exists("./upload/" . $_FILES["name_1"]["name"]))
{
echo $_FILES["name_1"]["name"] . " already exists. ";
//This function separates the extension from the rest of the file name and returns it
$filename = $_FILES["name_1"]["name"];
function findexts ($filename)
{
$filename = strtolower($filename) ;
$exts = split("[/\\.]", $filename) ;
$n = count($exts)-1;
$exts = $exts[$n];
return $exts;
}
//This applies the function to our file
$ext = findexts ($_FILES["name_1"]["name"]);
//This line assigns a random number to a variable. You could also use a timestamp here if you prefer.
$ran = rand () ;
//This takes the random number (or timestamp) you generated and adds a . on the end, so it is ready of the file extension to be appended.
$ran2 = $ran.".";
//This assigns the subdirectory you want to save into... make sure it exists!
$target = "./upload/";
//This combines the directory, the random file name, and the extension
$target = $target . $ran2.$ext;
move_uploaded_file($_FILES["name_1"]["tmp_name"],"./upload/" . $_FILES["name_1"]["tmp_name"]);
if(move_uploaded_file($_FILES["name_1"]["tmp_name"], "./upload/"))
{
echo "The file has been uploaded as ".$ran2.$ext;
}
}
else
{
move_uploaded_file($_FILES["name_1"]["tmp_name"],
"upload/" . $_FILES["name_1"]["name"]);
}
}
}
if (isset($_FILES["name_1"]["name"])) {
$fileToUpload = $_FILES["name_1"]["name"];
echo $fileToUpload;
echo "<style type=\"text/css\">
.drag {
border: 0px solid black;
background-color: rgb(255, 255, 255);
position: absolute;
padding: 0.5em;
margin: 0 0 0.5em 1.5em;
cursor: move;
}
</style>
<div class='drag'><img class='drag' src=upload/$fileToUpload border='0' style='position: absolute; top: 300px; left: 300px;'></div>
<pre id=\"debug\"></pre>
<script language=\"JavaScript\" type=\"text/javascript\">
<!--
// this is simply a shortcut for the eyes and fingers
function $(id)
{
return document.getElementById(id);
}
var _startX = 0; // mouse starting positions
var _startY = 0;
var _offsetX = 0; // current element offset
var _offsetY = 0;
var _dragElement; // needs to be passed from OnMouseDown to OnMouseMove
var _oldZIndex = 0; // we temporarily increase the z-index during drag
var _debug = $('debug'); // makes life easier
InitDragDrop();
function InitDragDrop()
{
document.onmousedown = OnMouseDown;
document.onmouseup = OnMouseUp;
}
function OnMouseDown(e)
{
// IE is retarded and doesn't pass the event object
if (e == null)
e = window.event;
// IE uses srcElement, others use target
var target = e.target != null ? e.target : e.srcElement;
_debug.innerHTML = target.className == 'drag'
? 'draggable element clicked'
: 'NON-draggable element clicked';
// for IE, left click == 1
// for Firefox, left click == 0
if ((e.button == 1 && window.event != null ||
e.button == 0) &&
target.className == 'drag')
{
// grab the mouse position
_startX = e.clientX;
_startY = e.clientY;
// grab the clicked element's position
_offsetX = ExtractNumber(target.style.left);
_offsetY = ExtractNumber(target.style.top);
// bring the clicked element to the front while it is being dragged
_oldZIndex = target.style.zIndex;
target.style.zIndex = 10000;
// we need to access the element in OnMouseMove
_dragElement = target;
// tell our code to start moving the element with the mouse
document.onmousemove = OnMouseMove;
// cancel out any text selections
document.body.focus();
// prevent text selection in IE
document.onselectstart = function () { return false; };
// prevent IE from trying to drag an image
target.ondragstart = function() { return false; };
// prevent text selection (except IE)
return false;
}
}
function ExtractNumber(value)
{
var n = parseInt(value);
return n == null || isNaN(n) ? 0 : n;
}
function OnMouseMove(e)
{
if (e == null)
var e = window.event;
// this is the actual \"drag code\"
_dragElement.style.left = (_offsetX + e.clientX - _startX) + 'px';
_dragElement.style.top = (_offsetY + e.clientY - _startY) + 'px';
_debug.innerHTML = '(' + _dragElement.style.left + ', ' + _dragElement.style.top + ')';
}
function OnMouseUp(e)
{
if (_dragElement != null)
{
_dragElement.style.zIndex = _oldZIndex;
// we're done with these events until the next OnMouseDown
document.onmousemove = null;
document.onselectstart = null;
_dragElement.ondragstart = null;
// this is how we know we're not dragging
_dragElement = null;
//_debug.innerHTML = 'mouse up';
}
}
</script>";
} else {
$_FILES["name_1"]["name"] == "";
echo "No file to upload";
}
?>
<textarea id="xml_out" cols="60" rows="15" style="display : none;"></textarea>
</div>
</div>
</div>
<div style="position: absolute; left: 800px; top: 640px;"><input type="image" src="../edstore/images/next.png"></div>
<?php
if ($_FILES["name_1"]["name"] != "") {
// This is the form processing to upload the file
$filename = $_FILES["name_1"]["name"];
echo "<input type='hidden' name='name_1' id='name_1' value=".$filename;">";
if ((($_FILES["name_1"]["type"] == "image/gif")
|| ($_FILES["name_1"]["type"] == "image/jpeg")
|| ($_FILES["name_1"]["type"] == "image/pjpeg")
|| ($_FILES["name_1"]["type"] == "image/x-png"))
&& ($_FILES["name_1"]["size"] < 20000))
{
if ($_FILES["name_1"]["name"]["error"] > 0)
{
echo "Return Code: " . $_FILES["name_1"]["name"]["error"] . "<br />";
}
else
{
//This line assigns a random number to a variable. You could also use a timestamp here if you prefer.
$ran = rand () ;
//This takes the random number (or timestamp) you generated and adds a . on the end, so it is ready of the file extension to be appended.
$ran2 = $ran.".";
//This assigns the subdirectory you want to save into... make sure it exists!
$target = "./upload/";
//This combines the directory, the random file name, and the extension
$target = $target . $ran2.$ext;
move_uploaded_file($_FILES["name_1"]["tmp_name"],"./upload/" . $_FILES["name_1"]["name"]);
}
//This line assigns a random number to a variable. You could also use a timestamp here if you prefer.
$ran = rand () ;
//This takes the random number (or timestamp) you generated and adds a . on the end, so it is ready of the file extension to be appended.
$ran2 = $ran.".";
//This assigns the subdirectory you want to save into... make sure it exists!
$target = "./upload/";
//This combines the directory, the random file name, and the extension
$target = $target . $ran2.$ext;
if(move_uploaded_file($_FILES["name_1"]["tmp_name"], $target))
{
echo "The file has been uploaded as ".$ran2.$ext;
echo "Upload: " . $_FILES["name_1"]["name"] . "<br />";
echo "Type: " . $_FILES["name_1"]["type"] . "<br />";
echo "Size: " . ($_FILES["name_1"]["size"] / 1024) . " Kb<br />";
move_uploaded_file($_FILES["name_1"]["tmp_name"],"./upload/" . $_FILES["name_1"]["name"]);
}
if (file_exists("./upload/" . $_FILES["name_1"]["name"]))
{
echo $_FILES["name_1"]["name"] . " already exists. ";
//This function separates the extension from the rest of the file name and returns it
$filename = $_FILES["name_1"]["name"];
function findexts ($filename)
{
$filename = strtolower($filename) ;
$exts = split("[/\\.]", $filename) ;
$n = count($exts)-1;
$exts = $exts[$n];
return $exts;
}
//This applies the function to our file
$ext = findexts ($_FILES["name_1"]["name"]);
//This line assigns a random number to a variable. You could also use a timestamp here if you prefer.
$ran = rand () ;
//This takes the random number (or timestamp) you generated and adds a . on the end, so it is ready of the file extension to be appended.
$ran2 = $ran.".";
//This assigns the subdirectory you want to save into... make sure it exists!
$target = "./upload/";
//This combines the directory, the random file name, and the extension
$target = $target . $ran2.$ext;
move_uploaded_file($_FILES["name_1"]["tmp_name"],"./upload/" . $_FILES["name_1"]["tmp_name"]);
if(move_uploaded_file($_FILES["name_1"]["tmp_name"], "./upload/"))
{
echo "The file has been uploaded as ".$ran2.$ext;
}
}
else
{
move_uploaded_file($_FILES["name_1"]["tmp_name"],
"upload/" . $_FILES["name_1"]["name"]);
}
}
}
if (isset($_FILES["name_1"]["name"])) {
$fileToUpload = $_FILES["name_1"]["name"];
echo $fileToUpload;
echo "<style type=\"text/css\">
.drag {
border: 0px solid black;
background-color: rgb(255, 255, 255);
position: absolute;
padding: 0.5em;
margin: 0 0 0.5em 1.5em;
cursor: move;
}
</style>
<div class='drag'><img class='drag' src=upload/$fileToUpload border='0' style='position: absolute; top: 300px; left: 300px;'></div>
<pre id=\"debug\"></pre>
<script language=\"JavaScript\" type=\"text/javascript\">
<!--
// this is simply a shortcut for the eyes and fingers
function $(id)
{
return document.getElementById(id);
}
var _startX = 0; // mouse starting positions
var _startY = 0;
var _offsetX = 0; // current element offset
var _offsetY = 0;
var _dragElement; // needs to be passed from OnMouseDown to OnMouseMove
var _oldZIndex = 0; // we temporarily increase the z-index during drag
var _debug = $('debug'); // makes life easier
InitDragDrop();
function InitDragDrop()
{
document.onmousedown = OnMouseDown;
document.onmouseup = OnMouseUp;
}
function OnMouseDown(e)
{
// IE is retarded and doesn't pass the event object
if (e == null)
e = window.event;
// IE uses srcElement, others use target
var target = e.target != null ? e.target : e.srcElement;
_debug.innerHTML = target.className == 'drag'
? 'draggable element clicked'
: 'NON-draggable element clicked';
// for IE, left click == 1
// for Firefox, left click == 0
if ((e.button == 1 && window.event != null ||
e.button == 0) &&
target.className == 'drag')
{
// grab the mouse position
_startX = e.clientX;
_startY = e.clientY;
// grab the clicked element's position
_offsetX = ExtractNumber(target.style.left);
_offsetY = ExtractNumber(target.style.top);
// bring the clicked element to the front while it is being dragged
_oldZIndex = target.style.zIndex;
target.style.zIndex = 10000;
// we need to access the element in OnMouseMove
_dragElement = target;
// tell our code to start moving the element with the mouse
document.onmousemove = OnMouseMove;
// cancel out any text selections
document.body.focus();
// prevent text selection in IE
document.onselectstart = function () { return false; };
// prevent IE from trying to drag an image
target.ondragstart = function() { return false; };
// prevent text selection (except IE)
return false;
}
}
function ExtractNumber(value)
{
var n = parseInt(value);
return n == null || isNaN(n) ? 0 : n;
}
function OnMouseMove(e)
{
if (e == null)
var e = window.event;
// this is the actual \"drag code\"
_dragElement.style.left = (_offsetX + e.clientX - _startX) + 'px';
_dragElement.style.top = (_offsetY + e.clientY - _startY) + 'px';
_debug.innerHTML = '(' + _dragElement.style.left + ', ' + _dragElement.style.top + ')';
}
function OnMouseUp(e)
{
if (_dragElement != null)
{
_dragElement.style.zIndex = _oldZIndex;
// we're done with these events until the next OnMouseDown
document.onmousemove = null;
document.onselectstart = null;
_dragElement.ondragstart = null;
// this is how we know we're not dragging
_dragElement = null;
//_debug.innerHTML = 'mouse up';
}
}
</script>";
} else {
$_FILES["name_1"]["name"] == "";
echo "No file to upload";
}
?>
</form>
<?php
include('templates/footer.php');
?>
|
Advertisement
| Hall of Fame |