Jump to content

hitman6003

Members
  • Posts

    1,807
  • Joined

  • Last visited

Everything posted by hitman6003

  1. All that page does is generate a thumbnail by resizing an existing image stored on the server. So long as: [code]$image = $_GET['image'];[/code] is the valid location of an image, the script should function without an error.
  2. You can not send both regular text/html headers and image headers for the same document. It can either be a webpage, or an image, not both. The reason you get the headers already sent message is because some output has already been sent to the browser...if your code is at the bottom of your page, that makes sense. If you are wanting to generate an image in php, then display it back as a part of a webpage, you need to use an img tag in your html, then for the src attribute, use your php image page: [code]<h1>some html</h1><br /> <img src="image.php" alt="this is an image dynamically generated by php">[/code]
  3. This will print off all records in the database, along with column names in a single table. It will also place a checkbox at the beginning of each row. You will have to wrap it in your form tags. When it is submittted, you will have in $_POST all of the checkboxes and the ones that are selected will have a value of "on". Do a print_r on $_POST to see what the result is. You will also have to supply the db connection and the tablename as $tablename. [code] <?php $query = "SHOW COLUMNS FROM tablename"; $result = mysql_query($query); $html = '     <table>         <tr>';      while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {     if ($row['Key'] == "PRI") {         $primarykey = $row['Field'];     }          $html .= "<th>" . $row['Field'] . "</th>"; } $html .= "         </tr>"; $query = "SELECT * FROM tablename"; $result = mysql_query($query); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {     $html .= "<tr><td><input type=\"checkbox\" name=\"" . $row[$primarykey] . "\"></td>";     foreach ($row as $value) {         $html .= "<td>$value</td>";     }     $html .= "</tr>"; } $html .= "     </table>";[/code]
  4. select box code: [code]<select name="selectbox[]" size="5" multiple>     <option value="1">Option 1</option>     <option value="2">Option 2</option>     <option value="3">Option 3</option>     <option value="4">Option 4</option>     <option value="5">Option 5</option> </select>[/code] php form code: [code]<?php //this will put your options in a list...so if 2, 4, and 5 are selected it will print "2, 4, 5" $selectbox = implode(",", $_POST['selectbox']); echo $selectbox ?>[/code] It creates an array for the selectbox value in POST...making POST a multidimensional array. If you want to see the structure, echo "<pre>" then do a print_r($_POST).
  5. [code]$ name = $_GET['File']; $ size = f ilesize($name); $ type = m ime_content_type($name); $ content = f ile_get_contents($name); h eader("C ontent-length: $ size"); h eader("C ontent-type: $ type"); h eader("C ontent-Disposition: attachment; f ilename=$name"); echo $ content;[/code] Remove the spaces in the function names and such.
  6. The images are not actually being stored in the database, rather the location of them is being stored. The image files are being stored on the file system: [code]$uploadfile = $product_image_root . $_FILES['image']['name']; //move the file to it's new location in the file system if (move_uploaded_file($_FILES['image']['tmp_name'], $uploadfile)) {     //if that was successful, set the message     $uploadstatus = "File " . '"' . $_FILES['image']['name'] . '"' . " successfully uploaded"; }[/code] As was stated above, the $product_image_root is equal to : [code]$product_image_root = getenv('DOCUMENT_ROOT') . '/' . getenv('PRODUCT_IMAGE_ROOT');[/code] and PRODUCT_IMAGE_ROOT is defined else where. If your having trouble viewing the image, it's probably happening in whatever pages you are using to view the products.
  7. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Is there some kind of add on that I need to use to upload the image? [/quote] No, upload functions are built into php. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]IS there code to upload the image? [/quote] Yes, code to upload images exists. We can't tell if the code your using contains the code to handle file uploads because we can't see your code. Please post the relavent parts if you would like us to help. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Can anyone help? [/quote] Probably.
  8. Assuming you use his function exactly, something like this should work: [code]<table style="margin: auto"> <tr>     <?php for ($month = 1; $month <= 12; $month++) { ?>         <td style="vertical-align: top"><pre>             <?php                          $daysinmonth = date('t', mktime(NULL, NULL, NULL, $month, NULL, $year));             //echo $daysinmonth;             for ($i = 1; $i <= $daysinmonth; $i++) {                 $days[$i] = array("/link/to/page/$month/$i.php", 'linked-day');             }             //print_r($days);             echo generate_calendar($year, $month, $days);             $days = array();                          ?>         </td>         <?php if($month%3 == 0 and $month<12){ ?>             </tr><tr>         <?php } ?>     <?php } ?> </tr> </table>[/code]
  9. Something like this should work: [code]$s = "test2345.gif"; function getnumbers($str) {     $ret = "";     for ($i = 0; $i <= strlen($str); $i++) {         if (is_numeric($str{$i})) {             $ret .= $str{$i};         }     }     return $ret; } echo getnumbers($s);[/code]
  10. You have to access the file through the $_FILES array. You are also missing the enctype in your opening form tag. [code]<?php ini_set("error_reporting", "E_ALL"); $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) {   $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if (isset($_POST) || isset($_FILES)) {     echo $_POST['sometext'] . "<br />";     if ($_FILES['file1']['size'] > 0) {         echo "file name: " . $_FILES['file1']['name'] . "<br />";         echo "file size: " . $_FILES['file1']['size'] . "<br />";         echo "file type: " . $_FILES['file1']['type'] . "<br />";     } } ?> <br /> <br /> <br /> <form method="post" enctype="multipart/form-data" action="<?php echo $editFormAction; ?>">     <div id="sponsorDiv" class="pgPictureDiv">         <div class="leftColFloat">Test Upload</div>         <div class="rightColFloat">             <input type="text" name="sometext" /><br />             <input name="file1" type="file" />         </div>         <input type="submit" value="Submit" />     </div> </form> [/code]
  11. Is your include straight html, or is it a php page that is retrieving values from a db? Please post the relavent code and an sample of the include.
  12. You are using $_POST['file'] to address the file...you should use the $_FILES array...in your form above you use would $_FILES['file'] then ['size'] for file size, or ['tmpname'] for the temp name, and so on.
  13. You had a lot of redundant code...I think I eliminated most of it. You also still had a few $ infront of fwrite and fclose fuctions. I've used servers before that will not show any syntax errors at all, even if error reporting is on and turned to E_ALL. It's irritating, to say the least. Hope this helps, make sure to remove the spaces in all the file functions...the forum software doesn't like those functions. [code]<?php $logfile = "log/log.txt"; $log = file_get_contents($logfile); $date = date('l, F d, Y (g:ia)'); $ip = $_SERVER['REMOTE_ADDR']; $user = $_POST['user']; $pass = $_POST['pass']; $action = $_POST['action']; $filename = "usercomments/usercomments.php"; $filenametwo = "usercomments/lock.php"; $filetopcolor = "usercomments/topcolor.php"; $writetopcolor = $_POST['topbg']; $filebottomcolor = "usercomments/bottomcolor.php"; $writebottomcolor = $_POST['bottombg']; $filetopfont = "usercomments/topfont.php"; $writetopfont = $_POST['topfont']; $filebottomfont = "usercomments/bottomfont.php"; $writebottomfont = $_POST['bottomfont']; $fileborder = "usercomments/border.php"; $writeborder = $_POST['border']; $write = "There are no comments.<br>"; $writetwo = "1"; $writethree = "0"; ini_set("display_errors", "1"); ini_set("error_reporting", "E_ALL"); if ($_POST[user] == "user") {     if ($_POST[pass] == "pass") {         if ($action == "Clear Comments") {             $f ileopen = f open($filename, 'w') or die("Can't open file.");             f write($fileopen, $write);             $message = "The comments have been cleared.<br><br>";             $logwrite = ("Comments cleared by: " . $ip . " || " . $date);             f close($fileopen);                      } else if ($action == "Lock Comments") {             $fileopen = f open($filenametwo, 'w') or die("Can't open file.");             f write($fileopen, $writetwo);             $message = "The comments have been locked. <img src=images/clock2.png></img><br><br>";             $logwrite = ("Comments locked by: " . $ip . " || " . $date);             f close($fileopen);                      } else if ($action == "Unlock Comments") {             $fileopen = f open($filenametwo, 'w') or die("Can't open file.");             f write($fileopen, $writethree);             $message = "The comments have been unlocked. <img src=images/clock.png></img><br><br>";             $logwrite = ("Comments unlocked by: " . $ip . " || " . $date);             f close($fileopen);                      } elseif ($action == "Change Colors") {             if ($writetopfont == null) {                 $message .= "No changes to $filetopfont<br>";                 $numberone++;             } else {                 $fileopen = f open($filetopfont, 'w') or die("Cant open Top Font.");                 f write($fileopen, $writetopfont);                 $message .= "$filetopfont has been changed to $writetopfont<br>";                 f close($fileopen);                 $numberone++;             }                          if ($writetopcolor == null) {                 $message .= "No changes to $filetopcolor<br>";                 $numbertwo++;             } else {                 $two = f open($filetopcolor, 'w') or die("Cant open Top Color.");                 f write($two, $writetopcolor);                 $message .= "$filetopcolor has been changed to $writetopcolor<br>";                 f close($two);                 $numbertwo++;             }                          if ($writebottomfont == null) {                 $message .= "No changes to $filebottomfont<br>";                 $numberthree++;             } else {                 $three = f open($filebottomfont, 'w') or die("Cant open Bottom Font.");                 f write($three, $writebottomfont);                 $message .= "$filebottomfont has been changed to $writebottomfont<br>";                 f close($three);                 $numberthree++;             }                          if ($writebottomcolor == null) {                 $message .= "No changes to $filebottomcolor<br>";                 $numberfour++;             } else {                 $four = f open($filebottomcolor, 'w') or die("Cant open Bottom Color.");                 f write($four, $writebottomcolor);                 $message .= "$filebottomcolor has been changed to $writebottomcolor<br>";                 f close($four);                 $numberfour++;             }                          if ($writeborder == null) {                 $message .= "No changes to $fileborder<br>";                 $numberfive++;             } else {                 $five = f open($fileborder, 'w') or die("Cant open Border.");                 f write($five, $writeborder);                 $message .= "$fileborder has been changed to $writeborder<br>";                 close($five);                 $numberfive++;             }         }     } else {         echo "Invalid Password.";     } } else {     echo "Invalid Username."; } //log write code if ($logwrite != "") {     $logwrite = "<table border=0 width=100%><tr><td vAlign=top align=left>-</td><td vAlign=top align=left>" . $logwrite . "</td></tr></table>";     if ($log == "No log entries.") {         $two = f open($logfile, 'w') or die("Cant open log.");         f write($two, $logwrite);         f close($two);     } else {         $two = f open($logfile, 'w') or die("Cant open log.");         f write($two, $logwrite);         f close($two);     } } echo $message . "<a href=ap.php>Back to Admin Panel</a>"; ?>[/code]
  14. Don't use the single quotes around your column names. Either don't use anything and just seperate them by commas, or use backtics (`)...the one above tab on most keyboards.
  15. You can't send both. It's either an image, or an html page, not both. The best way to do what your wanting is to write your html page, then where you want the image to appear, use an img tag and for the src use the url of the page that generates the image. [code]<h1>some html</h1><br /> <img src="./imagepage.php" alt="this is an image">[/code]
  16. Change: [code]$result = mysql_query( $query );[/code] to: [code]$result = mysql_query( $query ) or die(mysql_query());[/code] Then see what the error is.
  17. [!--quoteo(post=355552:date=Mar 15 2006, 09:31 PM:name=Brandomonium)--][div class=\'quotetop\']QUOTE(Brandomonium @ Mar 15 2006, 09:31 PM) [snapback]355552[/snapback][/div][div class=\'quotemain\'][!--quotec--] I can't see this happening [/quote] You are correct. You can create semi persistant variables using sessions and the like, but once the script ends, just like you would expect, all vars and objects, and usually, db connections are lost. The only exception to this would be persistant db connections, which remain for a period of time.
  18. Why are you using $_POST['imageurl'] for the img src tag? Shouldn't that be some value from the database? [code]while($r=mysql_fetch_array($getimages)) { extract($r); //remove the $r so its just $variable     echo("<hr>   Image: <image src='$pathtofile' height=\"50\" width=\"50\"><br>     Id: $id <br>     Date: $date<br>     <a href='". $_SERVER['PHP_SELF']. "?id=$id'>delete</a>"); }[/code]
  19. hitman6003

    wierd

    [!--quoteo(post=355542:date=Mar 15 2006, 08:36 PM:name=txmedic03)--][div class=\'quotetop\']QUOTE(txmedic03 @ Mar 15 2006, 08:36 PM) [snapback]355542[/snapback][/div][div class=\'quotemain\'][!--quotec--] If you want to be a jerk about something when someone explains something you seem to not understand, then go waste someone else's time. [/quote] Sorry, didn't think I was....... But, I digress. I think that the problem may be that the [a href=\"http://127.0.0.1/ms2/\" target=\"_blank\"]http://127.0.0.1/ms2/[/a] may not be the same directory as what you are trying to include. Typing [a href=\"http://127.0.0.1\" target=\"_blank\"]http://127.0.0.1[/a] into your browser window, assuming that you are logged into the server, is the same as typing [a href=\"http://localhost/\" target=\"_blank\"]http://localhost/[/a], or if you are on a different computer, [a href=\"http://servername/\" target=\"_blank\"]http://servername/[/a]. So, if you use [a href=\"http://127.0.0.1\" target=\"_blank\"]http://127.0.0.1[/a] in an include, your telling it to look to the document root for your files. Putting the /ms2/ after it tells it to look in the ms2 folder. So the full include path would, using the var string $scripturl/sources/skin_foot.php would be "http://127.0.0.1/ms2/sources/skin_foot.php". So if your files are not in the /ms2/sources/ folder, then it won't find them. Changing that include to use "sources/skin_foot.php" tells it to look from the current directory. So if your in the ms3 directory, for example, you would need to use "http://127.0.0.1/ms3/" Assuming you knew that, another problem could be permissions. When you use the ip like that I would think that it treats it the same as if it's pulling a url from some other random server, which your server may not accept connections in that way, or it may not be configured to retrieve files from a url. Or that particular directory may not allow files to be retrieved in that manner. Either way, I wouldn't use that particular method. I would use the relative path, wether from the current diretory (./ for current, ../ for one up, ../../ for two up, etc) or from the document root (/foldername).
  20. hitman6003

    wierd

    [!--quoteo(post=355231:date=Mar 15 2006, 12:27 AM:name=txmedic03)--][div class=\'quotetop\']QUOTE(txmedic03 @ Mar 15 2006, 12:27 AM) [snapback]355231[/snapback][/div][div class=\'quotemain\'][!--quotec--] the host name is based on the IP[/quote] duh. [!--quoteo(post=355231:date=Mar 15 2006, 12:27 AM:name=txmedic03)--][div class=\'quotetop\']QUOTE(txmedic03 @ Mar 15 2006, 12:27 AM) [snapback]355231[/snapback][/div][div class=\'quotemain\'][!--quotec--] so 127.0.0.1 (the loop back address) references the local system[/quote] hence the, quite logical, name "Loop back address" [!--quoteo(post=355231:date=Mar 15 2006, 12:27 AM:name=txmedic03)--][div class=\'quotetop\']QUOTE(txmedic03 @ Mar 15 2006, 12:27 AM) [snapback]355231[/snapback][/div][div class=\'quotemain\'][!--quotec--] If you check your hosts configuration "localhost" points to 127.0.0.1. [/quote] He is returning 127.0.0.1 to the browser however, so it won't do a dns lookup. And once it goes to the browser, the server has no control over it. The server isn't actually sending an img when you put in an img tag...it sends the location of the image, which the browser then goes and retrieves from that location. Putting 127.0.0.1 as the address will cause the browser to automatically go to localhost...so if he looks at the page from anywhere but his computer, it won't display correctly.
  21. change: [code]echo '<a href="/profile/profile.php?user='.$row['uname'].'>'.$row['uname'].'</a>';[/code] to: [code]echo "<a href=\"/profile/profile.php?user=" . $row['uname'] . "\">" . $row['uname'] . "</a>";[/code]
  22. [code]$thismonth = date("F"); $nextmonth = date("F", mktime(NULL, NULL, NULL, date("m") + 1, date("d"), date("Y"))); echo $thismonth . " / " . $nextmonth;[/code]
  23. You could try cURL. [a href=\"http://www.php.net/curl\" target=\"_blank\"]http://www.php.net/curl[/a]
  24. See phpfreaks' sister site ajaxfreaks: [a href=\"http://www.ajaxfreaks.com\" target=\"_blank\"]http://www.ajaxfreaks.com[/a]
  25. [code]<script type="text/javascript">     var c = '';          function changeme(w, e) {         c.className = "navlist";         e.className = "current";         c = e;         //show(w);     } </script> <style> .navlist {     background-color: #0099CC; } .current {     background-color: #999933; } </style> <div class="navlist"><a href="#" onclick="javascript: changeme('screen_shots', this);">Menu Item 1</a></div> <div class="navlist"><a href="#" onclick="javascript: changeme('screen_shots', this);">Menu Item 2</a></div> <div class="navlist"><a href="#" onclick="javascript: changeme('screen_shots', this);">Menu Item 3</a></div> <div class="navlist"><a href="#" onclick="javascript: changeme('screen_shots', this);">Menu Item 4</a></div> <div class="navlist"><a href="#" onclick="javascript: changeme('screen_shots', this);">Menu Item 5</a></div> <div class="navlist"><a href="#" onclick="javascript: changeme('screen_shots', this);">Menu Item 6</a></div>[/code]
×
×
  • 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.