php脚本是否可能使共享服务器超载?

时间:2014-05-02 02:20:45

标签: php webserver

我在php中构建了一个目录脚本。它的工作非常好;但是,我的托管公司给我发了一封电子邮件,说脚本正在超载服务器。那可能吗?如果可能,我该如何找到问题并予以纠正。

<?PHP
    session_start();
    define('DB_HOST','localhost');
    define('DB_USER','root');
    define('DB_PASSWORD','');
    define('DB_DATABASE','salondir');
        $link = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("host Userid and Password Not match");
        mysql_select_db(DB_DATABASE,$link) or die("Could not Select DatabBase");
    $config_qry = "SELECT * FROM config";
    $config_result = mysql_query($config_qry) or die('ERROR.... CHECK CONFIG QUERY');
    $config_row = mysql_fetch_assoc($config_result);

    ?>
    <!doctype html>
    <html>
    <head>
    <?PHP $ip =  $_SERVER['REMOTE_ADDR'];
if($ip == '::1')
{
    $ipdetails = GetIpDetails('98.251.213.154');    
}
else
{
    $ipdetails = GetIpDetails($ip);
}
//print_r($ipdetails); exit;
if(isset($_GET))
{
    if(@$_GET['urltype'] != '')
    {
        $urltype = $_GET['urltype'];
    }
    else
    {
        $urltype = 'home';  
    }

    if(@$_GET['url'] != '')
    {
        if($_GET['url'] == 'pages')
        {
            $url = $_GET['url'];
        }
        else
        {
            $url = $_GET['url'];    
        }
    }

    if(@$_GET['pages'] != '')
    {
        $pages = $_GET['pages'];
    }
    else
    {
        $pages = 0;
    }
}
else
{

}

