Jump to content

CageyJ0nnY

Members
  • Posts

    31
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

CageyJ0nnY's Achievements

Member

Member (2/5)

0

Reputation

  1. I have tried the code above, but i am getting this error message? I dont have a clue what i am doing wrong (im new to this)? Array ( [name] => img.jpg [type] => image/jpeg [tmp_name] => /tmp/php1X7FhM [error] => 0 => 2218 ) FileX jpg Warning: move_uploaded_file(upload/img.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/jjennings3/jjennings3.bimserver2.com/upload2.php on line 18 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php1X7FhM' to 'upload/img.jpg' in /home/jjennings3/jjennings3.bimserver2.com/upload2.php on line 18 Sorry, there was a problem uploading your file. # Back thanks Jonny
  2. I have tried inserting the following script after the login is succesfull part of the script, but i keep getting an error message. any ideas? header("location: http://jjennings3.bimserver2.com/siteadmin.php"); exit();
  3. thats great! thanks for the help, what i need though is if the password / username is correct for it to take me to another page. would i have to set this up using an if statement? cheers Jonny
  4. wow, which bits are ment to go where? and i am still ment to connect with the database in both the form and php pages? thanks Jonny
  5. i have made a html form to upload a picture to webspce, it links to a php page that does the uploading and gives a message depending on if the image was successfully uploaded or not. I keep getting the error message and i cant figure out why. please help. here is the form: <?php $conn = mysql_connect('jjennings3db.bimserver2.com', 'jjennings3db', 'bullet8'); mysql_select_db('jjennings3db', $conn); ?> <html> <head> <title>Picture Upload</title> </head> <body> <form enctype="multipart/form-data" action="http://jjennings3.bimserver2.com/upload2.php" method="POST"> <p><input type="hidden" name="MAX_FILE_SIZE" value="100000"> Send this file: <input name="filename" type="file"></p> <p>Name for uploaded file: <input name="filename" type="text" id="filename" value="picture.jpg"></p> <p><input type="submit" value="Send File"></p> </form> <p><a href = "http://jjennings3.bimserver2.com/home-ltd.php"></p> <li>Back</li> </a> </body> </html> and here is the php page: <?php $conn = mysql_connect('jjennings3db.bimserver2.com', 'jjennings3db', 'bullet4243'); mysql_select_db('jjennings3db', $conn); $filename = ('$_POST[filename]'); $uploaddir = '/home/jjennings3/jjennings3.bimserver2.com/'; $uploadfile = $uploaddir . $filename; if (move_uploaded_file($_FILES['image']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.<br>"; echo "Its name is <a href=$filename>$filename</a>"; } else { echo "There was an error."; } ?> <html> <head> <title>Imperial to Metric</title> </head> <body> <p><a href = "http://jjennings3.bimserver2.com/upload.php"></p> <li>Back</li> </a> </body> </html> any help would be apprieciated Jonny
  6. sorry i should have posted the new code up here because of the changes i have made here it is: <?php if ((!$_POST[username]) || (!$_POST[password])) { header("location: http://jjennings3.bimserver2.com/userlogin.html"); exit; } $conn = mysql_connect('jjennings3db.bimserver2.com', 'jjennings3db', 'bullet557'); mysql_select_db('jjennings3db', $conn); $sql = "SELECT * username FROM login WHERE username = ('', '$_post[username]' AND password = '$_POST[password]')"; $result = mysql_query($sql,$conn); if (mysql_num_rows($result) ==1) { $username = mysql_result($result, 0, 'username'); setcookie("auth", "1", 0, "/", "jjennings3.bimserver2.com/siteadmin.php", 0); $display_block = "<p>$username is authorised!</p> <p>authorised users' menu: <ul> <li><a href=<\"jjennings3.bimserver2.com/siteadmin.php\">site admin</a> </ul>"; } else{ header ("location:http://jjennings3.bimserver2.com/userlogin.html"); exit; } ?> <html> <head> <title>User Login</title> </head> <body> </ echo "$msg"; ?> </body> </html> i dont know weahter your suggestion would still apply (im very new to all this) thanks for the help
  7. I have managed to iron out some of the problems, but the loop keeps sending me back to the log on screen, which leads me to believe that the log on details are not correct. can anyone see where i am going wrong? Jonny
  8. i have created a form that allows a user to enter a username and password. I also have these fields set up in a database which the page links to. I keep getting a timeout error about cookies? I can figure out where i am going wrong? can anyone see the problem? <?php if ((!$_POST[username]) || (!$_POST[password])) { header("location: http://jjennings3.bimserver2.com/userlogin.php"); exit; } $conn = mysql_connect('jjennings3db.bimserver2.com', 'jjennings3db', 'bullet68474321'); mysql_select_db('jjennings3db', $conn); $sql = "select f_name from login where username = ('$_post[jonathan]') AND password = password('$_POST[jonathan]')"; $result = mysql_query($sql,$conn); if (mysql_num_rows($result) ==1) { $f_name = mysql_result($result, 0, 'f_name'); setcookie("auth", "1", 0, "/", "jjennings3.bimserver2.com/siteadmin.php", 0); $display_block = "<p>$f_name is authorised!</p> <p>authorised users' menu: <ul> <li><a href=<\"jjennings3.bimserver2.com/siteadmin.php\">site admin</a> </ul>"; }else{ header ("location:http://jjennings3.bimserver2.com/userlogin.html"); exit; } ?> <html> <head> <title>User Login</title> </head> <body> </ echo "$msg"; ?> </body> </html> thanks Jonny
  9. I have changed it to what you suggested but it still wont work =[, im at a loss. thanks for the help
  10. Hello, I cannot figure out how to populate a text box with the result from an array?? The idea is that this is an update form, so the user can amend a property. Heres my first attempt that doesnt work: <?php $conn = mysql_connect('jjennings3db.bimserver2.com', 'jjennings3db', 'bullet688468845'); mysql_select_db('jjennings3db', $conn); $id = mysql_real_escape_string($_GET[id]); $sql = "SELECT PropertyName, Location, SalePrice FROM tblProperties WHERE id={$id}";$result1 = mysql_query($sql, $conn); $updateproperty = mysql_fetch_array($result1); ?> <html> <head> <title>Update a Property</title> </head> <body> <form method="post" action="http://jjennings3.bimserver2.com/siteadmin2.php"> <p>Property Name: <input name= <?php echo $updateproperty['PropertyName']; ?> type="text"></p> <p>Location: <input name="Location" type="text"></p> <p>No of Bedrooms: <input name="NoofBedrooms" type="text"></p> <p>Property Price: <input name="Saleprice" type="text"></p> <p>Let Price:<input name="LetPrice" type ="text"></p> <p>Garden Size: <input name="GardenSize" type ="text"></p> <p><input type="submit" name="Submit" value="Update Record"></p> <p><a href = "http://jjennings3.bimserver2.com/update-main.php"></p> <li>Back</li> </form> </body> </html> Thanks for looking Jonny
  11. I have created an array that stores values in a table. I do not know why the values are not being stored in the table but rather outside of it. here is the code: <?php $conn = mysql_connect('jjennings3db.bimserver2.com', 'jjennings3db', 'bullet5646546541'); mysql_select_db('jjennings3db', $conn); $sql = "SELECT * FROM tblProperties WHERE id=".$_GET[id]; $result1 = mysql_query($sql, $conn); $array1 = mysql_fetch_array($result1); ?> <html> <head> <title>Properties</title> </head> <body> <table width="640" border="2" align="center" cellpadding="0" cellspacing="0"> <tr> <td colspan="3" align="center"><h1>Property</h1></td> </tr> <tr> <td align="left" valign="top"><strong>Address:</strong></td> <td align="left" valign="top">PropertyName</td> <td rowspan="2" align="center"valign="middle">book cover picture</td> <?php echo '$array1[PropertyName]'; ?> </tr> <tr> <td align="left" valign="top"><strong>Location:</strong></td> <td align="left" valign="top">Location</td> <?php echo '$array1[Location]'; ?> </td> <tr> <td align="left" valign="top"><strong>Property Price:</strong></td> <td align="left" valign="top">SalePrice</td> <?php echo '$array1[salePrice]'; ?> </td> <tr> <td colspan="3" align="center" valign="top"><a href="http://jjennings3.bimserver2.com/links.php">back to list of Properties</a> </td> </tr> </table> </body> </html> any help would be appreciated Jonny
  12. Im relativley new to PHP so all this is a little confusing 8-S, i problably need what you just said to be translated into lemans terms.... thanks for the help
  13. Hello, i have a database an i am trying to insert records using PHP and HTML. I keep getting this error: Invalid query: Column count doesn't match value count at row 1 this is becuase i jhave told it to give me an error message but i cant find what the problem is... here is the HTML: <html> <head> <title>Insert a Property</title> </head> <body> <form method="post" action="http://jjennings3.bimserver2.com/siteadmin2.php"> <p>Property Name: <input name="PropertyName" type="text"></p> <p>Location: <input name="Location" type="text"> </p> <p>Property Price: <input name="Saleprice" type="text"></p> <p>Let Price:<input name="LetPrice" type ="text"></p> <p>Garden Size: <input name="GardenSize" type ="text"></p> <p><input type="submit" name="Submit" value="Insert Record"></p> <p><a href = "http://jjennings3.bimserver2.com/home-page.php"></p> <li>Back</li> </form> </body> </html> and here is the PHP it links to: <?php $conn = mysql_connect('jjennings3db.bimserver2.com', 'jjennings3db', 'bullet83478345'); mysql_select_db('jjennings3db', $conn); $sql = "INSERT INTO tblProperties values ('', '$_POST[PropertyName]', '$_POST[Location]', '$_POST[salePrice]', '$_POST[LetPrice]', '$POST[GardenSize]')"; $result = mysql_query($sql); if (!$result) { die('Invalid query: ' . mysql_error()); } else { echo "Record Inserted. Would you like to <a href=\"lecture09example3.php\">view the full list of books</a> or <a href=\"lecture09example1.php\">insert another</a>?"; } ?> any help would be appriciated Jonny
  14. I have a site linked to a database. When uploading an image i get my own error message in return. Because of this i know the script works but that there is an error in there somewhere. Here is the HTML page: <form enctype="multipart/form-data" action="http://jjennings3.bimserver2.com/upload2.php" method="POST"> <p><input type="hidden" name="MAX_FILE_SIZE" value="50000"> Send this file: <input name="filename" type="file"></p> <p>Name for uploaded file: <input name="filename" type="text" id="filename" value="picture.jpg"></p> <p><input type="submit" value="Send File"></p> </form> <p><a href = "http://jjennings3.bimserver2.com/home-page.php"></p> <li>Back</li> </a> </body> </html> and here is the PHP it links to: <?php $filename = $_POST[filename]; $uploaddir = '/home/jjennings3/jjennings3.bimserver2.com/'; $uploadfile = $uploaddir . $filename; if (move_uploaded_file($_FILES['bookimage']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.<br>"; echo "Its name is <a href=$filename>$filename</a>"; } else { echo "There was an error."; } ?> any help would be greatly appreiciated Jonny
×
×
  • 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.