Go Back   Webmaster Malaysia Forum » Website Design & Development » Website Programming

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-05-2004, 09:00 AM
paranoidz's Avatar
Novice Webmaster
 
Join Date: Jul 2002
Location: dalam perut bumi
Posts: 40
Rep Power: 0
paranoidz is on a distinguished road
perlukan bantuan untuk coding php

aku ade buat satu webbase system cam helpdesk...aku ingin buat password tapi coding aku tak berjalan lancar la...boleh sesiapa bantu aku untuk buat coding tuk password.

ade sesiapa boleh bantu aku buat coding untuk search cam search nama, or barang dalam webbase aku nie...
__________________
<embed src="http://www.geocities.com/paranoidz02/new.swf" WIDTH=400 HEIGHT=55 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>®

Last edited by paranoidz; 12-05-2004 at 12:59 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-05-2004, 09:53 AM
lcf's Avatar
lcf lcf is offline
Pro-Blogger
 
Join Date: Feb 2003
Location: Kluang, Johor
Posts: 2,376
Rep Power: 118
lcf will become famous soon enough
Send a message via ICQ to lcf Send a message via MSN to lcf Send a message via Yahoo to lcf
wat? sorry, I do not understand your language.

In your check.php, you should get the submited form data first. use $variableName = $_POST['FIELD']
__________________
LiewCF | Malaysia Bloggers Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-05-2004, 09:58 AM
paranoidz's Avatar
Novice Webmaster
 
Join Date: Jul 2002
Location: dalam perut bumi
Posts: 40
Rep Power: 0
paranoidz is on a distinguished road
do you have any script that written properly cause i'm new in php...
__________________
<embed src="http://www.geocities.com/paranoidz02/new.swf" WIDTH=400 HEIGHT=55 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>®
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-05-2004, 02:13 PM
lcf's Avatar
lcf lcf is offline
Pro-Blogger
 
Join Date: Feb 2003
Location: Kluang, Johor
Posts: 2,376
Rep Power: 118
lcf will become famous soon enough
Send a message via ICQ to lcf Send a message via MSN to lcf Send a message via Yahoo to lcf
no, sorry.
we are here to help you, not here to write code for you.
__________________
LiewCF | Malaysia Bloggers Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 05-05-2004, 09:01 PM
paranoidz's Avatar
Novice Webmaster
 
Join Date: Jul 2002
Location: dalam perut bumi
Posts: 40
Rep Power: 0
paranoidz is on a distinguished road
ok i repaired my script first then i submit here
__________________
<embed src="http://www.geocities.com/paranoidz02/new.swf" WIDTH=400 HEIGHT=55 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>®
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 07-05-2004, 04:32 PM
paranoidz's Avatar
Novice Webmaster
 
Join Date: Jul 2002
Location: dalam perut bumi
Posts: 40
Rep Power: 0
paranoidz is on a distinguished road
Quote:
<body topmargin="0" leftmargin="0">
<form name="password" method="post" action="<?echo $PHP_SELF?>">
<table width="300" border="0" align="center" cellpadding="0" cellspacing="0" class="border">
<tr>
<td width="400" class="text"><div align="center"></div></td>
</tr>
<tr>
<td class="text"><table width="250" border="0" cellpadding="0" cellspacing="0" class="text">
<tr>
<td width="94"><div align="right">username</div></td>
<td width="9">: </td>
<td width="120"><input name="username" type="text" id="username" maxlength="12" border="0"></td>
</tr>
<tr>
<td><div align="right">password</div></td>
<td>: </td>
<td><input name="password" type="password" id="password" maxlength="8"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="3"><div align="right">
<input type="submit" name="Submit" value="Submit" border="0">
</div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="3"><div align="center">forgot password contact nazrin</div></td>
</tr>
</table>
<div align="left"></div>
<div align="center"></div></td>
</tr>
</table>
</form>
<?php
if ($submit) {
$db=mysql_connect("localhost","sreport") or die ("connection problem");
mysql_select_db("sreport",$db) or die ("cant connect to database");
$result=mysql_query("select * from user where name='$username'",$db) or die ("database not found");
while ($row=mysql_fetch_array($result)) {
if ($row["password"]==$password) {
printf("Successfully Logged In!<a href="report/report.php?">Click Here</a>");
}
}
}
?>
</body>
</html>
Parse error: parse error in C:\apache\htdocs\sreport\users\users.php on line 223...
the error refer hereprintf("Successfully Logged In!<a href="report/report.php?">Click Here</a>");
__________________
<embed src="http://www.geocities.com/paranoidz02/new.swf" WIDTH=400 HEIGHT=55 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>®
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 07-05-2004, 07:34 PM
MHR's Avatar
MHR MHR is offline
Senior Webmaster
 
