-
Posts
393 -
Joined
-
Last visited
Posts posted by npsari
-
-
Oops, thanks for telling me about file permissions, I will change it tommorow for sure. I am on my mobile now, cant check the code you given me Mabis, will work on it tommorow. Cheers for replies. If someone has a different way to do it, please share.
-
Hello! I have a small question...
I used to upload all my member's images in same directory, but now i've decided to put 1000 images in each directory
<?php $ID = $get_member_id_from_mySQL; if($ID >=0 AND $ID <=1000 ){ $directory_name='from0to1000'; } else if($ID >=1001 AND $ID <=2000 ){ $directory_name='from1001to2000'; } else if($ID >=2001 AND $ID <=3000 ){ $directory_name='from2001to3000'; } else if($ID >=3001 AND $ID <=4000 ){ $directory_name='from3001to4000'; } if(is_dir($directory_name)){ imagejpeg( $tmp_img, "{$directory_name}{$image_name}" ); }else{ mkdir("/path/to/my/$directory_name", 7777); imagejpeg( $tmp_img, "{$directory_name}{$image_name}" ); } ?>
Is there any simpler way to continue with the IF function? Because I can't do this until 1000000 ?
-
Hello
Sorry, what I meant is, do I have to upload the php script in same directory where the image will be uploaded
Because when i ask the script to upload the image 2 directories deep, it does not work
-
If I upload this script in /www/ads/insert/image/ it works fine
If I upload it in /www/ads/insert/ it does not work It says PHP could not open /new/ to upload image
<? $target_path = 'images/new/'; $image_name = 'myself.gif'; if( imagejpeg( $tmp_img, "{$target_path}{$image_name}" ) ){ print"image uploaded!"; } ?>
I think because PHP only allows to upload images 1 folder deep!!!
Why? How do I solve this? I want to create different folders for each group of images
-
Thank you very much
-
Hello,
This script is provided by Google maps. It uses the mileage between one place to another to another, then multiplies it by the price per mile, to give the Price of the journey.
The problem is, we charge 3 different prices: Normal Taxi, MPV and Van
<script src=" http://maps.google.com/?file=api&v=2.x&key=ABQIAAAAdvr5JYYnjJ7QwkL0rI8FrxRfZHv9OEd3Hnby8E72WEHGAekdchQJINHRmw2K9eqQkSsnVCfbH6xLYw" type="text/javascript"></script> <script src="http://www.deltacarstaxi.com/taxiscript/taxiquote.js"></script> <body bgcolor="ADCCE9" onload="initialize()" onunload="GUnload()"> <form action='#' onsubmit='setDirections(this.from.value, this.to.value, this.locale.value); return false'> <input type='hidden' id='locale' name='locale'> <input type='hidden' id='fromAddress' name='from' value='RH1 1BB'> <input type='hidden' id='toAddress' name='to' value='RH1 1BB'> </form> Price (Normal car) is: £<span id='costs1'> </span> </body>
So, at the moment, the result comes out like this:
Price (Normal car) is: £20
But I want 3 results like this:
Price (Normal car) is: £20
Price (MPV) is: £30
Price (Van) is: £40
Basically, the MPV is x1.5 the price
And the VAN is x2 the price
Please tell me how to change the script. Your help is needed. Thank you much.
Ohh, by the way, this is part of the script too:
var map; var gdir; var geocoder = null; var addressMarker; function initialize() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("map_canvas")); gdir = new GDirections(map, document.getElementById("directions")); GEvent.addListener(gdir, "load", onGDirectionsLoad); GEvent.addListener(gdir, "error", handleErrors); // change these values to your own base start and finish values. There must be values here to work. setDirections("Gatwick airport UK", "Crawley", "en_US"); } } function setDirections(fromAddress, toAddress, locale) { gdir.load("from: " + fromAddress + " to: " + toAddress, { "locale": locale }); } function handleErrors(){ if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS) alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code); else if (gdir.getStatus().code == G_GEO_SERVER_ERROR) alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code); else if (gdir.getStatus().code == G_GEO_MISSING_QUERY) alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code); // else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS) <--- Doc bug... this is either not defined, or Doc is wrong // alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + gdir.getStatus().code); else if (gdir.getStatus().code == G_GEO_BAD_KEY) alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code); else if (gdir.getStatus().code == G_GEO_BAD_REQUEST) alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code); else alert("An unknown error occurred."); } // the quote mechanism. change the miles*2.90 etc to your own mileage rates. This example has 3 zones under 150 miles, 150 - 250 miles and over 250 miles. You can add as many zones as you like by replicating the else if functions and setting you own bands. The 70.00 in the final band is the minimum price and you can change this to what ever minimum charge you have. function onGDirectionsLoad(){ var miles = gdir.getDistance().meters*0.000621371192237334; document.getElementById("costs1").innerHTML = (Math.round((miles*1.3+3)).toFixed(2)) ; }
-
Monkeh, I am sorry, I did not see your previous script.
I just saw the words.
Thank you much.
Yes, it works now.
Good job friend.
-
Thank you for the replies...
I just want to echo $get_first_number, and when I do, it should give me 32
function extract_numbers($string) { preg_match_all('/([\d]+)/', $string, $match); return $match[0]; } $string = '32hello42good32morning';
Untill now, I have the above script... What happens after that? Can you complete it so $get_first_number will print 32
-
Hello,
This script is useful. It extracts the numbers.
I am trying to echo the first number only!
<?php function extract_numbers($string) { preg_match_all('/([\d]+)/', $string, $match); return $match[0]; } $string = '32hello42good32morning'; $numbers_array = extract_numbers($string); echo '<pre>'; print_r($numbers_array); echo "</pre>"; $get_first_number = $array["$numbers_array"][0]; echo "$get_first_number"; ?>
$get_first_number is not showing
$get_first_number should be 32
Can you please fix the script for me?
-
Hello all,
I have a mySQL table which is called 'data'
I want to empty this table once everyday
I want to empty it when my server time is 00:00
But the problem is, I am sleeping at this time
How can I run a PHP script which will do it for me while I am sleeping
I dont want to wake up and do it manually :-\
I want a PHP script which will do it when the server times hits 00:00 (or a new date)
Can you help me
mysql_query("DELETE FROM data WHERE data_id>'0' ");
-
Hello there,
I am not sure what are they called, I think they are called Robots or Bots!
Anyway, I have a page which is full of links
I want a Robot (or a Script i guess) which will click on each link in that page 10 times!
I don't want to click on them manually, because it will take alot of time
I want something which will do it for me
How can I do that please? Any information will be helpful, thank you
-
I wish you good luck friend. There is a huge competition out there
You took the first step, great
-
haha, 'Do me'
wow, thanks for the info about the forums
I will work to make it more clean
I will also remove the bad topics
Thank you guys
-
Another thing, the forums were cluttered beyond belief.
hmm, I feel that the forums are nice and tidy
Where is the cluttered bit ?
-
Yes, you are right MrAdam, I know what you mean, because the other sites are already famous, so no need to spend time on fixing. Got you
-
Thank you friends,
I came to realize that... As more silly & crowded a site looks, as more people will register!
However, I am trying to make my website easy to use and understand anyway.
Ohh, to be honest, I dont care much about that validation service from w3.org. Is that wrong?
Because when I type famous sites like ebay.com or Google.com, I still get loads of errors there
In fact, my website gives me less errors compared to them famous sites
-
Hello there,
I changed the design of my website, please tell me your first impression, if you like it or not
And is it easy to understand?
Here is the link: http://www.yavrim.com
Thank you much
-
wow , this is all I can say
You are an expert friend
-
Hello there,
I have this simple Javascript which works great...
<div id="container"> <div class="event"> <div class="eventtitle"> <p><a href="javascript://">OpenClose</a></p> </div> <div class="eventbody"> Content goes here. </div> </div> </div> <script type="text/javascript"> var wrap = document.getElementById('container'), divs = wrap.getElementsByTagName('div'); for (var i=0; i<divs.length; i++) if (/\beventtitle\b/gi.test(divs[i].className)) divs[i].getElementsByTagName('a')[0].onclick = showHide; function showHide() { var p = this.parentNode.parentNode, div = p.nextSibling; while (div.nodeType != 1) div = div.nextSibling; div.style.display = (div.style.display == 'none') ? 'block' : 'none'; } </script>
The only problem is, when the page is loaded, the div area is already expanded.
Can you please change my code so the div area will be collapsed by default?
Thank you
-
Hello there,
Do you have a website? If yes, I am interested to advertise with you
If you can display my mini banner (or a normal link) somewhere in your site, that will be great
The price i can pay is $10/month, but please, your site must get at least 10,000 uniques/month
My banner is very tiny or it can be just a link
It will be really nice to advertise with your site
Contact me asap, I am ready
Thank you
-
You can use Javascript if you prefer, however, PHP is better for me, because I can do more with it
Or you can use both
-
Lets assume the Image field is called Image1 ...
$original_image_name = basename( $_FILES['Image1']['name']); $new_image_name = str_replace(' ', '_', $original_image_name);
If you are asking about the code which uploads the image to your server, then, thats another topic
-
I have a veru easy script which will find the most comon numbers in an array
Then, it will echo them in order
If you are after this type of come, let me know so I can find it for you
I think it is somewhere in my files
-
lol, well, I personally prefer Microsoft browser
By the way, I think you better ask this question in PHP forums
Sorry I am not of more of help
Remove ' mark in php
in PHP Coding Help
Posted
Im trying to rermove ' symbol from a string.
give errors
How else could i do this?