Jump to content

optiplex

Members
  • Posts

    29
  • Joined

  • Last visited

    Never

Everything posted by optiplex

  1. ermm.. may be u are rite.. but still cannot work.. ermmm
  2. ive tried this coding.. but the email didnt send at all... the code $to = "$t_email"; $subject = "Request account"; $message = "good morning. your application bla bla bla\n\n\nregards, admin"; $from = "xxyyzz@yahoo.com"; $headers = "From: $from"; mail($to,$subject,$message,$headers); is it because of the hosting mail server or anything else? tq
  3. hi all when i run login-exec.php code, this error will come out Warning: session_regenerate_id() [function.session-regenerate-id]: Cannot regenerate session id - headers already sent in Z:\www\algebra\user\login-exec.php on line 66 Warning: Cannot modify header information - headers already sent by (output started at Z:\www\algebra\user\login-exec.php:60) in Z:\www\algebra\user\login-exec.php on line 71 the coding is <?php //Start session session_start(); //Include database connection details require_once('config.php'); //Array to store validation errors $errmsg_arr = array(); //Validation error flag $errflag = false; //Connect to mysql server $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //Select database $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } //Function to sanitize values received from the form. Prevents SQL injection function clean($str) { $str = @trim($str); if(get_magic_quotes_gpc()) { $str = stripslashes($str); } return mysql_real_escape_string($str); } //Sanitize the POST values $username = clean($_POST['username']); $password = clean($_POST['password']); //Input Validations if($username == '') { $errmsg_arr[] = 'Login ID missing'; $errflag = true; } if($password == '') { $errmsg_arr[] = 'Password missing'; $errflag = true; } //If there are input validations, redirect back to the login form if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; session_write_close(); header("location: login.php"); exit(); } //Create query $qry="SELECT * FROM members WHERE username='$username' AND password='".md5($_POST['password'])."'"; $result=mysql_query($qry); echo $qry; //exit; //Check whether the query was successful or not if($result) { if(mysql_num_rows($result) == 1) { //Login Successful session_regenerate_id(); //LINE 66 $member = mysql_fetch_assoc($result); $_SESSION['SESS_MEMBER_ID'] = $member['member_id']; session_write_close(); header("location: index.php"); exit(); }else { //Login failed header("location: login-failed.php"); exit(); }//LINE 71 }else { die("Query failed"); } ?>
  4. dear akitchin.. checking the username and password (checklogin.php) <?php $t_nick=$_GET['t_nick']; ob_start(); $host="localhost"; // Host name $username="root"; // Mysql username xx $password="root"; // Mysql password $db_name="algebraf_account"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Define $t_nick and $t_password $t_nick=$_POST['t_nick']; $t_password=$_POST['t_password']; // To protect MySQL injection (more detail about MySQL injection) $t_nick = stripslashes($t_nick); $t_password = stripslashes($t_password); $t_nick = mysql_real_escape_string($t_nick); $t_password = mysql_real_escape_string($t_password); $sql="SELECT * FROM $tbl_name WHERE t_nick='$t_nick' and t_password='$t_password'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $t_nick and $t_password, table row must be 1 row if($count==1){ // Register $t_nick, $t_password and redirect to file "list_details.php" //session_register("t_nick"); //session_register("t_password"); //echo $t_nick; //exit; $_SESSION["t_nick"] = $t_nick; $_SESSION["t_password"] = $t_password; header("location:index.php"); } else { echo "Wrong Username or Password.. please <a href=login.php>re-login"; } ob_end_flush(); ?> index.php <?php session_start(); if(!session_is_registered(t_nick)){ header("location:login.php"); } include "config.inc"; include "connect.inc"; $t_nick=$_GET['t_nick']; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>AlgebraForex</title> <link href="../style.css" rel="stylesheet" type="text/css" /> </head> <? if ($t_nick) { $sql = "select * from trader_details where t_nick='$t_nick' "; $res = mysql_query($sql); echo mysql_error(); $row = mysql_fetch_row($res); $id = $row[0]; $t_nick = $row[1]; $t_password = $row[2]; $t_name = $row[3]; $t_telefon = $row[4]; $t_email = $row[5]; $t_alamat = $row[6]; $t_ic = $row[7]; $intro = $row[8]; $no_akaun = $row[9]; $bank = $row[10]; $w_nama = $row[11]; $w_telefon = $row[12]; $w_alamat = $row[13]; $w_ic = $row[14]; $p_status = $row[15]; $acc_no = $row[16]; $acc_status = $row[17]; $reg_date = $row[18]; $trade_cat = $row[19]; } //echo $sql; //exit; ?> <body> <table width="90%" border="0" align="center"> <tr> <td><h1>algebraforex.com</h1></td> </tr> <tr> <td> </td> </tr> <tr> <td><div align="center">| My Profile | <? $semakdeposit = mysql_query ("SELECT * from deposit where t_nick ='$t_nick'"); if (mysql_num_rows($semakdeposit) == 0) { echo "<a href=deposit.php?t_nick=$row[1]>Deposit</a> |"; } else { echo "Add Account |"; } echo " <a href=withdraw.php?t_nick=$row[1]>Withdrawal</a> | Msg To Admin | <a href=aff_report.php?t_nick=$row[1]>Affiliate Report</a>";?> | </div></td> </tr> <tr> <td> </td> </tr> <tr> <td><div align="center"></div></td> </tr> <tr> <td><table width="80%" border="0" align="center"> <tr> <td colspan="2" bgcolor="#E4E4E4"><h2>Maklumat : <strong><?php echo htmlentities ($t_nick);?></strong></h2></td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td width="26%"><div align="right">Status Akaun : </div></td> <td width="74%"><strong><?php echo htmlentities ($acc_status);?> <input name="id" type="hidden" value="<?php echo $id ?>" /> </strong></td> </tr> <tr> <td><div align="right"></div></td> <td> </td> </tr> <tr> <td><div align="right"></div></td> <td><strong><?php echo htmlentities ($t_name);?></strong></td> </tr> <tr> <td> </td> <td><strong><?php echo htmlentities ($t_alamat);?></strong></td> </tr> <tr> <td> </td> <td><strong><?php echo htmlentities ($t_email);?></strong></td> </tr> <tr> <td> </td> <td><strong><?php echo htmlentities ($t_telefon);?></strong></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td colspan="2" bgcolor="#E4E4E4"><h2>Maklumat Akaun </h2></td> </tr> <tr> <td><div align="right">Kategori Akaun : </div></td> <td><strong><?php echo htmlentities ($trade_cat);?></strong></td> </tr> <tr> <td><div align=right>Baki : </div></td> <td> <? if ($t_nick) { //nengok berpa dia dah keluarkan $sql2 = "select t_nick ='$t_nick', sum(wd_amount) as TWdraw from withdraw WHERE t_nick ='$t_nick'"; $res = mysql_query($sql2); echo mysql_error(); $row = mysql_fetch_assoc($res); $totalWithdraw = $row['TWdraw']; //kira profit bonus sendirik $sql3 = "select t_nick ='$t_nick', sum(total_bonus) as TBonus2 from profit_bonus WHERE t_nick ='$t_nick'"; $res = mysql_query($sql3); echo mysql_error(); $row = mysql_fetch_assoc($res); $totalTBonus2 = $row['TBonus2']; //kira deposit saya $sql4i = "select t_nick ='$t_nick', sum(dep_amount) as TBonus1i from deposit WHERE t_nick ='$t_nick'"; $res = mysql_query($sql4i); echo mysql_error(); $row = mysql_fetch_assoc($res); $totalTBonus1i = $row['TBonus1i']; //kira profit bonus yg kita introduce $sql3i = "select t_nick ='$t_nick', sum(total_bonus) as TBonus3 from profit_bonus WHERE intro ='$t_nick'"; $res = mysql_query($sql3i); echo mysql_error(); $row = mysql_fetch_assoc($res); $totalTBonus3 = $row['TBonus3'] * (5/100); //kira deposit org $sql4 = "select t_nick ='$t_nick', sum(dep_amount) as TBonus1 from deposit WHERE intro ='$t_nick'"; $res = mysql_query($sql4); echo mysql_error(); $row = mysql_fetch_assoc($res); //kira 5% dari deposit utk introducer $totalprofit1 = $row['TBonus1'] * (5/100); } //echo "owner acc $t_nick<br>"; $baki = ($totalTBonus2 + $totalTBonus1i + $totalTBonus3 + $totalprofit1) - $totalWithdraw; echo "<b>RM $baki</b>"; ?> </td> </tr> <tr> <td><div align=right>Introducer : </div></td> <td><strong><?php echo htmlentities ($intro) ;?></strong></td> </tr> <?php if ($trade_cat != 'affliate') { echo " <tr> <td><div align=right>No Account : </div></td> <td><strong>$acc_no</strong></td> </tr> "; } ?> </table></td> </tr> </table> </body> </html> tq..
  5. tq.. but still not working... :'(
  6. ok.. ive put $_GET <?php $t_nick=$_GET['t_nick']; ob_start(); $host="localhost"; // Host name $username="root"; // Mysql username xx $password="root"; // Mysql password $db_name="algebraf_account"; // Database name $tbl_name="members"; // Table name and ive put session_start(); $_SESSION["t_nick"] = $t_nick; //echo "namo den $t_nick"; //exit; if(!session_is_registered(t_nick)){ header("location:login.php"); } at the top of every script. tq
  7. basically the problem is the username and password session variables don't get passed to next url.. the coding to check is <?php ob_start(); $host="localhost"; // Host name $username="root"; // Mysql username xx $password="root"; // Mysql password $db_name="algebraf_account"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Define $t_nick and $t_password $t_nick=$_POST['t_nick']; $t_password=$_POST['t_password']; // To protect MySQL injection (more detail about MySQL injection) $t_nick = stripslashes($t_nick); $t_password = stripslashes($t_password); $t_nick = mysql_real_escape_string($t_nick); $t_password = mysql_real_escape_string($t_password); $sql="SELECT * FROM $tbl_name WHERE t_nick='$t_nick' and t_password='$t_password'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $t_nick and $t_password, table row must be 1 row if($count==1){ // Register $t_nick, $t_password and redirect to file "list_details.php" //session_register("t_nick"); //session_register("t_password"); //echo $t_nick; //exit; $_SESSION["t_nick"] = $t_nick; $_SESSION["t_password"] = $t_password; header("location:index.php?t_nick=$t_nick"); //HERE IM TRYING TO PASS THE USERNAME } else { echo "Wrong Username or Password.. please <a href=login.php>re-login"; } ob_end_flush(); ?> tq
  8. header("location:index.php?username=$username"); why index.php cannot refer to username? tq
  9. ermmm... seems like im talking to myself... still cannot pull data from the table after login into the system...
  10. dear friends... another logic error i found when run in server site. when user login, nothing happened, its seem like looping at the login page... but when i run at my desktop, the system cannot display user data.. tq
  11. tq.. i've try and still didnt get the data..
  12. im trying to do a login page.. my login handler coding is (checklogin.php) <?php ob_start(); $host="localhost"; // Host name $username="admin"; // Mysql username xx $password="123"; // Mysql password $db_name="account"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Define $t_nick and $t_password $t_nick=$_POST['t_nick']; $t_password=$_POST['t_password']; // To protect MySQL injection (more detail about MySQL injection) $t_nick = stripslashes($t_nick); $t_password = stripslashes($t_password); $t_nick = mysql_real_escape_string($t_nick); $t_password = mysql_real_escape_string($t_password); $sql="SELECT * FROM $tbl_name WHERE t_nick='$t_nick' and t_password='$t_password'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $t_nick and $t_password, table row must be 1 row if($count==1){ // Register $t_nick, $t_password and redirect to file "list_details.php" session_register("t_nick"); session_register("t_password"); //echo $t_nick; //exit; header("location:list_details.php"); } else { echo "Wrong Username or Password"; } ob_end_flush(); ?> if the username and password correct, this page will display <? session_start(); //$_SESSION['t_nick']=$t_nick; if(!session_is_registered(t_nick)){ header("location:login.php"); } include "config.inc"; include "connect.inc"; //$t_nick = $_POST['t_nick']; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>AlgebraForex</title> <link href="../style.css" rel="stylesheet" type="text/css" /> </head> <? if ($t_nick) { $sql = "select * from trader_details where t_nick='$t_nick' "; $res = mysql_query($sql); echo mysql_error(); $row = mysql_fetch_row($res); $id = $row[0]; $t_nick = $row[1]; $t_name = $row[2]; $t_telefon = $row[3]; $t_email = $row[4]; $t_alamat = $row[5]; $t_ic = $row[6]; $intro = $row[7]; $no_akaun = $row[8]; $bank = $row[9]; $w_nama = $row[10]; $w_telefon = $row[11]; $w_alamat = $row[12]; $w_ic = $row[13]; $p_status = $row[14]; $acc_no = $row[15]; $acc_status = $row[16]; $reg_date = $row[17]; $trade_cat = $row[18]; } //echo $sql; //exit; ?> <body> <table width="90%" border="0" align="center"> <tr> <td><h1>algebraforex.com</h1></td> </tr> <tr> <td> </td> </tr> <tr> <td><div align="center">| My Profile | <? $semakdeposit = mysql_query ("SELECT * from deposit where t_nick ='$t_nick'"); if (mysql_num_rows($semakdeposit) == 0) { echo "<a href=deposit.php?t_nick=$row[1]>Deposit</a> |"; } else { echo "Add Account |"; } echo " <a href=withdraw.php?t_nick=$row[1]>Withdrawal</a> | Msg To Admin | <a href=aff_report.php?t_nick=$row[1]>Affiliate Report</a>";?> | </div></td> </tr> <tr> <td> </td> </tr> <tr> <td><div align="center"></div></td> </tr> <tr> <td><table width="80%" border="0" align="center"> <tr> <td colspan="2" bgcolor="#E4E4E4"><h2>Maklumat : <strong><?php echo htmlentities ($t_nick);?></strong></h2></td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td width="26%"><div align="right">Status Akaun : </div></td> <td width="74%"><strong><?php echo htmlentities ($acc_status);?> <input name="id" type="hidden" value="<?php echo $id ?>" /> </strong></td> </tr> <tr> <td><div align="right"></div></td> <td> </td> </tr> <tr> <td><div align="right"></div></td> <td><strong><?php echo htmlentities ($t_name);?></strong></td> </tr> <tr> <td> </td> <td><strong><?php echo htmlentities ($t_alamat);?></strong></td> </tr> <tr> <td> </td> <td><strong><?php echo htmlentities ($t_email);?></strong></td> </tr> <tr> <td> </td> <td><strong><?php echo htmlentities ($t_telefon);?></strong></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td colspan="2" bgcolor="#E4E4E4"><h2>Maklumat Akaun </h2></td> </tr> <tr> <td><div align="right">Kategori Akaun : </div></td> <td><strong><?php echo htmlentities ($trade_cat);?></strong></td> </tr> <tr> <td><div align=right>Introducer : </div></td> <td><strong><?php echo htmlentities ($intro) ;?></strong></td> </tr> </table></td> </tr> </table> </body> </html> the problem is, at list_details.php, its contain no data.. pls help me
  13. hahahaha.. i doing the tutorial right now.. tq for the helping.. u r very nice
  14. i've remove session_start(); still blur :'(
  15. Nice! ermmm.. ive put this.. $_SESSION['t_nick']='$t_nick'; but.. still facing the same problem..
  16. i've call session.. here the coding session_start(); if(!session_is_registered(t_nick)){ header("location:login.php"); } and still doesn't work... :'(
  17. i cant carry the value of $t_nick to another page... <?php ob_start(); $host="localhost"; // Host name $username="algebraf_admin"; // Mysql username xx $password="algebraforex_123"; // Mysql password $db_name="algebraf_account"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Define $t_nick and $t_password $t_nick=$_POST['t_nick']; $t_password=$_POST['t_password']; // To protect MySQL injection (more detail about MySQL injection) $t_nick = stripslashes($t_nick); $t_password = stripslashes($t_password); $t_nick = mysql_real_escape_string($t_nick); $t_password = mysql_real_escape_string($t_password); $sql="SELECT * FROM $tbl_name WHERE t_nick='$t_nick' and t_password='$t_password'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $t_nick and $t_password, table row must be 1 row if($count==1){ // Register $t_nick, $t_password and redirect to file "list_details.php" session_register("t_nick"); session_register("t_password"); //echo $t_nick; //exit; header("location:list_details.php"); } else { echo "Wrong Username or Password"; } //ob_end_flush(); ?> from above, if t_nick and t_password is true, the page will direct to list_details.php... the problem occurs at list_details.php. cannot display any data from database because the t_nick is not carry along.
  18. now, i can access the list_details.php but this error was came out.. Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at Z:\www\algebra\user\list_details.php:2) in Z:\www\algebra\user\list_details.php on line 3 tq
  19. dear friends.. the username and password is correct but the sistem display Wrong Username or Password. this is the checking coding.. <?php ob_start(); $host="localhost"; // Host name $username="root"; // Mysql username $password="root"; // Mysql password $db_name="account"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Define $t_nick and $password $t_nick=$_POST['t_nick']; $t_password=$_POST['t_password']; // To protect MySQL injection (more detail about MySQL injection) $t_nick = stripslashes($t_nick); $t_password = stripslashes($t_password); $t_nick = mysql_real_escape_string($t_nick); $t_password = mysql_real_escape_string($t_password); $sql="SELECT * FROM $tbl_name WHERE t_nick='$t_nick' and t_password='$t_password'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $t_nick and $password, table row must be 1 row if($count==1){ // Register $t_nick, $password and redirect to file "login_success.php" session_register("t_nick"); session_register("t_password"); header("location:list_details.php"); } else { echo "Wrong Username or Password"; } ob_end_flush(); ?> and ive put this syntax at the top of list_details.php session_start(); if(!session_is_registered(t_nick)){ header("location:login.php"); } tq
  20. btw tq friends... it was because overloaded '?>' muhahaha.. how silly i am.. so careless..
×
×
  • 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.