Jump to content

sungpeng

Members
  • Posts

    290
  • Joined

  • Last visited

Posts posted by sungpeng

  1. 
    <?php
    
    if($_POST[action]=="Submit")
    {
    
    
    
    
    include ("".$_SERVER['DOCUMENT_ROOT']."/housing/includes/config.php"); 
    
    
    
    
    
    
    $loginname=$_POST[loginname];
    echo "$loginname";
    $insert_student="insert into users ('llid','loginname') values ('3','$loginname')"; 
    mysql_query($insert_student) or die ("cannot insert");
    
       
    
    
    
    
    
    ?>
    
    
    
    <?php }else{ ?>
    
    
    
                     
    <?php include ("".$_SERVER['DOCUMENT_ROOT']."/housing/includes/header.php");  ?>
    
    <html>
    
    <head>
    
    <title>Agents Register</title>
    
    </head>
    
    <body>
    
                     
    
                         <table width="400" align="center">
                        <br> <form name="form" action="<?php print $PHP_SELF ?>" onSubmit="return validate(this);" 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 
    }
    ?>
        
    

     

    Can anyone help, I don't know why simple script why cannot work? always show cannot insert

  2. <?php
    include ("".$_SERVER['DOCUMENT_ROOT']."/housing/includes/config.php");
    $uid='sungpeng1';
    $query = "SELECT * from users where loginname='$uid'";
    while($resu=mysql_query($query)){
    echo "$resu[llid]";
    }
    ?>

     

    Hi I see nothing wrong with my script, but it give me an error FATAL ERROR maximum execution time is 30 seconds on line 6. Why is that so? Can anyone help?

  3. 
    <?php
    
    
    if($_POST[action]=="Update")
    {	
    include ("".$_SERVER['DOCUMENT_ROOT']."/housing/includes/config.php");
    $indexnumber=$_GET[llid];		
    $user=$_POST[user];
    $passwd=$_POST[pass];
    echo $user;
    echo $passwd;
    echo $indexnumber;
    
    $check_result=0;
    $check_login=mysql_query("select * from users where email=$user and passwd=$passwd and llid=$indexnumber");
    $check_result=mysql_num_rows($check_login);
    echo $check_result;
    
    
    
    }else{ ?>
    
    
    
    
    
    
    <html>
    
    <title>Upload an image to a database</title>
    
    
    <body>
    
    
    
    
    <h2>Update with new information</h2>
    
    <form name="form" enctype="multipart/form-data" method="post" action="<?php echo"$PHP_SELF?llid=$_GET[llid]"; ?>">
    Please insert the images
    <input type='file' name='imagefile'><br>
    
    
    <br>
    USER : <input name="user"><br>
    PASSWORD : <input name="pass"><br>
    
    
    <input type="submit" name="action" value="Update">
    </form>
    
    </body>
    </html>
    
    <?php
    } ?>
    
    
    
    
    

     

    Can help I keep having error message warning: mysql_num_row(): supplied argument is not a valid MySql result resource in insertphoto.php on line 17

  4. <?php
    
    include 'config2.php';
    if($_POST[action]=="Update")
    {	
    
    $check_result=0;
    $check_login=mysql_query("select * from users where email='$_POST[user]' and passwd='$_POST[pass]' and pid='$_GET[pid]'");
    $check_result=mysql_num_rows($check_login);		
    
    
    }
    
    if($check_result>0)
    {
    
    $indexnumber=$_GET[pid];
    $folder_path="photo/$indexnumber/";
    
    
    if (file_exists("photo/$indexnumber"))
    {
    }
    else
    {
    mkdir($folder_path,0777);
    }
    
    echo $indexnumber;
    
    
    		$file_upload_err=0;
    		$max_file_size="10000000"; 
    		$max_file_size_kb="500";
    		$file_upload_err_msg="";
    
    		if($_FILES['imagefile']['size']>$max_file_size)
    		{
    		echo "image file too big";	
                
    
                }elseif
    ($imagefile && ($_FILES['imagefile']['type']!="image/jpeg" && $_FILES['imagefile']['type']!="image/pjpeg"))
    		{
    			$type=$_FILES['imagefile']['type'];
    				echo "image file type wrong";
                    
    		}
    
    
    
    
    
    }else{ ?>
    
    
    
    
    
    
    <html>
    
    <title>Upload an image to a database</title>
    
    
    <body>
    
    
    
    
    <h2>Update with new information</h2>
    
    <form name="form" enctype="multipart/form-data" method="post" action="<?php echo"$PHP_SELF?pid=$_GET[pid]"; ?>">
    Please insert the images
    <input type='file' name='imagefile'><br>
    
    
    <br>
    USER : <input name="user"><br>
    PASSWORD : <input name="pass"><br>
    
    
    <input type="submit" name="action" value="Update">
    </form>
    
    </body>
    </html>
    
    <?php
    } ?>
    
    

     

    Hi I keep editing the above code but it seem not working. Can anyone help? Parse error: syntax error?

     

  5. 
    <?php
    
    if($_POST[action]=="Submit")
    {
    
    
    
    
    include ("".$_SERVER['DOCUMENT_ROOT']."/includes/config.php"); 
    
    $loginname=$_POST["loginname"];
    echo "registration done";
    
    }
    ?>
    
    
                     
    <?php 
    if(!$action) 
    {
    ?>
    
    
    <html>
    
    <head>
    
    <title>Register</title>
    
    </head>
    
    <body>       
    
                         <table width="<?php print $number1 ?>" align="center">
                        <br> <form name="form" action="<?php print $PHP_SELF ?>" onSubmit="return validate(this);" method="post">
                          
    
                           
                            <tr> 
                              <td width="35%">Login name</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 good day, Can I check with you how to display only "registration done" after the form processed. Currently after the form processed, it still show the bottom form.

  6. housing accesscontrol.php

    <?php 
    include ("".$_SERVER['DOCUMENT_ROOT']."/housing/includes/config.php");
    
    session_start();
    
    if (isset($_POST['uid'])) {
    $uid = $_POST['uid'];
    } else {
    $uid = $_SESSION['uid'];
    }
    if (isset($_POST['pwd'])) {
    $pwd = md5($_POST['pwd']);
    } else {
    $pwd = $_SESSION['pwd'];
    }
    
    
    if(!isset($uid) || !isset($pwd) )
    {
      ?>
      <html>
      <head>
      <title> Please Log In for Access </title>
      </head>
    <body>
      <table align=center width=300 border=0 cellspacing=0 cellpadding=0 bgcolor="#2f4f4f">
      <tr><td>
       <table border=0 width=100% cellspacing=1 cellpadding=1>
        <form action="<?=$_SERVER['PHP_SELF']?>" method=POST>
        <tr><td BGCOLOR="#2f4f4f"><FONT SIZE="-1" FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif" COLOR="#FFFFFF">
        <B>Please Log In For Access:</B>
        </td></tr>
        <tr><td BGCOLOR="#c7c7c7"><FONT SIZE="-1" FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif">
    You must log in to access this area of the site.
         </td></tr>
        <tr>
         <td BGCOLOR="#fffff0">
          <table width=100% border=0 cellspacing=0 cellpadding=0>
        <tr>
         <td><FONT SIZE="-1" FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif">Email Address:</td>
         <td><input type=text name="uid" size="20" value=""></td>
        </tr>
            <tr>
         <td><FONT SIZE="-1" FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif">Password:</td>
         <td><input type=password name="pwd" size="20"></td>
        </tr>
        <tr>
         <td colspan=2 align=center>
          <input type=submit name="Login" value="Login">
         </td>
        </tr>
        </form>
          </table>
         </td>
        </tr>
       </table>
      </td></tr>
    </table>
      </body>
      </html>
      <?php
      exit;
    }
    //Clean the input submitted to mysql
    $uid=addslashes($uid);
    $pwd=addslashes($pwd);
    
    //this puts the variable into the session
    
    $_SESSION['uid'] = $uid; 
    $_SESSION['pwd'] = $pwd;
    
    $sql = "SELECT * FROM users WHERE email = '$uid' AND passwd = '$pwd' ";
    
    $result = mysql_query($sql);
    
    if (!$result) {
    echo "A database error occurred while checking your login details";
    }
    //if bad user/pass combo access denied
    if (mysql_num_rows($result) == 0) {
    
      unset($_SESSION['uid']);
      unset($_SESSION['pwd']);
      ?>
      <html>
      <head>
      <title> Access Denied </title>
      </head>
      <body>
      <h1> Access Denied </h1>
      <p>There are several reasons this may be happening:<BR>
      <UL><LI>Your username or password is incorrect</LI>
      <LI>You have forgotten your login information. <a href="password_reset.php">Lost Password</a></LI></UL>
      To return to our login page, <a href="index.php">click here</a>.</p>
      </body>
      </html>
        <?php
      exit;
    }
    
    ?>

  7.  

    accesscontrol.php

    <?php 
    include ("".$_SERVER['DOCUMENT_ROOT']."/housing/includes/config.php");
    
    session_start();
    
    if (isset($_POST['uid'])) {
    $uid = $_POST['uid'];
    } else {
    $uid = $_SESSION['uid'];
    }
    if (isset($_POST['pwd'])) {
    $pwd = md5($_POST['pwd']);
    } else {
    $pwd = $_SESSION['pwd'];
    }
    
    
    if(!isset($uid) || !isset($pwd) )
    {
      ?>
      <html>
      <head>
      <title> Please Log In for Access </title>
      </head>
    <body>
      <table align=center width=300 border=0 cellspacing=0 cellpadding=0 bgcolor="#2f4f4f">
      <tr><td>
       <table border=0 width=100% cellspacing=1 cellpadding=1>
        <form action="<?=$_SERVER['PHP_SELF']?>" method=POST>
        <tr><td BGCOLOR="#2f4f4f"><FONT SIZE="-1" FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif" COLOR="#FFFFFF">
        <B>Please Log In For Access:</B>
        </td></tr>
        <tr><td BGCOLOR="#c7c7c7"><FONT SIZE="-1" FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif">
    You must log in to access this area of the site.
         </td></tr>
        <tr>
         <td BGCOLOR="#fffff0">
          <table width=100% border=0 cellspacing=0 cellpadding=0>
        <tr>
         <td><FONT SIZE="-1" FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif">Email Address:</td>
         <td><input type=text name="uid" size="20" value=""></td>
        </tr>
            <tr>
         <td><FONT SIZE="-1" FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif">Password:</td>
         <td><input type=password name="pwd" size="20"></td>
        </tr>
        <tr>
         <td colspan=2 align=center>
          <input type=submit name="Login" value="Login">
         </td>
        </tr>
        </form>
          </table>
         </td>
        </tr>
       </table>
      </td></tr>
    </table>
      </body>
      </html>
      <?php
      exit;
    }
    //Clean the input submitted to mysql
    $uid=addslashes($uid);
    $pwd=addslashes($pwd);
    
    //this puts the variable into the session
    
    $_SESSION['uid'] = $uid; 
    $_SESSION['pwd'] = $pwd;
    
    $sql = "SELECT * FROM users WHERE email = '$uid' AND passwd = '$pwd' ";
    
    $result = mysql_query($sql);
    
    if (!$result) {
    echo "A database error occurred while checking your login details";
    }
    //if bad user/pass combo access denied
    if (mysql_num_rows($result) == 0) {
    
      unset($_SESSION['uid']);
      unset($_SESSION['pwd']);
      ?>
      <html>
      <head>
      <title> Access Denied </title>
      </head>
      <body>
      <h1> Access Denied </h1>
      <p>There are several reasons this may be happening:<BR>
      <UL><LI>Your username or password is incorrect</LI>
      <LI>You have forgotten your login information. <a href="password_reset.php">Lost Password</a></LI></UL>
      To return to our login page, <a href="index.php">click here</a>.</p>
      </body>
      </html>
        <?php
      exit;
    }
    
    ?>

     

     

     

    test2.php

    
    
    
    <?php 
    
    if($_POST[action]=="Update")
    {
    
    echo "hello";
    
        
    }
    
    ?>
    
    <html>
    
    <title>Upload an image to a database</title>
    
    
    <body>
    
    
    <h2>Update with new information</h2>
    <form name="form" enctype="multipart/form-data" method="post" action="<?php echo"$PHP_SELF?rid=$_GET[rid]"; ?>">
    <?php 
    include ("".$_SERVER['DOCUMENT_ROOT']."/housing/accesscontrol.php");
    ?>
    <input type=text name='images' class='bginput'>
    
    
    <input type="submit" name="action" value="Update">
    </form>
    
    </body>
    </html>

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