Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
pliz help

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side
View previous topic :: View next topic  
Author Message
liban0n



Joined: 10 Feb 2004
Posts: 128
Location: Dubrovnik, Zagreb

PostPosted: 10.02.2004 13:59    Post subject: pliz help Add user to your forum ignore list Reply with quote

HI!

Javljam se jer fakat vise kose cupam sa kodom!
This is the problem!

Prvi kod cupa iz baze vec unesene podatke!
Pocetnik sam u php-u pa sam malko neke opcije prilagodjavao da meni bude lakse .. mozda ce vam se ciniti cudnima ali barem meni je olaksavalo

Kod prvi :

Code:

<?php
include ("config.php");
mysql_pconnect("localhost", "$db_name1", "$db_pass");
mysql_select_db("$db_name") or die ("Unable to select database");
$result=mysql_query("SELECT * from korisnici where namef='$moj1'") or die ("Nisam mogao izvrsiti query u bazu!");
while (($myrow = mysql_fetch_row($result)))
{
printf ("<table border=1>\n");
printf ("<tr><td>Korisnik</td><td>Trenutni podatci</td>\n");
printf ('<tr><td>%s</td>', 'Ime i Prezime');
printf ("<td><input type=text value='$myrow[0]'></td>");
$myrow[0] = $name;
printf ('<tr><td>%s</td>', 'Ime firme:');
printf ("<td><input type=text value='$myrow[1]'></td>");
$myrow[1] = $namef;
printf ('<tr><td>%s</td>', 'Podatci:');
printf ("<td><input type=text value='$myrow[2]'></td>");
$myrow[2] = $pod;
printf ('<tr><td>%s</td>', 'Objekt:');
printf ("<td><input type=text value='$myrow[3]'></td>");
$myrow[3] = $objekt;
printf ('<tr><td>%s</td>', 'Mjesto:');
printf ("<td><input type=text value='$myrow[4]'></td>");
$myrow[4] = $mjesto;
printf ('<tr><td>%s</td>', 'Adresa:');
printf ("<td><input type=text value='$myrow[5]'></td>");
$myrow[5] = $adresa;
printf ('<tr><td>%s</td>', 'Drzava:');
printf ("<td><input type=text value='$myrow[6]'></td>");
$myrow[6] = $state;
printf ('<tr><td>%s</td>', 'Hardware');
printf ("<td><input type=text value='$myrow[7]'></td>");
$myrow[7] = $hardware;
printf ('<tr><td>%s</td>', 'CPU:');
printf ("<td><input type=text value='$myrow[8]'></td>");
$myrow[8] = $cpu;
printf ('<tr><td>%s</td>', 'RAM:');
printf ("<td><input type=text value='$myrow[9]'></td>");
$myrow[9] = $ram;
printf ('<tr><td>%s</td>', 'HDD:');
printf ("<td><input type=text value='$myrow[10]'></td>");
$myrow[10] = $hdd;
printf ('<tr><td>%s</td>', 'Ploca:');
printf ("<td><input type=text value='$myrow[11]'></td>");
$myrow[11] = $ploca;
printf ('<tr><td>%s</td>', 'Monitor:');
printf ("<td><input type=text value='$myrow[12]'></td>");
$myrow[12] = $monitor;
printf ('<tr><td>%s</td>', 'Printer:');
printf ("<td><input type=text value='$myrow[13]'></td>");
$myrow[13] = $pr;
printf ('<tr><td>%s</td>', 'OS:');
printf ("<td><input type=text value='$myrow[14]'></td>");
$myrow[14] = $os;
printf ('<tr><td>%s</td>', 'Kernel:');
printf ("<td><input type=text value='$myrow[15]'></td>");
$myrow[15] = $ker;
printf ('<tr><td>%s</td>', 'Baza:');
printf ("<td><input type=text value='$myrow[16]'></td>");
$myrow[16] = $baza;
printf ('<tr><td>%s</td>', 'Verzija programa:');
printf ("<td><input type=text value='$myrow[17]'></td>");
$myrow[17] = $verzijap;
printf ('<tr><td>%s</td>', 'Datum posjete:');
printf ("<td><input type=text value='$myrow[18]'></td>");
$myrow[18] = $dat;
printf ("</table>\n");
}
?>