//print_r($_GET); exit;
if($urltype == 'search')
{
    $pagename = $_GET['urltype'];
    $pageid = 0; 
    $pageids = 0; 
    $count_row = 1;
    $page_title = 'Search Salon';
    $heading = 'Search Salon';
    $metakw = 'Search Salon';
    $metades = 'Search Salon';
}
else if($urltype == 'photogallery')
{
    $pagename = $_GET['urltype'];
    $pageid = 0; 
    $pageids = 0; 
    $count_row = 1;
    $page_title = 'Photo Gallery';
    $heading = 'Photo Gallery';
    $metakw = 'Photo Gallery';
    $metades = 'Photo Gallery';
}
else if($urltype == 'categories')
{
    $pagename = $_GET['urltype'];
    $pageid = 0; 
    $pageids = 0; 
    $count_row = 1;
    $explodeurl = explode('-',$url);
    $explodecount = count($explodeurl);

    if($explodecount == 2)
    {
        $url1 = ucwords($explodeurl[0]).' '.ucwords($explodeurl[1]);
    }
    else
    {
        $url1 = ucwords($url);
    }

    if($pages != 0)
    {
        $ttilepage = 'Page # '.$pages;
    }
    else
    {
        $ttilepage = '';
    }

    if(@$_GET['show'] != 'all')
    {
        $loc = $ipdetails['city'].', '.$ipdetails['state'];
    }
    else
    {
        $loc = GetStateStingWithkeyword($url1);
    }



    $page_title = $url1.' Categories - '.$loc.' '.$ttilepage;
    $heading = $url1.' Categories - '.$loc.' '.$ttilepage;
    $metakw = $url1.' Categories - '.$loc.' '.$ttilepage;
    $metades = $url1.' Categories - '.$loc.' '.$ttilepage;
}
else if($urltype == 'comments')
{
    $pagename = $_GET['urltype'];
    $pageid = 0; 
    $pageids = 0; 
    $count_row = 1;
    $page_title = 'Comments';
    $heading = 'Comments';
    $metakw = 'Comments';
    $metades = 'Comments';
}
else if($urltype == 'wishlist')
{
    $pagename = $_GET['urltype'];
    $pageid = 0; 
    $pageids = 0; 
    $count_row = 1;
    $page_title = 'Wish List';
    $heading = 'Wish List';
    $metakw = 'Wish List';
    $metades = 'Wish List';
}
else if($urltype == 'home')
{
    $pagename = $urltype;
    $pageid = 0; 
    $pageids = 0; 
    $count_row = 1;
    $page_title = 'Spa Salon Offers Provide Largest Data of Spa Salon, Nails Salon, Beauty Salon, Tanning Salon, Laser Body Treatment, Barber and more...';
    $heading = 'Spa Salon Offers Provide Largest Data of Spa Salon, Nails Salon, Beauty Salon, Tanning Salon, Laser Body Treatment, Barber and more...';
    $metakw = 'Spa Salon, Nails Salon, Beauty Salon, Barber, Tanning Salons, waxing, Faical, Day Spas, Massage Services, Health Clubs, Body Wrap Salons, Hair Cut, Hair Stylists, Laser Body Treatment, Eyebrow Threading, Best Offers, offers, Beauty salon Offers, Spa Offers, Nail Offers ';
    $metades = 'spasalonoffers.com. Find Best Spa Salon Offer nearby you, also find Spa Salon, Nails Salon, Beauty Salon,Tanning Salon, Laser Body Treatment,Barber and more..';
}
else if($urltype == 'postspecial')
{
    $pagename = $_GET['urltype'];
    $pageid = 0; 
    $pageids = 0; 
    $count_row = 1;
    $page_title = 'Post Special';
    $heading = 'Post Special';
    $metakw = 'Post Special';
    $metades = 'Post Special';
}
else if($urltype == 'editspecial')
{
    $pagename = $_GET['urltype'];
    $pageid = 0; 
    $pageids = 0; 
    $count_row = 1;
    $page_title = 'Edit Special';
    $heading = 'Edit Special';
    $metakw = 'Edit Special';
    $metades = 'Edit Special';
}
else if($urltype == 'editaccountinfo')
{
    $pagename = $_GET['urltype'];
    $pageid = 0; 
    $pageids = 0; 
    $count_row = 1;
    $page_title = 'Edit Account';
    $heading = 'Edit Account';
    $metakw = 'Edit Account';
    $metades = 'Edit Account';
}
else if($urltype == 'salonserviceoffer')
{
    $pagename = $_GET['urltype'];
    $pageid = 0; 
    $pageids = 0; 
    $count_row = 1;
    $page_title = 'Salon Services';
    $heading = 'Salon Services';
    $metakw = 'Salon Services';
    $metades = 'Salon Services';
}
else if($urltype == 'logout')
{
    $pagename = $_GET['urltype'];
    $pageid = 0; 
    $pageids = 0; 
    $count_row = 1;
    $page_title = 'logout';
    $heading = 'logout';
    $metakw = 'logout';
    $metades = 'logout';
}
else if($urltype == 'viewappointment')
{
    $pagename = $_GET['urltype'];
    $pageid = 0; 
    $pageids = 0; 
    $count_row = 1;
    $page_title = 'View Appointment';
    $heading = 'View Appointment';
    $metakw = 'View Appointment';
    $metades = 'View Appointment';
}
else if($urltype == 'login')
{
    $pagename = $_GET['urltype'];
    $pageid = 0; 
    $pageids = 0; 
    $count_row = 1;
    $page_title = 'login';
    $heading = 'login';
    $metakw = 'login';
    $metades = 'login';
}   
else if($urltype == 'myaccount')
{
    $pagename = $_GET['urltype'];
    $pageid = 0; 
    $pageids = 0; 
    $count_row = 1;
    $page_title = 'My Account';
    $heading = 'My Account';
    $metakw = 'My Account';
    $metades = 'My Account';
}   
else if($urltype == 'managespecials')
{
    $pagename = $_GET['urltype'];
    $pageid = 0; 
    $pageids = 0; 
    $count_row = 1;
    $page_title = 'Manage Special';
    $heading = 'Manage Special';
    $metakw = 'Manage Special';
    $metades = 'Manage Special';
}
else if($urltype == 'makeappointment')
{
    $pagename = $_GET['urltype'];
    $pageid = 0; 
    $pageids = 0; 
    $count_row = 1;
    $page_title = 'Make Appointment';
    $heading = 'Make Appointment';
    $metakw = 'Make Appointment';
    $metades = 'Make Appointment';
}
else if($urltype == 'salonworkinghours')
{
    $pagename = $_GET['urltype'];
    $pageid = 0; 
    $pageids = 0; 
    $count_row = 1;
    $page_title = 'Salon Working Hours';
    $heading = 'Salon Working Hours';
    $metakw = 'Salon Working Hours';
    $metades = 'Salon Working Hours';
}
else if($urltype == 'socialnetworks')
{
    $pagename = $_GET['urltype'];
    $pageid = 0; 
    $pageids = 0; 
    $count_row = 1;
    $page_title = 'Social Networks';
    $heading = 'Social Networks';
    $metakw = 'Social Networks';
    $metades = 'Social Networks';
}
else if($urltype == 'getdirection' || $urltype == 'direction')
{
    $pagename = $_GET['url'];
    $query_Salon = "SELECT * FROM salons WHERE salonurl = '$pagename'";
    $Salon_result = mysql_query($query_Salon) or die('Erorr...');
    $Salon_row = mysql_fetch_assoc($Salon_result);

    $pageid = $Salon_row['salonid']; 
    $pageids = $Salon_row['salonid']; 
    $count_row = 1;
    $page_title = "Direction - ".$Salon_row['salonname'].' - '.$Salon_row['saloncity'].' - '.$Salon_row['salonstates'];
    $heading = strtoupper($Salon_row['salonname']);
    $metakw = strtoupper($Salon_row['salonname']);
    $metades = strtoupper($Salon_row['salonname']);
}
else if($urltype == 'salondetails' || $urltype == 'biz')
{
    $pagename = $_GET['url'];
    $query_Salon = "SELECT * FROM salons WHERE salonurl = '$pagename'";
    $Salon_result = mysql_query($query_Salon) or die('Erorr...');
    $Salon_row = mysql_fetch_assoc($Salon_result);

    $pageid = $Salon_row['salonid']; 
    $pageids = $Salon_row['salonid']; 
    $count_row = 1;
    $page_title = strtoupper($Salon_row['salonname']).', '.strtoupper($Salon_row['saloncity']).','.strtoupper($Salon_row['salonstates']);
    $heading = strtoupper($Salon_row['salonname']);
    $metakw = strtoupper($Salon_row['salonname']);
    $metades = strtoupper($Salon_row['salonname']);
}   


