Jump to content

npsari

Members
  • Posts

    393
  • Joined

  • Last visited

Posts posted by npsari

  1. 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.

  2. 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 ?

  3. 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

     

  4. 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))   ; 
    
    
    }

  5. 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

  6. 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?

  7. 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' ");

  8. 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

  9. 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

  10. 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

     

  11. 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

×
×
  • 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.