0

わかりましたので、私はまだ PHP に慣れていないということから始めましょう。基本的に、私は Oracle SQL データベースからユーザー データを照会するユーザー登録およびログイン システムを設計しようとしています。私にとって役立つチュートリアルはすべて MYSQL に関するものだけです。誰かがPHPコーディングを手伝ってくれる時間があるかどうか疑問に思っていました.

どんな助けでも大歓迎です。

編集:申し訳ありませんが、ログアウトするまでユーザーのセッションを維持するために Cookie を設定するログイン ページを取得しようとしています。私はいくつかの異なるバリエーションを試しましたが、どれもうまくいきません。以下の登録ページで動作する必要があります。

現時点でのユーザー登録用の私のコードは、かなりアマチュアであると確信しています。

 <?php
 /* Set oracle user login and password info */
  $dbuser = "xxxxxxx";  /* your login */
  $dbpass = "xxxxxx";  /* your password */
  $db = "xxxxx"; 
  $connect = OCILogon($dbuser, $dbpass, $db); 
  $salt = "plants";

  if (!$connect)  {
    echo "An error occurred connecting to the database"; 
    exit; 
  }


  // get the max ID in plants table and allocate $ID+1 for the new record
$max_id_stmt = "SELECT max(ID) FROM register_table";

// check the sql statement for errors and if errors report them
$stmt = OCIParse($connect, $max_id_stmt);
if(!$stmt) {
  echo "An error occurred in parsing the sql string.\n";
  exit;
}
OCIExecute($stmt);
$ID =0;

if(OCIFetch($stmt)) {
  $ID= OCIResult($stmt,1); //return the data from column 1
}else {
  echo "An error occurred in retrieving book id.\n";
  exit;
}
$ID++;


// Extract form data
$username=$_REQUEST['username'];
$password=$_REQUEST['password'];
$email=$_REQUEST['email'];
$phone=$_REQUEST['phone'];
$address=$_REQUEST['address'];
global $salt;


// Create the SQL statement to add the data. Note: field value should be single quoted           
'' if VARCHAR2 type.
$sql = "INSERT INTO register_table VALUES ($ID, '$username', '$password', '$email',             
'$address', '$phone')";
$password = md5($salt.$password);
// Add the data to the database as a new record
$stmt = OCIParse($connect, $sql);
if(!$stmt) {
echo "An error occurred in parsing the sql string.\n";
exit;
}
OCIExecute($stmt);
echo ("<p>Your registration has been successful!</p>
<p>User ID: $ID</P>
<p>Username: $username</p>
<p>Phone: $phone</p>
<p>Address: $address</p>


</p>")


?>

ありがとうございました!

4

1 に答える 1