Jump to content

merylvingien

Members
  • Posts

    267
  • Joined

  • Last visited

Everything posted by merylvingien

  1. http://developers.facebook.com/docs/reference/plugins/like
  2. Thanks the182guy, that was the problem,
  3. Thanks for the reply, ok the result from that is: Array ( [photo] => Array ( [name] => _MG_4145.jpg [type] => image/jpeg [tmp_name] => /tmp/phpUwG3fN [error] => 0 => 27055 ) ) It all looks ok to me...
  4. Thanks for that, i tried it, but when trying to upload a jpg image its still says not allowed. It wont even give me the jpg extension on the front of the error. requinix not sure how to impliment your answer.
  5. Thanks for the replies, but still no joy, no matter what i do, i cannot get the ext to echo out. Its like any image i try has no extension to it. Obviously missing something drastic here.
  6. Hi folks, just upgrading one of my sites with a new script which i thought i had working, well it did at least on my local server. Its an image upload script. It fails at the get image extension part, which when echoed out is blank. Which is why its failing. Can anyone see what i have missed? if($_POST){ $image =$_FILES["image"]["name"]; $img = $_FILES['image']['tmp_name']; $size = filesize($_FILES["image"]["tmp_name"]); $maxsize= 400; if(isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['CONTENT_LENGTH']>409600){ echo 'Upload FAILED, file is too large !'; exit(); } if ($size > $maxsize*1024){ echo "File too big"; exit(); } else { if(file_exists($existingimage)){ unlink($existingimage); } function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $extension = getExtension($image); $extension = strtolower($extension); if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) { echo "The extension is:" . $extension ." "; echo'Unknown Image extension'; exit(); } Ive ended the script here at the part where it fails to reduce the amount of uneeded code to sift through. It fails no matter what type of image is used to upload.
  7. For me personaly its still not hitting the mark. Maybe its just me and you could do with other peoples perspectives on it. Looking closely i can see the main content box needs to be redone as i can see jagged lines on the corners. I take it you like round boxes for everything? Round boxes is ok in moderation, but dont overdo it. Maybe do away with the round main content box and just have a couple of round ones within the content, or just have a round one as the main content. You see what i am getting at? Try a few different combinations and see where it goes. I am all for large font styles to a point, but i feel that yours are a bit in yer face. Could do with coming down a few points. Best advice i always think is to look a really big sites that have spent big money on design and research, then emulate to a point what they have spent thier money on.
  8. Just my opinion, thats all it is, cause i will give you my honest opinion... I dont like it. Its too cartoony and i feel that people will not take you seriously. I would revamp the site, choose some decent font styles and go with that. Try "lucida grande" as a font style, i think it would work well. Calm the logo down a bit too, less is more these days. If i didnt know better i would guess this was a site from the 90s.
  9. So once i have uploaded my image, then forgot the link, how do i get back where my image is stored? Looks flash, but the lack of usability will render your site un saleable...
  10. Are you discriminating against hampshire? I cant find Basingstoke, large city... Or Andover... Would be better to choose county first, then town. Much easier. But make sure your list of locations is comprehensive. I could sell you a full list of locations in the UK, along with the postcode prefixes if you like LOL
  11. I am just going through everything now, this is being done on my local server/computer rather than on a hosted server. I thought that may make a difference but i cant find any reference. I have echoed out the full path $userimage= $userid2['image']; $existingimage = "http://127.0.0.1/test/profileimage/$userimage"; if(file_exists($existingimage)){ unlink($existingimage); } else {echo"file doesnt exist $existingimage"; exit();} Then copied the path into a new window and the image is shown. Cant make any sense of it at all...
  12. Thanks for the reply BlueSkyIS, sorry bout the fellas thing You are correct, when i do a is_file() check it says that its not a file, how can this be? I have tried the full path as well!
  13. Hi fellas, i am wondering if someone can point me in the right direction? I have a simple upload script where users can upload thier profile picture, but if they want to change that picture i would like to delete the old one, to save space and time cleaning up the left overs. So, without further ado, i gather the info from the existing database: $existingimage = "/profileimage/". $userid2['image']; Then further on in the script when it comes time to add or update the image i have: if (!empty($existingimage)) {unlink($existingimage);} $insert= ("UPDATE userdatabase SET image='$finalname' WHERE user='$userid'"); mysql_query($insert); Only problem is, the unlink part dont work, the original image is still there! Any clues?
  14. I was doing this just yesterday. put this at the top: function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } Then replace: $target = "images/"; $target = $target . basename( $_FILES['photo']['name']); with: $extension = getExtension($pic); $extension = strtolower($extension); $randName = md5(rand() * time()); $target = "images/". $randName . "." . $extension;
  15. Actually its working fine, but as i was loading a file which was larger than the allowed size in the php.ini file, thats why the errors were throwing up. Researching how to prevent a larger than allowed file to be uploaded and prevent the errors to start with.
  16. Thanks for the reply, but still doesnt work, although the error messages have changed, i cant see why this wont work...
  17. Having an issue where a peice of code is just being ignored. <?php if($_POST){ $image =$_FILES["image"]["name"]; $img = $_FILES['image']['tmp_name']; $size= filesize($_FILES["image"]["name"]); $maxsize= 400; if ($size > $maxsize*1024){ echo "File too big"; exit(); } else { That is the first bit of code in the page, if i upload a image within the size allowance everything is ok, but if i try one which is a lot bigger, it ignore the if $size > statement and just continues on and throws a bunch of errors. Any ideas?
  18. Thanks for the reply, but i tried this but wont work unless the cookie is set. I have only ever worked with either cookies or sessions, never both! Seems impossible to get both to work together smoothly. Also for some reason, when i add this code to the top of the image upload file, it breaks the code, everything stops working correctly.... Headache!!!!
  19. Hi girls and boys I am trying to set a variable if a session OR a cookie has been set, but am unsure on how to write the statement... if (isset($_SESSION['name'])||isset($_COOKIE['name'])) {$variable = $_SESSION['name']||$_COOKIE['name'];} Obviously not working there, but just need a pointer here. any help is appreciated...
  20. Hi Fellas, having a bit of a brain freeze here, i am trying to set a max width or height for a uploaded image, but my brain has frozen, maybe its the cold weather lol list($width,$height)=getimagesize($uploadedfile); $newwidth=250; $newheight=($height/$width)*$newwidth; $tmp=imagecreatetruecolor($newwidth,$newheight); basicly i want to find the biggest size of an image, beit width or height then set that size to 250... Any pointers here?
  21. Hi folks, i have been playing with a script i downloaded from the net and have made some progress with it, however i have a couple of issues which i cannot figure out. There are two undefined variables which keep cropping up, and i cant figure out why or how to deal with it. <?php include('dbcon.php'); function checkValues($value) { $value = trim($value); if (get_magic_quotes_gpc()) { $value = stripslashes($value); } $value = strtr($value,array_flip(get_html_translation_table(HTML_ENTITIES))); $value = strip_tags($value); $value = mysql_real_escape_string($value); $value = htmlspecialchars ($value); return $value; } function clickable_link($text = '') { $text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $text); $ret = ' ' . $text; $ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret); $ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret); $ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret); $ret = substr($ret, 1); return $ret; } $next_records = 10; $show_more_button = 0; if(checkValues($_REQUEST['value'])) { $userip = $_SERVER['REMOTE_ADDR']; echo "INSERT INTO facebook_posts (post,f_name,userip,date_created) VALUES('".checkValues($_REQUEST['value'])."','99Points','".$userip."','".strtotime(date("Y-m-d H:i:s"))."')"; mysql_query("INSERT INTO facebook_posts (post,f_name,userip,date_created) VALUES('".checkValues($_REQUEST['value'])."','99Points','".$userip."','".strtotime(date("Y-m-d H:i:s"))."')"); $result = mysql_query("SELECT *, UNIX_TIMESTAMP() - date_created AS TimeSpent FROM facebook_posts order by p_id desc limit 1"); } } elseif($_REQUEST['show_more_post']) // more posting paging { i have highlighted the two variables which are showing as undefined. The javascript code (not complete script) which goes in hand with this script is: <script type="text/javascript"> // <![CDATA[ $(document).ready(function(){ $('#shareButton').click(function(){ var a = $("#watermark").val(); if(a != "What's on your mind?") { $.post("posts.php?value="+a, { }, function(response){ $('#posting').prepend($(response).fadeIn('slow')); $("#watermark").val("What's on your mind?"); }); } }); $('a.more_records').livequery("click", function(e){ var next = $(this).attr('id').replace('more_',''); $.post("posts.php?show_more_post="+next, { }, function(response){ $('#bottomMoreButton').remove(); $('#posting').append($(response).fadeIn('slow')); }); }); Does anyone have any idea on how or what i can do to stop these error messages appearing? Any help would be appreciated...
  22. Is this supposed to update info thats already in the database or add new info? insert into database will add another row update set will overwrite existing data
  23. If your just looking for a basic ajax search that shows the results as you type: Javascript: <script type="text/javascript"> function showResult(str) { if (str.length==0) { document.getElementById("livesearch").innerHTML=""; document.getElementById("livesearch").style.border="0px"; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("livesearch").innerHTML=xmlhttp.responseText; document.getElementById("livesearch").style.border="1px solid #A5ACB2"; } } xmlhttp.open("GET","livesearch.php?q="+str,true); xmlhttp.send(); } </script> html form: <form> <p>Search:<br> <input type="text" size="20" onkeyup="showResult(this.value)" /> </p> <div id="livesearch"></div> </form> livesearch.php: <?php include ("database connection"); $q=$_GET["q"]; $q = strip_tags($q); $q = mysql_real_escape_string($q); $sql="SELECT * FROM tablename WHERE `rowname` LIKE '%{$q}%' OR `rowname2` LIKE '%{$q}%' ORDER BY `rowname`"; $result = mysql_query($sql); if (mysql_num_rows($result) < 1) { $error[] = "No results found!"; }else { $results = array(); // the result array $i = 1; while ($row = mysql_fetch_assoc($result)) { $results[] = "{$i}:<br />{$row['rowname']}<br /><br />"; $i++; } } function removeEmpty($var) { return (!empty($var)); } if (empty($results)) {$output= implode("<br>", $error);} //$output= "No results found!"; elseif ($results > 0){$output = "<p>Your search term: <span id=\"high\">" . $q . "</span> returned:</p><p>" . implode("", $results) . "</p>"; } echo "$output"; ?> You will need to enter the relevant tablenames and database info etc, but this is a working code.
  24. I am doing just that! Buts its fooking expensive and painfull!
  25. If its a case of wanting to do this as a project to learn, then i have found this http://www.homeandlearn.co.uk/php/php.html site is a good start for learning from the ground up. There is also a basic forum where you can get the basics of how to start a project like this. If your just after a forum that you want to use straight away, as above!
×
×
  • 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.