Jump to content
php.lv forumi

query


MārisL

Recommended Posts

<?php

function showheader ($title) {

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<HTML>

<HEAD>

<TITLE> <?php echo $title ?> </TITLE>

</HEAD>

<BODY BGCOLOR="#FFFFFF">

<CENTER>

<?php

}

 

function showfooter () {

?>

</CENTER>

</BODY>

</HTML>

<?php

}

 

mysql_connect("localhost", "root", "parole");

mysql_select_db("datubaze");

 

if ($Password == $Password2) {

$user = mysql_query("SELECT * FROM personalize WHERE (Name='$Name')");

if (mysql_num_rows($user) > 0) {

showheader("User Name Taken !");

?>

We are sorry to inform you that the User Name <B><?php echo $Name ?></B> Is already Taken.

<?php

showfooter();

}

else {

$user = mysql_query("INSERT INTO personalize VALUES ('$Name','$Password','$News1','$News2','$Weather')");

setcookie("site_user", $Name, time() + 31536000, "/");

setcookie("site_pass", $Password, time() + 31536000, "/");

showheader("Registration Success!");

?>

You have registered.<BR>

User Name: <?php echo $Name ?>

<BR>

Password: <?php echo $Password ?>

<?php

showfooter();

}

}

else {

showheader("Registration Error!");

?>

Your Two Passwords Did Not Match

<?php

showfooter();

}

?>

 

Kas šajā kodā ir nepareizs, ka izlec errors?

 

2.) Un kādā veidā db var izveidot šo:

 

This is the query that inserts the values into the database.

 

setcookie("site_user", $Name, time() + 31536000, "/");

setcookie("site_pass", $Password, time() + 31536000, "/");

 

 

iznākums: http://81.198.234.32/register

Edited by MārisL
Link to comment
Share on other sites

1) kāds errors izlec?

2) no kurienes ienāk $Password, $Name un $Password2?

3) kur ir mysql_real_escape_string() ?

4) priekš kam html definīcijas jābāž funkcijās showheader() un showfooter ()?

5) priekš kam tev kukī reģistrācijā?

Edited by NiTrino
Link to comment
Share on other sites

1. Taadus koda blakjus --> paste.php.lv

2. Kaa jau mineja prieksh kam jaukt HTML ar PHP?

2.) Un kādā veidā db var izveidot šo:

This is the query that inserts the values into the database.

setcookie("site_user", $Name, time() + 31536000, "/");

setcookie("site_pass", $Password, time() + 31536000, "/");

3. kaads sakars setcookie() ar DB?

4. Visi te ir gaisregji --> Vismaz buutu paraadijis to gabalu kas paredzeets DB izveidei...

// tas ir *.SQL vai PHP kods...

Link to comment
Share on other sites

tāda koda nav!

Viss sastāv no viena faila, kas mani lika ļoti aizdomāties, jo nesen atradu skriptu, kur ir vismaz 4 faili (login.php, logout.php, u.c.)

VIss kods man jau ir ierakstīts. Pamācības links ar pievienots.

Link to comment
Share on other sites

×
×
  • Create New...