Chapman Posted January 6, 2010 Report Share Posted January 6, 2010 (edited) esmu uztasījis vienkāršu ielogošanās sistēmu :) tagad vēlētos uzzināt kā var izveidot sublapas,kas atveras nevis ka jauna lapa, bet atverās piem. jau iekšh index.php izbeidotas tabulas un links ir piem. http://lapa.lv/?pg=sublapa kas tas ir, un kā darbojas tieši šis: ?pg= Edited January 6, 2010 by Chapman Quote Link to comment Share on other sites More sharing options...
Java Posted January 6, 2010 Report Share Posted January 6, 2010 Tas ir HTTP protokola pieprasījuma GET metodē pieprasīto datu fragments, kuru php "sapratīs" kā globālo mainīgo $_GET masīvā ar atslēgas nosaukumu tieši tādu pašu kā norādītais parametrs, respektīvi, $_GET['pg']. Quote Link to comment Share on other sites More sharing options...
Chapman Posted January 6, 2010 Author Report Share Posted January 6, 2010 Tas ir HTTP protokola pieprasījuma GET metodē pieprasīto datu fragments, kuru php "sapratīs" kā globālo mainīgo $_GET masīvā ar atslēgas nosaukumu tieši tādu pašu kā norādītais parametrs, respektīvi, $_GET['pg']. paldies :) centishos saprast :) Quote Link to comment Share on other sites More sharing options...
2easy Posted January 6, 2010 Report Share Posted January 6, 2010 Tas ir HTTP protokola pieprasījuma GET metodē pieprasīto datu fragments, kuru php "sapratīs" kā globālo mainīgo $_GET masīvā ar atslēgas nosaukumu tieši tādu pašu kā norādītais parametrs, respektīvi, $_GET['pg']. paldies :) centishos saprast :) normālā cilvēku valodā runājot, aiz "?" padod lapai paredzētos parametrus formātā nosaukums=vertiba&nosaukums2=vertiba2 php pusē šiem parametriem var piekļūt ar $_GET['nosaukums'], $_GET['nosaukums2'] http://php.net/manual/en/language.variables.superglobals.php konkrēti tavā gadījumā: pg - page (standarta saīsinājums vārdam "lapa") norealizēt var dažādi, piemēram: if (isset($_GET['pg']) && $_GET['pg'] == 'par-mums') { $sContent = '<h1>Par mums</h1><p>blablabla...</p>'; // vai ņem datus no db } // pēc tam šo $sContent izvada vajadzīgajā vietā, kur ir lapas kontents Quote Link to comment Share on other sites More sharing options...
Chapman Posted January 6, 2010 Author Report Share Posted January 6, 2010 nu es tagad sapratu - kas tas pg ir un ka to lietot :) bet uzreiz man rodas errori! nospiezo submit button, ka lai dabu, ka man atver nodefineto login_start? kods no index.php : if (isset($_POST['login_start'])){ // Connect to server and select databse. mssql_connect("$host", "$username", "$password")or die("cannot connect"); mssql_select_db("SecKeyPrior")or die("cannot select DB"); // username and password sent from form $f_name=$_POST['F_Name']; $s_name=$_POST['S_Name']; $pw=$_POST['passw']; // To protect MySQL injection (more detail about MySQL injection) $f_name = stripslashes($f_name); $s_name = stripslashes($s_name); $pw= stripslashes($pw); $sql="SELECT * FROM S_Users WHERE F_Name='$f_name' and S_Name='$s_name' and pw='$pw'"; $result=mssql_query($sql); // Mysql_num_row is counting table row $count=mssql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("f_name"); session_register("s_name"); session_register("pw"); header("location: ?pg=loggedin"); } else { echo "Vārds, Uzvārds un/vai parole nav pareiza!"; } login: <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <form name="login_form" method="post" action=""> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td colspan="3"><strong>Autorizācija</strong></td> </tr> <tr> <td width="78">Vards</td> <td width="6">:</td> <td width="294"><input name="F_Name" type="text" id="F_name"></td> </tr> <tr> <td width="78">Uzvards</td> <td width="6">:</td> <td width="294"><input name="S_Name" type="text" id="S_Name"></td> </tr> <tr> <td>Parole</td> <td>:</td> <td><input name="passw" type="text" id="passw"></td> </tr> <tr> <td> </td> <td> </td> <td> <input type="submit" value="Ielogoties" name=Login_start></td> </tr> </table> </td> </form> </tr> </table> nospiezot submit pogu, man atver http://manalapa.lv/login_start bet man vaig, lai izpilda to login_start, kas ir minēts index.php, un izpilda nosacījumus. Quote Link to comment Share on other sites More sharing options...
Java Posted January 6, 2010 Report Share Posted January 6, 2010 nospiezot submit pogu, man atver http://manalapa.lv/login_start bet man vaig, lai izpilda to login_start, kas ir minēts index.php, un izpilda nosacījumus. Ja vajag, lai izpilda "index.php", tad attiecīgajā html lapā, kur tev ir tā forma, tagam "form" norādi atribūtu "action", kura vērtība būs "index.php", protams pieliekot priekšā URI uz index.php atrašanos relatīvi tavam webrootam, ar nosacījumu, ka index.php neatrodas ārpus tavas webroot direktorijas. Quote Link to comment Share on other sites More sharing options...
Chapman Posted January 6, 2010 Author Report Share Posted January 6, 2010 (edited) viss aizgaja, bet atkal cits error :( Warning: session_register() [function.session-register]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\index.php:1) in C:\xampp\htdocs\index.php on line 34 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\index.php:1) in C:\xampp\htdocs\index.php on line 37 viss ok :) nodzesu ar hex editoru pirmos 3 simbolus un darbojas :) Edited January 6, 2010 by Chapman Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted January 6, 2010 Report Share Posted January 6, 2010 Es jau neko, bet ja jau tā ir tava prakse, tad varbūt pats cīnies? Vai arī izmanto savu prakses vadītāju. Quote Link to comment Share on other sites More sharing options...
2easy Posted January 6, 2010 Report Share Posted January 6, 2010 šis forums sit pušu jebkuru prakses vadītāju ^^ Quote Link to comment Share on other sites More sharing options...
Chapman Posted January 7, 2010 Author Report Share Posted January 7, 2010 ielogoshanos smuki uztaisiiju :) ar cookies :) tik ajutajums, ka var uztaisit, ka paroles input laikam, kad raksta paroli, tad rada *** nevis paroli? Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted January 7, 2010 Report Share Posted January 7, 2010 <input type="text"/> - rāda tekstu <input type="password"/> - rāda bumbulīšus Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted January 7, 2010 Report Share Posted January 7, 2010 Nabaga Ogre ar savu lapu :( Quote Link to comment Share on other sites More sharing options...
Chapman Posted January 7, 2010 Author Report Share Posted January 7, 2010 okey :) viss skaidrs :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.