PHP脚本

时间:2016-01-13 06:43:44

标签: php image

我正在为脚本更新一些图像,根据用户的成员编号动态创建图像链接。对于旧图像,一切正常,但对于我们新创建的图像,脚本不会发送正确的数据。

此链接显示我使用旧图像获得的goobledegoop。这是我需要看到的。 http://cdja.ca/validate_new/img.php?memnum=150&type=2

此链接显示我没有获得新图像所需的goobledegoop。 http://cdja.ca/validate_new/img.php?memnum=548&type=2

我在此脚本上输出图像以证明图像链接是真实且有效并加载,但在完成的脚本中,此图像将不存在。该脚本应该只是将goobledegoop传递出去。

这是某种文件权限问题,还是我的代码有问题?

这是我的代码。

include ("../phpcommon/phpHelper.php");
include ("../quoteadmin/db_writer.php");

$memnum = getParameterString("memnum");
$type = getParameterString("type");

$img = "logo_links/";
$ext = "gif";

/* ----------  Image Versions ----------  */

if ($type == 1){
    // Code for Lifetime Members
    if ($memnum == "001" or $memnum == "002" or $memnum == "006" or $memnum == "015" or $memnum == "121" or $memnum == "153" or $memnum == "323" or $memnum == "150"){
        $filename1 = "Life-White";
        $filename2 = "NotCertified1";
    } 
    else if($memnum == "548" or $memnum == "226"){
        // Code for Vice-Presidents
        // 548 - Jason Cathcart
        // 226 - Mike Di Berardo
        $filename1 = "ViceA";
        $filename2 = "NotCertified-A";  
    }
    else{
        // Code for Other Members   
        $filename1 = "Certified1";
        $filename2 = "NotCertified1";
    }
}

/* -------------------------------------- */

if ($type == 2){
    // Code for Lifetime Members    
    if ($memnum == "001" or $memnum == "002" or $memnum == "006" or $memnum == "015" or $memnum == "121" or $memnum == "153" or $memnum == "323" or $memnum == "150"){
        $filename1 = "Life-Black";
        $filename2 = "NotCertified2";
    }
    else if($memnum == "548" or $memnum == "226"){
        // Code for Vice-Presidents
    $filename1 = "Vice-A";
    $filename2 = "NotCertified-A";  
    }
    else{
        // Code for Other Members   
        $filename1 = "Certified2";
        $filename2 = "NotCertified2";
    }
}

/* -------------------------------------- */

/*

Check Account using Company Name and Membership Number for compliency.
If complient exec Code 1
If not exec Code 2

*/

$companyCount = 0;

$conn = mysql_connect(HOST, USER, PASS);
mysql_select_db(DB);
// check entered parameters against company data
$strsql = sprintf("select count(company_id) from vw_CompliantCompanies where membership_number = %d;", mysql_real_escape_string($memnum));
//echo($strsql . "<br />");
$result = mysql_query($strsql, $conn) or die('Query failed: ' .           mysql_error());
$row = mysql_fetch_array($result);

// if match then
//echo($result."<br>");
if (!(mysql_num_rows($result) == 0))
{
    $companyCount = $row[0]; // only 1 field coming back
}
mysql_free_result($result);
mysql_close($conn);
if($companyCount == 1)
{
    /* Compliant CODE 1 */
    $logo = "<img src='". $img . $filename1 . "." . $ext . "'><br>" ; 
    echo($logo);
    include $img . $filename1 . "." . $ext; 
}
else
{
    /* Non-Complient CODE 2 */
    $logo = "<img src='". $img . $filename1 . "." . $ext . "'><br>" ; 
    //echo($logo);
    include $img . $filename2 . "." . $ext;
}

0 个答案:

没有答案