Register for your free account! | Forgot your password?

You last visited: Today at 03:56

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[PHP Hilfe]

Discussion on [PHP Hilfe] within the Web Development forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jul 2011
Posts: 56
Received Thanks: 30
[PHP Hilfe]

Ich versuche gerade ein Login Script zu schreiben erhalte aber immer einen ERROR bei:

PHP Code:
$username $_post('username');
$username $_post('password'); 
damit ihr wisst wie ich es verwende:

config.php

PHP Code:
<?php
$dbname
="hwid";
$dbhost="localhost";
$dbuser="root";
$dbpass="mein pw";
mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname);
?>
index.php

PHP Code:
<form action="login.php" method="post">
  <
link rel="stylesheet" type="text/css" media="all" href="/index.css" />
  <
table border="0" height="80%" width="100%" cellspacing="0" cellpadding="2">
  <
td valign="center" align="center" >
  <
b>Username:</b><input type="text" name="username" id="username"></br>
  <
b>Password:</b><input type="password" name="password" id="password"></br>
  <
input type="submit" value="Login"></br>
</
form
login.php

PHP Code:
<?php
include ("config.php");
$username $_post('username');
$username $_post('password');
  
$sql "SELECT hwid FROM hwid WHERE username='$username' AND password='$password'";
  
$query mysql_query($sql);
  if (
mysql_num_rows($query)) {
  
header("Location: http://localhost/home.php");
  } else {
  
header("Location: http://localhost/index.php");
    }
?>
und in der MySQL Datenbank ist mein Benutzername eingetragen!
(=|=)NIKIBOY(=|=) is offline  
Old 10/11/2011, 07:26   #2
 
Snake124's Avatar
 
elite*gold: 30
Join Date: Aug 2006
Posts: 110
Received Thanks: 28
versuchs mal so

PHP Code:
<?
$username 
$_POST('username'); 
$username $_POST('password'); 
  
$sql "SELECT * FROM `hwid` WHERE `username`= '".$username."' AND `password` = '".$password."'"
  
$query mysql_query($sql);
  if(
$query){ 
      if (
mysql_num_rows($query)) { 
          
header("Location: http://localhost/home.php"); 
      } else { 
          
header("Location: http://localhost/index.php"); 
      }
  } else {
      die(
'Mysql Fehlernummer: '.mysql_errno().' - Meldung: '.mysql_error());
  }
?>
achja, offtopic:

deine passwörter werden ja anscheinend unverschlüsselt gespeichert...
grob fahrlässig nennt man das

mfg Aileen
Snake124 is offline  
Old 10/11/2011, 12:22   #3
 
elite*gold: 0
Join Date: Jul 2011
Posts: 56
Received Thanks: 30
die md5 funktion werde ich noch rein machen
bekomme aber nun einen neuen error wenn ich Login klicke

