Jump to content

iamali

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

iamali's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [!--quoteo(post=360866:date=Apr 2 2006, 03:11 PM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Apr 2 2006, 03:11 PM) [snapback]360866[/snapback][/div][div class=\'quotemain\'][!--quotec--] hi there are several pinned topics entitled things such as 'Read here before posting' and 'Do you have header/session problems'. You really should read those first. Cheers Mark [/quote] Sorry I couldn't find them, there was only: Pinned: Have you been helped here? Pinned: Simple Error Handling/Form Validation Logic Pinned: MYSQL_SOMETHING - INVALID RESOURCE Pinned: DO YOU HAVE PHP SESSION PROBLEMS? at the top of the forum. :-S [!--quoteo(post=360867:date=Apr 2 2006, 03:12 PM:name=emehrkay)--][div class=\'quotetop\']QUOTE(emehrkay @ Apr 2 2006, 03:12 PM) [snapback]360867[/snapback][/div][div class=\'quotemain\'][!--quotec--] you have some stuff bering printed to the brower window befroe you call header. you need to put header before any output, i dont see why you can not do that in your code. just try to move it above the html [/quote] oh i see, so you can't have any HTML or anything before headers? ok I've moved it around and it works now :-) thanks!
  2. Hi, I have a problem with a login code I've written: [code]<?php session_start(); $user = $_POST['username']; $pass = $_POST['password']; $_SESSION['username'] = $user; $_SESSION['password'] = $pass; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>PHP Photograph Gallery</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <?php include("links_private.inc"); ?> <table class="page" align="center" cellpadding="15" cellspacing="0"> <tr><td class="header"><h1>PHP Photograph Gallery</h1><br />Login Successful</td></tr> <tr><td> <?php if ((!$_POST['username']) || (!$_POST['password'])) {     header("Location:login.htm");     exit; } include("dbconnect.inc"); $sql = "SELECT f_name, l_name from tbl_users where username = '$_POST[username]' AND password = password('$_POST[password]')"     or die(mysql_error()); $result = mysql_query($sql, $conn)     or die(mysql_error()); $num = mysql_num_rows($result); if ($num == 1) {     $f_name = mysql_result($result,0,'f_name');     $l_name = mysql_result($result,0,'l_name'); } else {     header("Location:login.htm");     exit; } echo "<p class=\"centre\">Welcome $f_name $l_name!</p>"; ?>      <p class="centre"><a href="admin.php">Continue to Gallery Administration</a></p> </td></tr> </table> </body> </html>[/code] whenever I try to log in with the username and password field as empty it gives me this error: [code]Warning: Cannot modify header information - headers already sent by (output started at C:\Inetpub\wwwroot\galleryuploader\auth_login.php:18) in C:\Inetpub\wwwroot\galleryuploader\auth_login.php on line 28[/code] and when I try and log in with incorrect details in the username and password field it gives me this error: [code]Warning: Cannot modify header information - headers already sent by (output started at C:\Inetpub\wwwroot\galleryuploader\auth_login.php:18) in C:\Inetpub\wwwroot\galleryuploader\auth_login.php on line 45[/code] ...when i was hoping it would use the 'header("Location:login.htm");' to send the user back to the login page. Any ideas why it's doing this anyone? Thanks!
  3. Does anyone know what would cause this error: [i]Notice: Undefined index: file in C:\Inetpub\wwwroot\Upload\uploader3.php on line 2 No file specified[/i] with these files for uploading images: uploader.htm <html><head><title>File Uploader</title></head> <body><h3>File Upload</h3> Select a file to upload:<br> <form action="uploader.php" method="post" enctype="multipart/form-data"> <input type="file" name="file" size="45"> <br> <input type="submit" value="Upload File"> </form> </body></html> and, uploader.php <?php if( $_FILES['file']['name'] != "" ) { copy ( $_FILES['file']['tmp_name'], "C:/Inetpub/wwwroot/Upload/" . $_FILES['file']['name'] ) or die( "Could not copy file" ); } else{ die( "No file specified" ); } ?> <html> <head><title>Upload Complete</title></head> <body> <h3>File Upload Succeeded...</h3> <ul> <li>Sent: <?php echo $_FILES['file']['name']; ?> <li>Size: <?php echo $_FILES['file']['size']; ?> bytes <li>Type: <?php echo $_FILES['file']['type']; ?> </ul> <a href="<?php echo "C:/Inetpub/wwwroot/Upload/".$_FILES['file']['name']; ?>"><img src="<?php echo "C:/Inetpub/wwwroot/Upload/".$_FILES['file']['name']; ?>" height="200"></a> </body> </html> Thanks!
  4. iamali

    Images

    [!--quoteo(post=351018:date=Mar 2 2006, 04:56 PM:name=shocker-z)--][div class=\'quotetop\']QUOTE(shocker-z @ Mar 2 2006, 04:56 PM) [snapback]351018[/snapback][/div][div class=\'quotemain\'][!--quotec--] that works for me.. [a href=\"http://www.blucode.net/phpfreaks.php\" target=\"_blank\"]http://www.blucode.net/phpfreaks.php[/a] was u running your page in the folder "Upload" ?? [/quote] ooh i got the images to to show up with: <?php if( $_FILES['file']['name'] != "" ) { copy ( $_FILES['file']['tmp_name'], "C:Inetpub/wwwroot/Upload/" . $_FILES['file']['name'] ) or die( "Could not copy file" ); } else{ die( "No file specified" ); } ?> <html> <head><title>Upload Complete</title></head> <body> <h3>File Upload Succeeded...</h3> <ul> <li>Sent: <?php echo $_FILES['file']['name']; ?> <li>Size: <?php echo $_FILES['file']['size']; ?> bytes <li>Type: <?php echo $_FILES['file']['type']; ?> </ul> <a href="<?php echo "C:/Inetpub/wwwroot/Upload/".$_FILES['file']['name']; ?>"><img src="<?php echo "C:/Inetpub/wwwroot/Upload/".$_FILES['file']['name']; ?>" height="200"></a> </body> </html> !!! but the <a href part seems to link to file:///C:/Inetpub/wwwroot/Upload/filename.gif for some reason...
  5. iamali

    Images

    [!--quoteo(post=351018:date=Mar 2 2006, 04:56 PM:name=shocker-z)--][div class=\'quotetop\']QUOTE(shocker-z @ Mar 2 2006, 04:56 PM) [snapback]351018[/snapback][/div][div class=\'quotemain\'][!--quotec--] that works for me.. [a href=\"http://www.blucode.net/phpfreaks.php\" target=\"_blank\"]http://www.blucode.net/phpfreaks.php[/a] was u running your page in the folder "Upload" ?? [/quote] yeah, it's in the folder upload. wondering whether it's something to do with my setup of PHP but i'd have no idea what it would be :-S
  6. iamali

    Images

    [!--quoteo(post=351004:date=Mar 2 2006, 04:28 PM:name=shocker-z)--][div class=\'quotetop\']QUOTE(shocker-z @ Mar 2 2006, 04:28 PM) [snapback]351004[/snapback][/div][div class=\'quotemain\'][!--quotec--] is your form like.. <form name="form1" enctype="multipart/form-data" method="post" action=""> Are you sure u have enctype="multipart/form-data" in the form eliment? maby post full code? [/quote] yeah, my form is: <html><head><title>File Uploader</title></head> <body><h3>File Upload</h3> Select a file to upload:<br> <form action="uploader.php" method="post" enctype="multipart/form-data"> <input type="file" name="file" size="45"> <br> <input type="submit" value="Upload File"> </form> </body></html> and the uploading script is: <?php if( $_FILES['file']['name'] != "" ) { copy ( $_FILES['file']['tmp_name'], "C:/Inetpub/wwwroot/Upload/" . $_FILES['file']['name'] ) or die( "Could not copy file" ); } else{ die( "No file specified" ); } ?> <html> <head><title>Upload Complete</title></head> <body> <h3>File Upload Succeeded...</h3> <ul> <li>Sent: <?php echo $_FILES['file']['name']; ?> <li>Size: <?php echo $_FILES['file']['size']; ?> bytes <li>Type: <?php echo $_FILES['file']['type']; ?> </ul> <a href="<?php echo $_FILES['file']['name']; ?>"><img src="<?php echo $_FILES['file']['name']; ?>" height="200"></a> </body> </html> :-)
  7. iamali

    Images

    Does anyone know what would cause images not to load? I'm displaying images after I upload them using this code: <a href="<?php echo $_FILES['file']['name']; ?>"><img src="<?php echo $_FILES['file']['name']; ?>" height="200"></a> but it's not working! Anyone?!
  8. hahaha thankyou so much, it was that! *slaps forehead*
  9. Been having a few problems, I'm using PHP 5 and IIS 5 I'm following a tutorial in a book for creating an uploading facility. The two files are: uploader.htm <html><head><title>File Uploader</title></head> <body><h3>File Upload</h3> Select a file to upload:<br> <form action="uploader.php" method="post" enctype="multiparty/form-data"> <input type="file" name="file" size="45"> <br> <input type="submit" value="Upload File"> </form> </body></html> and uploader.php <?php if( $_FILES['file']['name'] != "" ) { copy ( $_FILES['file']['tmp_name'], "C:/Inetpub/wwwroot/" . $_FILES['file']['name'] ) or die( "Could not copy file" ); } else{ die( "No file specified" ); } ?> <html><head><title>Upload Complete</title></head> <body><h3>File Upload Succeeded...</h3> <ul> <li>Sent: <?php echo $_FILES['file']['name']; ?> <li>Size: <?php echo $_FILES['file']['size']; ?> bytes <li>Type: <?php echo $_FILES['file']['type']; ?> </ul> <a href="<?php echo $_FILES['file']['name']; ?>">Click here to view the file</a> </body></html> uploader.htm works fine but when I click upload it gives me this error: "Notice: Undefined index: file in C:\Inetpub\wwwroot\uploader.php on line 2 No file specified" see image also: [a href=\"http://groups.msn.com/_Secure/0RADhAr0UCNb7c1bIEGOHeB35SQeNXnKIm1ZDxw7esEuiTTi1Xa4vYAagZnCPULWTqvXVIUz5LfRqCdZ6iuPVJtzNNGibh5P9QsxxeUkvj1s/uploaderphp.JPG?dc=4675562318333745343\" target=\"_blank\"]http://groups.msn.com/_Secure/0RADhAr0UCNb...562318333745343[/a] Does anyone have any idea why it's doing this? I got this tutorial to work last week and for no reason it's stopped working :-( Thanks!
×
×
  • 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.