Jump to content

roll_or_die

Members
  • Content Count

    17
  • Joined

  • Last visited

Community Reputation

0 Neutral

About roll_or_die

  • Rank
    Newbie
  1. I was told to use the chmod function to allow my script permission to write the file to the server, here is the script I have at the moment: <?phpinclude "conn.php"; //rename file $res=(mysql_query("SELECT num FROM num")); $num=mysql_result($res, 0); $num++; $target=$target.$num.'.jpg'; chmod($target, 0777); $res=mysql_query("UPDATE num SET num = $num"); //check dimensions and filetype, 200px and jpg $tmpname=$_FILES['file']['tmp_name']; $size=getimagesize($tmpname); $filetype=$size[2]; if($filetype!=2) { echo "<b>ERROR: All images must be a .jpg</b>"; } //transfer file and insert into databases elseif(move_uploaded_file($_FILES['file']['tmp_name'], $target)) { $name=$num; //mysql_query("INSERT INTO pics(name) VALUES('$name')"); $select=$_POST['select']; $pic=$_POST['pic']; $res=mysql_query("UPDATE gallery SET $pic='$name' WHERE name = '$select'"); if(!$res) { echo '<p>'.mysql_error(); } echo 'Image '.$name.'.jpg uploaded to '.$select.' '.$pic; } else { echo 'error'; } ?> But what happens now, is that instead of receiving the error message in the else statement, i receive the other message [as if it was a success]. but it doesnt name the file, insert anything into the database or even transfer the file. here is the message I am presented with: Does anyone know how i can fix it?Thanks.
  2. You can see it here:http://inspindesign.zidev.com/test/It displays fine in FF, but in IE there are gaps on the right hand side [it also shows up in dreamweaver].Here is the code for my stylesheet: body {font:11px Arial, Helvetica, sans-serif;color:#FFFFFF;background-image:url(../Images/bg_square2.gif);text-align:center;margin:0;}.title {font-size:14px;font-weight:900;}#container {text-align:left;margin:0 auto;width:720px;background:#171717 url(../Images/banner.gif) no-repeat 50% 0%;padding-top:120px;border:solid #323232;border-width:3px 4px 4px 3px;}div.nav {width:720px;}#content {width:720px;margin:0;padding:4px 5px;}#content_height {height:300px;}#footer {width:720px;text-align:center;font-weight:bolder;font-stretch:extra-condensed;background-color:#323232;padding:2px 0 0 2px;}a {color:#FFF;}a:hover {color:#950C00;}div.news {width:346px;height:150px;overflow:auto;border:solid #171717;border-width:1px 0px 0px 1px;margin-left:0px;display:block;clear:left;}div.news_h, div.news_m {width:308px;background-color:#323232;padding-left:15px;border-bottom-color: #171717;border-bottom-style: solid;}div.news_h {font-weight:900;font-size:12px;height:20px;background:url(../Images/deco_news.gif) 0 0 no-repeat;background-color:#323232;border-width:1px;padding-top:12px;}div.news_m {background-image:url(../Images/bg_square.gif);border-width:2px;padding-top:5px;padding-bottom:4px;}.info, .intro {width:346px;border:2px solid #323232;margin-bottom:4px;margin-right:4px;display:block;}.info .title {background-color:#323232;display:block;margin-bottom:5px;}.intro {background: url(../Images/logo.gif) no-repeat 100% 0;padding-top:42px;}.info img {margin-left:3px;margin-bottom:3px;}.info p, .intro p {text-align:right;padding:0;margin:3px;}ul#nav {margin-left:0px;padding-left:0px;list-style-type:none;}ul#nav li {display:inline;}ul#nav a {display:block;text-decoration:none;background-color:#323232;width:100px;padding:5px 4px;border-bottom:1px solid #171717;font-weight:900;font-stretch:condensed;text-align:right;}ul#nav a:hover {color:#FFF;} Does anyone know what might be causing it?Thanks.
  3. Ive just found out that a scrolling div im using on my website appears with a horizontal scroll bar in IE7.It works fine with FF and even IE6. The content isnt too wide for the div so i cant figure out what is causing it.any ideas??? arrrghhh i hate internet explorer!http://inspindesign.clawz.com/index.php
  4. 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...
  5. 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?
  6. 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??
  7. 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!
  8. 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?
  9. 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
  10. 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?
  11. hmmmm im sure ive already tried this one? ill try it again anyway to make sure!
  12. 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.
  13. 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?
  14. 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.
×
×
  • Create New...