Habe noch
PHP Code:
include ("config.php"
eingetragen vor der username defination und der code sieht nun so ausin der:

login.php

PHP Code:
<?
include ("config.php")
$username $_POST('username');
$username $_POST('password');
  
$sql "SELECT * FROM `hwid` WHERE `username`= '".$username."' AND `password` = '".$password."'";
  
$query mysql_query($sql);
  if(
$query){
      if (
mysql_num_rows($query)) {
          
header("Location: http://localhost/home.php");
      } else {
          
header("Location: http://localhost/index.php");
      }
  } else {
      die(
'Mysql Fehlernummer: '.mysql_errno().' - Meldung: '.mysql_error());
  }
?>
Ich verstehe den error nicht der nun kommt:

Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\login.php on line 3
(=|=)NIKIBOY(=|=) is offline  
Old 10/11/2011, 12:38   #4
 
elite*gold: 59
Join Date: Jun 2007
Posts: 374
Received Thanks: 86
Der Fehler kommt weil du hinter dem include das Semikolon vergessen hast.

Sprich du hast das hier:
Code:
include ("config.php")
Was aber so aussehen muss:
Code:
include ("config.php");
See Ya!
Devil589 is offline  
Old 10/11/2011, 12:59   #5
 
elite*gold: 0
Join Date: Jul 2011
Posts: 56
Received Thanks: 30
Bekomme nun wieder eine neue meldung:

Code:
Fatal error: Function name must be a string in C:\xampp\htdocs\login.php on line 3
-.- ich glaube ich muss noch viel lernen!
(=|=)NIKIBOY(=|=) is offline  
Old 10/11/2011, 13:35   #6
 
NotEnoughForYou's Avatar
 
elite*gold: 0
Join Date: Jun 2010
Posts: 3,406
Received Thanks: 2,024
Kuck mal dein $_POST an. Es ist
PHP Code:
$_POST['ussername'
und nicht
PHP Code:
$_POST('username'
NotEnoughForYou is offline  
Old 10/11/2011, 15:10   #7

 
iKyroja :>'s Avatar
 
elite*gold: 20
Join Date: May 2010
Posts: 2,792
Received Thanks: 1,988
Quote:
Originally Posted by NotEnoughForYou View Post
Kuck mal dein $_POST an. Es ist
PHP Code:
$_POST['ussername'
und nicht
PHP Code:
$_POST('username'
Er hat Recht und wen dan schreib das $_POST gleich so :
PHP Code:
mysql_real_escape_string($_POST['username']) 
iKyroja :> is offline  
Old 10/11/2011, 23:26   #8
 
elite*gold: 0
Join Date: Jul 2011
Posts: 56
Received Thanks: 30
ok danke es funktioniert soweit!

nur in diesem befehl habe ich nich ein problem ich werde auf die index.php
weitergeleitet und nicht auf home.php also stimmt etwas noch nicht

wenn ich meine datenbank öffne und den code oben generiere bekomme ich:

PHP Code:
$sql "SELECT * FROM `hwid` LIMIT 0, 30 "
also sollte es so stimmen!

PHP Code:
$sql "SELECT * FROM `hwid` WHERE `username`= '".$username."' AND `password` = '".$password."'"
:

vll ist der vehler auch hier:

Code:
if($query){
      if (mysql_num_rows($query)) {
          [COLOR="red"]header("Location: http://localhost/home.php");[/COLOR]
      } else {
          [COLOR="red"]header("Location: http://localhost/index.php");[/COLOR]
      }
  } else {
      die('Mysql Fehlernummer: '.mysql_errno().' - Meldung: '.mysql_error());
  }
home.php ist die seite wo es hin soll wenn es erfolgreich war und index.php wenns nicht funktioniert hat damit der login versuch wiederholt wird

egal ob ich existierende login daten angebe oder nicht existierende ich werde
zu index.php geleitet
(=|=)NIKIBOY(=|=) is offline  
Old 10/11/2011, 23:47   #9
 
elite*gold: 42
Join Date: Jun 2008
Posts: 5,425
Received Thanks: 1,888
Code:
$username = $_POST('username');
$username = $_POST('password');
Kann so ja nicht klappen :>
MoepMeep is offline  
Old 10/11/2011, 23:56   #10
 
elite*gold: 0
Join Date: Jul 2011
Posts: 56
Received Thanks: 30
ok ich habe es jetzt geschaft funktioniert einwandfrei ich werde mich melden fals ich neue probleme habe!

Neues Problem:

PHP Code:
$username = ($_POST['username']); 
in der hwid_set.php dass funktioniert nicht ist ja auch klar aber wie bekommt
man es hin dass es funktioniert

hwid.php sieht so aus:

PHP Code:
<form action="hwid_set.php" method="post">
  <
link rel="stylesheet" type="text/css" media="all" href="/index.css" />
  <
table border="0" height="80%" width="100%" cellspacing="0" cellpadding="2">
  <
td valign="center" align="center" >
  <
b>HWID:</b><input type="text" name="hwid" id="hwid"></br>
  <
input type="submit" value="Set HWID"></br>
</
form
hwid_set.php sieht so aus:

PHP Code:
<?php
include ("config.php");
$username = ($_POST['username']);
$hwid = ($_POST['hwid']);
  
$ssql "UPDATE hwid SET hwid = '".$hwid."' WHERE username = '".$username."'";
.
.
?>
wie bekomme ich nun den usernamen in die hwid_set.php damit ich mit einem sql befehl in die bestimmte tabelle schreiben kann wo der username ist!
(=|=)NIKIBOY(=|=) is offline  
Old 10/12/2011, 03:14   #11


 
elite*gold: 0
Join Date: Sep 2008
Posts: 526
Received Thanks: 82
Du konntest z.b. Sessions benutzen und den Namen darin speichern
Mozo_ is offline  
Old 10/13/2011, 01:05   #12
 
elite*gold: 0
Join Date: Jul 2011
Posts: 56
Received Thanks: 30
vielen dank euch allen dank euch habe ich´s geschaft!
werde jetzt noch dass pw md5 verschlüsseln, die seiten
dank der session´s sichern und dann habe ich es fertig!

MfG: NIKIBOY
(=|=)NIKIBOY(=|=) is offline  
Reply


Similar Threads Similar Threads
Hilfe Hilfe Pls Gucken Brauche Hilfe
04/04/2010 - Technical Support - 3 Replies
Ja wegen der Signatur sieht es euch ma an in pics /http://img641.imageshack.us/img641/6070/unbenann t790kjkh.png http://img444.imageshack.us/img444/6981/unbenannt kjhghzuijhbh.png kann mir pls einer HELFEN...



All times are GMT +1. The time now is 03:56.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.