Jump to content

conan318

Members
  • Posts

    195
  • Joined

  • Last visited

    Never

Everything posted by conan318

  1. id not passing onto next page. when i view the source code the id value is there. <a href='view_designs2.php?id='198'> but when the next page loads there is nothing in the address bar. <?php echo "<table width='1000' align='center'>"; $data=mysql_query("SELECT * FROM design WHERE jobno='$id' AND status!='rejected'") or die (mysql_error()); $counter = 0; while ($info=mysql_fetch_array($data)){ $img5=$info['name']; $id=$info['id']; $img=$info['thumbs']; echo "<td>"; echo "Design By "."$img5 "."<br><br>"; echo "<a href='view_designs2.php?id='$id'><img src='../dthumbs/$img' style='text-align: center; width:250px; max-height:250px; border: solid 10px; border-radius: 5px; border-color:tan; -moz-box-shadow: 3px 3px 4px #000; -webkit-box-shadow: 3px 3px 4px #000; box-shadow: 3px 3px 4px #000; -ms-filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000'); filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000'); ''>"; echo "<br><br></td>"; $counter = $counter + 1; if ($counter==3){ echo "<tr>"; $counter=0; } } echo "</tr></table>"; ?>'
  2. is it possible to use the OnClick on an input type="text" Can anyone see why its not working? <script language="javascript"> function test(){ document.getElementById("1").style.display='block'; } </script> <div id="1" name="1" style="display: none; margin-left: 500px; margin-top: 660px; position: absolute; z-index: 9000;"> <p> TESTING</p> </div> <label for='Email'>Email</label><input type="text" name="email" onclick="test()"/>
  3. fixed it self. the best kind of problem
  4. do you mean something like this $img="../images/yourimagesrc.jpg"; <input type="hidden" value="<img src='<?php echo $img"'> then send an email <?php // Example $HTML = "<b><img src='$img'></b>"; $from = "someone@someone"; $to = "[email protected]"; $subject = "Subject "; sendHTMLemail($HTML,$from,$to,$subject); function sendHTMLemail($HTML,$from,$to,$subject) { // First we have to build our email headers // Set out "from" address $headers = "From: $from\r\n"; // Now we specify our MIME version $headers .= "MIME-Version: 1.0\r\n"; // Create a boundary so we know where to look for // the start of the data $boundary = uniqid("HTMLEMAIL"); // First we be nice and send a non-html version of our email $headers .= "Content-Type: multipart/alternative;". "boundary = $boundary\r\n\r\n"; $headers .= "This is a MIME encoded message.\r\n\r\n"; $headers .= "--$boundary\r\n". "Content-Type: text/plain; charset=ISO-8859-1\r\n". "Content-Transfer-Encoding: base64\r\n\r\n"; $headers .= chunk_split(base64_encode(strip_tags($HTML))); // Now we attach the HTML version $headers .= "--$boundary\r\n". "Content-Type: text/html; charset=ISO-8859-1\r\n". "Content-Transfer-Encoding: base64\r\n\r\n"; $headers .= chunk_split(base64_encode($HTML)); // And then send the email .... mail($to,$subject,"",$headers); } ?>
  5. Hi my website has been working all day now everypage is getting this error also get the same error when i try to login into phpmyadmin Lost connection to MySQL server at 'reading initial communication packet', system error: 111 is this most likely a problem with the server?
  6. the answer remove the grouping $sql = "SELECT COUNT(DISTINCT album) FROM belsgallery "; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); $r = mysql_fetch_row($result); $numrows = $r['0']; echo $numrows; // RETURNS 1 $rowsperpage = 8; $totalpages = ceil($numrows / $rowsperpage);
  7. i have 12 distinct albums displaying 8 per page $number rows echo's out to be 1 so to me says my query is wrong how to count only distinct albums $sql = "SELECT COUNT(DISTINCT album) FROM belsgallery GROUP BY album"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); $r = mysql_fetch_row($result); $numrows = $r['0']; echo $numrows; // RETURNS 1 $rowsperpage = 8; $totalpages = ceil($numrows / $rowsperpage);
  8. Thanks that quite handy will hold to that one. but what i am trying to is to insert current time stamp then work out how many days since the user last logged in that part is working i just need the full timestamp which iam currently using the now() function to insert the time stamp as such. mysql_query("UPDATE mmembers set time='now() where email='$myusername'") or die (mysql_error()); header('location:../pages/index.php');
  9. trying to set the default time zone using this the current time in Sydney is 8:55 but the timestamp is showing as 2011-11-07 13:55:20 just a few hours out. date_default_timezone_set('Australia/Sydney'); if (date_default_timezone_get()) { echo 'date_default_timezone_set: ' . date_default_timezone_get() . '<br />'; } if (ini_get('date.timezone')) { echo 'date.timezone: ' . ini_get('date.timezone'); }
  10. forgot the ' ' around my $myusername could happend to anyone lol
  11. that would be a smarter way to do it. i am still learning php. next time i will try it that way
  12. here is the form <table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <form action="../php/goldportupload.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td><strong>multiple Files Upload </strong></td> </tr> <tr> <td>Select file <input name="uploadedfile" type="file" id="uploadedfile" size="20" /> <td>Select file <input name="uploadedfile1" type="file" id="uploadedfile1" size="20" /></td> </tr> <tr> <td>Select file <input name="uploadedfile2" type="file" id="uploadedfile2" size="20" /> <td>Select file <input name="uploadedfile3" type="file" id="uploadedfile3" size="20" /></td> </tr> <tr> <td>Select file <input name="uploadedfile4" type="file" id="uploadedfile4" size="20" /> <td>Select file <input name="uploadedfile5" type="file" id="uploadedfile5" size="20" /></td> </tr> <tr> <td>Select file <input name="uploadedfile6" type="file" id="uploadedfile6" size="20" /> <td>Select file <input name="uploadedfile7" type="file" id="uploadedfile7" size="20" /></td> </tr> <tr> <td>Select file <input name="uploadedfile8" type="file" id="uploadedfile8" size="20" /> <td>Select file <input name="uploadedfile9" type="file" id="uploadedfile9" size="20" /></td> </tr> </table> </div> <div class="uploadbutton" style="background-color:#A0D9F8;";> <input type="submit" name="Submit" value="Upload" /> </form> <form action="port3.php"> <input type="submit" value="uploadlater" /> </form>
  13. i tryed that once and could not work it out instead i made a form where up to 10 files can be uploaded <?php session_start(); require('connection'); $myusername=$_SESSION['myusername']; $mypassword=$_SESSION["mypassword"]; $ivn=$_SESSION["ivn"]; if (($_FILES['uploadedfile']['size']!= 0 && $_FILES['uploadedfile1']['size']!= 0 && $_FILES['uploadedfile2']['size']!= 0 && $_FILES['uploadedfile3']['size']!= 0 && $_FILES['uploadedfile4']['size']!= 0 && $_FILES['uploadedfile5']['size']!= 0 && $_FILES['uploadedfile6']['size']!= 0 && $_FILES['uploadedfile7']['size']!= 0 && $_FILES['uploadedfile8']['size']!= 0 && $_FILES['uploadedfile9']['size']!= 0 )) { $ext_a = explode(".", $_FILES['uploadedfile']['name']); $ext_a1 = explode(".", $_FILES['uploadedfile1']['name']); $ext_a2 = explode(".", $_FILES['uploadedfile2']['name']); $ext_a3 = explode(".", $_FILES['uploadedfile3']['name']); $ext_a4 = explode(".", $_FILES['uploadedfile4']['name']); $ext_a5 = explode(".", $_FILES['uploadedfile5']['name']); $ext_a6= explode(".", $_FILES['uploadedfile6']['name']); $ext_a7 = explode(".", $_FILES['uploadedfile7']['name']); $ext_a8 = explode(".", $_FILES['uploadedfile8']['name']); $ext_a9 = explode(".", $_FILES['uploadedfile9']['name']); $ext = $ext_a[1]; $ext2 = $ext_a1[1]; $ext3 = $ext_a2[1]; $ext4 = $ext_a3[1]; $ext5 = $ext_a4[1]; $ext6 = $ext_a5[1]; $ext7 = $ext_a6[1]; $ext8 = $ext_a7[1]; $ext9 = $ext_a8[1]; $ext10 = $ext_a9[1]; if ( ($ext!=="gif" && $ext!=="JPG" && $ext!=="png" && $ext!=="jpg" )){ echo "Images Must Be JPG,PNG, OR GIF"; echo "<a href='port2.php'>Go back</a>"; die; } /* hashes the file name with the date and time and rand number to genrate a uniue file name*/ $ran=mt_rand(1000, 9999); $ran1=mt_rand(1000, 9999); $ran2=mt_rand(1000, 9999); $ran3=mt_rand(1000, 9999); $ran4=mt_rand(1000, 9999); $ran5=mt_rand(1000, 9999); $ran6=mt_rand(1000, 9999); $ran7=mt_rand(1000, 9999); $ran8=mt_rand(1000, 9999); $ran9=mt_rand(1000, 9999); $img=md5($_FILES['uploadedfile']['name'] . date("m.d.y H:m:s")) .$ran. "." . $ext; $img2=md5($_FILES['uploadedfile1']['name'] . date("m.d.y H:m:s")) .$ran1. "." . $ext2; $img3=md5($_FILES['uploadedfile2']['name'] . date("m.d.y H:m:s")) .$ran2."." . $ext3; $img4=md5($_FILES['uploadedfile3']['name'] . date("m.d.y H:m:s")) .$ran3."." . $ext4; $img5=md5($_FILES['uploadedfile4']['name'] . date("m.d.y H:m:s")) .$ran. "." . $ext5; $img6=md5($_FILES['uploadedfile5']['name'] . date("m.d.y H:m:s")) .$ran5. "." . $ext6; $img7=md5($_FILES['uploadedfile6']['name'] . date("m.d.y H:m:s")) . $ran6."." . $ext7; $img8=md5($_FILES['uploadedfile7']['name'] . date("m.d.y H:m:s")) . $ran7."." . $ext8; $img9=md5($_FILES['uploadedfile8']['name'] . date("m.d.y H:m:s")) . $ran8."." . $ext9; $img10=md5($_FILES['uploadedfile9']['name'] . date("m.d.y H:m:s")) . $ran9."." . $ext10; $target_path = "../portimg/"; $target_path1 = "../portimg/"; $target_path2 = "../portimg/"; $target_path3 = "../portimg/"; $target_path4 = "../portimg/"; $target_path5 = "../portimg/"; $target_path6 = "../portimg/"; $target_path7 = "../portimg/"; $target_path8 = "../portimg/"; $target_path9 = "../portimg/"; $target_path = $target_path .basename($img) ; $target_path1 = $target_path1 .basename($img2); $target_path2 = $target_path2 .basename($img3); $target_path3 = $target_path3 .basename($img4); $target_path4 = $target_path4 .basename($img5); $target_path5 = $target_path5 .basename($img6); $target_path6 = $target_path6 .basename($img7); $target_path7 = $target_path7 .basename($img8); $target_path8 = $target_path8 .basename($img9); $target_path9 = $target_path9 .basename($img10); $result = mysql_query("UPDATE members SET p1='$img', p2='$img2', p3='$img3',p4='$img4', p5='$img5', p6='$img6',p7='$img7', p8='$img8', p9='$img9',p10='$img10' WHERE email='$myusername' and password='$mypassword' and inv='$ivn';") or die(mysql_error()); ?> <!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=utf-8" /> <title>3designbrief.com | Create Porfolio</title> <link href="../css/3lance.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="content" style="background-image:url(../img/3lance.png);"> <div class="slideport"> <?php if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { } if(move_uploaded_file($_FILES['uploadedfile1']['tmp_name'], $target_path1)){ } if(move_uploaded_file($_FILES['uploadedfile2']['tmp_name'], $target_path2)){ } if(move_uploaded_file($_FILES['uploadedfile3']['tmp_name'], $target_path3)) { } if(move_uploaded_file($_FILES['uploadedfile4']['tmp_name'], $target_path4)){ } if(move_uploaded_file($_FILES['uploadedfile5']['tmp_name'], $target_path5)){ } if(move_uploaded_file($_FILES['uploadedfile6']['tmp_name'], $target_path6)) { } if(move_uploaded_file($_FILES['uploadedfile7']['tmp_name'], $target_path7)){ } if(move_uploaded_file($_FILES['uploadedfile8']['tmp_name'], $target_path8)){ } if(move_uploaded_file($_FILES['uploadedfile9']['tmp_name'], $target_path9)){ echo "Profile Image has been uploaded";
  14. How do i correctly update a timestamp? $date = date("Y-m-d H:i:s"); mysql_query("UPDATE mmembers set time=now() where email=$myusername");
  15. the upload was still working with the imagee lol file is uploading to the right place be recorded into the database fine but the image is not getting resized.
  16. I am trying use simple image to resize images as i upload but i cant get it to work.. any ideas where i am going wrong simpleimage.php <?php /* * File: SimpleImage.php * Author: Simon Jarvis * Copyright: 2006 Simon Jarvis * Date: 08/11/06 * Link: http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details: * http://www.gnu.org/licenses/gpl.html * */ class SimpleImage { var $image; var $image_type; function load($filename) { $image_info = getimagesize($filename); $this->image_type = $image_info[2]; if( $this->image_type == IMAGETYPE_JPEG ) { $this->image = imagecreatefromjpeg($filename); } elseif( $this->image_type == IMAGETYPE_GIF ) { $this->image = imagecreatefromgif($filename); } elseif( $this->image_type == IMAGETYPE_PNG ) { $this->image = imagecreatefrompng($filename); } } function save($filename, $image_type=IMAGETYPE_JPEG, $compression=75, $permissions=null) { if( $image_type == IMAGETYPE_JPEG ) { imagejpeg($this->image,$filename,$compression); } elseif( $image_type == IMAGETYPE_GIF ) { imagegif($this->image,$filename); } elseif( $image_type == IMAGETYPE_PNG ) { imagepng($this->image,$filename); } if( $permissions != null) { chmod($filename,$permissions); } } function output($image_type=IMAGETYPE_JPEG) { if( $image_type == IMAGETYPE_JPEG ) { imagejpeg($this->image); } elseif( $image_type == IMAGETYPE_GIF ) { imagegif($this->image); } elseif( $image_type == IMAGETYPE_PNG ) { imagepng($this->image); } } function getWidth() { return imagesx($this->image); } function getHeight() { return imagesy($this->image); } function resizeToHeight($height) { $ratio = $height / $this->getHeight(); $width = $this->getWidth() * $ratio; $this->resize($width,$height); } function resizeToWidth($width) { $ratio = $width / $this->getWidth(); $height = $this->getheight() * $ratio; $this->resize($width,$height); } function scale($scale) { $width = $this->getWidth() * $scale/100; $height = $this->getheight() * $scale/100; $this->resize($width,$height); } function resize($width,$height) { $new_image = imagecreatetruecolor($width, $height); imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight()); $this->image = $new_image; } } ?> form.php <?php if( isset($_POST['submit']) ) { include('../php/SimpleImage.php'); $image = new SimpleImage(); $image->load($_FILES['uploaded_image']['tmp_name']); $image->resizeToWidth(150); $image->output(); } else { ?> <form action="../php/gallery.php" method="post" enctype="multipart/form-data"> <input type="file" name="uploaded_image" id="uploaded_image" /> <input type="submit" name="submit" value="Upload" /> </form> <?php } ?> gallery.php if ($_FILES['uploaded_image']['size']!= 0){ $ext_a = explode(".", $_FILES['uploaded_image']['name']); $ext = $ext_a[1]; if ( ($ext!=="gif" && $ext!=="JPG" && $ext!=="png" && $ext!=="jpg" )){ echo "Error IMAGES MUST BE EITHER PNG, GIF OR JPG "; echo "<a href='gal.php'>Go back</a>"; die; } /* hashes the file name with the date and time to genrate a uniue file name*/ $img=md5($_FILES['uploaded_imagee']['name'] . date("m.d.y H:m:s")) . "." . $ext; $target_path = "../gallery/"; $target_path = $target_path .basename($img); $insert_user=mysql_query("INSERT INTO mongrels_db.gallery (img) VALUES ('$img')") ; if(move_uploaded_file($_FILES['uploaded_image']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploaded_image']['name']). " has been uploaded"; echo"<br>"; } }else{ echo"<p style='font-size: 20px; color:red;' >"; echo"There was an error in uploading this image"; echo"<br>"; echo"this error may be because the file you are uploading exceeds 2mb"; echo"<br>"; echo"please resize this image"; echo"<br>"; echo"or you did not select a file to upload"; echo"<br>"; echo"<a href='gal.php'>go back</a>"; echo"</p>"; } ?>
  17. Can you give me an example of this or point me to tutorial ?
  18. i did do it like that to start with. but could not work how to display 4 img then create a new table row inside the loop im sure there is a way to do it.
  19. Ok the pagination part is all working fine. but i thought id be able to create a heap variables inside the loop then display the images in a table. the only trouble is all variables are grabbing the same img. i need them to grab the 10 different records. thanks $sql = "SELECT * FROM mongrels_db.gallery ORDER BY id DESC LIMIT $offset, $rowsperpage "; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); // while there are rows to be fetched... while ($list = mysql_fetch_array($result)) { $img1=$list['img']; $img2=$list['img']; $img3=$list['img']; $img4=$list['img']; $img5=$list['img']; $img6=$list['img']; $img7=$list['img']; $img8=$list['img']; $img9=$list['img']; $img10=$list['img']; // echo data } // end while echo "<table><tr>"; echo "<td>"."<img src='../gallery/".$img1 ."' width='100' height='100''> "."</td>"; echo "<td>"."<img src='../gallery/".$img2 ."' width='100' height='100''> "."</td>"; echo "<td>"."<img src='../gallery/".$img3 ."' width='100' height='100''> "."</td>"; echo "<td>"."<img src='../gallery/".$img4 ."' width='100' height='100''> "."</td></tr>"; echo "<tr><td>"."<img src='../gallery/".$img5 ."' width='100' height='100''> "."</td>"; echo "<td>"."<img src='../gallery/".$img6 ."' width='100' height='100''> "."</td>"; echo "<td>"."<img src='../gallery/".$img7 ."' width='100' height='100''> "."</td>"; echo "<td>"."<img src='../gallery/".$img8 ."' width='100' height='100''> "."</td>"; echo "<tr><td>"."<img src='../gallery/".$img9 ."' width='100' height='100''> "."</td>"; echo "<td>"."<img src='../gallery/".$img10 ."' width='100' height='100''> "."</td></tr>";
  20. topic solved once again thanks guys $date= date('Y-m-d'); $query=mysql_query("SELECT * FROM listing WHERE expiredate>='$date'") or die (mysql_error());
  21. iam using the date field with the date being displayed as 2011-09-13 after checking the field is called expire_date. but still no luck $date= date('y-m-d'); $query=mysql_query("SELECT * FROM listing WHERE expire_date>='$date'") or die (mysql_error());
  22. still shows all records in the database... any idea how i go about this? $date= date('y-m-d'); $query=mysql_query("SELECT * FROM listing WHERE date >= $date") or die (mysql_error());
  23. no probs thanks for your help... i will keep testing ill find the problem
  24. no error but not displaying the image it should... is that correct syntax for != in the where clause?
  25. i need to pull the records from where status not = rejected does anyone know the correct syntax? $data=mysql_query("SELECT * FROM design WHERE id='$id' AND status!='rejected' ") or die (mysql_error());
×
×
  • 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.