Jump to content

Bubblychaz

Members
  • Posts

    38
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Bubblychaz's Achievements

Newbie

Newbie (1/5)

2

Reputation

  1. I couldnt find my php.ini file My webhost said error reporting is on
  2. It isnt my code, It was partly made for me but the guy never finnished it all. All that is left to do is the delete function.. Sorry yes it should be delete_avatars
  3. Okay sure. When i clikc on Delete in my form, It just returns the next page blank, But when you then go back to the list, the Id you just deleted is still there
  4. My php script wont delete in selected id from the mysql database function code <?php function edit_avatar($_POST) { if ($_POST['delete'] == 1) { delete_item($_POST['id']); return 'deleted'; } $errors = check_required_fields($_POST); function delete_avatars($id) { $query = "DELETE FROM avatar_list WHERE id = '$id' LIMIT 1"; return mysql_query($query) or die(mysql_error()); } edit page code if (!empty($_GET['delete'])) { echo '<p style="color: green;">The avatar has been deleted.</p>'; } <td>Delete Avatar:</td> <td><input type="checkbox" name="delete" value="1" onclick="confirm_delete(this);"/><span style="color:red;">This cannot be undone!</span></td> Ive removed the rest of the code but delete bits
  5. The upload form is a in staff folder which is a subdomain so staff.spardel.com the images folder is in the main domain which is spardel.com/images
  6. I fixed it.. I think.. Im unsure if this is the correct way around it but I took $_SERVER['DOCUMENT_ROOT'] = "/home4/spardelc/"; off the addon.php and put it at the top of my script, But I also checked my file manager to see exactly what my root was called which and added this to the top of my script $_SERVER['DOCUMENT_ROOT'] = "/home4/spardelc/public_html/";
  7. I think the issue is the $_SERVER['DOCUMENT_ROOT'] in my addon.php i have $ip=$_SERVER['REMOTE_ADDR']; $baseurl = "http://www.spardel.com"; $_SERVER['DOCUMENT_ROOT'] = "/home4/spardelc/"; Am I missing something?
  8. How do I set up the error_reporting?
  9. That added, But. didnt upload the image to the server? ---- Edit: I did some work on the script, the script is on a subdomain, I want it to upload the images to a folder in the main domain, So out of curiousity I made a folder in subdomain called images and that is where the images are now uploading too.
  10. I cant see any images with the checks, only in the file destination of $baseurl/images/ $name = $_POST['name']; $madeby = $_POST['madeby']; $submitted = $_POST['submitted']; $filedunder = $_POST['filedunder']; $filedunder2 = $filedunder.'img'; $Image = $_FILES['Image']; $directoryName = "$baseurl/images/$filedunder"; $extension = strtolower(pathinfo($Image['name'], PATHINFO_EXTENSION)); if (!in_array($extension, array('jpg', 'jpeg', 'gif', 'png'))) { die("Statement here"); } if (!file_exists($directoryName)) { mkdir($directoryName, 0777); } $directoryName2 = "$baseurl/images/$filedunder"; if (!file_exists($directoryName2)) { mkdir($directoryName2, 0777); } if (strpos($_FILE['Image']['type'], 'image/') !== 0) { die(" Please only use image files"); } if ((!$name) OR (!$filedunder) OR (!$Image)) { die("Please dont leave blank info");} else { mysql_query("INSERT INTO $filedunder2 (madeby,name,date,submitted) VALUES ('$madeby','$name','$timestamp','$submitted')"); $insert_id = mysql_insert_id(); $image = $insert_id . "img.png"; mysql_query("UPDATE $filedunder2 SET url = '$baseurl/images/$filedunder/$image' WHERE id = '$insert_id' "); $file = $_FILES['Image']['tmp_name']; $dest = $_SERVER['DOCUMENT_ROOT'].'/images/'.$filedunder.'/'.$insert_id.'img.png'; copy($file, $dest); die("oooohhhhh It Added! <P> <B>Take note of this url, as Your uploads page is currently down!!!</b><P> <Textarea>www.spardel.com/images/$filedunder/$image</Textarea> "); }
  11. Ok its now, (I didnt know what to put) $extension = strtolower(pathinfo($Image['name'], PATHINFO_EXTENSION)); if (!in_array($extension, array('jpg', 'jpeg', 'gif', 'png'))) { die("Statement here"); } Run the script and got please only use image files
  12. I now have in coding print_r($_FILES); exit; $name = $_POST['name']; $madeby = $_POST['madeby']; $submitted = $_POST['submitted']; $filedunder = $_POST['filedunder']; $filedunder2 = $filedunder.'img'; $Image = $_FILES['Image']; $directoryName = "$baseurl/images/$filedunder"; $extension = strtolower(pathinfo($Image['name'], PATHINFO_EXTENSION)); if (!in_array($extension, array('jpg', 'jpeg', 'gif', 'png'))) { // ... } if (!file_exists($directoryName)) { mkdir($directoryName, 0777); } $directoryName2 = "$baseurl/images/$filedunder"; if (!file_exists($directoryName2)) { mkdir($directoryName2, 0777); } if (strpos($_FILE['Image']['type'], 'image/') !== 0) { die(" Please only use image files"); } if ((!$name) OR (!$filedunder) OR (!$Image)) { die("Please dont leave blank info");} else { mysql_query("INSERT INTO $filedunder2 (madeby,name,date,submitted) VALUES ('$madeby','$name','$timestamp','$submitted')"); $insert_id = mysql_insert_id(); $image = $insert_id . "img.png"; mysql_query("UPDATE $filedunder2 SET url = '$baseurl/images/$filedunder/$image' WHERE id = '$insert_id' "); $file = $_FILES['Image']['tmp_name']; $dest = $_SERVER['DOCUMENT_ROOT'].'/images/'.$filedunder.'/'.$insert_id.'img.png'; copy($file, $dest); die("oooohhhhh It Added! <P> <B>Take note of this url, as Your uploads page is currently down!!!</b><P> <Textarea>www.spardel.com/images/$filedunder/$image</Textarea> "); } and the print out is Array ( [image] => Array ( [name] => zebra.JPG [type] => image/jpeg [tmp_name] => /var/tmp/phpFbholc [error] => 0 [size] => 59038 ) )
  13. Array ( [image] => Array ( [name] => zebra.JPG [type] => image/jpeg [tmp_name] => /var/tmp/phppBpmma [error] => 0 [size] => 59038 ) ) is printed now. How do I escape the insert to the database? How would I make it more secure?
  14. Well just tested it as And Im still getting the please only use image files error.. Also what would I use instead of Die?
×
×
  • 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.