Jump to content

roll_or_die

Members
  • Posts

    17
  • Joined

  • Last visited

roll_or_die's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. ahhh thanks it works now! hmmm that was wierd, i used to have that bit of code in it, i must have deleted the wrong file by accident or sumthin...
  2. i cant figure it out! i swear it used to work!ive gone over the code and cant see any problems, ive also made sure that the correct upload folder is on my localhost and it is!heres the code i have:members_pic_upload.html <form id="form1" name="form1" method="post" action="members_pic_upload.php"> <h1>Picture upload</h1> <p> <input type="file" name="file" /> <br /> <label> <input type="submit" name="Submit" value="Upload" /> </label> </p> </form> members_pic_upload.php: <?phpinclude "conn.php";$target_path = "memberpics/";$target_path = $target_path . basename( $_FILES['file']['name']); if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) { $filename=basename( $_FILES['file']['name']); //insert into database $username=$_SESSION['username']; $result=mysql_query ("SELECT * FROM members WHERE username = '$username'"); while($row=mysql_fetch_array($result)) { $userid=$row['id']; } //put in member pics db mysql_query("INSERT INTO member_pics(filename, userid) VALUES('$filename', '$userid')"); echo "<h1>Picture uploaded</h1><p>It will now appear on your profile!"; } else{ echo "There was an error uploading the file, please try again!";}?> i just keep receiving the error message, and the files arent transferring into the folder. can anyone see any problems?
  3. ah thanks i think i'll do that.although on my auth.php page im using this code: <?phpif (!isset($_SESSION["username"])){header('location: redir_1.html');}?> but i get an error message saying that the headers have already been sent, im guessing this is because of the session_start(); at the top of each protected page.do you know how i can fix it??
  4. ah yea ive managed to find out the problem, its because i had an 'exit' statement in the 'auth.php' which made the rest of the page stop loading. i think i'm just going to make a page that says for the user to log in with a header redirect thingy leading to it from auth.php [if you know what i mean]but thanks anyway!
  5. Thats what i thought, but theyre part of the template i made that applies to every page on the site and are locked, so i cant understand how the script can interfere with it?
  6. For the site i am creating, i've created a file called 'auth.php' which i include at the start of my scripts to prevent unauthorised access to certain pages.<br>But i find that on one of the pages, it seems to stop one of the images at the side of the template from appearing!<br>Here are a couple of screenshots to explain...http://pic4.picturetrail.com/VOL749/276013...9/233647768.jpghttp://pic4.picturetrail.com/VOL749/276013...9/233647767.jpgthe bottom shows how the image at the side has dissappeared when the user isnt logged in [however the orange buttons are meant to dissapear].Does anyone know why it might do this?? It doesnt seem to happen on any other pages
  7. Ive created a navigation bar in flash for my website that makes a little beep noise when you click one of the buttons. the thing is, most of the time the noise is cut down due to the page loading the one that you click on, even though the noise is only about .4 of a second long.does anyone know of a way i can get the sound to play all the way through before the next page is loaded?
  8. hmmmm im sure ive already tried this one? ill try it again anyway to make sure!
  9. I'm trying to create a php script to enable file uploads, but i keep getting an error message! I've tried using sample scripts off the net to make sure its right but i still get error messages! here is the code i have so far:upload.htm <form action="upload.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> <label> <input type="file" name="file" /> </label> <p> <label> <input type="submit" name="Submit" value="Submit" /> </label> </p></form> upload.php <?php$target_path = "uploads/";$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";} else{ echo "There was an error uploading the file, please try again!";}?> but i keep receiving the error message thats in the else statement, does anyone have any ideas?thanks.
  10. im trying to use phpmyadmin in XAMPP to be able to set a primary key field as an id column so that whenever a user registers on my site; they are automatically assigned an id number.i cant seem to be able to do it though, i set it to 'auto increment' and int with a length of 15, but i cant figure out how to make it so that each user is automatically assigned a number upon registering?
  11. Im trying to set up a page which will bring up a list of all of the members on my website and set each persons name as a hyperlink to their profile. but whenever you click on the persons name to go to their profile the page just appears blank, at the moment its supposed to just show their username.here is the code of members_view.php: <?php include "conn.php"; $res=mysql_query("SELECT * FROM members"); while($row=mysql_fetch_array($res)) { echo '<a href="view_profile.php?id=<?='.$row['id'].'?>&amp">'.$row['username'].'</a><br>'; } ?> here is the code for view_profile.php: <?phpinclude "auth.php";include "conn.php";$member = $_GET['id'];$result=mysql_query ("SELECT * FROM members WHERE id = '$member'");while($row=mysql_fetch_array($result)) { echo "<b>".$row['username']."</b><br>"; }?> any help?thanks.
  12. when i apply a dreamweaver template to one of my scripts it stops it from working! and when i detatch it, the script works fine again! has anyone else had this problem?thanks.
  13. roll_or_die

    or operators

    ive created a form and a php script for it, but have a problem i cant get around, heres the PHP code for it:if (!$_POST["username"] || !$_POST["password"] || !$_POST["email"]) { echo "You did not fill in all of the required fields marked with '*'"; exit; }the thing is even when i fill in all of the required fields i still get this message, but if i take away the third condition , it works fine! ive checked to make sure that all the names match up.ive also tried using 'or' instead of '||' but that hasnt helped.any ideas?thanks
×
×
  • Create New...