Jump to content

sungpeng

Members
  • Posts

    290
  • Joined

  • Last visited

Posts posted by sungpeng

  1.  

    <?php

    include 'config2.php';

     

    $counted=setcookie("user", "mydomain", time()+60*60*60);
    
    
    if($counted==""){ 
    
        setcookie("counter","counted",time()+60*60*60);
        mysql_query("UPDATE stats SET counter=counter+1 where id='0'");
    }
    

     

    The above code intended to track the number of new customers visiting my webpages. It is not working, can anyone help to correct it?

  2. $going =$_SERVER["REMOTE_ADDR"];
    $time=date(y).date(m).date(d).date(h).date(i).date(s);
    $str="INSERT INTO track(chtime,visitor,pages) values ('$time','$going','index')" ;
    mysql_query($str) or die('Error insert query failed');
    

    The above code will track the user IP address whenever a visitor hit my pages. Can check how to stop repeated visitors from activate the above code or if refresh button is hit, the above code will not activate. It will work only work once to get exact number of new visitor.

  3. <?
    
    $hostname = "localhost";
    $username = "hello";
    $password = "fefa";
    $dbName = "sgfai_property"; 
    MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to database"); 
    mysql_select_db("$dbName") or die("Unable to select database"); 
    
    ?>

     

    like say I need to insert this 级搜索 into mysql, it will turn out character that cannot read.

  4. <?php
    
    if($_POST[action]=="Submit")
    {
    
    include ("".$_SERVER['DOCUMENT_ROOT']."/housing/includes/config.php");
    
    $loginname=$_POST["loginname"];
    
    
    $insert_student=mysql_query("insert into users (loginname) values ('$loginname'");
    
    ?>
    
    
    
    }else{ ?>
    
    
    
    
    <html>
    
    <head>
    <title></title>
    
    
    
    </head>
    
    <body>
    
                     
    
                         <table width="400" align="center">
                        <br> <form name="form" action="<?php echo "$PHP_SELF"; ?>" method="post">
                          
    
                             
                            <tr> 
                              <td width="35%">Loginname</td>
                              <td><input type="text" name="loginname" size="25"></td>
                            </tr>
                            
    
                             
    
                            <tr> 
                              <td align="center" colspan="2"><input type="submit" name="action" value="Submit"></td>
                            </tr>
                          </table>
                        </form>
    
    
    
    
              
    </body>
    
    </html>
    <?php 
    }
    ?>
        
    

     

    Hi checking when I input chinese character into "loginname" field using the above code. The chinese character turn out not able to read. Is there a special code for input chinese character?

  5. <?php
    mail("sung@hotmail.com", "$emailsubject", "Dear $fname $lname,
    Thank you for registering. Below you will find your username and password that will let you log in and begin to enter
    rental listings.
    Username: $email
    Password: $newpass
    ", "FROM:sgfair.com");
    ?>
    

     

    Hi the above script will sent an e-mail to the sung@hotmail.com. When it sent over an e-mail to another person, it's FROM "sgfair.com" (sgfair@yourhostingnet.com). Can the FROM just show "sgfair.com" without the sgfair@yourhostingnet.com?

     

  6. 
    <?php
    
    if($_POST[action]=="Submit")
    {
    
    
    
    $hostname = "localhost";
    $username = "sgfai_winning";
    $password = "helly";
    $dbName = "sgfai_property"; 
    MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to database"); 
    mysql_select_db("$dbName") or die("Unable to select database");
    
    
    $loginname=$_POST[loginname];
    
    echo "$loginname";
    
    $result=mysql_query("insert into users (loginname) values ('$loginname')") or die (mysqli_error($result)); 
    
    
    
    }
    
    
    ?>
    
    
    
    <html>
    
    <head>
    
    <title>Agents Register</title>
    
    </head>
    
    <body>
    
                     
    
                         <table width="400" align="center">
                        <br> <form name="form" action="<?php echo"$PHP_SELF"; ?>" method="post">
                          
    
                             
                            <tr> 
                              <td width="35%">Loginname</td>
                              <td><input type="text" name="loginname" size="25"></td>
                            </tr>
                            
                             
    
                            <tr> 
                              <td align="center" colspan="2"><input type="submit" name="action" value="Submit"></td>
                            </tr>
                          </table>
                        </form>
    
    
    
    
              
    </body>
    
    </html>
    
    
    
    
    

     

     

     

  7. <?
    
    $hostname = "localhost";
    $username = "sgfai_winning";
    $password = "heally";
    $dbName = "sgfai_property"; 
    MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to database"); 
    mysql_select_db("$dbName") or die("Unable to select database"); 
    
    ?>

     

    Hi zanus, is the above connection wrong?

  8. 
    <?php
    
    if($_POST[action]=="Submit")
    {
    
    
    
    
    include ("".$_SERVER['DOCUMENT_ROOT']."/housing/includes/config.php"); 
    
    
    
    
    $loginname=$_POST[loginname];
    
    echo "$loginname";
    
    
    $result=mysql_query("insert into users (loginname) values ('$loginname')") or die (mysqli_error($result)); 
    
    
       
    
    
    
    
    
    }else{ ?>
    
    
    
    <html>
    
    <head>
    
    <title>Agents Register</title>
    
    </head>
    
    <body>
    
                     
    
                         <table width="400" align="center">
                        <br> <form name="form" action="<?php echo"$PHP_SELF"; ?>" method="post">
                          
    
                             
                            <tr> 
                              <td width="35%">Loginname</td>
                              <td><input type="text" name="loginname" size="25"></td>
                            </tr>
                            
                             
    
                            <tr> 
                              <td align="center" colspan="2"><input type="submit" name="action" value="Submit"></td>
                            </tr>
                          </table>
                        </form>
    
    
    
    
              
    </body>
    
    </html>
    <?php 
    }
    ?>
    
    
    
    
    

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