简体   繁体   English

为什么我要禁止403?

[英]Why am I getting 403 forbidden?

I'm working on a Mario Kart Wii license maker and whenever I added a button to save it to my server it works on my http://localhost but when I uploaded it to my website it gives me. 我正在研究Mario Kart Wii许可证制造商,每当我添加一个按钮将其保存到服务器时,它都可以在我的http:// localhost上工作,但是当我将其上传到我的网站时,它可以为我提供服务。 This is the HTML/PHP, CSS, and JavaScript I use if that helps you. 如果可以的话,这就是我使用的HTML / PHP,CSS和JavaScript。

 $(document).ready(function(){ var canvas = document.getElementById("mainCanvas"); var ctx = canvas.getContext("2d"); var name = document.getElementById("name"); var favRace = document.getElementById("favRace"); var vr = document.getElementById("vrPoints"); var ranking = document.getElementById("ranking"); var favVehicle = document.getElementById("favKart"); var favVehicle2 = document.getElementById("favKart2"); var bgrnd = document.getElementById("bgrnd"); var textClr = document.getElementById("textClr"); var favChar = document.getElementById("favChar"); var secChar = document.getElementById("secChar"); var mainImg = document.getElementById("mainImg"); $("#create").click(function(){ drawRect(0, 0, bgrnd.value, 530, 300); drawRect(0, 0, "white", 163, 173); switch (favChar.value) { case "Yoshi": img = document.getElementById("yoshi"); break; case "Baby Luigi": img = document.getElementById("baby_luigi"); break; case "Baby Daisy": img = document.getElementById("baby_daisy"); break; case "Baby Peach": img = document.getElementById("baby_peach"); break; case "Baby Mario": img = document.getElementById("baby_mario"); break; case "Toad": img = document.getElementById("toad"); break; case "Toadette": img = document.getElementById("toadette"); break; case "Koopa Troopa": img = document.getElementById("koopa_troopa"); break; case "Dry Bones": img = document.getElementById("dry_bones"); break; case "Mario": img = document.getElementById("mario"); break; case "Luigi": img = document.getElementById("luigi"); break; case "Peach": img = document.getElementById("peach"); break; case "Daisy": img = document.getElementById("daisy"); break; case "Birdo": img = document.getElementById("birdo"); break; case "Diddy Kong": img = document.getElementById("diddy"); break; case "Bowser Jr.": img = document.getElementById("bowser_jr"); break; case "Wario": img = document.getElementById("wario"); break; case "Waluigi": img = document.getElementById("waluigi"); break; case "Donkey Kong": img = document.getElementById("dk"); break; case "Bowser": img = document.getElementById("bowser"); break; case "King Boo": img = document.getElementById("boo"); break; case "Rosalina": img = document.getElementById("rosalina"); break; case "Funky Kong": img = document.getElementById("funky"); break; case "Dry Bowser": img = document.getElementById("dry_bowser"); break; case "Mii": img = document.getElementById("mii"); break; default: img = "null"; } drawText("Name: " + name.value, 170, 20, textClr.value, "17px Times"); drawText("Favorite Race: " + favRace.value, 170, 45, textClr.value, "17px Times"); drawText("Favorite Vehicle: " + favVehicle.value, 170, 70, textClr.value, "17px Times"); drawText("Secondary Character: " + secChar.value, 170, 95, textClr.value, "17px Times") drawText("Secondary Vehicle: " + favVehicle2.value, 170, 120, textClr.value, "17px Times"); drawText("Overall Ranking: " + ranking.value, 170, 145, textClr.value, "17px Times"); drawText("Versus Points: " + vr.value, 170, 170, textClr.value, "17px Times"); drawImg(img, 8, 8, 150, 160); ctx.strokeRect(0, 0, 530, 300); drawText("Mario Kart Wii", 20, 260, textClr.value, "75px Bandits"); document.getElementById("canvasP").style.display = "block"; document.getElementById("share").style.display = "block"; canvas.style.display = "initial"; var imageURL = canvas.toDataURL(); document.getElementById("image").value = imageURL; }); function drawRect(x, y, color, width, height) { ctx.fillStyle = color; ctx.fillRect(x, y, width, height); } function drawText(text, x, y, color, font) { ctx.fillStyle = color; ctx.font = font; ctx.fillText(text, x, y); } function drawImg(img, x, y, width, height) { ctx.drawImage(img, x, y, width, height); ctx.strokeRect(0, 0, width + 14, height + 14); ctx.strokeStyle = "black"; ctx.lineWidth = 5; } }); 
 @font-face { font-family: Bandits; src: url("Bandits.ttf"); font-weight: bold; } #mainCanvas { display: none; } #canvasP { display: none; } .img { display: none; } a { text-decoration: none; } header { background: -linear-gradient(#EEEEEE, #DDDDDD); background: -webkit-linear-gradient(#EEEEEE, #DDDDDD); height: 50px; margin: -.6%; padding: 10px; } #title { font-family: Bandits; font-size: 55px; color: #585858; } body { background-color: rgb(134, 170, 230); } fieldset { width: 60%; text-align: left; } .yellow { color: yellow; } #license { border: 2px solid black; border-radius: 5px; } #share { display: none; } 
 <?PHP function share() { if (!empty($_POST)) { define('UPLOAD_DIR', ''); define('UPLOAD_DIR2', 'licenses/'); $img = $_POST['image']; $img = str_replace('data:image/png;base64,', '', $img); $img = str_replace(' ', '+', $img); $data = base64_decode($img); $file = UPLOAD_DIR . 'share.png'; $licenses = UPLOAD_DIR2 . uniqid() . '.png'; $success = file_put_contents($file, $data); print $success ? $file : 'Unable to save file.'; } } ?> <!DOCTYPE HTML> <HTML lang = "en"> <head> <meta charset = "UTF-8"> <meta name = "description" content = "Create Mario Kart Wii Licenses!"> <meta name = "author" content = "Adam Oates"> <meta name = "title" content = "Mario Kart Wii License Maker"> <title title = "Mario Kart Wii License Maker | Gigaboy Web Designs"> Mario Kart Wii License Maker | Gigaboy Web Designs </title> <link rel = "apple-touch-icon" href = "images/logo.png"> <link rel = "shortcut icon" href = "images/logo.png"> <link rel = "stylesheet" type = "text/css" href = "main.css"> <script type = "text/javascript" src = "https://apis.google.com/js/platform.js" async defer></script> <script type = "text/javascript" src = "http://code.jquery.com/jquery-2.1.4.js"></script> <script type = "text/javascript" src = "main.js"></script> </head> <body> <script> window.fbAsyncInit = function() { FB.init({ appId : 'your-app-id', xfbml : true, version : 'v2.5' }); }; (function(d, s, id){ var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> <header> <div id = "title"> MKWii License Maker </div> </header><br><br><br><br> <section> <div align = "center"> <form action = "" method = "post"> <fieldset> Name: <input type = "text" name = "name" id = "name" placeholder = "Name"><br><br> Favorite Race: <select id = "favRace"> <optgroup label = "Mushroom Cup"> <option value = "Luigi Circuit">Luigi Circuit</option> <option value = "Moo Moo Meadows">Moo Moo Meadows</option> <option value = "Mushroom Gorge">Mushroom Gorge</option> <option value = "Toad's Factory">Toad's Factory</option> <optgroup label = "Flower Cup"> <option value = "Mario Circuit">Mario Circuit</option> <option value = "Coconut Mall">Coconut Mall</option> <option value = "DK's Summit">DK's Summit</option> <option value = "Wario's Gold Mine">Wario's Gold Mine</option> <optgroup label = "Star Cup"> <option value = "Daisy Circuit">Daisy Circuit</option> <option value = "Koopa Cape">Koopa Cape</option> <option value = "Maple Treeway">Maple Treeway</option> <option value = "Grumble Volcano">Grumble Volcano</option> <optgroup label = "Special Cup"> <option value = "Dry Dry Ruins">Dry Dry Ruins</option> <option value = "Moonview Highway">Moonview Highway</option> <option value = "Bowser's Castle">Bowser's Castle</option> <option value = "Rainbow Road">Rainbow Road</option> <optgroup label = "Shell Cup"> <option value = "GCN Peach Beach">GCN Peach Beach</option> <option value = "DS Yoshi Falls">DS Yoshi Falls</option> <option value = "SNES Ghost Valley 2">SNES Ghost Valley 2</option> <option value = "N64 Mario Raceway">N64 Mario Raceway</option> <optgroup label = "Bannana Cup"> <option value = "N64 Sherbert Land">N64 Sherbert Land</option> <option value = "GBA Shy Guy Beach">GBA Shy Guy Beach</option> <option value = "DS Delfino Square">DS Delfino Square</option> <option value = "GCN Waluigi Stadium">GCN Waluigi Stadium</option> <optgroup label = "Leaf Cup"> <option value = "DS Desert Hill">DS Desert Hill</option> <option value = "GBA Bowser's Castle 3">GBA Bowser's Castle 3</option> <option value = "N64 DK Jungle Parkway">N64 DK Jungle Parkway</option> <option value = "GCN Mario Circuit">GCN Mario Circuit</option> <optgroup label = "Lightning Cup"> <option value = "SNES Mario Circuit 3">SNES Mario Circuit 3</option> <option value = "DS Peach's Garden">DS Peach's Garden</option> <option value = "GCN DK Mountain">GCN DK Mountain</option> <option value = "N64 Bowser's Castle">N64 Bowser's Castle</option> </select><br><br> Overall Ranking: <select id = "ranking"> <option id = "e" value = "E">E</option> <option id = "d" value = "D">D</option> <option id = "c" value = "C">C</option> <option id = "b" value = "B">B</option> <option id = "a" value = "A">A</option> <option id = "star1" value = "&#9733;">&#9733;</option> <option id = "star2" value = "&#9733;&#9733;">&#9733;&#9733;</option> <option id = "star3" value = "&#9733;&#9733;&#9733;">&#9733;&#9733;&#9733;</option> </select><br><br> Versus Points: <select id = "vrPoints"> <option id = "1000+" value = "1000+">1000+</option> <option id = "2000+" value = "2000+">2000+</option> <option id = "3000+" value = "3000+">3000+</option> <option id = "4000+" value = "4000+">4000+</option> <option id = "5000+" value = "5000+">5000+</option> <option id = "6000+" value = "6000+">6000+</option> <option id = "7000+" value = "7000+">7000+</option> <option id = "8000+" value = "8000+">8000+</option> <option id = "9000+" value = "9000+">9000+</option> </select><br><br> Favorite Character: <select id = "favChar"> <option value = "Baby Mario">Baby Mario</option> <option value = "Baby Luigi">Baby Luigi</option> <option value = "Baby Peach">Baby Peach</option> <option value = "Baby Daisy">Baby Daisy</option> <option value = "Toad">Toad</option> <option value = "Toadette">Toadette</option> <option value = "Koopa Troopa">Koopa Troopa</option> <option value = "Dry Bones">Dry Bones</option> <option value = "Mario">Mario</option> <option value = "Luigi">Luigi</option> <option value = "Peach">Peach</option> <option value = "Daisy">Daisy</option> <option value = "Yoshi">Yoshi</option> <option value = "Birdo">Birdo</option> <option value = "Diddy Kong">Diddy Kong</option> <option value = "Bowser Jr.">Bowser Jr.</option> <option value = "Wario">Wario</option> <option value = "Waluigi">Waluigi</option> <option value = "Donkey Kong">Donkey Kong</option> <option value = "Bowser">Bowser</option> <option value = "King Boo">King Boo</option> <option value = "Rosalina">Rosalina</option> <option value = "Funky Kong">Funky Kong</option> <option value = "Dry Bowser">Dry Bowser</option> <option value = "Mii">Mii</option> </select><br><br> Secondary Character: <select id = "secChar"> <option value = "Baby Mario">Baby Mario</option> <option value = "Baby Luigi">Baby Luigi</option> <option value = "Baby Peach">Baby Peach</option> <option value = "Baby Daisy">Baby Daisy</option> <option value = "Toad">Toad</option> <option value = "Toadette">Toadette</option> <option value = "Koopa Troopa">Koopa Troopa</option> <option value = "Dry Bones">Dry Bones</option> <option value = "Mario">Mario</option> <option value = "Luigi">Luigi</option> <option value = "Peach">Peach</option> <option value = "Daisy">Daisy</option> <option value = "Yoshi">Yoshi</option> <option value = "Birdo">Birdo</option> <option value = "Diddy Kong">Diddy Kong</option> <option value = "Bowser Jr.">Bowser Jr.</option> <option value = "Wario">Wario</option> <option value = "Waluigi">Waluigi</option> <option value = "Donkey Kong">Donkey Kong</option> <option value = "Bowser">Bowser</option> <option value = "King Boo">King Boo</option> <option value = "Rosalina">Rosalina</option> <option value = "Funky Kong">Funky Kong</option> <option value = "Dry Bowser">Dry Bowser</option> <option value = "Mii">Mii</option> </select><br><br> Vehichle Used For Favorite Character: <select id = "favKart"> <optgroup label = "Light Weight"> <option value = "Standard Kart S" id = "sks">Standard Kart S</option> <option value = "Booster Seat" id = "bseat">Booster Seat</option> <option value = "Mini Beast" id = "mb">Mini Beast</option> <option value = "Cheap Charger" id = "cc">Cheap Charger</option> <option value = "Tiny Titan" id = "tt">Tiny Titan</option> <option value = "Blue Falcon" id = "bf">Blue Falcon</option> <option value = "Standard Bike S" id = "sbs">Standard Bike S</option> <option value = "Bullet Bike" id = "bb">Bullet Bike</option> <option value = "Bit Bike" id = "bitb">Bit Bike</option> <option value = "Quacker" id = "qkr">Quacker</option> <option value = "Magikruser" id = "mgcCrsr">Magikruser</option> <option value = "Jet Bubble" id = "jb">Jet Bubble</option> <optgroup label = "Medium Weight"> <option value = "Standard Kart M" id = "skm">Standard Kart M</option> <option value = "Classic Dragster" id = "cd">Classic Dragster</option> <option value = "Wild Wing" id = "ww">Wild Wing</option> <option value = "Super Blooper" id = "sb">Super Blooper</option> <option value = "Daytripper" id = "dtrp">Daytripper</option> <option value = "Sprinter" id = "sprnt">Sprinter</option> <option value = "Standard Bike M" id = "sbm">Standard Bike M</option> <option value = "Mach Bike" id = "machb">Mach Bike</option> <option value = "Sugarscoot" id = "sugar">Sugarscoot</option> <option value = "Zip Zip" id = "zip">Zip Zip</option> <option value = "Sneakster" id = "sneak">Sneakster</option> <option value = "Dolphin Dasher" id = "dphin">Dolphin Dasher</option> <optgroup label = "Heavy Weight"> <option value = "Standard Kart L" id = "skl">Standard Kart L</option> <option value = "Offroader" id = "offrdr">Offroader</option> <option value = "Flame Flyer" id = "ffly">Flame Flyer</option> <option value = "Pirahna Prowler" id = "prwlr">Pirahna Prowler</option> <option value = "Jetsetter" id = "jetstr">Jetsetter</option> <option value = "Honeycoupe" id = "hnycp">Honeycoupe</option> <option value = "Standard Bike L" id = "sbl">Standard Bike L</option> <option value = "Flame Runner" id = "frner">Flame Runner</option> <option value = "Wario Bike" id = "wrobike">Wario Bike</option> <option value = "Shooting Star" id = "shstr">Shooting Star</option> <option value = "Spear" id = "spear">Spear</option> <option value = "Phantom" id = "phntm">Phantom</option> </select><br><br> Vehichle Used For Secondary Character: <select id = "favKart2"> <optgroup label = "Light Weight"> <option value = "Standard Kart S" id = "sks">Standard Kart S</option> <option value = "Booster Seat" id = "bseat">Booster Seat</option> <option value = "Mini Beast" id = "mb">Mini Beast</option> <option value = "Cheap Charger" id = "cc">Cheap Charger</option> <option value = "Tiny Titan" id = "tt">Tiny Titan</option> <option value = "Blue Falcon" id = "bf">Blue Falcon</option> <option value = "Standard Bike S" id = "sbs">Standard Bike S</option> <option value = "Bullet Bike" id = "bb">Bullet Bike</option> <option value = "Bit Bike" id = "bitb">Bit Bike</option> <option value = "Quacker" id = "qkr">Quacker</option> <option value = "Magikruser" id = "mgcCrsr">Magikruser</option> <option value = "Jet Bubble" id = "jb">Jet Bubble</option> <optgroup label = "Medium Weight"> <option value = "Standard Kart M" id = "skm">Standard Kart M</option> <option value = "Classic Dragster" id = "cd">Classic Dragster</option> <option value = "Wild Wing" id = "ww">Wild Wing</option> <option value = "Super Blooper" id = "sb">Super Blooper</option> <option value = "Daytripper" id = "dtrp">Daytripper</option> <option value = "Sprinter" id = "sprnt">Sprinter</option> <option value = "Standard Bike M" id = "sbm">Standard Bike M</option> <option value = "Mach Bike" id = "machb">Mach Bike</option> <option value = "Sugarscoot" id = "sugar">Sugarscoot</option> <option value = "Zip Zip" id = "zip">Zip Zip</option> <option value = "Sneakster" id = "sneak">Sneakster</option> <option value = "Dolphin Dasher" id = "dphin">Dolphin Dasher</option> <optgroup label = "Heavy Weight"> <option value = "Standard Kart L" id = "skl">Standard Kart L</option> <option value = "Offroader" id = "offrdr">Offroader</option> <option value = "Flame Flyer" id = "ffly">Flame Flyer</option> <option value = "Pirahna Prowler" id = "prwlr">Pirahna Prowler</option> <option value = "Jetsetter" id = "jetstr">Jetsetter</option> <option value = "Honeycoupe" id = "hnycp">Honeycoupe</option> <option value = "Standard Bike L" id = "sbl">Standard Bike L</option> <option value = "Flame Runner" id = "frner">Flame Runner</option> <option value = "Wario Bike" id = "wrobike">Wario Bike</option> <option value = "Shooting Star" id = "shstr">Shooting Star</option> <option value = "Spear" id = "spear">Spear</option> <option value = "Phantom" id = "phntm">Phantom</option> </select><br><br> License Color: <input id = "bgrnd" value = "#FFFFFF" type = "color"><br><br> Text Color: <input id = "textClr" value = "#000000" type = "color"><br><br> <input type = "button" name = "create" id = "create" value = "Create License"> <input type = "hidden" name = "image" id = "image" value = ""> <input type = "submit" value = "Share to Facebook" onclick = "<?PHP share(); ?>" id = "share"> </fieldset> </form><br> <p id = "canvasP"> Right click the image and click "Save image as..." to download license.<br> <div class = "fb-share-button" data-href = "http://www.gigaboywebdesigns.com/mkwii-license/index.php" data-layout = "button_count"></div> <sub> <a href = "https://twitter.com/share" class = "twitter-share-button" data-url = "http://www.gigaboywebdesigns.com/mkwii-license/index.php">Tweet</a> <script type = "text/javascript">!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script> <div class = "g-plus" data-action = "share" data-annotation = "bubble" data-href = "http://www.gigaboywebdesigns.com/mkwii-license/index.php"></div> </sub><br> <a href = "mk8.php" title = "Mario Kart 8 License Maker"> MK8 License Maker </a> <a href = "ssbb.php" title = "Super Smash Bros Brawl License Maker"> SSBB License Maker </a><br> <a href = "smk.php" title = "Super Mario Kart License Maker"> SMK License Maker </a> <a href = "mk64.php" title = "Mario Kart 64 License Maker"> MK64 License Maker </a><br> <a href = "mk7.php" title = "Mario Kart 7 License Maker"> MK7 License Maker </a> </p> <canvas width = "530" height = "300" id = "mainCanvas"></canvas> </div> <img src = "images/yoshi.png" id = "yoshi" class = "img"> <img src = "images/baby_mario.png" id = "baby_mario" class = "img"> <img src = "images/baby_luigi.png" id = "baby_luigi" class = "img"> <img src = "images/baby_daisy.png" id = "baby_daisy" class = "img"> <img src = "images/baby_peach.png" id = "baby_peach" class = "img"> <img src = "images/toad.png" id = "toad" class = "img"> <img src = "images/toadette.png" id = "toadette" class = "img"> <img src = "images/dry_bones.png" id = "dry_bones" class = "img"> <img src = "images/koopa_troopa.png" id = "koopa_troopa" class = "img"> <img src = "images/mario.png" id = "mario" class = "img"> <img src = "images/luigi.png" id = "luigi" class = "img"> <img src = "images/peach.png" id = "peach" class = "img"> <img src = "images/daisy.png" id = "daisy" class = "img"> <img src = "images/birdo.png" id = "birdo" class = "img"> <img src = "images/diddy.png" id = "diddy" class = "img"> <img src = "images/bowser_jr.png" id = "bowser_jr" class = "img"> <img src = "images/wario.png" id = "wario" class = "img"> <img src = "images/bowser.png" id = "bowser" class = "img"> <img src = "images/waluigi.png" id = "waluigi" class = "img"> <img src = "images/dk.png" id = "dk" class = "img"> <img src = "images/boo.png" id = "boo" class = "img"> <img src = "images/dry_bowser.png" id = "dry_bowser" class = "img"> <img src = "images/rosalina.png" id = "rosalina" class = "img"> <img src = "images/funky.png" id = "funky" class = "img"> <img src = "images/mii.jpg" id = "mii" class = "img"> </section> <footer> </footer> </body> </HTML> 

Forbidden 被禁止

You don't have permission to access /mkwii-license/ on this server. 您无权访问此服务器上的/ mkwii-license /。

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request. 此外,在尝试使用ErrorDocument处理请求时遇到403禁止错误。

You are uploading a file and likely do not have permission to access the location where the uploaded file is to be saved ie PHP does not have permission to access the location. 您正在上载文件,并且可能无权访问要保存上载文件的位置,即,PHP无权访问该位置。 If you set the permissions for your upload folder to 777, then it should work. 如果您将上传文件夹的权限设置为777,则它应该可以工作。 You can update the permissions with this command: 您可以使用以下命令更新权限:

chmod -r 777 /upload_folder_location/

And you can check the current permissions with this command: 您可以使用以下命令检查当前权限:

ls -al

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM