Jump to content

dezkit

Members
  • Posts

    1,236
  • Joined

  • Last visited

Everything posted by dezkit

  1. i was googling "php watermark" and i stumbled upon this code.... but i can't get it to work... why? index.php <?php $image = $HTTP_GET_VARS['image']; // Useful if using in an img tag to call images $image = str_replace(array("/", ".."), "", $image); // Prevent abuse $overlay = 'http://www.chestysoft.com/images/watermark.png'; $dir = '../hresources/'; if ($image == NULL) { $image = 'http://www.uscg.mil/mlcpac/ischon/mwr/images/club14/club.jpg'; } if (!file_exists($dir . $image)) { die("Image does not exist."); } $w_offset = 0; $h_offset = 0; $extension = strtolower(substr($image, strrpos($image, ".") + 1)); switch ($extension) { case 'jpg': $background = imagecreatefromjpeg($dir . $image); break; case 'jpeg': $background = imagecreatefromjpeg($dir . $image); break; case 'png': $background = imagecreatefrompng($dir . $image); break; case 'gif': $background = imagecreatefromgif($dir . $image); break; default: die("Image is of unsupported type."); } $swidth = imagesx($background); $sheight = imagesy($background); imagealphablending($background, true); $overlay = imagecreatefrompng($dir . $overlay); $owidth = imagesx($overlay); $oheight = imagesy($overlay); imagecopy($background, $overlay, $swidth - $owidth - $w_offset, $sheight - $oheight - $h_offset, 0, 0, $owidth, $oheight); header("Content-type: image/jpeg"); header("Content-Disposition: filename=" . $image); imagejpeg($background); imagedestroy($background); imagedestroy($overlay); ?> i go into my index.php and it says Image doesn't exist.
  2. thanks for the code, but i want there to be a if and an else.. something like this <?php if(isset($_POST['submit'])) { if ($_POST['checkbox'] == 'SOMEVALUE') { echo "Checkbox was selected."; } else { echo "Checkbox was not selected."; } } else { ?> <form action="<? $_SERVER['PHP_SELF']; ?>" method="post"> <input type="checkbox" name="checkbox" value="SOMEVALUE"> <input type="submit" value="submit"> </form> <?php } ?>
  3. How do i do so that if a user checks a checkbox and submits the form, it says, "Checkbox has been selected." and if not selected, but submited, "Checkbox has not been selected." <?php if(isset($_POST['submit'])) { ????????????????????????????????????? } else { ?> <form action="<? $_SERVER['PHP_SELF']; ?>" method="post"> <input type="checkbox" name="checkbox"> <input type="submit" value="submit"> </form> <?php } ?>
  4. oh, thanks, php.net is hard to understand, you got any other links?
  5. What is GD, and can anybody post me links to tutorials for GD? thaks
  6. thanks, +bookmarked
  7. how do i select the 5 latest mysql fields, i got ID int example code: <?php // Make a MySQL Connection $query = "SELECT * FROM example"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo $row['name']. " - ". $row['age']; echo "<br />"; } ?>
  8. nevermind, i got it, thanks. <?php if(isset($_POST['submit'])) { echo "Hello $First_Name $Last_Name"; } else { ?> <form action="<? $_SERVER['PHP_SELF']; ?>" method="post"> <table> <tr> <td>First Name: <td><input type="text" name="First_Name"> <tr> <td>Last Name: <td><input type="text" name="Last_Name"> <tr> <td colspan=2 align=right><input type="submit" value="submit" name="submit" /> </form> <?php } ?>
  9. fix up the code
  10. How do i do so when i press submit, it doesn't show the form under? <?php if(isset($_POST['submit'])) { echo "Hello $First_Name $Last_Name"; } ?> <form action="<? $_SERVER['PHP_SELF']; ?>" method="post"> <table> <tr> <td>First Name: <td><input type="text" name="First_Name"> <tr> <td>Last Name: <td><input type="text" name="Last_Name"> <tr> <td colspan=2 align=right><input type="submit" value="submit" name="submit" /> </form>
  11. Alright dude, do you have AIM? If yes, IM me, bicthplzz14
  12. <?php $page = $_GET["page"]; if (!$page) { include "/home.php"; } else if($page=="main") { include "/main.php"; } else if($page=="about_us") { include "/about_us.php"; } else { echo "<b><h1>404 Error</h1></b>"; } ?> Let me break it down for you. include "/home.php"; means that the default home page is home.php so when you type www.website.com/index.php, home.php is the content. else if($page=="main") { include "/main.php"; } means that if the page is index.php?page=main that the content will be included from main.php
  13. echo "<td rowspan='3'><img src=' "; echo $content; echo "'/></td>"; ???
  14. my guess is to do something sql SELECT idk im stupid in mysql.
  15. lol, i stand corrected.
  16. <?php echo "Hello $username"; ?> Basic PHP mang.
  17. http://www.phpeasystep.com/workshopview.php?id=6
  18. <?php $username = "admin"; $password = "password"; if ($_POST['txtUsername'] != $username || $_POST['txtPassword'] != $password) { ?> <form name="form" method="post" action="<?=$_SERVER['PHP_SELF']; ?>"> <h1>Login</h1> <table> <tr> <td>Username: <td><input type="text" name="txtUsername"> <tr> <td>Password: <td><input type="text" name="txtPassword"> <tr> <td colspan=2 align=right><input type="submit"><input type="reset"> </form> <?php } else { header('location: http://www.google.com'); } ?>
  19. try using this if outside php code <a href="view.php?heading=<? echo echo $ar1; ?>"><?php echo $ar1; ?></a> or this if inside php code <a href=\"view.php?heading=$ar1\">$ar1</a>
  20. session_destroy() ?
  21. change <b>p50mysql151.secureserver.net</b> to <b>localhost</b>
  22. This is not a php code, rather javascript. When you put this into your index.php in your website, it will redirect the person if their browser isn't IE7 to error.html Code is not tested and got it from google, if you wanna learn more just google "dynamicdrive browser redirect" <script> var browser_type=navigator.appName var browser_version=parseInt(navigator.appVersion) else if (browser_type=="Microsoft Internet Explorer"&&browser_version<=6) window.location.replace("error.html") else window.location="http://www.website.com/welcome/" </script>
  23. try going into FTP and deleting it
×
×
  • 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.