Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP][MySQL]Rejestracja Logowanie dodawanie zdjec, BLagam o pomoc
lokokosi
post 12.10.2010, 08:31:08
Post #1





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

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


Dzien dobry
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 sciana.gif
Lub robiac toturiale krok po kroku nadal nic, az czlowek ma wrazenie ze powinnien zajac sie puzlami a nie WWW 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 sadsmiley02.gif wstydnis.gif
carolkarol20@gmail.com


Go to the top of the page
+Quote Post
Fifi209
post 12.10.2010, 08:34:12
Post #2





Grupa: Zarejestrowani
Postów: 4 655
Pomógł: 556
Dołączył: 17.03.2009
Skąd: Katowice

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


Zapisałeś z odpowiednim rozszerzeniem te pliki?


--------------------
Zainteresowania: C#, PHP, JS, SQL, AJAX, XML, C dla AVR
Chętnie pomogę, lecz zanim napiszesz: Wujek Google , Manual PHP
Go to the top of the page
+Quote Post
lokokosi
post 12.10.2010, 09:15:30
Post #3





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

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


no sa zapisane jako *.php uruchamiam i sa wyzej opisane bledy. Jak wklejam kod pomiedzy body i zapisuje jako *.php tez niedziala
Go to the top of the page
+Quote Post
Fifi209
post 12.10.2010, 09:42:10
Post #4





Grupa: Zarejestrowani
Postów: 4 655
Pomógł: 556
Dołączył: 17.03.2009
Skąd: Katowice

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


Podaj kod, który próbujesz odpalić...bo tak się dziwnie składa, że ja gdy odpalam pliki php są interpretowane a nie wysyłane do przeglądarki.


--------------------
Zainteresowania: C#, PHP, JS, SQL, AJAX, XML, C dla AVR
Chętnie pomogę, lecz zanim napiszesz: Wujek Google , Manual PHP
Go to the top of the page
+Quote Post
lokokosi
post 12.10.2010, 10:09:02
Post #5





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
Fifi209
post 12.10.2010, 10:24:13
Post #6





Grupa: Zarejestrowani
Postów: 4 655
Pomógł: 556
Dołączył: 17.03.2009
Skąd: Katowice

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


Podmieniłeś wszystkie dane w skryptach?

Poza tym WRZUĆ TO W BB-CODE!!

P.S. Jak odpalasz te pliki?

Ten post edytował fifi209 12.10.2010, 10:24:44


--------------------
Zainteresowania: C#, PHP, JS, SQL, AJAX, XML, C dla AVR
Chętnie pomogę, lecz zanim napiszesz: Wujek Google , Manual PHP
Go to the top of the page
+Quote Post
lokokosi
post 12.10.2010, 10:30:51
Post #7





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

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


co mam pozmieniac ?pisalo ze to sa gotowe kody i ze dzialaja. co to jest bb code? odpalam: no klikam w rejestracja.html
Go to the top of the page
+Quote Post
Mackos
post 12.10.2010, 10:49:23
Post #8





Grupa: Zarejestrowani
Postów: 362
Pomógł: 44
Dołączył: 10.06.2009

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


Nie przeczytałem całego kodu/tematu ale wpadło w oko:
Cytat
$query = "INSERT INTO users (name, email, username, password)
VALUES('$name', '$email', '$username', '$password')";