Ovo je otprilike to!
Ovdje izvlacim vec postojece informacije od korisniku i zelio bi tu napraviti izmjene u vrijednostima.
E kad promjenim tj. nakon submita poziva funkciju :

Code:

<?php
include "config.php";
$mysql_link = mysql_pconnect("localhost", $db_name1, $db_pass);
mysql_select_db("$db_name") or die ("Unable to select database");
$insert = ("UPDATE korisnici set name='$_POST[name]' and namef='$_POST[namef]' and pod='$_POST[pod]' and objekt='$_POST[objekt]' and mjesto='$_POST[mjesto]' and adresa='$_POST[adresa]' and state='$_POST[state]' and hardware='$_POST[hardware]' and cpu='$_POST[cpu]' and ram='$_POST[ram]' and hdd='$_POST[hdd]' and ploca='$_POST[ploca]' and monitor='$_POST[monitor]' and pr='$_POST[pr]' and os='$_POST[os]' and ker='$_POST[ker]' and baza='$_POST[baza]' and verzijap='$_POST[verzijap]' and dat='$_POST[dat]' where namef='$_POST[moj1]'");
$result = mysql_query ($insert, $mysql_link) or die ("Nisam mogao unjeti u bazu");
echo "Over and out";
?>


Ne javlja mi nista .. tj. zbunjujuce neznam zasot mi nikakve varijable ne prenosi na update.html

pokusao sam sa $HTTP_POST_VARS ali nista!

Pomoc!!
Znam da negdje grijesim ali nisam siguran gdje!

Hvala unaprijed!

_________________
mount -t swap /dev/brain /mnt/head
look'n for a job
Back to top
View user's profile Send private message Visit poster's website
maxy



Joined: 07 Sep 2003
Posts: 894
Location: Zagreb

PostPosted: 10.02.2004 14:33    Post subject: Add user to your forum ignore list Reply with quote

fali ti <form> tag i nemas name tag kod <input> kucica...
Back to top
View user's profile Send private message
liban0n



Joined: 10 Feb 2004
Posts: 128
Location: Dubrovnik, Zagreb

PostPosted: 10.02.2004 15:02    Post subject: Add user to your forum ignore list Reply with quote

Hvala!
Koliko sam beljio i nikako da vidim tu sitnicu!!!

Hvala ti puno .. idem odmah provjeriti ! Smile

_________________
mount -t swap /dev/brain /mnt/head
look'n for a job
Back to top
View user's profile Send private message Visit poster's website
liban0n



Joined: 10 Feb 2004
Posts: 128
Location: Dubrovnik, Zagreb

PostPosted: 10.02.2004 15:25    Post subject: Add user to your forum ignore list Reply with quote

ok .. sada i prodje ali opet mi ne proslijedi vrijedno kako treba!
stavljao sam ovo :

$myrow[4] = $mjesto;

Da bih kasnije mogao izvlaciti preko $_POST['mjesto']
ali opet nista!
Nikako da ih izvucem!

Dok mi u $HTTP_POST_VARS ima informacija.
I naravno zbog toga ne ide i daljnje prosljedivanje u bazu!

_________________
mount -t swap /dev/brain /mnt/head
look'n for a job
Back to top
View user's profile Send private message Visit poster's website
maxy



Joined: 07 Sep 2003
Posts: 894
Location: Zagreb

PostPosted: 10.02.2004 16:11    Post subject: Add user to your forum ignore list Reply with quote

totalno si si zakomplicirao zivot sa ovom skriptom :>

imas par krucijalnih gresaka:
prvo, falio ti je form tag te name pod <input> , drugo - pod $_POST postavi navodnike u indekse, dakle $_POST['mjesto']; itd.

i posljednje, u mysql queryu postavi


("UPDATE korisnici set
name='$_POST[name]',
namef='$_POST[namef]',
pod='$_POST[pod]'
.
.
.

where namef='$_POST[moj1]'");

ja obicno prvoj provjerim $_POST i $_GET varijable sa mysql_real_escape_string i htmlspecialchars da se ne dogode pizdarije tipa sql injection attack itd.
btw. koji to php koristis (verziju)?
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group