?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="RATING" content="General" />
<meta name="DISTRIBUTION" content="Global" />
<meta name="classification" content="<?php echo($metakw); ?>" />
<meta name="keywords" content="<?php echo($metakw); ?>" />
<meta name="description" content="<?php echo($metades); ?>" />
<meta name="subject" content="<?php echo($metades); ?>" />
<meta name="submission" content="<?php echo($config_row['dirurl']); ?>" />
<meta name="google-site-verification" content="TYfy6tRySOfLfJwtM0Q8FPXq5wBJ70h7dUd-2yjLGKA" />
<meta name="author" content="<?php echo($config_row['dirurl']); ?>" />
<meta name="copyright" content="Copyright © <?PHP echo(date('Y')); ?>-<?PHP echo(date('Y')+1); ?> <?php echo($config_row['dirurl']); ?>" />
<meta name="language" content="English" />
<title><?php echo($page_title); ?></title>

<link href="<?PHP echo(GetSeoURL('css/style2.css')); ?>" rel="stylesheet" type="text/css" />
<link href="<?PHP echo(GetSeoURL('css/paginate.css')); ?>" rel="stylesheet" type="text/css" />
<?PHP include('banner_scripts.php'); ?>

<script language="javascript" src="<?PHP echo(GetSeoURL('js/validator.js')); ?>"></script>
<script language="javascript" src="<?PHP echo(GetSeoURL('js/scripts.js')); ?>"></script>
<link rel="stylesheet" href="<?PHP echo(GetSeoURL('css/smoothness/jquery-ui-1.8.2.custom.css')); ?>" /> 

