Jump to content
php.lv forumi

ziedinjsh

Reģistrētie lietotāji
  • Content Count

    789
  • Joined

  • Last visited

Posts posted by ziedinjsh


  1. Sveiki,

     

    Šāds ir logina scritps:

    <?php
    
    //Checks if there is a login cookie
    if(isset($_COOKIE['ID_my_site']))
    
    //if there is, it logs you in and directes you to the members page
    {
    $epasts = $_COOKIE['ID_my_site'];
    $pass = $_COOKIE['ID_my_site'];
    $check = mysql_query("SELECT * FROM users WHERE email = '$email'")or die(mysql_error());
    while($info = mysql_fetch_array( $check ))
    {
    if ($pass != $info['pass'])
    {
    }
    else
    {
    header("Location: index.php");
    
    }
    }
    }
    
    //if the login form is submitted
    if (isset($_POST['login'])) { // if form has been submitted
    
    // makes sure they filled it in
    if(!$_POST['email'] | !$_POST['pass']) {
    die('Aizpildi visus lauciņus.');
    }
    // checks it against the database
    
    if (!get_magic_quotes_gpc()) {
    $_POST['email'] = addslashes($_POST['email']);
    }
    $check = mysql_query("SELECT * FROM users WHERE email = '".$_POST['email']."'")or die(mysql_error());
    
    //Gives error if user dosen't exist
    $check2 = mysql_num_rows($check);
    if ($check2 == 0) {
    die('Šāds producents nav šeit reģistrējies');
    }
    while($info = mysql_fetch_array( $check ))
    {
    $_POST['pass'] = stripslashes($_POST['pass']);
    $info['pass'] = stripslashes($info['pass']);
    
    
    //gives error if the password is wrong
    
    if ($_POST['pass'] != $info['pass']) {
    die('Nepareiza parole.');
    }
    else
    {
    
    // if login is ok then we add a cookie
    $_POST['email'] = stripslashes($_POST['email']);
    $hour = time() + 60 * 60 * 3;
    setcookie('ID_my_site', $_POST['email'], $hour);
    setcookie('Key_my_site', $_POST['pass'], $hour);
    
    //then redirect them to the members area
    header("Location: index.php");
    }
    }
    }
    else
    {
    
    
    
    echo"<form name='login' method='post' action='index.php'>";
    echo"<table width='210' border='0' align='center' cellpadding='0' cellspacing='0' class='login'>
     <tr>
       <th align='right' scope='col'>e-pasts:</th>
       <th align='right' scope='col'>
         <input type='text' name='email' class='ltextbox'></th>
     </tr>
     <tr>
       <th align='right' scope='col'>parole:</th>
       <th align='right' scope='col'>
         <input type='password' name='pass' class='ltextbox'> </th>
     </tr>
     <tr>
       <th align='right' scope='col'> </th>
       <th align='right' scope='col'>
         <input type='submit' name='login' value='ieiet' class='lbutton'>   </th>
     </tr>
    </table>
    ";
    echo"</form>";
    
    }
    
    ?>

     

    Kad ielogojas tad vienalga var atvērt login.php scriptu.. lai gan viņam vajadzētu mest uz index.php

    sanāk tā ka lietotājs ielogojas, bet viņš nav ielogojies.. es īsti nesaprotu

     

    būtu vajadzīgs kaut kas tāds:

    if (user) {
    header("Location: index.php");
    }
    
    if (guest) {
    header ("Location: login.php");
    }
    

     

    Kaut kā tā, tikai nezinu kā īsti uztaisit to, jo logina scripts nav manis taisīts


  2. :) Laikam jau.. Headers already sent.. Tur arī iet run par par šām rindiņām:

    setcookie('ID_my_site', $_POST['email'], $hour);
    setcookie('Key_my_site', $_POST['pass'], $hour);
    
    //then redirect them to the members area
    header("Location: index.php");

    \

     

    Es nevaru saparast kur tad viņš pirmstam ir izvadījis..

     

     <?php
    error_reporting(E_ALL);
    ini_set("display_errors", 1);
    
    echo '<pre>';
    print_r($_POST);
    print_r($_GET);
    print_r($_COOKIE);
    echo '</pre>';
    
    include "misc/opendb.php";
    include "misc/functions.php";
    //Checks if there is a login cookie
    if(isset($_COOKIE['ID_my_site']))
    
    //if there is, it logs you in and directes you to the members page
    {
    $email = $_COOKIE['ID_my_site'];
    $pass = $_COOKIE['ID_my_site'];
    $check = mysql_query("SELECT * FROM users WHERE email = '$email'")or die(mysql_error());
    while($info = mysql_fetch_array( $check ))
    {
    if ($pass != $info['pass'])
    {
    }
    else
    {
    header("Location: index.php");
    
    }
    }
    }
    
    //if the login form is submitted
    if (isset($_POST['login'])) { // if form has been submitted
    
    
    // checks it against the database
    
    if (!get_magic_quotes_gpc()) {
    $_POST['email'] = addslashes($_POST['email']);
    }
    $check = mysql_query("SELECT * FROM users WHERE email = '".$_POST['email']."'")or die(mysql_error());
    
    //Gives error if user dosen't exist
    $check2 = mysql_num_rows($check);
    if ($check2 == 0) {
    die('ðâds producents nav ðeit reìistrçjies');
    }
    while($info = mysql_fetch_array( $check ))
    {
    $_POST['pass'] = stripslashes($_POST['pass']);
    $info['pass'] = stripslashes($info['pass']);
    
    
    //gives error if the password is wrong
    
    if ($_POST['pass'] != $info['pass']) {
    die('Nepareiza parole.');
    }
    else
    {
    
    // if login is ok then we add a cookie
    $_POST['email'] = stripslashes($_POST['email']);
    $hour = time() + 60 * 60 * 3;
    setcookie('ID_my_site', $_POST['email'], $hour);
    setcookie('Key_my_site', $_POST['pass'], $hour);
    
    //then redirect them to the members area
    header("Location: index.php");
    }
    }
    
    
    include "skin/header.php";
    include "skin/menu.php";
    
    echo '<table id="warp" align="center">';
    echo '<tr>';
    echo '<td id="left" valign="top">';
    echo '<div id="panel-left">';
    include "skin/left.php";
    echo '</div>';
    echo '</td>';
    echo '<td id="center" valign="top">';
    
    if ($set == '') {
    include "home/index.php";
    }
    if ($set == 'news') {
    include "news/index.php";
    }
    if ($set == 'music') {
    include "music/index.php";
    }
    if ($set == 'producers') {
    include "producers/index.php";
    }
    if ($set == 'register') {
    include "reg.php";
    }
    
    echo '</td>';
    echo '<td id="right" valign="top">';
    echo '<div id="panel-right">';
    include "skin/right.php";
    echo '</div>';
    echo '</td>';
    echo '</tr>';
    echo '</table>';
    
    include "skin/footer.php";
    
    }
    else
    {
    
    
    
    echo"<form name='login' method='post' action='index.php'>";
    echo"<table width='210' border='0' align='center' cellpadding='0' cellspacing='0' class='login'>
     <tr>
       <th align='right' scope='col'>e-pasts:</th>
       <th align='right' scope='col'>
         <input type='text' name='email' class='ltextbox'></th>
     </tr>
     <tr>
       <th align='right' scope='col'>parole:</th>
       <th align='right' scope='col'>
         <input type='password' name='pass' class='ltextbox'> </th>
     </tr>
     <tr>
       <th align='right' scope='col'> </th>
       <th align='right' scope='col'>
         <input type='submit' name='login' value='ieiet' class='lbutton'>   </th>
     </tr>
    </table>
    ";
    echo"</form>";
    
    }
    
    
    include "misc/closedb.php";
    ?>


  3. tā tad izvada logina informāciju parāda e-pastu, paroli un pogu

     

    echo '<pre>';
    print_r($_POST);
    print_r($_GET);
    print_r($_COOKIE);
    echo '</pre>';

     

    Viņam nepatīk kaut kas šijā:

     

    $_POST['email'] = stripslashes($_POST['email']);
    $hour = time() + 60 * 60 * 3;
    setcookie(ID_my_site, $_POST['email'], $hour);
    setcookie(Key_my_site, $_POST['pass'], $hour);
    
    //then redirect them to the members area
    header("Location: index.php");

     

    Use of undefined constant ID_my_site - assumed 'ID_my_site'

    Use of undefined constant Key_my_site - assumed 'Key_my_site'

     

    Šis arī ir iemesls droši vien kapēc uzpiežot uz kādu linku, viņš man atmet atpakaļ uz loginu


  4. ieejot lapā es vēlos lai ir redzams tikai login forma, piec ielogošanās atveras paša lapa

     

    <?php
    $con = mysql_connect("localhost","root","nls2236300");
    if (!$con)
    
     {
     die('Could not connect: ' . mysql_error());
     }
    mysql_select_db("pro");  
    
    //Checks if there is a login cookie
    if(isset($_COOKIE['ID_my_site']))
    
    //if there is, it logs you in and directes you to the members page
    {
    $epasts = $_COOKIE['ID_my_site'];
    $pass = $_COOKIE['ID_my_site'];
    $check = mysql_query("SELECT * FROM users WHERE email = '$email'")or die(mysql_error());
    while($info = mysql_fetch_array( $check ))
    {
    if ($pass != $info['pass'])
    {
    }
    else
    {
    header("Location: index.php");
    
    }
    }
    }
    
    //if the login form is submitted
    if (isset($_POST['login'])) { // if form has been submitted
    
    
    // checks it against the database
    
    if (!get_magic_quotes_gpc()) {
    $_POST['grupa'] = addslashes($_POST['grupa']);
    }
    $check = mysql_query("SELECT * FROM users WHERE email = '".$_POST['email']."'")or die(mysql_error());
    
    //Gives error if user dosen't exist
    $check2 = mysql_num_rows($check);
    if ($check2 == 0) {
    die('sheit taads lietotaajs nav');
    }
    while($info = mysql_fetch_array( $check ))
    {
    $_POST['pass'] = stripslashes($_POST['pass']);
    $info['pass'] = stripslashes($info['pass']);
    
    
    //gives error if the password is wrong
    
    if ($_POST['pass'] != $info['pass']) {
    die('Nepareiza parole.');
    }
    else
    {
    
    // if login is ok then we add a cookie
    $_POST['email'] = stripslashes($_POST['mail']);
    $hour = time() + 60 * 60 * 3;
    setcookie(ID_my_site, $_POST['epasts'], $hour);
    setcookie(Key_my_site, $_POST['pass'], $hour);
    
    //then redirect them to the members area
    header("Location: http://62.63.191.54/");
    }
    }
    
    echo 'Mana lapa';
    
    }
    else
    {
    
    
    
    echo"<form name='login' method='post' action='index.php'>";
    echo"<table width='210' border='0' align='center' cellpadding='0' cellspacing='0' class='login'>
     <tr>
       <th align='right' scope='col'>e-pasts:</th>
       <th align='right' scope='col'>
         <input type='text' name='epasts' class='ltextbox'></th>
     </tr>
     <tr>
       <th align='right' scope='col'>parole:</th>
       <th align='right' scope='col'>
         <input type='password' name='pass' class='ltextbox'> </th>
     </tr>
     <tr>
       <th align='right' scope='col'> </th>
       <th align='right' scope='col'>
         <input type='submit' name='login' value='ieiet' class='lbutton'>   </th>
     </tr>
    </table>
    ";
    echo"</form>";
    
    }
    
    
    
    ?>
    

     

    ieelogojoties man rāda ka šāds lietotājs nav!!

     

    un kā lai izvada tādu lietu kā piemēram:

     

    if (user) {
    echo 'kautkas';
    }
    else (guest) {
    header("Location: index.php");
    }
    


  5. Sveiki,

     

    Kādu laiku atpakaļ nic.lv reģistrēju domēnu, bet nebija kur viņu piesaistīt. Vakar iegādājos hostu www.dream-hosting.co.uk

     

    It kā es viņu piesaistīju pie sava domena, bet nu kad ievada domēnu parādas server not found un kad iekš CMD nopingoju parādas could not find host

     

    No hosta tika doti 4 nameservers, bet nic.lv mājas lapa varu tiaki it kā vienu piesaistīt


  6. Atkārtosu vēlreiz: Neredzot dzīvu lapu, neko nevar palīdzēt.

    Vidrīzāk tev kādā include tiek kaut kas izdrukāts, jo izskats ka pirms #header kaut kas ir.

     

     

    @waplet : ko tieši tas dotu ?

     

    es nezinu, jo neesmu progrmētājs.. Vnk tā bišķ māku parediģēt.. vairkak nedaudz zinu kaut ko no CSS un html..

     

    lapu var apskatīt šeit http://netmaniack.oo.lv/ uzliku uz citu serveri un vairāk tādu problēmu nav


  7. Neredzot dzīvu lapu, neko nevar palīdzēt.

    Visdrīzāk ka ir kļūda kaut kādā include'ā.

     

    Besides, kāda tieši jēga ir no šīm rindām ?

    $lv = '<img src="misc/lv.png">';
    $ru = '<img src="misc/ru.png">';
    $en = '<img src="misc/en.png">';
    echo '<div id="lang"><a href="?lang=lv">'.$lv.'</a> <a href="?lang=ru">'.$ru.'</a> <a href="?lang=en">'.$en.'</a></div>';

     

    no pirmajām 3 diži nekāda jēga nav, bet es jau pameiģināju šādi:

     

    echo '<div id="lang"><a href="?lang=lv"><img src="misc/lu.png"></a> <a href="?lang=ru"><img src="misc/ru.png"></a> <a href="?lang=en"><img src="misc/en.png"></a></div>';

     

    bet tas tukšums vienalga ir.. Tas ir lai lapā parādītos Karodziņi, lai varētu mainīt valodas..

     

    Bildi var apskatīt pie attach

    post-3549-125000439718_thumb.jpg


  8. Uztaisīju tagad pēc tā parauga http://innonesen.se/test/l-4/ pārtaisiju uz savu dizainu.. viss ir ok, bet ir viena lieta

     

    $lv = '<img src="misc/lv.png">';
    $ru = '<img src="misc/ru.png">';
    $en = '<img src="misc/en.png">';
    
    $languages = array(
       'lv' => 'lv',
       'ru' => 'ru',
    'en' => 'en',
    );
    
    if (isset($_GET['lang']) AND array_key_exists($_GET['lang'], $languages))
    {
       include 'lang/' . $languages[$_GET['lang']] . '.php';
    }
    else
    {
       include './lang/lv.php';
    }
    echo '<div id="layout">';
    
    echo '<div id="header">';
    echo '<div id="logo"><img src="css/img/logo2.png" title="Producer Records"></div>';
    echo '<div id="lang"><a href="?lang=lv">'.$lv.'</a> <a href="?lang=ru">'.$ru.'</a> <a href="?lang=en">'.$en.'</a></div>';
    		echo '</div>';
    

     

    Ielieku valodas slēdzi, uzslēdziet EN viss ir ok, bet kās uzslēdz LV un RU tad augšā parādās atkal tā atstarpe no browsera malas līdz headeram..


  9. Wow .. šito nevarēja nepareizāk uzrakstīt pat ja pacenšas.

    Tieši padding ir tā daļa kas strādā uz IE korekti, bet margin ir dažādi bugi, tai skaitā double-margin bug's.

     

     

    ziedinjsh, vai šitas ir tas ko tu gribi ?

    http://innonesen.se/test/l-4/

     

    Jā, kaut ko tādu! :)

     

    Tā bija.. Viss bija ok gan uz FF un IE. Ieliku valodas flagus kādu brīdi bija ok, bet pēkšiņi un IE viss ir šķībi un greizi un valodas īsti nesalasāmas!


  10. Headers un footers man ir 100% vidus daļas 70% Vidusdaļā iekšā man kreisā pusē stāv div 25% un labājā pusē div- 70% Samazinot browseri uz Firefox viņi saspiežas kopā.. vienīgi burti pārkāpj div robežas, bet uz IExplorer labā pala palec zem kreisas un tad spiežas.. vai tā varētu būt vai tajā, ka vidu daļas manir 70% un augstums ir 550px? it kā jau nevajadzētu būt..

     

     

    Te būs mans css:

    body{
    background-color:#F0F0F0;
    background-image:url('');
    margin: 0px 0px 0px 0px;
    font-family:Agency FB;
    }
    
    img {
    border:0px
    }
    
    a:link {
    color: #CC3399;
    text-decoration: none;
    }
    a:visited {
    text-decoration: none;
    color: #CC3399;
    }
    a:hover {
    text-decoration: none;
    color: #333333;
    }
    a:active {
    text-decoration: none;
    color: #CC3399;
    }
    
    #logo{
    width:376px;
    height:102px;
    padding:2em 0em 0em 2em;
    position:absolute;
    }
    
    #header{
    height:200px;
    background-image:url('img/header.gif');
    }
    
    #lang{
    float:right;
    margin-top:8em;
    margin-right:2em;
    clear: both;
    }
    
    #midlle{
    height:550px;
    width:70%;
    margin-left:20%;
    margin-rigth:20%;
    margin-top:1em;
    margin-bottom:1em;
    }
    
    #midlle-left{
    border:1px solid #CF8DE9;
    width:25%;
    float:left;
    text-align:left;
    font-family:Agency FB;
    font-size:20px;
    padding:5px 5px 5px 5px;
    }
    
    #midlle-right{
    border:1px solid #CF8DE9;
    width:70%;
    float:right;
    text-align:left;
    font-size:20px;
    padding:5px 5px 5px 5px;
    
    }
    
    #footer{
    background-image:url('img/footer.gif');
    height:70px;
    width:100%;
    position: fixed;
    bottom: 0px;
    
    }
    
    #title{
    background-image:url('img/title.gif');
    height:38px;
    padding:2px 0px 0px 2px;
    font-size:25px;
    font-weight:bold;
    }
    h2 {
    margin: 10px 0px 5px 0px;
    color:#006600;
    }
    
    
    

×
×
  • Create New...