ziedinjsh
Reģistrētie lietotāji-
Posts
789 -
Joined
-
Last visited
Everything posted by ziedinjsh
-
Paldies waplet :)
-
es jau štukoju.. mošk kodā nav kaut kas vai arī ar seozām :? <?php $status = (isset($_GET['status'])) ? $_GET['status'] : ''; if(isset($_POST['login'])){ $email = strip_tags($_POST['email']); $password = strip_tags($_POST['password']); $query = sprintf("SELECT ID FROM users WHERE email = '%s' AND password = '%s' LIMIT 1;", mysql_real_escape_string($email), md5($password)); $result = mysql_query($query) or die(mysql_error); if(mysql_num_rows($result) != 1){ echo "<span style='color:#ff0000'>bad login</span>"; }else{ $row = mysql_fetch_assoc($result); $_SESSION['user_ID'] = $row['ID']; } } echo "<form method='post' action='".$_SERVER['PHP_SELF']."'>"; echo "<table><tr>"; echo "<td>email</td><td><input type='text' name='email'></td>"; echo "</tr><tr>"; echo "<td>password</td><td><input type='password' name='password'></td>"; echo "</tr><tr>"; echo "<td></td><td><input type='submit' name='login' value='Login'></td>"; echo "</tr><tr>"; echo "<td><a href='register.php'>Register?</a></td><td><a href='lost.php'>Lost password?</a></td>"; echo "</tr></table>"; ?>
-
Vēljoprojām nevaru saprast kapēc ielogojas tikai 2 x nospiežot login pogu
-
nu ok.. tagadir šādi <?php include "misc/config.php"; include "header.php"; include "left.php"; $result = mysql_query("SELECT * FROM users ORDER BY id DESC"); while($data = mysql_fetch_array($result)) { if(isset ($_GET['id'])) { $id = $_GET['id']; $query= mysql_query("delete FROM users where id =$id")or die(mysql_error()); } echo "<form method='post' action='".$_SERVER['PHP_SELF']."'>"; echo "<table><tr>"; echo "<td>username</td><td>".$data['username']."</td>"; echo "</tr><tr>"; echo "<td>email</td><td>".$data['email']."</td>"; echo "</tr></table>"; echo "".$data['id'].""; echo "<a href='users.php?page=delete&id=".$data['id']."'>delete user</a>"; echo "</form>"; echo "<hr>"; } include "footer.php"; ?> kods strādā, bet tikai ja spiez uz linka 2x.. vienreiz nospiež nekas nenotiek.. pārlādējas tikai lapa, bet kad nospiež otro reizi tad izdzēš.. kapēc tā?
-
nesaprotu kapēc rāda šadu notici: Notice: Undefined index: users in /home/produc/public_html/mp3/1/admin/users.php on line 12 Notice: Use of undefined constant delete - assumed 'delete' in /home/produc/public_html/mp3/1/admin/users.php on line 12 users.php: <?php include "misc/config.php"; include "header.php"; include "left.php"; $result = mysql_query("SELECT * FROM users ORDER BY id DESC"); while($data = mysql_fetch_array($result)) { if($_GET["users"]==delete) { $sql = "DELETE FROM users WHERE id=$id"; $result = mysql_query($sql); echo "User deleted!"; } echo "<form method='post' action='index.php?page=users'>"; echo "<table><tr>"; echo "<td>username</td><td>".$data['username']."</td>"; echo "</tr><tr>"; echo "<td>email</td><td>".$data['email']."</td>"; echo "</tr></table>"; echo "".$data['id'].""; echo "<a href='users.php?page=delete&id=".$data['id']."'>delete user</a>"; echo "</form>"; echo "<hr>"; } include "footer.php"; ?> kapēc rodas šāda notice un kapēc nedzēš?
-
Paldies! Šis strādā! Vienīgi tagad nospiež vienu reizi login pogu viņš neielogojās.. ielogojās tikai ar otro reizi kad nospiež pogu kas varētu būt pa vainu? :?
-
logout izskatās sādi <?php header("Location:../index.php"); session_destroy(); ?> bet nu met topašu ārā
-
tā, to atpazīšanu uztaīsīju.. laikam, ka strādā if ($_SESSION['user_ID']){ include "user/profile.php"; }else{ include "user/login.php"; }
-
jā tikoes arī par to aizdomājos.. pieliku session_start(); un aizgāja Paldies! :) uztaisīju logout.php bet bet kad meoģinu izlogoties parāda šādu Warning: session_destroy() [function.session-destroy]: Trying to destroy uninitialized session in /home/produc/public_html/mp3/1/logout.php on line 2 Warning: Cannot modify header information - headers already sent by (output started at /home/produc/public_html/mp3/1/logout.php:2) in /home/produc/public_html/mp3/1/logout.php on line 3 logout.php: <?php session_destroy(); header("Location:index.php"); ?> betman liekas, ka kkas trūkst :D un kāds varētu izskatīties kods kurš atpazīst vai ir ielogojies vai nē.. piem man ir šādi: <div id='left'> include "login.php"; include "profile.php"; </div> protams, ka rādīsies abi divi, bet kā varētu panāk sādu efektu: <div id='left'> if(member){ include "profile.php"; }else{ include "login.php"; }
-
nop Notice: Undefined variable: _SESSION in /home/produc/public_html/mp3/1/profile.php on line 9 bet kapēc tā
-
jā, man ir username tabula.. iekš user man ir username, email. password, date
-
login.php <?php session_start(); include "misc/config.php"; $status = (isset($_GET['status'])) ? $_GET['status'] : ''; if(isset($_POST['login'])){ $email = strip_tags($_POST['email']); $password = strip_tags($_POST['password']); $query = sprintf("SELECT ID FROM users WHERE email = '%s' AND password = '%s' LIMIT 1;", mysql_real_escape_string($email), md5($password)); $result = mysql_query($query) or die(mysql_error); if(mysql_num_rows($result) != 1){ header('Location: login.php?status=error'); }else{ $row = mysql_fetch_assoc($result); $_SESSION['user_ID'] = $row['ID']; header('Location: profile.php'); } } if ($status == 'error'){ echo "<span style='color:#ff0000'>bad login</span>"; } echo "<form method='post' action='".$_SERVER['PHP_SELF']."'>"; echo "<table><tr>"; echo "<td>email</td><td><input type='text' name='email'></td>"; echo "</tr><tr>"; echo "<td>password</td><td><input type='password' name='password'></td>"; echo "</tr><tr>"; echo "<td></td><td><input type='submit' name='login' value='Login'>"; echo "</tr></table>"; ?> tātad sanāk ka vajadzētu izskatīties šadi: $_SESSION['user_ID'] jo iekš login.php ir šādi: $_SESSION['user_ID'] = $row['ID']; Šādi man izskatās profiles.php: <?php include "misc/config.php"; $result = mysql_query("SELECT * FROM users WHERE username= '{$_SESSION['user_ID']}'"); while($data = mysql_fetch_array($result)) { echo "<table><tr>"; echo "<td>username</td><td>".$data['username']."</td>"; echo "</tr><tr>"; echo "<td>email</td><td>".$data['email']."</td>"; echo "</tr></table>"; echo "".$data['id'].""; echo "<hr>"; } ?> ielogojoties man parādās tukša lapa
-
man uz sesijām.. kas tad man ir jāmaina šajā? SELECT * FROM users ORDER BY id DESC
-
Paldies waplet, aizgāja, bet kā tagad, lai es izdaru tā: ielogojoties man aizmet uz lapu profiles.. tur parādās visi reģistrētie profili, bet kas man jādara lau parādītos tikai tas profils kurā es ielogojos un darbības notiktu tikai ar to profilu.. nu kā lietotājam kurš ir ielogojies? profiles.php: <?php include "misc/config.php"; $result = mysql_query("SELECT * FROM users ORDER BY id DESC"); while($data = mysql_fetch_array($result)) { echo "<table><tr>"; echo "<td>username</td><td>".$data['username']."</td>"; echo "</tr><tr>"; echo "<td>email</td><td>".$data['email']."</td>"; echo "</tr></table>"; echo "".$data['id'].""; echo "<hr>"; } ?> kā varētru izveidot kko šādu: if (member) { echo "te rādās viskautkas tike prekš reģistrētiem"; } else { echo "viesiem"; } //viesiem if (guest){ echo "kkas viesiem tikai, ko neredz reģistreeti"; }
-
tad sanāk ka šai rindiņai ir jāizskatās šadi? $query = sprintf("SELECT ID FROM users WHERE email = '$email' '%s' AND password = '$password' '%s' LIMIT 1;", mysql_real_escape_string($email), md5($password));
-
meoģinot ielogoties izmet error ziņu Bad login
-
Sveiki! Šāds ir reģistrēšanas kods: <?php include "misc/config.php"; $submit = $_POST['register']; //Savāc datus $username = strip_tags($_POST['username']); $email = strip_tags($_POST['email']); $password = strip_tags($_POST['password']); $password2 = strip_tags($_POST['password2']); $date = date("y-m-d"); if ($submit) { //Paarbauda vai nav tuksh if($username&&$email&&$password&&$password2) { if($password==$password2) { //parbaudiis useranme un email garumu if(strlen($username)>50||strlen($email)>50) { echo "Lenght of username or/and email is too long!"; } else { //paarbauda password garumu if (strlen($password)>20||strlen($password)<6) { echo "Password must be between 6 and 20 characters!"; } else { //Registreet lietotaaju // nokodee password ar md5 $password = md5($password); $password2 = md5($password); $query = mysql_query("INSERT INTO users VALUES ('','$username','$email','$password','$date') "); die("You hav been registred!"); } } } else echo "Your password do not match!"; } else echo "Please fill all feilds!"; } /// echo "<form method='post' action='".$_SERVER['PHP_SELF']."'>"; echo "<table>"; echo "<tr>"; echo "<td>username</td><td><input type='text' name='username' value='$username'></td>"; echo "</tr><tr>"; echo "<td>email</td><td><input type='email' name='email' value='$email'></td>"; echo "</tr><tr>"; echo "<td>password</td><td><input type='password' name='password'></td>"; echo "</tr><tr>"; echo "<td>password2</td><td><input type='password' name='password2'></td>"; echo "</tr><tr>"; echo "<td></td><td><input type='submit' name='register' value='register'></td>"; echo "</tr>"; echo "</table>"; echo "</form>"; ?> Kods strādā.. datus ievada iekš mysql.. izvadot datus viss parādās.. Es nevaru ielogotes!! šāds ir ielogošanās kods: <?php session_start(); include "misc/config.php"; $status = (isset($_GET['status'])) ? $_GET['status'] : ''; if(isset($_POST['login'])){ $email = strip_tags($_POST['email']); $password = strip_tags($_POST['password']); $query = sprintf("SELECT ID FROM users WHERE email = '$email' AND password = '$password' LIMIT 1;", mysql_real_escape_string($email), md5($password)); $result = mysql_query($query) or die(mysql_error); if(mysql_num_rows($result) != 1){ header('Location: login.php?status=error'); }else{ $row = mysql_fetch_assoc($result); $_SESSION['user_ID'] = $row['ID']; header('Location: login.php?status=done'); } } if ($status == 'error'){ echo "<span style='color:#ff0000'>bad login</span>"; } echo "<form method='post' action='".$_SERVER['PHP_SELF']."'>"; echo "<table><tr>"; echo "<td>email</td><td><input type='text' name='email'></td>"; echo "</tr><tr>"; echo "<td>password</td><td><input type='password' name='password'></td>"; echo "</tr><tr>"; echo "<td></td><td><input type='submit' name='login' value='Login'>"; echo "</tr></table>"; if($status == 'done'){ echo "Welcome to member eare"; } ?> Kas man nav pareizi? vai kāds lūdzu nevarētu izlabot vai pielabot?
-
Šāds ir kods: <?php error_reporting(E_ALL); include "misc/config.php"; if (isset($_POST['get_photo'])) { // faila detaljas $p_name = $_FILES["photo"]["name"]; $p_type = $_FILES["photo"]["type"]; $p_size = $_FILES["photo"]["size"]; $p_temp = $_FILES["photo"]["tmp_name"]; $p_error = $_FILES["photo"]["error"]; $p_date = date("Y-m-d"); $p_time = time("H:i:s"); if($p_error > 0) die ("photo culd not uploaded! Code: $p_error"); else { //Faila nosaciijumi if($p_type == "application/octet-stream" || $p_size >3145728) { die("this format is not allowed or file is to big"); } else { $query = mysql_query("INSERT INTO photos (p_name, p_type, p_size, p_date, p_time) VALUES ('$p_name','$p_type','$p_size','$p_date', 'p_time') "); move_uploaded_file($p_temp,"uploads/".$p_name); echo "photo uploaded!"; } } } echo "<form method='post' action='".$_SERVER['PHP_SELF']."' enctype='multipart/form-data'>"; echo "<input type='file' name='photo'>"; echo "<input type='submit' value='Upload' name='get_photo'>"; echo "</form>"; ?> viņš augšupielādē bildi iek uploads foldera.. un ieliek datus iekš mysql. Tātad.. Kā varētu uztaisīt tā kad augšupielādējas bilde un arī taj pašai bildei izveidojas thumbnail iekš uploads/small
-
atkal jautājums.. kā tagad es augšupielādejot bildi man vēl uztaisās thumbnail citā folderā?
-
it kā jau nemet.. jo no no text formām infomāciju ievada Tagad pievienojās
-
nevienu scriptu neizdodas palaist.. tiešman vav kaut kāds vienkārs upload scripts kurš atļauj tikai bilžu fomātus augšupielādēt un ieliek datus iekš db lai pēc tam var izvilkt tās bildes kkur?
-
Sveiki. Šādi izskatās kods: <?php include "misc/config.php"; if (isset($_POST['get_photo'])) { // faila detaljas $p_name = $_FILES["photo"]["name"]; $p_type = $_FILES["photo"]["type"]; $p_size = $_FILES["photo"]["size"]; $p_temp = $_FILES["photo"]["tmp_name"]; $p_error = $_FILES["photo"]["error"]; $p_date = date("y-m-d"); if($p_error > 0) die ("photo culd not uploaded! Code: $p_error"); else { //Faila nosaciijumi if($p_type == "application/octet-stream" || $p_size >3145728) { die("this format is not allowed or file is to big"); } else { $query = mysql_query("INSERT INTO photos (p_name, p_type, p_size, p_date) VALUES ('','$p_name','$p_type','$p_size','$p_date') "); move_uploaded_file($p_temp,"uploads/".$p_name); echo "photo uploaded!"; } } } echo "<form method='post' action='".$_SERVER['PHP_SELFE']."' enctype='multipart/form-data'>"; echo "<input type='file' name='photo'>"; echo "<input type='submit' value='Upload' name='get_photo'>"; echo "</form>"; ?> failu viņš augšupielādē, bet informāciju datubāzē neieliek.. kas nav pareizi? kur man jālike md5(); funkcija lai augšupielādējot faili viņš būtu nokodēts ar md5(); un paliktu faila formāts? meiģināju šādi: $p_name = md5($_FILES["photo"]["name"]); failu viņš nokodēja ar md5 bet fomāts galā nebija varbūt ir kāds gatavs kods kur datus ieliek mysql un var augšupielādēt tikai bilžu failus ar md5(); funkciju?
-
provēju jau..skatījos tur tās figūriekavas.. kur ir + un - bet es nesaprotu kā es varu zināt kad ķēde noslēdas un kur nē
-
viss man ir melns un line skaitļi ir sarkani.. nekur zils nav :|