<script src="<?PHP echo(GetSeoURL('js/jquery.min.js')); ?>" type="text/javascript"></script>
<script src="<?PHP echo(GetSeoURL('js/ui/jquery-ui.js')); ?>" type="text/javascript"></script>
<!--<link id="jquiCSS" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/ui-lightness/jquery-ui.css" type="text/css" media="all">
-->
<link id="jquiCSS" rel="stylesheet" href="<?PHP echo(GetSeoURL('css/jquery-ui.css')); ?>" type="text/css" media="all">
<link href="<?PHP echo(GetSeoURL('css/gridcss.css')); ?>" rel="stylesheet" /> 
<link href="<?PHP echo(GetSeoURL('css/evol.colorpicker.min.css')); ?>" rel="stylesheet" /> 
<script src="<?PHP echo(GetSeoURL('js/evol.colorpicker.min.js')); ?>" type="text/javascript"></script>

 <script type="text/javascript" language="javascript" src="<?PHP echo(GetSeoURL('js/jquery.easing.min.1.3.js')); ?>"></script>
<script type="text/javascript" language="javascript" src="<?PHP echo(GetSeoURL('js/jquery.jcontent.0.8.min.js')); ?>"></script> 
<link href="<?PHP echo(GetSeoURL('css/jcontent.css')); ?>" rel="stylesheet" type="text/css"/> 

<script type="text/javascript" src="<?PHP echo(GetSeoURL('js/jquery.timepicker.js')); ?>"></script>
<link rel="stylesheet" type="text/css" href="<?PHP echo(GetSeoURL('css/jquery.timepicker.css')); ?>" />

<link rel="stylesheet" href="<?PHP echo(GetSeoURL('css/colorbox.css')); ?>" />
<script language="javascript" src="<?PHP echo(GetSeoURL('js/jquery.colorbox.js')); ?>"></script>
<script>
    $(document).ready(function(){
        $(".ajax").colorbox();
        $(".ajax1").colorbox();
        $(".group1").colorbox();
        $(".group4").colorbox({rel:'group4', slideshow:true, innerWidth:640,transition:"elastic"}); 
        $(".inline").colorbox({inline:true, width:"50%"});  
    });

    $(document).ready(function(){
        //demo3 
        $("div#demo3").jContent({orientation: 'horizontal', 
                 easing: "easeOutBounce", 
                 duration: 500,
                 auto: true,
                 pause_on_hover: true,
                 direction: 'next',
                 width: 130,
                 height: 87,
                 pause: 1500});   
    });
</script> 
    </head>
    <body>
    <div id="wrapper">
        <div id="pinkbg">
            <script type="text/javascript"> 
    jQuery(document).ready(function(){
        $('#l').autocomplete
        ({
            source:'<?PHP echo($gf->GetSeoURL('controller/city.php')); ?>', 
            minLength:2
        });
    });

</script> 
<style type="text/css"><!--

        li.ui-menu-item { font-size:12px !important; }

</style> 
<div id="topcontent">
    <div id="logo">
        <a href="<?PHP echo($config_row['dirurl']); ?>"><img src="<?PHP echo($gf->GetSeoURL('images/'.$config_row['dirlogo'])); ?>" width="100%" ></a>
    </div>

     <div id="topmenus">
                      <div class="buttondiv">
                         <?PHP include('topmenu.php'); ?>
                      </div>

                      <div id="search">
                       <?PHP include('search.php'); ?>
                      </div>
                </div>


    <?PHP
    if($userid > 0)
    {
        if($_SESSION['salonname'] != '')
        {
    ?>
        <div id="welcome">Welcome To <?PHP echo(@$_SESSION['salonname']); ?></div>
    <?PHP }
    }?>    