a powinno być:
Cytat
mysql_query("INSERT INTO users (name, email, username, password)
VALUES('$name', '$email', '$username', '$password')");


BBcode to znaczniki na tym forum dzięki którym możesz formatować tekst - dzięki czemu nam (osobom które Ci pomagają) wygodniej jest to czytać.

Ten post edytował Mackos 12.10.2010, 10:50:51


--------------------
WebLemon.pl - projektowanie stron www, reklama i PR w internecie - Adwords, Facebook.
Go to the top of the page
+Quote Post
lokokosi
post 12.10.2010, 11:15:16
Post #9





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

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


mozecie napisac jak ten kod ma wygladac zeby dzialalo?
Go to the top of the page
+Quote Post
Fifi209
post 12.10.2010, 11:22:59
Post #10





Grupa: Zarejestrowani
Postów: 4 655
Pomógł: 556
Dołączył: 17.03.2009
Skąd: Katowice

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


Cytat(Mackos @ 12.10.2010, 11:49:23 ) *
Nie przeczytałem całego kodu

To czytaj cały, to co napisałeś jest zupełną nieprawdą, gdyż pod tym kodem jest:
  1. mysql_query($query) or die(mysql_error());

więc wszystko działa.

@do autora
Jeszcze raz: WRZUĆ KOD W BBCODE
Podaj adres jaki wpisałeś w przeglądarce, aby przetestować plik.


--------------------
Zainteresowania: C#, PHP, JS, SQL, AJAX, XML, C dla AVR
Chętnie pomogę, lecz zanim napiszesz: Wujek Google , Manual PHP
Go to the top of the page
+Quote Post
lokokosi
post 12.10.2010, 12:52:54
Post #11





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

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


LOGIN.HTML

  1.  
  2. <form name="login" method="post" action="login.php">
  3. <table border="0" width="225" align="center">
  4. <tr>
  5. <td width="219" bgcolor="#999999">
  6. <p align="center"><font color="white"><span style="font-size:12pt;"><b>Login</b></span></font></p>
  7. </td>
  8. </tr>
  9. <tr>
  10. <td width="219">
  11. <table border="0" width="220" align="center">
  12. <tr>
  13. <td width="71"><span style="font-size:10pt;">Username:</span></td>
  14. <td width="139"><input type="text" name="username"></td>
  15. </tr>
  16. <tr>
  17. <td width="71"><span style="font-size:10pt;">Password:</span></td>
  18. <td width="139"><input type="password" name="password"></td>
  19. </tr>
  20. <tr>
  21. <td width="71">&nbsp;</td>
  22. <td width="139">
  23. <p align="right"><input type="submit" name="submit" value="Submit"></p>
  24. </td>
  25. </tr>
  26. </table>
  27. </td>
  28. </tr>
  29. <tr>
  30. <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>
  31. </tr>
  32. </form>
  33.  
  34.  
  35.  
  36.  



login.php


  1. login.php
  2.  
  3.  
  4.  
  5.  
  6. <?php
  7.  
  8. //Database Information
  9.  
  10. $dbhost = "localhost";
  11. $dbname = "your database name";
  12. $dbuser = "username";
  13. $dbpass = "yourpass";
  14.  
  15. //Connect to database
  16.  
  17. mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
  18.  
  19. $username = $_POST[&#8216;username’];
  20. $password = md5($_POST[&#8216;password’]);
  21.  
  22. $query = &#8220;select * from users where username=’$username’ and password=’$password’”;
  23.  
  24. $result = mysql_query($query);
  25.  
  26. if (mysql_num_rows($result) != 1) {
  27. $error = &#8220;Bad Login”;
  28. include &#8220;login.html”;
  29.  
  30. } else {
  31. $_SESSION[&#8216;username’] = “$username”;
  32. include &#8220;memberspage.php”;
  33. }
  34.  
  35. ?>
  36.  


register.html

  1.  
  2. <form name="login" method="post" action="register.php">
  3. <table border="0" width="225" align="center">
  4. <tr>
  5. <td width="219" bgcolor="#999999">
  6. <p align="center"><font color="white"><span style="font-size:12pt;"><b>Registration</b></span></font></p>
  7. </td>
  8. </tr>
  9. <tr>
  10. <td width="219">
  11. <table border="0" width="282" align="center">
  12. <tr>
  13. <td width="116"><span style="font-size:10pt;">Name:</span></td>
  14. <td width="156"><input type="text" name="name" maxlength="100"></td>
  15. </tr>
  16. <tr>
  17. <td width="116"><span style="font-size:10pt;">Email:</span></td>
  18. <td width="156"><input type="text" name="email" maxlength="100"></td>
  19. </tr>
  20. <tr>
  21. <td width="116"><span style="font-size:10pt;">Username:</span></td>
  22. <td width="156"><input type="text" name="username"></td>
  23. </tr>
  24. <tr>
  25. <td width="116"><span style="font-size:10pt;">Password:</span></td>
  26. <td width="156"><input type="password" name="password"></td>
  27. </tr>
  28. <tr>
  29. <td width="116">&nbsp;</td>
  30. <td width="156">
  31. <p align="right"><input type="submit" name="submit" value="Submit"></p>
  32. </td>
  33. </tr>
  34. </table>
  35. </td>
  36. </tr>
  37. <tr>
  38. <td width="219" bgcolor="#999999">&nbsp;</td>
  39. </tr>
  40. </form>
  41.  
  42.  


register.php


  1. <?PHP
  2.  
  3. //Database Information
  4.  
  5. $dbhost = "localhost";
  6. $dbname = "your database name";
  7. $dbuser = "username";
  8. $dbpass = "yourpass";
  9.  
  10. //Connect to database
  11.  
  12. mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
  13.  
  14.  
  15. $name = $_POST['name'];
  16. $email = $_POST['email'];
  17. $username = $_POST['username'];
  18. $password = md5($_POST['password']);
  19.  
  20. // lets check to see if the username already exists
  21.  
  22. $checkuser = mysql_query("SELECT username FROM users WHERE username='$username'");
  23.  
  24. $username_exist = mysql_num_rows($checkuser);
  25.  
  26. if($username_exist > 0){
  27. echo "I'm sorry but the username you specified has already been taken. Please pick another one.";
  28. unset($username);
  29. include 'register.html';
  30. exit();
  31. }
  32.  
  33. // lf no errors present with the username
  34. // use a query to insert the data into the database.
  35.  
  36. $query = "INSERT INTO users (name, email, username, password)
  37. VALUES('$name', '$email', '$username', '$password')";
  38. mysql_query($query) or die(mysql_error());
  39.  
  40. echo "You have successfully Registered";
  41.  
  42. // mail user their information
  43.  
  44. $yoursite = &#8216;www.blahblah.com’;
  45. $webmaster = &#8216;yourname’;
  46. $youremail = &#8216;youremail’;
  47.  
  48. $subject = "You have successfully registered at $yoursite...";
  49. $message = "Dear $name, you are now registered at our web site.
  50. To login, simply go to our web page and enter in the following details in the login form:
  51. Username: $username
  52. Password: $password
  53.  
  54. Please print this information out and store it for future reference.
  55.  
  56. Thanks,
  57. $webmaster";
  58.  
  59. mail($email, $subject, $message, "From: $yoursite <$youremail>\nX-Mailer:PHP/" . phpversion());
  60.  
  61. echo "Your information has been mailed to your email address.";
  62.  
  63. ?>
  64.  




  1.  
  2. CREATE TABLE users (
  3. userid int(25) NOT NULL AUTO_INCREMENT,
  4. name varchar(25) NOT NULL DEFAULT '',
  5. email varchar(255) NOT NULL DEFAULT '',
  6. username varchar(25) NOT NULL DEFAULT '',
  7. password varchar(255) NOT NULL DEFAULT '',
  8. PRIMARY KEY (userid),
  9. UNIQUE KEY username (username)
  10. ) TYPE=MyISAM COMMENT='Members';
  11.  
  12.  
  13.  
  14.  
  15.  


potrafi ktos to zrobic? dry.gif
Go to the top of the page
+Quote Post
Fifi209
post 12.10.2010, 13:32:12
Post #12





Grupa: Zarejestrowani
Postów: 4 655
Pomógł: 556
Dołączył: 17.03.2009
Skąd: Katowice

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


Cytat(fifi209 @ 12.10.2010, 12:22:59 ) *
@do autora
Podaj adres jaki wpisałeś w przeglądarce, aby przetestować plik.


Kolego a potrafisz czytać? Bo mi się czasem wydaje będąc w tym temacie, iż piszę w obcym, kompletnie niezrozumiałym dla Ciebie języku.

Jeżeli prosisz o pomoc, staraj się nie tyle zadać pytanie, co odpowiadać na zadane przez Nas pytania.

Ten post edytował fifi209 12.10.2010, 13:33:08


--------------------
Zainteresowania: C#, PHP, JS, SQL, AJAX, XML, C dla AVR
Chętnie pomogę, lecz zanim napiszesz: Wujek Google , Manual PHP
Go to the top of the page
+Quote Post
lokokosi
post 12.10.2010, 13:50:22
Post #13





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

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


nie umiescilem tego jescze na serwerze. bo niedizala.chyba oczywiste dry.gif

napewno macie pelno takich przykladow i zamiast je dac to marnujecie swoj i moj czas!

Ok zaplace 20 Funtow na konto paypal osobie ktora przesle mi :
DZIALAJACA!!!!

-Forme rejestracji (zeby byl obrazek ktory nazely przepisac,wramach anty spamu)
-logowania
-wylogowania
-przypomnienia hasla
-podczas rejestracji musi zostac zaznaczona opcja Akceptuje Regulamin
-oraz po zalogowaniu opcja dodaj foto(podczas dodawania zeby byl obrazek nazely przepisac,wramach anty spamu)
-i zrobila wszystko z mysql zeby dzialo!
w polu rejestracji: tylko pola nazwa urzytkownika i haslo (bylo by super gdyby sprawdzal czy nazwa jest dostepna)



moj email: carolkarol20@gmail.com
Go to the top of the page
+Quote Post
Fifi209
post 12.10.2010, 13:51:48
Post #14





Grupa: Zarejestrowani
Postów: 4 655
Pomógł: 556
Dołączył: 17.03.2009
Skąd: Katowice

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


Cytat(lokokosi @ 12.10.2010, 14:50:22 ) *
nie umiescilem tego jescze na serwerze. bo niedizala.chyba oczywiste dry.gif

Przepraszam, to jak to testujesz?


--------------------
Zainteresowania: C#, PHP, JS, SQL, AJAX, XML, C dla AVR
Chętnie pomogę, lecz zanim napiszesz: Wujek Google , Manual PHP
Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 24.07.2025 - 15:40