Join Date: Sep 2001
Location: epox
Posts: 435
Rep Power: 96
MHR is on a distinguished road
Send a message via ICQ to MHR Send a message via Yahoo to MHR
your script is screwed if the server enabled register_globals
*laughs*
__________________
Munzir + "/^[Hh](a)(z)\1\2[iI]$/"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 07-05-2004, 10:49 PM
hafizuddin's Avatar
Novice Webmaster
 
Join Date: May 2002
Location: Klate
Posts: 91
Rep Power: 82
hafizuddin is on a distinguished road
maybe u need to escape the double quote eh , like this

printf("Successfully Logged In!<a href=\"report/report.php?\">Click Here</a>");
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 10-05-2004, 05:25 PM
paranoidz's Avatar
Novice Webmaster
 
Join Date: Jul 2002
Location: dalam perut bumi
Posts: 40
Rep Power: 0
paranoidz is on a distinguished road
<?php
function print_form() {
?>
<form action="chk_pass.php3" method="post">
<h3>Please Login</h3>
Username : <input type="text" name="user_name">
Password : <input type="password" name="user_pass">
<input type="submit" name="submit" value="login">
</form>
<?
}

if(isset($submit));

if(!$db = mysql_connect("localhost","root")):
print("<h1>Database Connection Failed</h1>\n");
else:
mysql_select_db("users",$db);
endif;

$sql = "select * from users where user_name = '$user_name'";
$result = mysql_query($sql);
$row_count = mysql_num_rows($result);
if($row_count == 0):
?>
<h3>Wrong Username</h3>
<?
print_form();
else:
$row = mysql_fetch_array($result);
if($password != $row["user_pass"]):
?>
<h3>Invalid Password</h3>
<?
print_form();
else:
?>
<h3>Password Accepted</h3>
<?
endif;
endif;
else: <---------------------error asyik kat sini...
print_form();
endif;
?>

aku modified script tu kasik lowert skit...n dapat error nie...
__________________
<embed src="http://www.geocities.com/paranoidz02/new.swf" WIDTH=400 HEIGHT=55 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>®
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 10-05-2004, 09:01 PM
hafizuddin's Avatar
Novice Webmaster
 
Join Date: May 2002
Location: Klate
Posts: 91
Rep Power: 82
hafizuddin is on a distinguished road
kat if(isset($submit)); tu hujung dia tanda ni ; ke : ???
__________________
PHP Code:
<?php echo "PHP is a language?"?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #11 (permalink)  
Old 12-05-2004, 10:35 AM
paranoidz's Avatar
Novice Webmaster
 
Join Date: Jul 2002
Location: dalam perut bumi
Posts: 40
Rep Power: 0
paranoidz is on a distinguished road
PHP Code:
if ($_POST[user] && $_POST[pass]) {  
$result mysql_query("select * from users where user_name='$_POST[user]");    
$row mysql_fetch_array($result);    
if (
$row[id] > 0) {     
setcookie ("user"md5($user_data[username]));      
setcookie ("pass"md5($user_data[password])); 
header("Location: users.php");    }
 else 
$login_errortrue; }   } 
Warning: Supplied argument is not a valid MySQL result resource in c:\apache\htdocs\sreport\users\users.php on line 26

