Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][MySQL]Rejestracja Logowanie dodawanie zdjec, BLagam o pomoc
lokokosi
post
Post #1





Grupa: Zarejestrowani
Postów: 10
Pomógł: 0
Dołączył: 12.10.2010

Ostrzeżenie: (0%)
-----


Dzien dobry
(IMG:style_emoticons/default/guitar.gif)


Od roku bawie sie z HTML i CSS.
Naprawde bardzo potrzebuje pomocy,przez ostatni miesiac szukam gotowych skryptow czytam na temat PHP,
ale cokolwiek znajduje na polskich lub angielskich stronach okazuje sie ze nie dziala.
Pomimo ze mam slaba wiedze na temat PHP to chyba sciagajac gotowe skrypty, powinny dzialac!! niestety nie dzialaja (IMG:style_emoticons/default/sciana.gif)
Lub robiac toturiale krok po kroku nadal nic, az czlowek ma wrazenie ze powinnien zajac sie puzlami a nie WWW (IMG:style_emoticons/default/wstydnis.gif)
Mimo wszystko mam nadzieje ze znajda si eosoby ktory zecha pomoc takiemu noobowi jak mi


Czego chce?
Staram sie na mojej stronie zrobic opcje rejsetracji logowania oraz gdy osoba jest zalogowana to moze dodac zdjecie,naturalnie chce zeby podczas dodawania zdjecia i rejestracji byl
wyswietlony jakis obrazek bezpieczenstwa ktory nalezalo by przepisac,aby urchonic strone od spamu.


PROBLEMY
wiec zainstalowalem XAMPP
stworzylem table np user i skopiowalem ten MYSQL kod do zakladki SQL
mam niby dobre pliki php rejestracji i logowania( dobre! powolujac sie na komentarze ludzi ktorzy z danej strony)
gdy uruchamiam te pliki PHP w IE to pliki chca sie zapisywac tak jak podczas sciagania i tak caly czasz, gdy uruchamiam
go w FireFoxie to widac pole rejestracji ale pelno kodu, w polach urzytkownika i hasla jest kod php
cala storna wyglada ledwo czytelnie.
A jak raz znalazlem normalnie wygladajaca,to po kliknieciu rejstracjii nic si enie dzialo
Juz zastanawiam sie czy to nie przez Windowsa 7, ktorego posiadam

Na co licze?


Na Pomoc. jestem pewnien ze macie takie przykladowe kody ktore dzialaja. Prosze pomocy (IMG:style_emoticons/default/sadsmiley02.gif) (IMG:style_emoticons/default/wstydnis.gif)
carolkarol20@gmail.com


Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
lokokosi
post
Post #2





Grupa: Zarejestrowani
Postów: 10
Pomógł: 0
Dołączył: 12.10.2010

Ostrzeżenie: (0%)
-----


w phpmyadmin tworze table users i dajke wklejam ten kod:

gdy klikam w zaloguj lub zarejestruj wyskakuje mi okno czy chcesz zapisac na dysku tak jak przy sciaganiu czegos z neta.


CREATE TABLE users (
userid int(25) NOT NULL auto_increment,
name varchar(25) NOT NULL default '',
email varchar(255) NOT NULL default '',
username varchar(25) NOT NULL default '',
password varchar(255) NOT NULL default '',
PRIMARY KEY (userid),
UNIQUE KEY username (username)
) TYPE=MyISAM COMMENT='Members';


Login.html

<form name="login" method="post" action="login.php">
<table border="0" width="225" align="center">
<tr>
<td width="219" bgcolor="#999999">
<p align="center"><font color="white"><span style="font-size:12pt;"><b>Login</b></span></font></p>
</td>
</tr>
<tr>
<td width="219">
<table border="0" width="220" align="center">
<tr>
<td width="71"><span style="font-size:10pt;">Username:</span></td>
<td width="139"><input type="text" name="username"></td>
</tr>
<tr>
<td width="71"><span style="font-size:10pt;">Password:</span></td>
<td width="139"><input type="password" name="password"></td>
</tr>
<tr>
<td width="71">&nbsp;</td>
<td width="139">
<p align="right"><input type="submit" name="submit" value="Submit"></p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="219" bgcolor="#999999"><font color="white">Not Registered? </font><a href="register.html" target="_self"><font color="white">Register</font></a><font color="white"> </font><b><i><font color="white">Now!</font></i></b></td>
</tr>
</table>
</form>

Register.html


<form name="login" method="post" action="register.php">
<table border="0" width="225" align="center">
<tr>
<td width="219" bgcolor="#999999">
<p align="center"><font color="white"><span style="font-size:12pt;"><b>Registration</b></span></font></p>
</td>
</tr>
<tr>
<td width="219">
<table border="0" width="282" align="center">
<tr>
<td width="116"><span style="font-size:10pt;">Name:</span></td>
<td width="156"><input type="text" name="name" maxlength="100"></td>
</tr>
<tr>
<td width="116"><span style="font-size:10pt;">Email:</span></td>
<td width="156"><input type="text" name="email" maxlength="100"></td>
</tr>
<tr>
<td width="116"><span style="font-size:10pt;">Username:</span></td>
<td width="156"><input type="text" name="username"></td>
</tr>
<tr>
<td width="116"><span style="font-size:10pt;">Password:</span></td>
<td width="156"><input type="password" name="password"></td>
</tr>
<tr>
<td width="116">&nbsp;</td>
<td width="156">
<p align="right"><input type="submit" name="submit" value="Submit"></p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="219" bgcolor="#999999">&nbsp;</td>
</tr>
</table>
</form>


Login.php

login.php



<?php

//Database Information

$dbhost = "localhost";
$dbname = "your database name";
$dbuser = "username";
$dbpass = "yourpass";

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());

session_start();
$username = $_POST[‘username’];
$password = md5($_POST[‘password’]);

$query = “select * from users where username=’$username’ and password=’$password’”;

$result = mysql_query($query);

if (mysql_num_rows($result) != 1) {
$error = “Bad Login”;
include “login.html”;

} else {
$_SESSION[‘username’] = “$username”;
include “memberspage.php”;
}

?>


register.php



<?PHP

//Database Information

$dbhost = "localhost";
$dbname = "your database name";
$dbuser = "username";
$dbpass = "yourpass";

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());


$name = $_POST['name'];
$email = $_POST['email'];
$username = $_POST['username'];
$password = md5($_POST['password']);

// lets check to see if the username already exists

$checkuser = mysql_query("SELECT username FROM users WHERE username='$username'");

$username_exist = mysql_num_rows($checkuser);

if($username_exist > 0){
echo "I'm sorry but the username you specified has already been taken. Please pick another one.";
unset($username);
include 'register.html';
exit();
}

// lf no errors present with the username
// use a query to insert the data into the database.

$query = "INSERT INTO users (name, email, username, password)
VALUES('$name', '$email', '$username', '$password')";
mysql_query($query) or die(mysql_error());
mysql_close();

echo "You have successfully Registered";

// mail user their information

$yoursite = ‘www.blahblah.com’;
$webmaster = ‘yourname’;
$youremail = ‘youremail’;

$subject = "You have successfully registered at $yoursite...";
$message = "Dear $name, you are now registered at our web site.
To login, simply go to our web page and enter in the following details in the login form:
Username: $username
Password: $password

Please print this information out and store it for future reference.

Thanks,
$webmaster";

mail($email, $subject, $message, "From: $yoursite <$youremail>\nX-Mailer:PHP/" . phpversion());

echo "Your information has been mailed to your email address.";

?>



Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 3.10.2025 - 02:34