Jump to content

Ell20

Members
  • Posts

    337
  • Joined

  • Last visited

    Never

Everything posted by Ell20

  1. Hi, I have an upload script which successfully uploads a picture and creates a thumbnail of the picture and stores the information in the database. I have just used the file_exists function to give out an error message if a user uploads a photo which has the same name as another photo in the directory. But what I would ideally like to do is to create some kind of unique image name so that is either unlikely or impossible to have 2 images with the same name. I have had a look at various unique image naming scripts online but none of them seem to fit my code as I am using the copy function. copy ($_FILES['imagefile']['tmp_name'], "/home/mysport/public_html/images/UserImgs/".$_FILES['imagefile']['name']) or die ("Could not copy"); Appreciate any help.
  2. Excellent, thanks will look into it. Ive progressed a bit further now with it, however I have just noticed that when you have say 5 images. So that will be 4 across the top then another 1 on the next row? If I add another image in this situation it creates a new row again rather than putting the picture alongside the 5th image? Appreciate your help
  3. Thanks for your help! Managed to get it working well, with the caption displayed at the bottom too. Will look into the maximum of 16 per page. Thanks
  4. Thanks for the help. I added this mysql in replace of the array: $query = "SELECT * FROM images WHERE club_id = '$id'"; $result = mysql_query($query); $row = mysql_fetch_assoc($result); $dbitems = $row['picture_name']; $caption = $row['caption']; And it gives the error: An error occured in script /home/mysport/public_html/gallery.php on line 99: Invalid argument supplied for foreach() Thanks for your help
  5. Hi, I have created a form for users to upload photos. When they upload photos the photo name and caption is stored in the database along with club_id. Now I want the images to be displayed on the page on the page where club_id = '$id'. I could just do a simple while loop to show all the images and captions WHERE club_id = '$id' but this is an untidy way of displaying them, as I dont no how many images the club has. Is there anyway I can display the images so that they show 4 across with the caption below it, then say there is 5 images it creates a new row, otherwise it dosent? Then is it possible to say if there are more than 16 images create another page rather than keep displaying them down the page? Thanks for your help.
  6. Ell20

    PHP Mail

    Ive got it working now, by removing the if to check whether the input box contains anything however I somehow need to put that back in.
  7. Ell20

    PHP Mail

    Ok, is there another way which you recommend I can do this? Cheers
  8. Ell20

    PHP Mail

    I filled in all 3 input boxes and echoed $to and it only showed the email address posted in the first input.
  9. Ell20

    PHP Mail

    Thanks but that hasnt solved it, it only ever sends one email.
  10. Ell20

    PHP Mail

    Sorry: if (eregi ("^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$", stripslashes(trim($_POST['email1'])))) { $e1 = escape_data($_POST['email1']); } else { $e1 = FALSE; echo '<p><font color="red" size="+1">Please enter a valid email address!</font></p>'; } if (!empty($email2)) { if (eregi ("^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$", stripslashes(trim($_POST['email2'])))) { $e2 = escape_data($_POST['email2']); } else { $e2 = FALSE; echo '<p><font color="red" size="+1">Please enter a valid email address!</font></p>'; } } if (!empty($email3)) { if (eregi ("^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$", stripslashes(trim($_POST['email3'])))) { $e3 = escape_data($_POST['email3']); } else { $e3 = FALSE; echo '<p><font color="red" size="+1">Please enter a valid email address!</font></p>'; } } if ($e1) { $to = "$e1"; } elseif ($e1 && $e2) { $to = "$e1, $e2"; } elseif ($e1 && $e2 && $e3) { $to = "$e1, $e2, $e3"; }
  11. Ell20

    PHP Mail

    Hi, I have set up a form on my site to invite users to the site. I have set it up so there are 3 boxes to put in 3 different email addresses at a time, however I obviously only want to send the message to all 3 if all 3 boxes have an email address in. I have tried using if and elseif to determine which $to statement to use but it dosent seem to be working. Am I doing something wrong? Cheers
  12. Hi, I have a variable at the moment called $name which contain a name of someone for example "Ryan Giggs". Is there anyway in which I can split that variable into 2? e.g $first = "Ryan" and $last = "Giggs" Thanks for your help
  13. Ive done it now, the path didnt require the /public_html section. Ive now configured it to only show up on selected textareas, thanks
  14. I just looked into what you said: "textareas - Converts all textarea elements to editors when the page loads." The mode its currently set at should work I think?
  15. Hey guys, You have been so helpful to me whilst I have been making my website and the guys at tinymce charge for support so I thoughts I would see if any of you can possibly help me. Im not sure where to post it so I am just going to put it here, sorry if its wrong. I am trying to use TinyMCE to convert my textareas to look similar to what you can see when you post on this forum. I have followed the online instructions they give to install tinymce yet I dont seem to be able to get it working. I uploaded the whole folder downloaded from the site to the /public_html folder. I then placed this code in the header on the page: <head> <script language="javascript" type="text/javascript" src="/public_html/tinymce/jscripts/tiny_mce/tiny_mce.js"></script> <script language="javascript" type="text/javascript"> tinyMCE.init({ mode : "textareas" }); </script> </head> But when I load the page the textarea looks no different from normal? Really appreciate any help, it could be a simple error!
  16. I think ive done it now. The session holds the user_id and the club_id of the user logged in. For that reason I have set it up to automatically create a guest account when a new club is created. Thanks for the original idea of doing it this way.
  17. Im fairly new to PHP so I dont no all the ins and outs yet. I have a session which is created when a normal user logs in. I dont really have much idea how to set up the guest login which is why I was hoping to get some help here. Thanks
  18. Ok I have now set it up so that when a new club is registered an account called Guest, with no password is set up. I now need to link my drop down box, which shows all the clubs available to login to, so that when the club is selected they are logged in as Guest with the correct club. My code for the drop down box is: <?php require_once ('mysql_connect.php'); $sql = "SELECT * FROM club"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)){ $club_id = $row["club_id"]; $clubName = $row["clubn"]; $club_id == $OTHER_CLUB_ID ? $sel = 'SELECTED' : $sel = ''; ?> <option value="<?php echo $club_id ?>" <?php echo $sel ?>><?php echo $clubName ?></option> <?php } ?> </select> Appreciate any help.
  19. I need some kinda of login for guests because there will be lots of websites based on different sports clubs, so without this there would be no way to determine which club to log the guest into. Thanks
  20. Hi, I have started creating a website which sports clubs can register their club and fill out information about themselves, these members are set as admins. Then members of that club can use a separate registration to register to their club, these are set as members. This is all working perfectly. What I would like to do now is to allow "Guests" i.e users which don't want to register but only get limited access to pages. I have set up a dynamic drop down box on the login page which lists all the clubs currently available. How do I go about logging the guest into the club they want to once they have selected their club from the drop down box then press login as guest? Thanks for your help
  21. Fixed I think, thanks for your help! Had to remove WHERE pavilion = POST....... from the No part! Thanks
  22. Gives this error if I try and untick it and submit again? An error occured in script /home/mysport/public_html/aboutclub.php on line 266: Undefined index: pavilion Thanks
  23. Like this: if (isset($_POST['submit3'])){ if (isset($_POST['pavilion'])){ $query = mysql_query("UPDATE club SET pavilion='yes' WHERE pavilion='{$_POST['pavilion']}' AND club_id='$id'")or die(mysql_error()); } else { $query = mysql_query("UPDATE club SET pavilion='no' WHERE pavilion='{$_POST['pavilion']}' AND club_id='$id'")or die(mysql_error()); } }
  24. I have managed to do it for all 10 now and it works at first however, if for some reason any of the checkboxes need to be unticked then submitted again the check box is not updating and stays checked regardless? Thanks
  25. Ok, I tried that on its own and of course, its works, thanks. But how do I go about doing this for say 10 check boxes, as thats how many I have on the page? Thanks Elliot
×
×
  • 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.