Jump to content
php.lv forumi

EdgarsK

Reģistrētie lietotāji
  • Posts

    621
  • Joined

  • Last visited

Posts posted by EdgarsK

  1. $adress = $_SERVER['HTTP_HOST'];
    $link = $_SERVER['PHP_SELF'];
    
    
    $query = mysq_fetch_object(mysql_query("select count(id) as cnt from clients where adress='$adress'"));
    if($query->cnt == 0){
    mysql_query("insert into clients (adress,link) values ('$adress','$link')");
    }

     

     

     

    ak dievs.. ak dievs.. bērniņ mīļo, ēd tak no rokām...

    cerēju jau ka pats tiksi galā ar šo.

  2. a nevar vienkarshi insert ignore ?

    bet nu ..

     

    
    $query = mysql_fetch_object(mysql_query("select count(id) as cnt from tabula where homepage='http://www.php.lv'"));
    if($query->cnt == 0){
    mysql_query("insert into table (homepage,ip) values('http://www.php.lv','127.0.0.1')");
    }
    
    

  3. kā man besī, kad iedod rokās, bet pašam grūti pat iedziļināties ..

     

    
    $string = 'My name is [b]bolde text[/b], what is your name?';
    $string = preg_replace("/\[b\](.*)\[\/b\]/Usi","<strong>\\1</b>",$string);
    
    echo $string;
    
    

  4. JL - izstrādes laikā jau par to ir jāparūējas.

     

    Visa veida saturs kas nāk POST / GET veidā servera apstrādē, tāpat arī REQUEST un URI_QUERY ir jāapstrādā korekti, tā lai šis saturs nebūtu valīds html, vai sql injection, vai nedod dievs pie eval šo saturu pielaist.

    Jānoslēdz visas brīvi pieejamās direktorijas, jāizvāc phpinfo fails, ja tāds ir.

     

    php expose vajadzētu atslēgt, aizslēgt openbasedir, izslēgt php safe mode,

    tā lai mums nebūtu šādi joki :)

    1) http://oho.lv/?=PHPB...A9-4C7B08C10000

    2) http://oho.lv/?=PHPE9568F34-D428-11d2-A769-00AA001ACF42

    3) http://oho.lv/?=PHPE9568F35-D428-11d2-A769-00AA001ACF42

    4) http://oho.lv/?=PHPE9568F36-D428-11d2-A769-00AA001ACF42

    + veel 100 konfiguraciju kuras parasti tiek veiktas pie izstrades.

  5. ceru ka sapratu pareizi..

     

    labak lieto preg nevis str_rep

     

     

     

    $string = preg_replace("/\[b\](.*)\[\/b\]/Usi", "<b>\\1</b>", $string);
    $string = preg_replace("/\[u\](.*)\[\/u\]/Usi", "<u>\\1</u>", $string);
    $string = preg_replace("/\[i\](.*)\[\/i\]/Usi", "<i>\\1</i>", $string);
    $string = preg_replace("/\[color=(\#[0-9A-F]{6}|[a-z]+)\](.*)\[\/color\]/Usi", "<span style=\"color:\\1\">\\2</span>", $string);
    $string = preg_replace("/\[size=(.*)\](.*)\[\/size\]/Usi", "<span style=\"font-size:\\1ex\">\\2</span>", $string);
    $string = preg_replace("/\[quote](.*)\[\/quote\]/Uis", "<div>Quote:</div><div style=\"border:solid 1px;\">\\1</div>", $string);
    $string = preg_replace("/\[quote=(.*)](.*)\[\/quote\]/Uis", "<div>Quote from: \\1</div><div style=\"border:solid 1px;\">\\2</div>", $string);
    

  6. noskanēju tavu lapu ar savu rīku izmantojot atslēgvārdu "rīga , riga"

     

     

     

     

    Your seo request is 4.86% valid.

     

    Keyword usage in document title

    Keyword validation in document title has 100% of valid keywords.

    Keyword usage in documents head keyword list

    Keyword validation in document keyword list has 0% of valid keywords.

    Keyword usage in documents head description

    Keyword validation in document description has 0% of valid keywords.

    Keyword usage in Headline H1

    Keyword validation in document H1 tags has 0% of valid keywords.

    Keyword usage in Headlines H2-H6

    Keyword validation in document H2 tags has 0% of valid keywords.

    Keyword validation in document H3 tags has 0% of valid keywords.

    Keyword validation in document H4 tags has 0% of valid keywords.

    Keyword validation in document H5 tags has 0% of valid keywords.

    Keyword validation in document H6 tags has 0% of valid keywords.

    Keyword usage in first contents of the document

    Keyword validation in document first sentence has 100% of valid keywords.

    Keyword usage in bold text

    Keyword validation in document bolded tags has 0% of valid keywords.

    Keyword usage as links for same domain content

    Keyword validation in document links for the same domain has 33.33% of valid keywords.

    Keyword usage as links for outter domain content

    Keyword validation in document links for outsider domains has 0.78% of valid keywords.

    Keyword usage in main domain name

    Keyword validation in document links for the same domain has 50% of valid keywords.

    Keyword usage in tag attributes

    Keyword validation in document tags as links has 2.13% of valid keywords.

    Keyword validation in document tags as images has 2.04% of valid keywords.

    Keyword usage in html comments

    Keyword validation in document html commentaries has 0% of valid keywords.

    Page validation for W3C standarts

    Page html validation: 3 Errors

  7. Nu kamdēļ ir jāraksta tik tizli, tak var arī sakārtot.

     

    <?php
    $db = mysql_query("SELECT * FROM tabula LIMIT 1");
    if(@mysql_num_rows($db)){
    echo "Ir atgriezti rezultati";
    }else{
    echo "Nav atgriezti rezultati";
    }
    ?>

     

     

    izmantojam @mysql_num... lai nebūtu kļūdu paziņojums gadijumā ja atgriezti 0 rezultāti.

     

    2 metode ir

     

    <?php
    $db = mysql_query("select count(id) as cnt from tabula");
    $db = mysql_fetch_object($db);
    
    if($db->cnt>0){
    echo "Ir atgriezti {$db->cnt} rezultati";
    }else{
    echo "Nav atgriezti rezultati";
    }
    ?>

  8. Ticu, daudziem būs noderīgi.

     

    Lūk kods kā apstrādāt (pievienot , lasīt , dzēst) cepumiņus ar Js palīdzību.

     

    function createCookie(name,value,days) {
    if (days) {
    	var date = new Date();
    	date.setTime(date.getTime()+(days*24*60*60*1000));
    	var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
    }
    
    function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
    	var c = ca[i];
    	while (c.charAt(0)==' ') c = c.substring(1,c.length);
    	if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
    }
    function eraseCookie(name) {
    createCookie(name,"",-1);
    }

  9. Sveiki forumieši.

     

    Situācija : Ir lapa, kurā ir daudz satura un daudz darba ar peli. Tā kā ši lapa ir interaktīva ar 90% js darbībām, ir nepieciešams izvairīties no vienas nianses, kura man personīgi krīt uz nerviem.

    Katru reizi, kad veidoju kaut kādus drag&drop vai vēl kaut ko kas ar peli saistīts, saskaros ar situāciju, ka nejauši trāpu citur, nevis uz kastes ko vēlos pārbīdīt, tad nu aiziet iezīmēšanās un tiek iezīmēti objekti.

     

    Gribētu izveidot kaut kāda veida event listener, kurš čekotu, gadijumā ja kaut kas tiek iezīmēts, kura typeof nav teksts, automātiski fokusēt body tagu lai viss iezīmētais attīrītos.

     

    Ceru ka mani sapratāt :)

     

    Lietoju jQuery.

×
×
  • Create New...