Jump to content

micah1701

Members
  • Posts

    613
  • Joined

  • Last visited

Posts posted by micah1701

  1. good thinking... I'm getting two warnings:

     

    Warning: file() [function.file]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /path/to/my/file.php line #

     

    and

     

    Warning: file(http://www.google.com/) [function.file]: failed to open stream: Resource temporarily unavailable in /path/to/my/file.php line #

     

    guess I'll go google those; maybe someone here can respond back in the meantime with a good interpretation.

  2. thanks for once again padding your post count while giving absolutely no help whatsoever.  I realize this is a PHP forum but it seem'd like a fairly simple question and I thought someone could help - since I've received and given much help through this site in the past.

     

     

  3. I know how to do simple redirects with .htaccess but I have a slightly more complicated problem.

     

    I have a several different pages of code from a client.  Each page includes() other pages of code but those urls are coded coded into the application.

     

    example:

    <?php include_once($_SERVER['DOCUMENT_ROOT'].'/clients_subfolder/another_folder/some_php_code.php'); ?>

     

    I need to work on this code on my own server but am running my scripts, for obvious reasons, in a differnt folder path.

     

    Is there an easy way using .htaccess to "trick" all the existing code to look for the include files using my existing structure, instead of what's harded coded?

     

    ie, the page /my/site/index.php looks to include the previously show file but the file really resides at /my/site/some_php_code.php

     

    thanks!

  4. here's what'd i do though.

     

    1) explode() the query string into individual words.

    2) remove common words like ("the," "what," "when," "is," "a," etc...) from your array using preg_match or eregi

    3) build a query that will check through your table for questions that contain each word: LIKE '% $word %'

    4) ta-da - show the results to the user.

  5. the or die is only for error handling.  you can take it out once you've solved the problem.

     

    if you leave it in, if there is an error with the query it will break your page.  (probably a bad thing)

     

    also, if someone does attempt a sql-injection, allowing them to see the error in your die() statement will just help them figure out how to improve their injection attack.  I vote take it out.

     

  6. it doesn't seem to like the value of $champion

     

    two things

    1) add single 'quotes' to the $comp var (unless the value is an integer):

    $champion=mysql_query("SELECT * FROM competitions WHERE comp_name = '$comp' ");

     

    2) check for errors in your sql statement:

    $champion=mysql_query("SELECT * FROM competitions WHERE comp_name = '$comp' ") or die(mysql_error() );

  7. your subject line says "remote file" but your message say's "remote site" which is it?

     

    the first one is easy, the latter is a bit trickier as cross-site-scripting is difficult if you don't administer the second site.  your best bet then is screen-scraping.

     

    what exactly are you trying to do?

  8. I re-read your post like 4 time and am still not sure what you're asking.

     

    are you asking how to get the "sponsor type" from your table by passing it the sponsor type code?

     

    if so, in this line:

    $st = "Select * from sponsor_type where 'sponsor_type_code' = '$sponsor_type_code'";

     

    just select the specific column (presumably named sponsor_type) instead of selecting *

     

    $st = "Select sponsor_type from sponsor_type where 'sponsor_type_code' = '$sponsor_type_code'";

     

     

    if not, could you maybe try to re-explain what the issue is?

  9. try "application/octet-stream" instead of "application/msword"

     

    if that doesn't do it, read up on the different MIME types for word docs, you'll find your answer

     

     

    EDIT:  Also, try sticking something like:  echo  $JobCV_Mime_Type; into your code and upload a file you know to be a word doc then see what specific mime type is echoed out.  That'll help diagnose the problem.

  10. or you could get all complicated and do something like:

     

    <?php
    $n = 3.3912;
    $rounded = round($n,3); //shorten to 3 decimal places
    $parts = explode(".",$rounded); 
    $decimal = $parts[1];  // = 391
    $divided = round($decimal/ 125);   // = 3
    $new_decimal = $divided * .125;  // = 0.375
    $n = $parts[0] + $new_decimal;  // = 3.375
    echo $n;
    ?>

  11. again, your quotes in the HTML are partially to blame, try:

    <?php //.....
    echo "<tr><td>$row[Artist]</td><td>$row[Album] </td><td>$row[Price]</td><td>$row[ProductDesc]</td><td><img src=$row[image] /><td><a href=\"cart.php?ProductId=$row[ProductId]\">Add Item</a></td>
    </tr>\n";
    
    //.... ?>

     

    I moved the " in your <a> tag to after the href=  and then I \escaped it so it would screw up the quote marks that your echo statement is in

  12. for starters, your HTML has the "quotes" in the wrong place, and your PHP is not in between PHP tags.

     

    you need something like:

     

    <td><a href="cart.php?ProductId=<?php echo $row[ProductId]; ?>">Add Item</a></td>

  13. or use varchar and any format you want.

     

    thats a good idea too - unless later you're going to want to compare dates in mysql (such as searching for users born before 1985 or who are x number of years old). 

  14. MySQL stores dates as  YYYY-MM-DD

     

    there are a zillion things you can do.  look into strtotime() and date() functions.

     

    The simplest thing though, since you know the format coming in and just need to convert it is to explode the string and reorganize the values:

     

    <?php
    
    $users_input_dob = "31/12/95";
    $parts = explode("/",$users_input_dob);  //$parts[0] = 31  $parts[1] = 12 $parts[2] = 95
    $newDate = "19".$parts[2]."-".$parts[1]."-".$parts[0];
    
    echo $newDate;  //returns 1995-12-31
    
    

     

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