Jump to content

phillips321

Members
  • Posts

    44
  • Joined

  • Last visited

    Never

Everything posted by phillips321

  1. Hi guys, Many people are now buying mobile phone data plans. I've got one myself but have noticed that there are a fair amount of locked outbound ports. (And that i've also not got a WAN IP). I know there are lots of sites that try to connect back to your ip to see which ports are open(inbound) but are there any sites that check outbound ports? For example i know that some network operators block outbound ports to services like skype and msn. It would be nice to have a quick app that checked to see what outbound ports are blocked and list them. Anyone know of such a tool? If there isn't one available what way would you look into coding it?
  2. sorted, cheers teng84, that was enough to allow me to hack something that works. The JS --> function textchange(newtext){ document.getElementById('textarea').innerHTML=newtext } and the HTML --> <span class="pictext" id="textarea">BEFORE</span> <img src="image.jpg" onmouseover="textchange('AFTER)"> many thanks (p.s. sorry to admin, didn't realise there was a JS forum, my bad)
  3. Hi guys, I know this is a php forum, my site is built using php but i need to do a part of it using JavaScript. I currently have a picture system where there is a main image and lots of thumbs, when one of the thumbs has the mouse cursor hover over it the main image change to the large version of the thumb, all works fine. What i need to do now is create text for each image, when the image is hovered on the main image changes to replicate the thumb as well as text that relates to the photo. Here is the Javascript part: <script type="text/javascript" language="JavaScript"> <!-- function swapImage() { //v3.0 var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } function preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.p) d.p=new Array(); var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}} } function findObj(n, d) { //v4.0 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document); if(!x && document.getElementById) x=document.getElementById(n); return x; } function swapImage() { //v3.0 var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } function swapImgRestore() { //v3.0 var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } preloadImages('pics/normal/I_made_smart_paving_2.jpg','pics/normal/I_instal_automatic_gate_2.jpg','pics/normal/pics/normal/pics/normal/I_made_painting_and_decorating2.jpg','pics/normal/I_made_smart_paving_3.jpg','pics/normal/I_install_automatic_gate.jpg','pics/normal/I_made_painting_and_decorating3.jpg','pics/normal/I_made_smart_paving_4.jpg','pics/normal/I_install_gate.jpg','pics/normal/I_made_painting_and_decorating.jpg','pics/normal/I_made_smart_paving.jpg','pics/normal/I_install_railings.jpg','pics/normal/I_made_paving_and_lighting_1.jpg','pics/normal/I_made_timber_faced_vegetable_beds_and_gravel_paths.jpg','pics/normal/I_instal_railings.jpg','pics/normal/I_made_paving_and_lighting_2.jpg','pics/normal/I_repair_brick_walls_2.jpg','pics/normal/I_made_natural_stone_walling_1.jpg','pics/normal/I_made_paving_and_lighting_3.jpg','pics/normal/I_repair_brick_walls.jpg','pics/normal/I_made_natural_stone_walling_2.jpg','pics/normal/I_made_paving_and_lighting_4.jpg','pics/normal/I_repair_steps_2.jpg','pics/normal/I_made_natural_stone_walling_3.jpg','pics/normal/I_made_paving_and_lighting.jpg','pics/normal/I_repair_steps.jpg','pics/normal/I_made_natural_stone_walling_4.jpg','pics/normal/I_made_Paving_natural_stone_gravel.jpg','pics/normal/I_made_natural_stone_walling_5.jpg','pics/normal/I_made_Paving_natural_stones_2.jpg','pics/normal/house_before.jpg'); //--> </script> And here is the HTML that uses it: <img src="default.jpg" name="large_pic"> <img src="A_small.jpg" onmouseover="swapImage('large_pic','','A.jpg',1)"> <img src="B_small.jpg" onmouseover="swapImage('large_pic','','B.jpg',1)"> <img src="C_small.jpg" onmouseover="swapImage('large_pic','','C.jpg',1)"> <img src="D_small.jpg" onmouseover="swapImage('large_pic','','D.jpg',1)"> Any one with any ideas? I was thinking of createing a form with a lable and that text in that just changes. Would that work? Sorry for not being a php question but this code is based inside a php script Cheers in advance
  4. Hi guys, I'm looking for a php script that i can use to read the contents of an apache access log file and then display this to the user. The sort of thing im looking for needs to be like http://www.mrunix.net/webalizer/ or http://www.hping.org/visitors/. Any ideas guys?
  5. Hi guys, I have made some modifications to my picture hosting site. Please will you guys test it and advise things that you (dis)like, and also any more ideas or things you think i should consider changing/adding. http://www.forumpix.co.uk Many thanks
  6. the preg_match("/\d{10}/",$_POST['I']) line doesn't work at all (it wont execute the true if block of code) if i remove it from the if variables i can produce the following issue: by using the address line "www.domain.tld/image.php?I=../test.jpg" i can browse up a directory from the uploads folder any ideas on howto secure it? <?php $image = $_GET['I']; if (isset($image)){ echo '<IMG src="/uploads/'.$image.'.jpg">'; } else{ echo '<IMG src="error.jpg">'; } ?>
  7. just checked and it should be "_GET" not "_POST", working fine now, Cheers for your help
  8. For some reason the following block of code doesn't work(extra crap stripped out) <html> <head> <title>ForumPix.co.uk - Upload your pictures for free and host them anywhere!</title> </head> <body> <?php $filename = $_POST['I']; echo $filename; echo '<IMG src="/uploads/'.$filename.'.jpg">'; ?> </center> </body> </html> the output is a blank page with an image box that points to "http://www.forumpix.co.uk/uploads/.jpg" even the echo $filename; line doesnt output anything so i guess there is a fault with getting from address line? P.s. address line tested was "http://www.forumpix.co.uk/image_test.php?I=00000003", i have confirmed that the image /uploads/00000003.jpg exists
  9. i need to make sure that a user doesn't enter "image.php?I=../../../../" or I=[user code here] the image name will only ever be in a unix time format, no letters or special characters
  10. what do these commands do? ob_start(); ob_clean(); there doesn't seem to be any verification/validation on the $_POST['I']
  11. Hi guys, I have images stored in the directory "/uploads/*********.jpg" Rather than link directly to the image i would much rather be able to display the image on a webpage with some other html, i.e. www.example.com/image.php?i=****** I'm pretty sure i could easily write this code but how do i go about securing the image variable passed to the server in the address field? i wouldn't want the user to change the 'i' value to something like "../../../home/user/" All of the names of the images are stored using a unix time stamp, e.g. 1195208745.jpg, 1195202879.jpg Any idea on what im trying to achieve guys? Many thanks Sorry for any typos etc.. it's too early in the morning and i'm shattered
  12. i place this script in my image directory, it simply displays a random image: <?php $files = array(); $i = -1; // Initialize some variables $handle = opendir('./'); while (false !== ($file = readdir($handle))) { if (preg_match('/\.'.'jpg'.'$/i', $file, $test)) { // faster than ereg, case insensitive $files[] = $file; // it's good ++$i; } } closedir($handle); // We're not using it anymore mt_srand((double)microtime()*1000000); // seed for PHP < 4.2 $rand = mt_rand(0, $i); // $i was incremented as we went along header('Location: '.$folder.$files[$rand]); // Voila! ?>
  13. i thort about the use of time() and did realise the 1sec problem, i'm going to implement the naming a little better to improve. im still unsure how to validate the cookie value of 'lastimage' the value last image should only be "", "noimage" or a number any ideas?
  14. Thanks for the help on this. $lastimage is simply the output of time() so is only a number setcookie('lastimage',$image_number,time()+(60*60*24*365)); how do i make sure that when the lastimage cookie is read in that only valid numbers are allowed? and things like "../../directory/directory/img.jpg" are not allowed? cheers
  15. Hi guys, my website www.forumpix.co.uk is working pretty well so far. The main idea of the site is that you can upload images to host on forums (test it here if you want). Once you have uploaded your first image you shouldn't have to type in the verification code again (stores a cookie) If you revisit the site it should show you your most recent uploaded image (uses a cookie), you can also then turn off this option by clicking the link under the last uploaded image. Any chance you guys can see if it can be broken for me? Cheers Matt
  16. magic, cheers guys it's very late here in england (4am), sorry for forgetting the ";" thanks to all those that helped
  17. DOH!!!! ; fixed it any chance you can test it by uploading an image, then re-visiting the site, your image should be displayed, click the link under the image and it should get rid of it
  18. <?php setcookie('lastimage','noimage',time()+(60*60*24*365)) header("HTTP/1.1 301 Moved Permanently"); header("Location: http://phillips321.getmyip.com/testing.php"); ?> still no joy Parse error: syntax error, unexpected T_STRING in /media/data/forumpix.co.uk/noimage.php on line 3
  19. still not fixed Parse error: syntax error, unexpected T_STRING in /media/data/forumpix.co.uk/noimage.php on line 3 <?php header("HTTP/1.1 301 Moved Permanently")); header("Location: http://phillips321.getmyip.com/"); ?>
  20. no joy, just tried single quotes. I know that the following code works but i need to set the cookie first <?php header("HTTP/1.1 301 Moved Permanently"); header("Location: http://phillips321.getmyip.com/"); ?>
  21. Just tried noimage.php <?php setcookie('lastimage','noimage',time()+(60*60*24*365) header("Location: http://phillips321.getmyip.com/testing.php"); ?> and this as my link echo '<font size ="2"><a href="noimage.php">Click here to not display previous image</a></font><BR><BR>'; didn't work, out put was Parse error: syntax error, unexpected T_STRING in /media/data/forumpix.co.uk/noimage.php on line 3
  22. Hi guys, My picture upload site shows the users last uploaded image. Underneath the image i would like to have a link that would set the cookie='noimage' if they clicked it, thus they would never see the last image they displayed. So basically i want to run this linewhen the linked is clicked on and then reload index.php setcookie('lastimage','noimage',time()+(60*60*24*365)); i guess i could create a file named noimage.php with the command in, but then once the command has run how do i redirect back to index.php? cheers guys. P.s. here's the full code: <?php //----------------------------------------- // User defined variables //----------------------------------------- $logpath = 'log.php'; //sets location of the log file $resize = '1000'; //sets max width or height of image $url = 'http://forumpix.getmyip.com'; //url of site (dont not include trainling "/") $quality = '85'; //user sets quality of jpg image //----------------------------------------- // Proces flags //----------------------------------------- $fail = '0'; $img_resized = '0'; //----------------------------------------- // Create the new image name and path //----------------------------------------- $image_name = time().'.jpg'; $path = 'uploads/'.$image_name; //create a new filename $webpath = $url.'/'.$path; //generate path to new photo //----------------------------------------- //Gets some upload image properties //----------------------------------------- $size = $_FILES['upload']['size']; $type = $_FILES['upload']['type']; $name = $_FILES['upload']['tmp_name']; //----------------------------------------- // Checks for errors on upload //----------------------------------------- if ($_POST['tac'] == 1){$tac = 1;} else {$tac = 0;} if ($name != UPLOAD_ERR_OK){$fail = 'Error uploading file!';} //checks for upload error if ($size == 0){$fail = 'Error: uploaded file is empty or incompatible!';} //file size check if ($size > '2048000') {$fail = 'File was too big - please upload one smaller than 2048KB.';} //checks uploaded file size if ($tac == 0){$fail = 'Please remember to accept the terms&conditons';} //----------------------------------------- // Variable tests //----------------------------------------- //echo '<BR>type = '.$type; //echo '<BR>size = '.$size; //echo '<BR>name = '.$name; //echo '<BR>tac = '.$tac; //----------------------------------------- // Creates an image using the uploaded file // after checking the filetype is correct //----------------------------------------- if($fail == '0'){ if(@getimagesize($name)){ if ($type == 'image/jpeg' || $type == 'image/pjpeg' || $type == 'image/pjpg' || $type == 'image/jpg') {$img = imagecreatefromjpeg($name);} elseif ($type == 'image/gif') {$img = imagecreatefromgif($name);} elseif ($type == 'image/png') {$img = imagecreatefrompng($name);} else {$fail = 'Incorrect file type, please upload either: JPG, GIF or PNG';} if(!$img){$fail = 'Incorrect file type, please upload either: JPG, GIF or PNG';} } else{$fail = 'Incorrect file type, please upload either: JPG, GIF or PNG';} } if ($fail != '0'){} else { //----------------------------------------- // Get image width and height //----------------------------------------- $iwidth = imagesx($img); $iheight = imagesy($img); //----------------------------------------- //Shrink image size if larger than 1000x1000 //----------------------------------------- if($iwidth > $resize || $iheight > $resize){ $img_resized = '1'; if($iwidth>$iheight){ $tmp_iwidth= $resize; //set width of new size $tmp_iheight = $iheight * ($tmp_iwidth/$iwidth); //create height based on width maintaining aspect ratio } else{ $tmp_iheight= $resize; //set width of new size $tmp_iwidth = $iwidth * ($tmp_iheight/$iheight); //create width based on height maintaining aspect ratio } $tmp_resized = imagecreatetruecolor($tmp_iwidth, $tmp_iheight); //create new images with resized dimentions imagecopyresampled($tmp_resized, $img, 0, 0, 0, 0, $tmp_iwidth,$tmp_iheight, $iwidth, $iheight); //resample image to new size $img = $tmp_resized; //set resampled image back to $img $iwidth= imagesx($img); //get image width $iheight= imagesy($img); //get image height } //----------------------------------------- // Define colours of overlay //----------------------------------------- $white = imagecolorallocate($img, 255, 255, 255); $orange = imagecolorallocate($img, 255, 102, 0); $grey = imagecolorallocate($img, 45, 45, 45); //----------------------------------------- // Define the text to overlay //----------------------------------------- $text = ' ForumPix.co.uk ForumPix.co.uk ForumPix.co.uk ForumPix.co.uk ForumPix.co.uk ForumPix.co.uk ForumPix.co.uk ForumPix.co.uk ForumPix.co.uk ForumPix.co.uk'; $font = '/media/data/forumpix.co.uk/FreeSansBold.ttf'; //define the font imagealphablending($img, true); //----------------------------------------- // Apply overlay text to the image //----------------------------------------- if ($fail == '0'){ imagettftext($img, 10, 0, 4, 9, $grey, $font, $text); //top imagettftext($img, 10, 0, 4, 11, $grey, $font, $text); imagettftext($img, 10, 0, 6, 9, $grey, $font, $text); imagettftext($img, 10, 0, 6, 11, $grey, $font, $text); imagettftext($img, 10, 0, 5, 10, $orange, $font, $text); //main part of font imagettftext($img, 10, 0, 4, $iheight-'2', $grey, $font, $text); //bottom imagettftext($img, 10, 0, 4, $iheight, $grey, $font, $text); imagettftext($img, 10, 0, 6, $iheight-'2', $grey, $font, $text); imagettftext($img, 10, 0, 6, $iheight, $grey, $font, $text); imagettftext($img, 10, 0, 5, $iheight-'1', $orange, $font, $text);//main part of font imagettftext($img, 10, 90, 11, $iheight+'6', $grey, $font, $text); //left imagettftext($img, 10, 90, 11, $iheight+'4', $grey, $font, $text); imagettftext($img, 10, 90, 9, $iheight+'6', $grey, $font, $text); imagettftext($img, 10, 90, 9, $iheight+'4', $grey, $font, $text); imagettftext($img, 10, 90, 10, $iheight+'5', $orange, $font, $text);//main part of font imagettftext($img, 10, 90, $iwidth-'2', $iheight-'4', $grey, $font, $text); //right imagettftext($img, 10, 90, $iwidth-'2', $iheight-'6', $grey, $font, $text); imagettftext($img, 10, 90, $iwidth, $iheight-'4', $grey, $font, $text); imagettftext($img, 10, 90, $iwidth, $iheight-'6', $grey, $font, $text); imagettftext($img, 10, 90, $iwidth-'1', $iheight-'5', $orange, $font, $text);//main part of font } //----------------------------------------- // Create the new image //----------------------------------------- if(!imagejpeg($img, $path, $quality)) {$fail = 'Unable to write a new JPEG. Contact the administrator.';} else { //----------------------------------------- // Get IP of client and write it to log //----------------------------------------- $ip= $_SERVER['REMOTE_ADDR']; //remote IP address $logoutput = "\r\n".$image_name." --> ".$ip; //new data for log file $logfile = fopen($logpath, a); //open log file in append mode fwrite($logfile, $logoutput); //add new data to log file fclose($logfile); //close log file } imagedestroy($img); //Get rid of our temporary file... setcookie('lastimage',$image_name,time()+(60*60*24*365)); } //----------------------------------------- // Retrieve last upload and store next //----------------------------------------- $lastimage = $_COOKIE['lastimage']; ?> <html> <head> <title>ForumPix Uploader</title> <SCRIPT TYPE="text/javascript"> <!-- function popup(mylink, windowname){ if (! window.focus)return true; var href; if (typeof(mylink) == 'string') href=mylink; else href=mylink.href; window.open(href, windowname, 'width=440,height=365,scrollbars=auto'); return false; } //--> </SCRIPT> <STYLE type="text/css"> <!-- A {text-decoration:none} --> </STYLE> </head> <body background="background.gif" TEXT="#FFFFFF" LINK="FF6600" VLINK="FF6600"> <!--Changed theme to personalise--> <center> <A HREF="http://www.forumpix.co.uk" STYLE="text-decoration: none"> <PRE STYLE="font-size: 70%;"> __ _ _ / _| (_) | | | |_ ___ _ __ _ _ _ __ ___ _ __ ___ __ ___ ___ _ _| | __ | _/ _ \| '__| | | | '_ ` _ \| '_ \| \ \/ / / __/ _ \ | | | | |/ / | || (_) | | | |_| | | | | | | |_) | |> < _ | (_| (_) | _ | |_| | < |_| \___/|_| \__,_|_| |_| |_| .__/|_/_/\_\ (_) \___\___/ (_) \__,_|_|\_\ | | |_| </PRE> </A> <?php if (!$fail=='0') { //failure during script so output UPLOAD FAILED if ($lastimage != ''){ echo '<font size="6">Previous image...</font><BR>'; echo '<font size ="2">Copy and paste the below link into your message on a forum</font><BR>'; echo '<input type="text" id="text" style="background-color: 2D2D2D;color: FF6600; border:0px;" name="thetext" onClick="this.focus();this.select();" size="32" value=\'[url=http://www.forumpix.co.uk][img='.$url.'/uploads/'.$lastimage.'][/url]\'>'; echo '<BR><a href="'.$url.'/uploads/'.$lastimage.'"><img src="'.$url.'/uploads/'.$lastimage.'" width="210" border="0"></a><BR>'; echo '<font size ="2"><a href="index.php?cookies=0">Click here to not display previous image</a></font><BR><BR>'; echo '<font size ="2">Upload a new image below. </font>'; } else{ echo '<font size="6">File Upload...</font><BR>'; } echo '<font size="2">'.$fail.'</font><BR>'; } else{ //----------------------------------------- // Create HTML output after upload success //----------------------------------------- echo '<font size="6">Upload Sucess!</font><BR>'; echo '<font size ="2">Copy and paste the below link into your message on a forum</font><BR>'; echo '<input type="text" id="text" style="background-color: 2D2D2D;color: FF6600; border:0px;" name="thetext" onClick="this.focus();this.select();" size="64" value=\'[url=http://www.forumpix.co.uk][img='.$webpath.'][/url]\'>'; echo '<BR><a href="'.$webpath.'"><img src="'.$webpath.'" width="400" border="0"></a><BR>'; //displays uploaded image to the user if ($img_resized == "1"){echo '<font size="1">Image resized to='.$iwidth.'x'.$iheight.'<BR></font>';} //show new dimentions echo '<font size ="2"><BR>Feel free to upload another if you\'d like...</font><BR>'; } ?> <form enctype="multipart/form-data" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="4096000"/> <font size="2">Your image:</font><input name="upload" style="background-color: 2D2D2D;color: FF6600;" type="file"> <font size="1"> <A HREF="TandCs.html" onClick="return popup(this, 'notes')">Accept T&Cs:</A> </font> <input type="checkbox" style="background-color: 2D2D2D;color: FF6600;" name="tac" value="1" /> <input type="submit" value="Upload!"> </form> <font size="2">----- <A HREF="help.html" onClick="return popup(this, 'notes')">Help</A> -- <A HREF="mailto:contact@forumpix.co.uk">Contact Us</A> -- <A HREF="faqs.html" onClick="return popup(this, 'notes')">FAQs</A> -- <A HREF="abuse.html" onClick="return popup(this, 'notes')">Abuse</A> -- <A HREF="about.html" onClick="return popup(this, 'notes')">About</A> -- <A HREF="uploads/random.php" onClick="return popup(this, 'notes')">Random image</A> ----- </font> </center> </body> </html>
  23. Hi guys. For some reason my friends couldn't upload files to my site. Seemed very odd to me even tho i could upload the same files. I decided to echo the $variables so i could see where there was an error. The image file type was coming back as "image/pjpeg", what is this? Initially i only had image/jpeg, image/gif and image/png, i've now had to add image/pjpeg, seems like IE does this. My code now consists of the following, are there anymore that i need to know about? if($fail == '0'){ if(@getimagesize($name)){ if ($type == 'image/jpeg' || $type == 'image/pjpeg' || $type == 'image/pjpg' || $type == 'image/jpg') {$img = imagecreatefromjpeg($name);} elseif ($type == 'image/gif') {$img = imagecreatefromgif($name);} elseif ($type == 'image/png') {$img = imagecreatefrompng($name);} else {$fail = 'Incorrect file type, please upload either: JPG, GIF or PNG';} if(!$img){$fail = 'Incorrect file type, please upload either: JPG, GIF or PNG';} } else{$fail = 'Incorrect file type, please upload either: JPG, GIF or PNG'; } }
  24. can anyone get me pointed into the right direction?
×
×
  • 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.