Jump to content

LucaCrippa

Members
  • Content Count

    20
  • Joined

  • Last visited

Community Reputation

0 Neutral

About LucaCrippa

  • Rank
    Newbie
  1. Hello all, I'm trying to embed a public google calendar to my website using iframe, but this is not woorking in safari, chrome (private window) and i.e. The calendar is alrady set to public. This is the page: you can check it on multiple browsers. http://www.omcc03.net/testcinemanew/page.php?p=calendario How can I fix it? Thank you
  2. Hi, please could you tell me where I'm doing wrong? Page php 1: list of directories where to upload images (galleryedit.php) <?php $path = '../public/gallery';$dirs = scandir($path);foreach ($dirs as $valore) { if($valore === '.' || $valore === '..') { continue; } echo "<a href=uploadimage.php?cartella=$valore> <img src="images/icons/edit.png" title="Carica" width="15" height="15"> </a> $valore </br>";}?> Page php 2: form to upload image, which takes the name of the folder where I want to upload (uploadimage.php) <?php$path = '../public/gallery';$cartella = $path .'/'. $_GET['cartella'];echo "<form action="upload.php?updir=$cartella" method="post" enctype="multipart/form-data"> <input name="image" type="file" size="40" /> <br /><br /> <input name="submit" type="submit" value="Carica immagine" /></form>";?> Page php 3: the uploading facility, which takes the name of the folder (upload.php) <?php $path = '../public/gallery';$dir = $_GET['updir'];if(!isset($_SERVER['DOCUMENT_ROOT'])){ if(isset($_SERVER['SCRIPT_FILENAME'])){ $_SERVER['DOCUMENT_ROOT'] = str_replace( '', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF']))); };}; if(!isset($_SERVER['DOCUMENT_ROOT'])){ if(isset($_SERVER['PATH_TRANSLATED'])){ $_SERVER['DOCUMENT_ROOT'] = str_replace( '', '/', substr(str_replace('', '', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF']))); };};$PercorsoDominio = $_SERVER['DOCUMENT_ROOT'];$public = "/$path/$dir/";if(is_dir($PercorsoDominio.$public)){ continue; }else{ exit; }if ((($_FILES["file"]["type"] == "image/gif") ||($_FILES["file"]["type"] == "image/jpeg") ||($_FILES["file"]["type"] == "image/pjpeg") && ($_FILES["file"]["size"] < 20000000)) ) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { if (file_exists($PercorsoDominio. $public . $_FILES["file"]["name"])) { continue; } else { move_uploaded_file($_FILES["file"]["tmp_name"], $PercorsoDominio. $public . $_FILES["file"]["name"]); include("uploadsuccess.php"); } } }else { include("uploaderror.php"); }}?> Thank you!!
  3. Sure, but if I ask for info directly in a forum I would like to have an answer, just because there are many guides on the web... if one cannot solve its problems with guides, he asks in forums... Anyway, I'm trying Ingolme solution
  4. You are not telling me the solution. I know that I need to redirect only if the submit button is pressed, but I don't know how to do it. header('Location: ./Index.php');bla bla blaecho "<h7>Modifica l'evento</h7><p><form action="$_SERVER[php_self]" method= "post" ><textarea name="newd" cols="100%" rows="18"> $data </textarea><input type="submit" value="Salva modifiche" name="submitted"></form>";if($_SERVER['REQUEST_METHOD'] == "POST") { exit;} Not working. Found here: http://electrokami.com/coding/the-correct-way-to-check-php-form-submission/ last paragraph.
  5. <?php // set file to read$path = '../public/events';$edit = $path .'/'. $_GET['edi']; $newdata = $_POST['newd'];if ($newdata != '') { $fw = fopen($edit, 'w') or die('Could not open file!'); $fb = fwrite($fw,stripslashes($newdata)) or die('Could not write to file'); fclose($fw);} $fh = fopen($edit, "r") or die("Could not open file!"); $data = fread($fh, filesize($edit)) or die("Could not read file!"); fclose($fh);echo "<h7>Modifica l'evento</h7><p><form action="$_SERVER[php_self]" method= "post" ><textarea name="newd" cols="100%" rows="18"> $data </textarea><input type="submit" value="Salva modifiche" ></form>";header('Location: ./Index.php');exit;?> Not working.
  6. Not working. This is redirecting to my new page as entering my php page, but I would like to redirect after clicking the button of the form.
  7. $path = '../public/events';$edit = $path .'/'. $_GET['edi']; $newdata = $_POST['newd'];if ($newdata != '') { $fw = fopen($edit, 'w') or die('Could not open file!'); $fb = fwrite($fw,stripslashes($newdata)) or die('Could not write to file'); fclose($fw);} $fh = fopen($edit, "r") or die("Could not open file!"); $data = fread($fh, filesize($edit)) or die("Could not read file!"); fclose($fh);echo "<h7>Modifica l'evento</h7><p><form action="$_SERVER[php_self]" method= "post" ><textarea name="newd" cols="100%" rows="18"> $data </textarea><input type="submit" value="Salva modifiche" ></form>"; Yeah, I managed to solve it. With this code is working, but now the problem is that when I click on button txt file is saved, but the textarea remains freezed. How can I redirect on another page, such as a edit-confirmed page? Thank you!
  8. Pheraps I fail to open stream, or I have no file or directory.. Or the supplied argument is not a valid stream resource, I don't know.. Or there are two /?
  9. First, I succeeded to make secure session to protect my pages. Secondly, removing the @ in the editevent page brings me these errors: Warning: fopen(../public/events//) [function.fopen]: failed to open stream: No such file or directory inD:Inetpubwebscoroconcorezzoitcircolinoeditevent.php on line 42Warning: fopen(../public/events//) [function.fopen]: failed to open stream: No such file or directory inD:Inetpubwebscoroconcorezzoitcircolinoeditevent.php on line 49Warning: fread(): supplied argument is not a valid stream resource in D:Inetpubwebscoroconcorezzoitcircolinoeditevent.php on line 50Warning: fclose(): supplied argument is not a valid stream resource in D:Inetpubwebscoroconcorezzoitcircolinoeditevent.php on line52
  10. Any idea about fixin' also this problem?
  11. Ok, I'm trying. No, the editing page is protected by a login page!
  12. Ok, the error for the delete was: $deleted = $path .'/'. $_GET['delete']; I'm stupid. I tried to fix the other problem (the edit) with the same code but I failed!
  13. 2.txt in this case is really located in ../public/events so how can I modify my code to make it working? edit: aaahhhh I missed a / I'm trying edit2: no, it's not working at all..
  14. $loadcontent has actually the right value, in fact when I press the edit button the content of my txt file appears! When I click on Save on the form I have that error. About the deleting code, I tried to comment the $path variable but I got the same result. It's a mess!!
  15. I can't have a database for the site I'm building.. it was hard also persuading my clients (friends) to create a website rather than a free blog...
×
×
  • Create New...