camner nie ye
__________________
<embed src="http://www.geocities.com/paranoidz02/new.swf" WIDTH=400 HEIGHT=55 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>®

Last edited by paranoidz; 12-05-2004 at 10:37 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 12-05-2004, 12:10 PM
lcf's Avatar
lcf lcf is offline
Pro-Blogger
 
Join Date: Feb 2003
Location: Kluang, Johor
Posts: 2,376
Rep Power: 118
lcf will become famous soon enough
Send a message via ICQ to lcf Send a message via MSN to lcf Send a message via Yahoo to lcf
replace:
PHP Code:
$result mysql_query("select * from users where user_name='$_POST[user]"); 
with:
PHP Code:
$result mysql_query("select * from users where user_name='" $_POST[user] . "'"); 
__________________
LiewCF | Malaysia Bloggers Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 12-05-2004, 12:49 PM
paranoidz's Avatar
Novice Webmaster
 
Join Date: Jul 2002
Location: dalam perut bumi
Posts: 40
Rep Power: 0
paranoidz is on a distinguished road
PHP Code:
<?php
$db_username 
"ayin"
$db_password "mypass"
$db_hostname "localhost";     
$db_connect mysql_connect($db_hostname$db_username$db_password)or die("Unable to connect to MySQL"); 
$db_select mysql_select_db("sreport"$db_connect)or die("Unable to select test"); 
//additional functionality here 
echo "You have successfully connected to MySQL!"
mysql_close($db_connect);

//$username = 'admin';  
//$password = 'password';

//current time
$time=time();

//logout
if($logout == true){
setcookie("user",md5($_POST[user]),$time-3200);
setcookie("pass",md5($_POST[pass]),$time-3200);
header("location:users.php");
}

//mysql validate
if ($_POST[user] && $_POST[pass]) {
$result mysql_query("select * from users where user_name='" $_POST[user] . "'");
 
$row mysql_fetch_array($result); 
 if (
$row[id] > 0) { 
  
setcookie ("user"md5($user_data[username]));  
  
setcookie ("pass"md5($user_data[password]));  
  
header("Location: users.php"); 
 } else { 
$login_errortrue; } 
}
still same problem la...anybody can help me...
__________________
<embed src="http://www.geocities.com/paranoidz02/new.swf" WIDTH=400 HEIGHT=55 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>®

Last edited by paranoidz; 12-05-2004 at 12:59 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 12-05-2004, 08:08 PM
lcf's Avatar
lcf lcf is offline
Pro-Blogger
 
Join Date: Feb 2003
Location: Kluang, Johor
Posts: 2,376
Rep Power: 118
lcf will become famous soon enough
Send a message via ICQ to lcf Send a message via MSN to lcf Send a message via Yahoo to lcf
Try change all
$_POST[pass] to $_POST["pass"]
$_POST[user] to $_POST["user"]
$user_data[username] to $user_data["username"]
$user_data[password] to $user_data["password"]
__________________
LiewCF | Malaysia Bloggers Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 12-05-2004, 08:49 PM
paranoidz's Avatar
Novice Webmaster
 
Join Date: Jul 2002
Location: dalam perut bumi
Posts: 40
Rep Power: 0
paranoidz is on a distinguished road
did u mean like this...i try 1st...if still cannot i give my other script but i need to do a cookies for this script n it did not work as i wanted...tomorrow i post it here...

PHP Code:
<?php
$db_username 
"ayin"
$db_password "mypass"
$db_hostname "localhost";     
$db_connect mysql_connect($db_hostname$db_username$db_password)or die("Unable to connect to MySQL"); 
$db_select mysql_select_db("sreport"