</div>
        </div>
        <div class="clearfix"></div>
        <div id="banner">
            <img src="<?PHP echo($gf->GetSeoURL('images/01.jpg')); ?>" width="100%" height="100%" >
        </div>
        <div class="clearfix"></div>

        <div id="center">
            <div id="errors">
                <?php
 if(isset($_SESSION['errtype']))
 { 

    if($_SESSION['errtype'] == 1)
    { ?>
       <div class="error"><strong>Error Message: </strong> <?php echo($_SESSION['mess']); ?></div>
<?php }
    elseif($_SESSION['errtype'] == 2)
    { ?>
       <div class="success"><strong>Successful Message: </strong> <?php echo($_SESSION['mess']); ?></div>
    <?php }
    elseif($_SESSION['errtype'] == 3)
    { ?>
      <div class="warning"><strong>Warning Message: </strong> <?php echo($_SESSION['mess']); ?></div>
    <?php }
    elseif($_SESSION['errtype'] == 4)
    {
    ?>
        <div class="info"><strong>Info Message: </strong> <?php echo($_SESSION['mess']); ?></div>
<?php } 

unset($_SESSION['errtype']);
unset($_SESSION['mess']);
}
?>   
            </div>
            <div id="homewrapper"><?PHP  
    if($pages == '0')
    {
    ?>
    <div id="welcomenote"><?PHP echo($config_row['welcomenote']); ?></div>
    <?PHP } ?>
