Jump to content

Matpatnik

Members
  • Posts

    227
  • Joined

  • Last visited

Everything posted by Matpatnik

  1. Did you uninstall all php, MySQL, apache... first?Did you install in C:\ so your path is like that C:\wamp\... (this is very important)Else I don't know what to say except ask on their forum
  2. Sorry for the double post
  3. Yup, it work only on XP maybe on vista too at the end of the month or it will be on the next wamp version but I'm just guessing for vista.
  4. Maybe you didn't uninstall it properly from add/remove programs try to uninstall it and reinstall it after and make sure that your server is turned off.I personally use wampserver on my computer and never had problem with it
  5. Matpatnik

    Login script

    Hi guys, I found this script somewhere on the net few month ago and it was working fine but a soon as I try to include_once() in my page it keep asking the login every time that I send the login informationthis is the code: $username = this;$password = is_me;function authenticate() { Header( "WWW-authenticate: basic realm=\"Protected\""); Header( "HTTP/1.0 401 Unauthorized"); echo "You must enter a valid login ID and password!"; exit;}function CheckPwd($user,$pass) { global $username,$password; return ($user != $username || $pass != $password) ? false : true;}if(!isset($PHP_AUTH_USER)) { authenticate();}elseif(!CheckPwd($PHP_AUTH_USER,$PHP_AUTH_PW)) { authenticate();} I was using this code on every page and decide to include it from a different page.is the pulpfiction link code is better for an administration panel?
  6. Thank you guys, your help are very appreciatedI've send a tickets to my host to upgrade the php to 5.2.0 and MySQL to 5.0.27. Now I just have to wait till the upgrade is done
  7. that's what I thoughtif I use a php5 extension will it work?
  8. My tester server have a php version 4.4.3 does it handle the function imagefilter()? because I got this error message: with this code: // make variables available $id = $_POST['id']; if (isset($_POST['bw'])) { $bw = $_POST['bw']; } else { $bw = ''; } // get info on the pic we want $getpic = mysql_query("SELECT * FROM images WHERE images_id = '$id'") or die(mysql_error()); $rows = mysql_fetch_array($getpic); extract($rows); $image_filename = "images/" . $images_id . ".jpg"; list($width, $height, $type, $attr) = getimagesize($image_filename); $image = imagecreatefromjpeg("$image_filename"); if ($bw == 'on') { imagefilter($image, IMG_FILTER_GRAYSCALE); }
  9. I'm using Dreamweaver MX 2004 too for now I'm gonna upgrade for the latest one a soon as Adobe come out with the new version (if they come out with something within 3 years ) I can't wait to see the result of that combination
  10. I'm actually working on something similar $today = date("Y-m-d");$i_username = $_POST['username'];$i_nname = $_POST['image_name'];$i_name = $_FILES['file']["name"];$i_type = $_FILES['file']["type"];$i_size = ($_FILES['file']["size"] / 1024);$i_tname = $_FILES['file']["tmp_name"];$i_error = $_FILES['file']["error"];$i_folder = "images/"; // image directory$i_dir = $i_folder . $i_name;if ($i_type == "image/gif") { $ext = ".gif";} else if ($i_type == "image/jpeg") { $ext = ".jpeg";} else if ($i_type == "image/png") { $ext = ".png";}if (($i_type == "image/gif")|| ($i_type == "image/jpeg")|| ($i_type == "image/png")&& ($i_size < 20000)) { if ($i_error > 0) { die("<span style=\"color:#FF0000\">Return Code: " . $i_error . "</span>"); } else { echo "Upload: " . $i_name . "<br />"; echo "Database picture name: " . $i_nname . "<BR>"; echo "Type: " . $i_type . "<br />"; echo "Size: " . round($i_size) . " Kb<br />"; echo "Temp file: " . $i_tname . "<br />"; if (file_exists($i_dir)) { die("<span style=\"color:#FF0000\">" . $i_name . " already exists. Change the name and try again</span>"); } else { move_uploaded_file($i_tname, $i_dir); echo "Stored in: " . $i_dir . "<br>"; // insert info into image table $insert = "INSERT INTO images (images_name, images_username, images_date) VALUES ('$i_nname', '$i_username', '$today')"; $insertresult = mysql_query($insert) or die(mysql_error()); $newname = $i_folder . mysql_insert_id() . $ext; rename($i_folder . $i_name, $newname); echo "new name: " . $newname; } }} else { echo "<span style=\"color:#FF0000\">Invalid file or your file is too big</span>";} This is my draft code, it work well on my server, it only accept gif, jpeg/jpg, and png format. It will rename using the 'images_id'. You will need a table called images with row image_id, images_name, images_username, images_date. And this is the form that come with it <?php $trest = "Username";$header=<<<TEST<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Untitled Document</title></head>TEST; $body=<<<TEST<body><form action="upload_file.php" method="post" enctype="multipart/form-data"> <table> <tr> <td>You are loged as </td> <td>$trest<input name="username" type="hidden" id="username" value="$trest" /></td> </tr> <tr> <td>Picture Title</td> <td><input name="image_name" type="text" id="image_name" size="30" maxlength="255" /></td> </tr> <tr> <td>Filename:</td> <td><input type="file" name="file" id="file" size="30" /></td> </tr> <tr> <td align="center" colspan="2"><input type="submit" name="submit" value="Submit" /> <input type="reset" name="submit2" value="Reset" /></td> </tr> </table></form></body></html>TEST;echo $header . $body;?> Play with it and have fun :)/* edited */* I forgot to tell you that you will need to have a folder called images in the same folder that those files are and you will need to chmod them to be able to rewrite it and store it I've used 0777 for now but I strongly suggest that you secure those files unless you can have bad surprise (unwanted user that throw 2k pictures every day)
  11. Sorry I don't understand your question can you specify plz
  12. Yes it is possibleThere is a big discussion about should we or not but the easiest way of doing it is with the folder (for me as a newbie). You can store 100px * 100px .gif thumbnails in the database using longblob, it will transfer your picture into binary but then you will have to convert it into whatever format you want to show it.With the folder you can store the path of the picture or rename it and using the 'id' in your database table to get it back on your page.I hope that help you
  13. I forgot the = sign in between name and " Thank you for your help
  14. Ok it show me: array(0) {}How come? here is the form: <form name="form1" method="post" action="check_image.php" enctype="multipart/form-data"> <table border="0" cellpadding="5"> <tr> <td>Picture Title</td> <td><input name="image_caption" type="text" id="image_caption" size="55" maxlength="255"></td> </tr> <tr> <td>Your Username</td> <td><input name="image_username" type="text" id="image_username" size="15" maxlength="255"></td> </tr> <tr> <td>Upload Image</td> <td><input name"image_filename" type="file" id="image_filename"></td> </tr> </table> <br> <em>Acceptable image include: GIF, JPG/JPEG, and PNG.</em> <p align="center"> <input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Clear Form"> </p> </form> When submit doesn't it take the input name="" to define the $_POST or $_FILES ?
  15. thx for the codeit say: Undefined index: image_filename in... at the if statement line
  16. zip your file and it will download automaticaly when hit
  17. Matpatnik

    BBCodes

    Wow that's a very intresting link Obi1
  18. Ok I did fix it by modifying the code abit $today = date("Y-m-d");$i_username = $_POST['username'];$i_nname = $_POST['image_name'];$i_name = $_FILES['file']["name"];$i_type = $_FILES['file']["type"];$i_size = ($_FILES['file']["size"] / 1024);$i_tname = $_FILES['file']["tmp_name"];$i_error = $_FILES['file']["error"];$i_folder = "images/"; // image directory$i_dir = $i_folder . $i_name;if ($i_type == "image/gif") { $ext = ".gif";} else if ($i_type == "image/jpeg") { $ext = ".jpeg";} else if ($i_type == "image/png") { $ext = ".png";}if (($i_type == "image/gif")|| ($i_type == "image/jpeg")|| ($i_type == "image/png")&& ($i_size < 20000)) { if ($i_error > 0) { die("<span style=\"color:#FF0000\">Return Code: " . $i_error . "</span>"); } else { echo "Upload: " . $i_name . "<br />"; echo "Database picture name: " . $i_nname . "<BR>"; echo "Type: " . $i_type . "<br />"; echo "Size: " . round($i_size) . " Kb<br />"; echo "Temp file: " . $i_tname . "<br />"; if (file_exists($i_dir)) { die("<span style=\"color:#FF0000\">" . $i_name . " already exists. Change the name and try again</span>"); } else { move_uploaded_file($i_tname, $i_dir); echo "Stored in: " . $i_dir . "<br>"; and it work fine now but, I got this code which is smaller and cleaner // make variable available $image_caption = $_POST['image_caption']; $image_username = $_POST['image_username']; $image_tempname = $_FILES['image_filename']['name']; $today = date("Y-m-d"); // upload image and check for image type $ImageDir = "images/"; $ImageThumb = $ImageDir . "thumbs/"; $ImageName = $ImageDir . $image_tempname; if (move_uploaded_file($_FILES['image_filename']['tmp_name'], $ImageName)) { // get info about the image being uploaded list($width, $height, $type, $attr) = getimagesize($ImageName); My problem with this one it's not passing through the first if statement! It look like the same as the other one but shortened a bit more, isn't? I can't see why it dosen't work Any idea?
  19. You can use 1 colon for the month and 1 for the day from your database tableand assign the right variable to each colons SELECT $month_colon FROM $yourtable WHERE $month_colon <= 2 AND $month_colon = 12 I didn't test it but I think you are looking for something like that * I'm not sure if you can write <= side by side in the database query
  20. Hi guys,I'm trying to build an upload picture form somthing very simple for now.here is my code: <?php // connection to MySQL $connect = mysql_connect("localhost","****","****") or die ("Hey loser, check you connection."); // make sure we're using the right database mysql_select_db("****"); // make variable available $item_caption = $_POST['item_caption']; $image_username = $_POST['image_username']; $image_tempname = $_FILES['image_filename']['name']; $today = date("Y-m-d"); $imageDir = "images/"; if (($_FILES["file"]["type"] == "images/gif") || ($_FILES["file"]["type"] == "images/jpeg") && ($_FILES["file"]["size"] < 800000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists($imageDir . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], $imageDir . $_FILES["file"]["name"]); echo "Stored in: " . $imageDir . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } $ImageName = $imageDir . $image_tempname; // insert info into image table $insert = "INSERT INTO images (images_name, images_date) VALUES ('$item_caption', '$today')"; $insertresult = mysql_query($insert) or die(mysql_error()); $lastpicid = mysql_insert_id(); $newfilename = $imageDir . $lastpicid . $ext; rename($ImageName, $newfilename);?> and I get this error: Did I forgot something?
  21. Intresting but I'll stick only with php for now and I'll keep your suggestion in mind Thank you
  22. Thank you guys, I have an other question related to the date()How can I use the date() function so it check the hour of the browser insted of the hour of the server so the costumer will see the theme_switch without having to fill a form?
  23. Can you tell me what's wrong?It was working for few days and now my freind just updated some picture on the site and for some funny reason it stop working. <?php // beginning of switch_theme $theme_switch_hour = date(G); // look at the local time from 0 to 23 // if it's between 7 am and 8 pm show day else show night, if unknow show unknow if ($theme_switch_hour>=7 && $theme_switch_hour<20) { echo "this is the day"; } else if (($theme_switch_hour>=0 && $theme_switch_hour<7) or ($theme_switch_hour>=20 && $theme_switch_hour<23)) { echo "this is the night"; } else { echo "I don't know!"; } // ending of switch_theme?> But after he toke off the } else if (($theme_switch_hour>=0 && $theme_switch_hour<7) or ($theme_switch_hour>=20 && $theme_switch_hour<23)) { echo "this is the night"; to see if it still work (he think that part might be the problem) and now it work fine.Can someone can explain what happened?Why was it working until that time?Thank you for clearing this up for meMatpatnik
  24. I need to show those two variable but I don't want them to be able to modify it (they can modify the rest of the form).So if I understand, I just have to remplace } else { $_POST['picture_realname'] = $picture_realname; echo $picture_realname; } by } else { echo "<input type=\"hidden\" name=\"picture_name\" value=\"" . $picture_name . "\">" . $picture_realname; } Yeah, it make sence. I don't know why I didn't think about this earlier Thank you justsomeguy!
  25. I just added mine that's nice* It give me some idea for 1 of my website
×
×
  • Create New...