Jump to content

bmbc

Members
  • Posts

    21
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

bmbc's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks, yes I didn't think it through because I don't obviously write php so I have been using the same script for a long time but actually not for a few years since using cms, then coming back to it was a mistake. I think I will try swiftmailer on my linux server.
  2. I have used this same php contact form many times and never had this problem. I just checked it in online php code checker and comes up with no errors but when uploaded to the site and I got to test the form it goes to mysite.com/contact.php stuck on trailing code \nReply-To: \"$name\" <$email>\nX-Mailer: chfeedback.php 2.03" ); header( "Location: $thankyouurl" ); exit ; ?> It has me stumped I can't work it out. The full code is: <? /* CHFEEDBACK.PHP Feedback Form PHP Script Ver 2.03 */ $mailto = 'contact@gmail.com' ; $subject = "Contact Form" ; $formurl = "http://www.mysite.com/contact.html" ; $errorurl = "http://www.mysite.com/error.html" ; $thankyouurl = "http://www.mysite.com/thanks.html" ; $name = $_POST['name'] ; $email = $_POST['email'] ; $comments = $_POST['comments'] ; $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ; } if (empty($name) || empty($email) || empty($comments)) { header( "Location: $errorurl" ); exit ; } if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments ); } $messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------- COMMENTS -------------------------\n\n" . $comments . "\n\n------------------------------------------------------------\n" ; mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>\nReply-To: \"$name\" <$email>\nX-Mailer: chfeedback.php 2.03" ); header( "Location: $thankyouurl" ); exit ; ?> But when I look at the source code in browser I can see all of it is in red except for the last trailing bit which appears in black .
  3. bmbc

    httppath

    I don't know what I'm doing wrong but it's something simple: $httppath = "http:www.mydomain.com/folder".dirname($_SERVER['PHP_SELF']); the index.php is in the folder which has the code for uploading files - the file uploads fine but when it shows it's url , it ends up being: http:www.mydomain.com//www.mydomain.com/folder/file.jpg Can someone please tell me why?
  4. Hi again , I spent from 8am till 8pm today working with code and actually now that I think of it I've been doing that for the last three days plus dreaming about code solutions! ARGHH - I've come to the conclusion that either I am incredibly dumb or I'm trying to understand something which would take at least three months of studying(for me at least or I'm thinking maybe never will I comprehend it). Anyway, what I have worked out is there is a script in phpformgen that easily creates db tables but nothing else; a quick script at php will upload multiple files to your server folder but nothing else and dodupload will upload files as well but with the added benefit of restricting upload file size without my service provider's safe mode stopping it! But none of it is good :( because I want a php script that will execute my files text and images to a folder on my site from the htm form I've already created and on top of it all I dream of having one that will automatically resize input images so no mucking around in photoshop with ppl uploading absurd file size formats. It would be a bonus to then have all this recorded in mysql db. Pathetically I can only come up with the htm form :(( My business idea is quickly fading away. All for one form. *vicious*
  5. Thanks but it still doesn't work , no error now just no action- no files found in uploads folder after submit.
  6. Hi poirot, Here is where my form is that I'm practising on trying to make work: [a href=\"http://www.yabbit.net/myuploadform.htm\" target=\"_blank\"]http://www.yabbit.net/myuploadform.htm[/a] (I have no idea why there is a text field right up the top when I can't see it in the htm but anyway the form just doesn't work) And then I changed the upload.php to what you gave me: [code]<?php $updir = '/home/l/lukem/www/uploads/' for ($k=0; $k<count($_FILES['pictures']['name']); $k++) {    if ($_FILES['pictures']['error'][$k] == '0') {       if (move_uploaded_file($_FILES['pictures']['tmp_name'][$k],       $updir . basename($_FILES['pictures']['name'][$k]))) {          echo 'File ' . ($k+1) . ' uploaded successfully' . '<br />';       }    } } ?> [/code] And this is the error msg I get: Parse error: syntax error, unexpected T_FOR in /home/l/lukem/www/upload.php on line 5 Also because I have radio buttons and text fields and text files as well as pictures etc to upload, my php doesn't reflect that or even point to a error and success page. Thx again.
  7. My server admin explained I'm stuck on safe mode which means no way around setting max file upload . Since then I've been trying to use phpformgenerator and I'm sure the safe mode of my server is again stopping me from having permissions. I also tried the cms drupal and it is coming up with the same no access alerts and I'm sure it has to with the safe mode. Does anyone know how to get around this? because my service provider assures me no htaccess file or anything else will over ride it. I'd prefer to create a form from the ground up which will accept both txt and image files (as I've asked about in a previous post) but with some kind of js which will resize uploaded images to correct size. Any help GREATLY appreciated (losing it here) Charlotte
  8. <?php for ($k=0; $k<count($_FILES['pictures']['name']); $k++) { if ($_FILES['pictures']['error'][$k] == '0') { if (move_uploaded_file($_FILES['pictures']['tmp_name'][$k], 'uploads/' . $_FILES['pictures']['name'][$k])) { echo 'File ' . ($k+1) . ' uploaded successfully' . '<br />'; } } } ?> That is your code above? I renamed this one upload2.php and changed the link in the htm file but I'm getting this error: Warning: move_uploaded_file(uploads/claw.gif): failed to open stream: No such file or directory in /home/l/lukem/www/upload2.php on line 6 Warning: move_uploaded_file(): Unable to move '/home/l/lukem/www/upload/phphR7nZH' to 'uploads/claw.gif' in /home/l/lukem/www/upload2.php on line 6 Thanks for your help and hope you can see my error this time.
  9. This is the html part which I'm sure is not right: <form action="upload.php" method="post" enctype="multipart/form-data"> <p>name: <input type="text" name="name[]" /></p> <p>email: <input type="text" name="name[]" /></p> <p>phone: <input type="text" name="name[]" /></p> <p>choose area: <select name="area" size="1"> <option>Canberra Inner North</option> <option>Canberra Belconnen</option> <option>Canberra Gungahlin and Hall</option> <option>Canberra Inner South</option> <option>Canberra Weston Creek</option> <option>Canberra Woden Valley</option> <option>Canberra Tuggeranong</option> <option>Queanbeyan</option> </select> </p> <p>property address: <input type="text" name="name[]" /></p> <p>suburb name: <input name="suburb[]" type="text" id="suburb" size="8" maxlength="12" /> <p>property type: <input name="suburb[]" type="text" id="suburb" size="8" maxlength="12" /> <p>energy rating: <input name="number[]" type="text" size="5" maxlength="10" /> <p>bedrooms: <input name="number[]" type="text" size="5" maxlength="10" /> <p>block size: <input name="number[]" type="text" size="5" maxlength="10" /> <p> property description: <br/> <textarea name="describe" cols="60" rows="18">Please type no more than the approx. 200 words, deleting this message first.</textarea> </p> <p>Pictures: <br/> <input type="file" name="pictures[]" /> <br/> <input type="file" name="pictures[]" /> <br/> <input type="file" name="pictures[]" /> <br/><input type="file" name="pictures[]" /> <br/><input type="file" name="pictures[]" /> <input type="submit" value="Send" /> </p> </form> and this is the php part: <?php foreach ($_FILES["pictures"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { $tmp_name = $_FILES["pictures"]["tmp_name"][$key]; $name = $_FILES["pictures"]["name"][$key]; move_uploaded_file($tmp_name, "data/$name"); } } ?> None of which works :( Any help really appreciated.
  10. bmbc

    settings.php

    [!--quoteo(post=365471:date=Apr 17 2006, 03:13 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Apr 17 2006, 03:13 AM) [snapback]365471[/snapback][/div][div class=\'quotemain\'][!--quotec--] No. If you have mysql installed on the server which your site is running off then you can use localhost as the server is located locally. PHP will fund where the database is automatically. However if your MySQL database is hosted of another server then you'll have to subsitiue localhost with the domain name to the remote server. [/quote] I have mysql installed on my service provider so do I put in mysql.mydomain.net? Thanks for your help too Charly
  11. Hi, I'm trying to get something really simple right ; Database URL format: * $db_url = 'mysql://username:password@localhost/databasename'; With localhost , are you meant to put in your domain name or what? If you are say blah.net do you put that in as localhost or just blah or something else ?
  12. Thanks so much for your help today toplay. I will save any other questions I have for another time when I've read more of the tutorials and forum entries.
  13. Yes, I just worked that out :) I separated the php page from the htm one and set the action to the name of the php and there is no more warning. Problem now is the file size restriction doesn't work , it just ignores it and let's me upload any size I want. Also I need to create an error and successful upload page script. Plus I was hoping to be able to send text with the images to the same uploads folder but I don't know how that would work let alone so the images and text would be associated.
  14. I'm really sorry but I just don't follow. action is missing it's value- which action(?) and why does the php tutorial use the exact same code as the working example? OOOOOPS SORRY!!!!! I just got it - how embarrassing is that! Ok so the action should be upload right or should it be post? Anyway thanks :)
  15. [code]<div id="upload"> <form action="" method="post" enctype="multipart/form-data"> <p>Pictures: <li><input type="file" name="pictures[]" /></li> <li><input type="file" name="pictures[]" /></li> <li><input type="file" name="pictures[]" /></li> <li><input type="file" name="pictures[]" /></li> <li><input type="file" name="pictures[]" /></li> <li><input type="submit" value="Send" /></li> </p> </form> </div> [/code] What is wrong with this?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.