Jump to content
xisto Community

TavoxPeru

Members
  • Content Count

    865
  • Joined

  • Last visited

Posts posted by TavoxPeru


  1. this is the script that I use to resize image..

     

    <?php$a = "images/".$_GET['src'];$b = $_GET['w'];$ext = explode(".",$_GET['src']);$ext = end($ext);$ext = strtolower($ext);if ($ext == "jpg") { header ("Content-type: image/jpeg"); }else if ($ext == "gif") { header ("Content-type: image/gif"); }else if ($ext == "png") { header ("Content-type: image/png"); }if ($ext == "jpg") { $img_src=imagecreatefromjpeg($a); }else if ($ext == "gif") { $img_src=imagecreatefromgif($a); }else if ($ext == "png") { $img_src=imagecreatefrompng($a); }$size = getimagesize($a);if ($b >= $size[0]) $b = $size[0];$c = round($b * $size[1] / $size[0]);$img_dst=imagecreatetruecolor($b,$c);imagecopyresampled($img_dst, $img_src, 0, 0, 0, 0, $b, $c, $size[0], $size[1]);if ($ext == "jpg") { imagejpeg($img_dst, "", 100); }else if ($ext == "gif") { imagegif($img_dst); }else if ($ext == "png") { imagepng($img_dst); }imagedestroy($img_dst);?>

    using my script, the image will show with ?src=image_name&w=image_width

    the images are store in /images directory..

     

    this is the example:

    real image

    resized image

     

    Well done, but, i take the liberty to optimize your code :) here is my version:
    <?php$a = "images/".$_GET['src'];$b = $_GET['w'];$ext = explode(".",$_GET['src']);$ext = end($ext);$ext = strtolower($ext);$size = getimagesize($a);if ($b >= $size[0]) $b = $size[0];$c = round($b * $size[1] / $size[0]);$img_dst=imagecreatetruecolor($b,$c);if ($ext == "jpg") { header ("Content-type: image/jpeg"); $img_src=imagecreatefromjpeg($a);imagecopyresampled($img_dst, $img_src, 0, 0, 0, 0, $b, $c, $size[0], $size[1]);imagejpeg($img_dst, "", 100); }else if ($ext == "gif") { header ("Content-type: image/gif"); $img_src=imagecreatefromgif($a);imagecopyresampled($img_dst, $img_src, 0, 0, 0, 0, $b, $c, $size[0], $size[1]);imagegif($img_dst);}else if ($ext == "png") { header ("Content-type: image/png"); $img_src=imagecreatefrompng($a);imagecopyresampled($img_dst, $img_src, 0, 0, 0, 0, $b, $c, $size[0], $size[1]);imagepng($img_dst); }imagedestroy($img_dst);?>
    Best regards,

  2. Well, finally my client decide not to use this approach. What i do is simply change it to a standard login script using a form with a text box and a password box and all works very fine, so sorry dudes, i hope sometime i could complete this approach. For me, it is an incomplete task that i must finish soon.Best regards,PS: please admins let me know if i'm doing wrong when i post again and if the correct way was simply to include this in my previous post.


  3. Hi! I found this Newsletter System, based on TXT files, not MySQL. It is VERRY simple. Here is the instructions:

     

    ----------------------------------------------

    |### Newsletter System 1.0 L.E. ###|

    ----------------------------------------------

    Leandro Maniezo

    lemaniezo@ig.com.br

     

    TRANSLATION FROM PORTUGUESE-BR TO ENGLISH:

    Alexandre Cisneiros Filho

    misteryoshi@gmail.com

    Introduction

    ----------

    - Put line-by-line the adresses on the file emails_bd.txt.

     

    - Set the permitions of the txt files to be writebly.

     

    - After sendin, all the adresses who recived the message are stored at log.txt.

     

    - If some people dont recive the message, deleta all adresses on the file emails_bd that are in log.txt and send again.

    Instaling

    ----------

     

    - Put all the files in a folder on the site and set the permitions to the TXT files.

     

    Obs.: NO Javascript allowed.

    If you want to send images, you need to host them.

     

    Just download the attached file!

     

    Thanks dude, a lot of time i waste searching something like this, is very simple, and also it demostrates me what i was doing bad in my script.

     

    best regards,


  4. Thank you very much TavoxPeru. It worked.

     

    In the statement that has ORDER BY in it ...

     

    why is the there both a " (quotes) and a ' (apostrophe) ?

    Sorry my understanding of PHP is very new.

     


    In PHP and SQL, the " and the ' are use to specify strings literals like the $query variable, in this specific case you are creating a SQL statement that will select some links of a category type whick also is a string, thats why you use this.

     

    Best regards,


  5. In order to show that malicious software is present even without OS security holes, researchers have developed a prototype of malware that cannot be detected. It is invisible even on Windows Vista, which is supposed to be fully protected from these kinds of attacks. The concept Blue Pill, which is the prototype name, uses AMD's SVM/Pacifica virtualization technology and enables complete take-over of the operating system. The user is not aware of this, because everything happens without the computer being restarted, even without lowering the computer performance.

     

    Blue Pill doesn't use bugs in the OS, and can be used on other operating systems, such as Linux and FreeBSD that are on a 64bit platform. Even though this was just a demonstration, not detecting malware is a big problem. Fortunately, the problem (and the solution, hopefully) has been sighted long before attacks will appear.

     

    Thanks for the info, its really amazing all the things that the hUman can create, i hope that i never be infected by this malware, yes yes, i know, i ask too mUch :D

     

    BTW, a few months ago i lost my 30GB HD especially becaUse of downloading torrents, i know that i can find good things in this format but my experience told me that the risk to get some virri is very high.

     

    Best regards,


  6. My query is returning a list of manufacturers with a hyperlink to their web site.
    I would like to LIST them alphabetically but can't seem to figure it out. Can someone lend me a hand?

    <?php	  // Query the Database $specific_value = 'Industrial';$query = "SELECT * FROM table_links WHERE cat='" . mysql_real_escape_string($specific_value) . "' ORDER BY 'manufacturer' ASC";$query = "SELECT * FROM table_links WHERE cat = '" . mysql_real_escape_string($specific_value) . "'";$result = mysql_query($query);if(!$result) die("ERROR: " . mysql_error());while($row = mysql_fetch_array($result)) {	  echo '<a href="'.$row['mfr_url'].'">'.$row['manufacturer'].'</a><br>'; }  ?>
    To order alphabetically simply remove the quoutes of your order by clause, and also delete your second $query variable assignment because if you dont do it, this will replace your first assignment.

    Your statement will be:
    <?php	  // Query the Database$specific_value = 'Industrial';$query = "SELECT * FROM table_links WHERE cat = '" . mysql_real_escape_string($specific_value) . "' ORDER BY manufacturer ASC";$result = mysql_query($query);if(!$result) die("ERROR: " . mysql_error());while($row = mysql_fetch_array($result)) {  echo '<a href="' . $row['mfr_url'] . '">' . $row['manufacturer'] . '</a><br>'; }?>
    Best regards,

  7. Hi, this simple one line script changes the image size and source on your thumbnail picture without reloading the page or using popups, just paste this code into the BODY section of your HTML document:

    <img src="yourimage.jpg" width="150" height="200" onclick="this.src='yourimage.jpg';this.height=400;this.width=300" ondblclick="this.src='yourimage.jpg';this.height=200;this.width=150">
    Best regards,

    edit: adding the missing ' of the src on the ondblclick event.

  8. I view this behavior in many sites, i think they do it with the use of an iframe, so you will have 2 pages, one main page and one with your links. Lets view it with an example.

    mainpage.htm:

    <html><head><title>Main Page</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /></head><body><!-- here you can put whatever you want --><!-- set your iframe whatever you want --><iframe src="linkspage.htm" name="target_iframe"></iframe></body></html>
    linkspage.htm:

    <html><head><title>Links Page</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /></head><body><a href="http://forums.xisto.com/&; target="_self">Xisto</a><br /><a href="https://www.google.com/&%2334; target="_self">Google</a><br /><a href="http://forums.xisto.com/no_longer_exists/; target="_self">Yahoo</a><br /></body></html>
    I'm not 100% sure if it is the way they implement this but this example works fine. :D

     

    Best regards,


  9. First of all: that's really handy calculator. Thanks for posting TavoxPeru. No. Em sizes are relational. So if user changes font size in his browser, Ctrl+MouseScroll or View->Font Size in IE, all the fonts are resized proportionally. So headers "<hX>" are increased in size proportianlly as much as the normal text.

    If you have set the font size as absolute pixels, the IE, for example, refuses to change it. The font size is set in the code and the browser won't render it differently. Browsers which "zoom" are a different thing as they zoom everything, including tables divs and images.

    Ems are the recommended way. Simply because relational measures are far more handy for special browsers such as one's in hand helds. Basically the text stays readable regardless of the screen size or resolution.

    Ok, thanks a lot, i will put this in practice right now.

    Best regards,

  10. Now that is a really good calculator you pointed out TavoxPeru.
    I prefer to use 'ems' instead of specific pixel sizes when defining the font-sizes for various blocks in CSS because else, that would keep the design fixed. If someone wants to resize the fonts using their browser option, they are unable to.

    But if one uses 'em' sizes for the fonts through out the CSS, then that leads to a truly fluid design and a visitor has choices of font-sizes and can choose whichever is comfortable to him.

    Tell me something, what you say is that if i specify the font sizes using 'ems' in an external css file the user can't modify these sizes by the browser right??? but if i specify these sizes usign 'ems' directly in the html page using a style attribute of any html tag or by using an inline style they could modify these by the browser???

    Best regards,

  11. The forum has worked fine for me except for this particular problem.
    Yeah I don't strip out html/jscript as of yet, not sure how to. This is basically my first attempt at doing it.

    It's quite easy simply call the function with the value that you want to strip out as a parameter before your insert stament. I use this function everytime and you dont know how many problems and time i avoid with it:
    <?phpfunction safeEscapeString($string){	if (get_magic_quotes_gpc()) {		return $string;	}	else {		return mysql_real_escape_string($string); // PHP 4.x	}}$var1=safeEscapeString($_POST["var1"]);$var2=safeEscapeString($_POST["var2"]);...// your db connection settingsmysql_query("insert into table(var1,var2) values ('$var1','$var2')") or die ("Error...\n" . mysql_errno(). ": " . mysql_error() );// other code?>

    Best regards,

  12. first of all, i just visit your forum and it doesn't work, it redirects you to other website and shows an error that you forgot to disable javascript posting in the forum. Now, tell me something, do you use MySql as your database backend??? if it is true, well, i recommend you to use the mysql_real_escape_string() function.Best regards,

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.