Jump to content

watsmyname

Members
  • Posts

    226
  • Joined

  • Last visited

Posts posted by watsmyname

  1. Hello,

     

    Let me explain with an example.

    Lets say I have an Image of size

    960px X 668px

     

    I have a div which holds this image. The div size is
    154px X 75px

     

    This div can have any variable size.

     

    If we see that the aspect ratio of image and the aspect ratio of the div that holds image are different.

     

    All i need to do is Resize and Crop the Image in such a way that it takes maximum possible height and width  of the original size and also maintain the aspect ratio of the div that holds this image. I just need a logic to calculate a percentage that by how much DIV width and height should be multiplied so that the resulting size is closer to the image size but doesnot exceed the image size and also the aspect Ratio will be same as that of DIV but not of image..

    The motive to do this is that image exactly fits the div when scaled to div's size without stretching or disorting the image.

     

    Thanks

    watsmyname

  2. Hello,

     

    In wordpress admin, I have set permalinks, custom structure like this /%category%/%postname%/

     

    Now i m having problem. Everything is fine in firefox, a url link to a page [postname is in unicode character] shows fine in firefox.  but when site is browsed in Internet explorer the links which has unicode characters shows like

    http://www.mysite.com/news/international-news/%E0%A4%B9%E0%A4%99%E0%A4%95%E0%A4%99%E0%A4%AE%E0%A4%BE-%E0%A4%A8%E0%A5%87%E0%A4%AA%E0%A4%BE%E0%A4%B2%E0%A5%80-%E0%A4%97%E0%A4%A4%E0%A4%BF%E0%A4%AC%E0%A4%BF%E0%A4%A7%E0%A4%BF/
    

    Is it anyway to fix this in Internet explorer??

     

    Thanks

    watsmyname

     

  3. Hello,

     

    I had a website made with wordpress in one server...i transfered it to another server. Whenever i browse wp-admin I get 500 Internal server error. What i did to get it work to new server is -

    1. I changed path, edited database manually. Client side of Word Press site working fine.

    2. Permalinks was not working so i deleted manually from wp_options table.

    3. I deleted all .htaccess file in root and in wp-admin folder.

    4. i increased memory_limit to 64M.

    5. I disabled all plugins manually from database.

    But I still getting 500 internal server only in wordpress admin.

     

    Any help will be much appreciated

    Watsmyname

  4. Hello

     

    I had a query on salting passwords, i saw this thread so felt like posting here. I found this code somewhere in the internet and modified a bit. Just want to know how feasible is this code? (feasible in the sense of security).

     

    <?php
    function smhs($password,$algorithm="sha256"){
    $salt=sha1(md5($password));
    $hashedpassword=hash($algorithm,$salt.$password);
    return $hashedpassword;
    }
    
    echo smhs("mypassword");
    ?>
    

    thanks

  5. Hi

    <?php
    function sanitize($var,$sanitize='1')
    {
       //sanitizing
       $var = str_replace("\\","",$var);
       if($sanitize=='1')
       {
    	   if(function_exists("filter_var"))
    	   {
    		   $returnvar=filter_var($var, FILTER_SANITIZE_STRING);
    
    	   }else{
    		   $returnvar=$var;
    	   }
       }else{
    	  $returnvar=$var;
       }
       if(!get_magic_quotes_gpc()){
    	   $returnvar=addslashes($returnvar);
       }
       //using mysql reql escape string
       if(function_exists("mysql_real_escape_string"))
       {
    	   $returnvar=mysql_real_escape_string($returnvar);
       }else{
    	   $returnvar=addslashes($returnvar);
       }
      return $returnvar;
    }
    ?>
    

    You use function like this

    <?
    $name=santize($_POST["name"]);
    ?>
    

    Hope this helps

    watsmyname

  6. hi,

     

    use javascript timer to force download [if you dont know this search google] on particular amount of time. Mean time show the link "If your download doesnot start click here", which upon click user can manually download the song.

     

    For javascript timer, you call a function which loads php ajax page where you pass the file id and  use force download code, for javascript timing functions

    Click Here

  7. looking to have client quotes rotating on the sites' homepage.

     

    does he mean rotating in the sense one after another showing the quotes, or he actually meant rotation of the quotes clockwise or counter-clockwise. I think he meant it the first way and for this it can be done via javascript and php. I don't really need canvas of HTML 5 if he meant the first way.

  8. hi

    <?php
    $daytoadd="+1 day";
    $newdate=strtotime($daytoadd, strtotime(date("Y-m-d H:i:s")));
    $newdate= date ( 'Y-m-d H:i:s' , $newdate);
    ?>
    

    This will add 1 day to the current date and returns date in Y-m-d H:i:s format, 

    I hope this helps

  9. if(!empty($name) && !empty($username) && !empty($password) && !empty($password2) && !empty($email) && !empty($email2) && !empty($gender) && !empty($security) && !empty($adminpw))

     

    the code inside this IF statement executes only if none of these variables[$name,$username,etc] are empty. Try printing these variables to check if they are empty. i guess these are coming from form fields. So in this page check whether the fields are empty or not. Moreover, if you have not used extract function, you need to check the variables you've assigned to fetch the form variables[$name,$username,etc].

    <?php
    echo "<pre>";
    print_r($_POST); //if you have used GET method in form then use $_GET instead
    echo "</pre>";
    ?>
    

     

    MOREOVER, if you paste few lines of codes above and below that IF statement will help us debug it. Like code from

    <?php
    if(isset($_POST['submit']))
    {
    // your codes here
    } //end of checking $_POST["submit"]
    ?>
    

  10. well your process page doesnot redirects user to form.php with query string. Your process page should be

     

    <?php
    if (empty($b_addr)) { $b_addr_error = "Address is required"; $check_failed = TRUE;} 
    header("Location: form.php?b_addr_error=".$b_addr_error);
    ?>
    

    it is just a noob approach. It would be better you put errors in session and show them in form.php page upon redirection from process page

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