<div id="category"> 
    <ul>
        <li><div id="image"><a href="<?PHP echo($gf->GetSeoURL('categories/beauty_salon/?cq=beauty_salon-hair_salon')); ?>"><img src="<?PHP echo($gf->GetSeoURL('images/beauty.png')); ?>" title="Eyebrow Threading" width="100%" height="100%" ></a></div>

        <div id="text">
            <a href="<?PHP echo($gf->GetSeoURL('categories/beauty_salon/?cq=beauty_salon-hair_salon')); ?>">Beauty & Hair Salon</a></div>
        </li>   

        <li><div id="image"><a href="<?PHP echo($gf->GetSeoURL('categories/nails/?cq=nails-nails_salon-manicure-pedicure-spa_pedicure-spa_manicure-gentlemans_manicure')); ?>"><img src="<?PHP echo($gf->GetSeoURL('images/nails.jpg')); ?>" width="100%" height="100%" title="Nails Salon, Spa" name="Nails Salon, Manicure Spa" ></a></div>

        <div id="text">
            <a href="<?PHP echo($gf->GetSeoURL('categories/nails/?cq=nails-nails_salon-manicure-pedicure-spa_pedicure-gentlemans_manicure')); ?>">Nails Salon</a></div>
        </li>

        <li><div id="image"><a href="<?PHP echo($gf->GetSeoURL('categories/barber/?cq=barber-barber_shop')); ?>"><img src="<?PHP echo($gf->GetSeoURL('images/barber.jpg')); ?>" width="100%" height="100%" title="Barber Shop" name="Barber Shop" ></a></div>

        <div id="text">
            <a href="<?PHP echo($gf->GetSeoURL('categories/barber/?cq=barber-barber_shop')); ?>">Barber Shop</a></div>
        </li>

        <li><div id="image"><a href="<?PHP echo($gf->GetSeoURL('categories/tanning_salon/?cq=tanning_salon-tan')); ?>"><img src="<?PHP echo($gf->GetSeoURL('images/tanning.jpg')); ?>" width="100%" height="100%" title="Tanning Salon" name="Tanning Salon, Tan" ></a></div>

        <div id="text">
            <a href="<?PHP echo($gf->GetSeoURL('categories/tanning_salon/?cq=tanning_salon-tan')); ?>">Tanning Salon</a></div>
        </li>

        <li><div id="image"><a href="<?PHP echo($gf->GetSeoURL('categories/day_spa/?cq=day_spa-spa-massage-facials-body_treatments-airbrush_tanning-waxing')); ?>"><img src="<?PHP echo($gf->GetSeoURL('images/spa.jpg')); ?>" title="Day Spa, Massage, Facials, Waxing" name="Day Spa, Spa, Massage, Facials, Body" width="100%" height="100%" ></a></div>

        <div id="text">
            <a href="<?PHP echo($gf->GetSeoURL('categories/day_spa/?cq=days_spa-spa-massage-facials-body_treatments-airbrush_tanning-waxing')); ?>">Day Spa</a></div>
        </li>

        <li><div id="image"><a href="<?PHP echo($gf->GetSeoURL('categories/laser_treatment/?cq=laser_treatment')); ?>"><img src="<?PHP echo($gf->GetSeoURL('images/laser-treatment.jpg')); ?>" name="Laser Treatment, Laser Hair Reduction" title="Laser Treatment, Laser Hair Reduction, Laser Pigment Eraser, Laser Tattoo Removal, Laser Toning, Limelight IPL, Thermage" width="100%" height="100%" ></a></div>

        <div id="text">
            <a href="<?PHP echo($gf->GetSeoURL('categories/laser_treatment/?cq=laser_treatment')); ?>">Laser Treatment</a></div>
        </li>

        <li><div id="image"><a href="<?PHP echo($gf->GetSeoURL('categories/hair_replacement/?cq=hair_replacement')); ?>"><img src="<?PHP echo($gf->GetSeoURL('images/hair_style.png')); ?>" name="Hair Replacement" title="Wig/unit design, Wig/unit sales, Wig customizing,Styling, Fitting, Coloring, Hair Bonding Attachment" width="100%" height="100%" ></a></div>

        <div id="text">
            <a href="<?PHP echo($gf->GetSeoURL('categories/hair_replacement/?cq=hair_replacement')); ?>">Hair Replacement</a></div>
        </li>

         <li><div id="image"><a href="<?PHP echo($gf->GetSeoURL('categories/salon_equipment/?cq=salon_equipment')); ?>"><img src="<?PHP echo($gf->GetSeoURL('images/salon-equipment.jpg')); ?>" width="100%" height="100%" title="Spa & Salon Equipment" name="Spa & Salon Equipment" ></a></div>
        <div id="text">
            <a href="<?PHP echo($gf->GetSeoURL('categories/salon_equipment/?cq=salon_equipment')); ?>">Salon & Salon Equipment</a></div>
        </li>

         <li><div id="image"><a href="<?PHP echo($gf->GetSeoURL('categories/salon_jobs/?cq=salon_jobs')); ?>"><img src="<?PHP echo($gf->GetSeoURL('images/job.png')); ?>" name="Salon Jobs" title="Salon Jobs" width="100%" height="100%" ></a></div>

        <div id="text">
            <a href="<?PHP echo($gf->GetSeoURL('categories/salon_jobs/?cq=salon_jobs')); ?>">Spa & Salon Jobs</a></div>
        </li>

    </ul>
</div>
</div>
        </div>
        <div class="clearfix"></div>

    </div>

    </body>
    </html>

1 个答案:

答案 0 :(得分:1)

当然你可以写一个基本的form bomb

while(1) pcntl_fork();

基本上会创建一个无限循环,每次循环它都会创建另一个无限循环。这将很快将几乎任何服务器带到它的膝盖。

不看你的代码我不知道哪个部分超载服务器但有tools来帮助你找到需要很长时间的内容。

我首先寻找任何嵌套循环。