sungpeng
-
Posts
290 -
Joined
-
Last visited
Posts posted by sungpeng
-
-
database is connected, but it just cannot insert into sql??
-
it always came out "cannot insert". Is there any error testing script for php?
-
<?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
-
<?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?
-
Is it's high chance that my passwords will be stolen from mysql if I don't use md5? I don't see anyway that others can steal it unless they can access to mysql database.
-
Check is md5 really needed for all password? Is it that secure?
-
Thank again
-
hi Yesideez, ask you again,
$image_path=$folder_path.$_FILES['images']['name]['$key'];
$image_path=$folder_path.$_FILES['images']['name'][$key];
Why cannot write ['$key'] and must write [$key] bec I am puzzle sometime need to put """ sometime no need..
-
Thank a lot
-
Thank is working now.. Check with you yesideez why need to put '' ''' on top then it work. Sometime I don't put '''''' on top it also work?
-
<?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
-
Sorry, the Parse error: syntax error solved, I need it only to upload JPG, but it seem the code still can upload all type of files.. it didn't echo "image file type wrong".
-
<?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?
-
Hi check I got a online management system. Do I store user as session or cookie. I notice session once close window need to key in user name and password again.
-
-
<?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.
-
sorry ken, just now don't quite understand. Finally got it..Thank you all really solid..
-
Hi brian why I cannot declare session start?
-
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; } ?>
-
even after log in, it will prompt again to key in user name and password.. which I think is unneccessary because I thought session already register the first time i log in.. on test2.php
-
sorry amended see above, it is cracking my head!
-
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>
-
hi check I keep having this error when dealing with session
Warning session_start()[function.session-start]: Cannot send session cookie - headers already sent by (output started at /home2/example/public_html/house/test2.php.
Can anyone please help explain?
-
ok I think I use meta. Thank
[SOLVED] simple script cannot work
in PHP Coding Help
Posted
error is "Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in signup.php on line 21" What is it means?