Jump to content

antonyjohn

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Posts posted by antonyjohn

  1. function findexts ($filename)

    {

    $filename = strtolower($filename) ;

    $exts = split("[/\\.]", $filename) ;

    $n = count($exts)-1;

    $exts = $exts[$n];

    return $exts;

    }

     

    $ext = findexts ($_FILES['uploaded']['name']) ;

     

    $new = $_SESSION['LOGO'].".";

     

    $target = "logos/";

     

    $target = $target . $new.$ext;

    if ($ext=="gif" || $ext=="jpg" || $ext=="png"){

    if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))

    {

    ...stuff

    }

    }

     

     

    this code will allow u to upload pictures with file format gif, jpg,png

  2. hi,

     

      i have url which gives me the output in the form of a zip file by prompting me for a download.this file exits in a different server which i dont have access, i only know the url

     

    i have writen a code in CURL which helps me to retirve the results from my server. the code is as below

     

    <?

    function curlHeaderCallback($resURL, $strHeader) {

        if (preg_match('/^HTTP/i', $strHeader)) {

            header($strHeader);     

            header('Content-Disposition: attachment; filename="file-name.zip"');     

        }

        return strlen($strHeader);

    }

     

    $strURL = 'http://www.xyz.com/download_inventory_excel/AlpineCreationsFeed.asp?format=csv&item_type=1';

     

    $resURL = curl_init();

    curl_setopt($resURL, CURLOPT_URL, $strURL);

    curl_setopt($resURL, CURLOPT_BINARYTRANSFER, 1);

    curl_setopt($resURL, CURLOPT_HEADERFUNCTION, 'curlHeaderCallback');

    curl_setopt($resURL, CURLOPT_FAILONERROR, 1);

     

    curl_exec ($resURL);

     

    $intReturnCode = curl_getinfo($resURL, CURLINFO_HTTP_CODE);

    curl_close ($resURL);

    ?>

    it gives the desired results, but i dont want it to prompt me for download, i need it to save it to to location i assign.

     

  3. now i got this error::

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ';SELECT @rank := @rank +1 AS rank, fname, pointbalance FROM vs_u

  4. hi,

    i keep getting an error while executing the code below

     

    <?

    include("includes/db.php");

     

    $sql = "SET @rank=0; SELECT @rank := @rank +1 AS rank, fname, pointbalance FROM vs_userprofile ORDER BY pointbalance";

    $query = mysql_query($sql) or die(mysql_error("FAiled"));

    while($row = mysql_fetch_object($query))

    {

    echo "<br>".$rank = $row->rank;

        $name = $row->fname;

    }

     

    ?>

    the error i got is ::Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in /usr/local/www/sites/myofficerivalry/testrank.php on line 5

     

    i need to get the result like this

    +------+--------+--------+

    | rank | fruit  | amount |

    +------+--------+--------+

    |    1 | cherry |    124 |

    |    2 | plum  |    23 |

    |    3 | pear  |    19 |

    |    4 | apple  |    13 |

    |    5 | banana |      4 |

    |    6 | orange |      2 |

    +------+--------+--------+

     

    Plz help

  5.  

     

      how time comparison validation is done in javascript.

     

      suppose i have two textboxes...

     

      1st textbox takes the first time

     

    2rd textbox takes the second time.

     

    second time should be greater than the first time.. whether it may be AM/ PM

     

     

    plzzzzzzzzz help

  6.  

     

    hai ..

     

      have anyone heard about the snipe auction tool ...used for bidding in the ebay..

    does anyone have info regarding this plzzzzzzzz .....reply back

     

    how can it be implemented  to my website

       

  7.  

     

     

    hai friends..

     

          i have from trouble while retrieval data from the database for editing..

     

    i will give the table layout

     

    Subcateid        Categorid

          1                  5

          1                  6

          1                  7

          2                  8 

    while editing the subcategory linking with the category Withrespect to Subcateid = '1'

     

                in the Listbox these 3 values should come selected along with all the other category ids...

     

    plzzz help...

     

     

     

  8.  

     

     

    hai friends..

     

              i need to implement a concept in my website..

     

    will explain it to u now.

     

    a list of categories will be there with Link Next to it saying "Add to top 5 list".

    the add to top 5 list will be a Listbox, which should be populated each time user clicks on the "Add To Top 5 List, and should not populate more than 5 .....Should be done via ajax and php,no page loading should be done.

    Plzz.............help me out with some logic or any sample codes

  9. $db_host = "localhost";
    $db_name = "dinasteel";
    $db_user = "root";
    $db_pass = "zenith2255";
    
    mysql_connect($db_host,$db_user,$db_pass);
    mysql_select_db($db_name) or die("Unable to select database.");function datadump ($table) 
    {
    
        $result .= "# Dump of $table \n";
        $result .= "# Dump DATE : " . date("d-M-Y") ."\n\n";
    
        $query = mysql_query("select * from $table");
        $num_fields = mysql_num_fields($query);
        $numrow = mysql_num_rows($query);
    
        for ($i =0; $i<$numrow; $i++) 
    {
      $result .= "INSERT INTO ".$table." VALUES(";
        for($j=0; $j<$num_fields; $j++) {
        $row[$j] = addslashes($row[$j]);
        $row[$j] = ereg_replace("\n","\\n",$row[$j]);
        if (isset($row[$j])) $result .= "\"$row[$j]\"" ; else $result .= "\"\"";
        if ($j<($num_fields-1)) $result .= ",";
       }   
          $result .= ");\n";
         }
         return $result . "\n\n\n";
      }
    $dn_country         = datadump ("dn_country");
    $dn_payments        = datadump ("dn_payments");
    $dn_projecttracking = datadump ("dn_projecttracking");
    
    $content = $dn_country . $dn_payments . $dn_projecttracking;
    
    $file_name = "MySQL_Database_Backup.sql";
    Header("Content-type: application/octet-stream");
    Header("Content-Disposition: attachment; filename=$file_name");
    echo $content;
    exit;

     

     

    i have written this program to backup my database....the file is been downloaded....but with some problem

     

    when i open the text file ....the written like this.....INSERT INTO dn_country VALUES("","","");

     

     

    plzzzzzzzz help ...ver is the data

     

  10.  

     

    hai friends,

     

        i am trying to create a cookie for my site....have some problems. i heard that cookie is browser independent.....should i create two cookies for both IE and Mozilla.....

    i read that we can solve this problem by creating the cookie in javascript.

     

    Can a cookie created for one site, be accesed by its partner sites ,by accessing the cookies, there by showing the users preferred articles

     

     

    plzzzzzzzzzzzz help

  11.  

    I have a link on my html page.Onclicking the link a popup(not a popup window)is generated using ajax.The content of the popup is a php page.

    The issue is i need that php page to function like ordinary php page,ie i have some textboxes and a submit button.Onclicking the submit button,it should do the database operations as i have coded in that php page and the result should be shown in my popup page.Please suggest me a solution..

  12.  

    I need to display a popup window using ajax.The pop up window page is a  php page with php codes including submit buttons.On clicking submit it should perform the submit function just like ordinary php pages.Can anyone give me a solution?

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