Jump to content
php.lv forumi

raivis

Reģistrētie lietotāji
  • Posts

    106
  • Joined

  • Last visited

Everything posted by raivis

  1. Varēji jau arī lūdzu pabeigt savu domu līdz galam, to ne tik vien ieskicējot :( nolasīt faila "data.txt" mainīgo $name, $email vērtības; sagrupēt tās alfabēta secībā pēc $name vērtības; ..
  2. $header_info = "MIME-Version: 1.0\n"; $header_info .= "Content-type: text/html; charset=windows-1257\n"; $header_info .= "X-Priority: 1\n"; $header_info .= "X-MSMail-Priority: High\n";
  3. Man nepieciešams rāmī izvadīt sagrupētus(iekrāsotus) data.txt $name, $email vērtības !?.. <?php $file = file("data.txt"); $totalLines = sizeof($file); for($line = 0; $line < $totalLines; $line++){ @list($name,$age,$email) = explode("|", $file[$line]); echo "'".$name."' => '".$email."', "; } $users = array ( // $name => $email #izvada tikai peedeejaas rindinjas mainiigo veertiibu!? 'Jānis Bērziņš' => '[email protected]', 'Kārlis Asnītis' => '[email protected]', 'Guntars Osiņš' => '[email protected]', 'Laura Vāvere' => '[email protected]', 'Anna Kocene' => '[email protected]' ); echo '<hr>'; echo '<table border="1">'; echo '<tr style="background-color: #696969; color: #ffffff">'; echo '<th>Vārds</th><th>E-pasts</th></tr>'; $counter = 0; foreach($users AS $name => $email) { $bgcol = ($counter % 2) ? '#dcdcdc' : '#ffffff'; echo '<tr style="background-color: ' . $bgcol . '">'; echo '<td>' . $name . '</td><td>' . $email . '</td></tr>'; $counter++; } echo '</table>'; ?> ..ar šo tas neizdodas!
  4. raivis

    Bomber

    nekas nebuutu. lmt novaaca to domeenu tajaa dienaa, kad solija kaut kur 11tos no riita. raivis: paskat tik - nosper sms.id.lv HTML sourci 1:1 un pieliek savu liiko php. gud lak. varu pachuxteet, ka pilnais sisteemas kods aiznjem ap 1MB. :P Ja jau tev tik daudz ir zinām, tad jau tu arī zināsi» kāds šis SMS kods būtu vai kā man to dabūt...?
  5. Bet tomēr vēl neesmu ticis skaidrībā - ja man ir bilde 400x700px izmeeraa un man uz PHP vajag proporcionaali korigjeet taas izmeeru, apgriežot liekās malas, lai iekļautos izmēros: 150x50px, bet ja gadījumā $bilde neiekļaujas izmēros 150x50px, tad lai proporcionāli tā palielinās, lai iekļautos noteiktos izmēros!? » bet kā?
  6. Paldies! - atkodu pats: <?php //links: img3.php?s=143094.jpg&h=100 , kur s=bildes nosaukums, w=attēla platums, h=attēla augstums // Vieta, kura atradīsies attēls $pth = "img/" . $s; // Noskaidrojam kāda veida attēlus atbalsta pašreizējais GD if (imagetypes() &IMG_PNG) { $suport["PNG"] = true; } if (imagetypes() &IMG_GIF) { $suport["GIF"] = true; } if (imagetypes() &IMG_JPG) { $suport["JPG"] = true; } if (imagetypes() &IMG_WBMP) { $suport["BMP"] = true; } // Noskaidrojam visu infromāciju par rādāmo attēlu $pic_type = GetImageSize($pth); // Noskaidrojam attēla tipu un iestādam, // vai ir iespējams attēlam mainīt izmērus if ($pic_type[2] == 2 and $suport["JPG"]) { $USE_RESIZE = true; $img_in = ImageCreateFromJPEG($pth); } elseif ($pic_type[2] == 3 and $suport["PNG"]) { $USE_RESIZE = true; $img_in = ImageCreateFromPNG($pth); } elseif ($pic_type[2] == 1 and $suport["GIF"]) { $USE_RESIZE = true; $img_in = ImageCreateFromGIF($pth); } elseif ($pic_type[2] == 6 and $suport["BMP"]) { $USE_RESIZE = true; $img_in = ImageCreateFromWBMP($pth); } else { $USE_RESIZE = false; } // Ja jaunā attēla lielums nav bijis norādīts, izvada attēlu bez izmaiņām if (!$w and !$h) { $USE_RESIZE = false; } $w = $_GET["w"]; $h = $_GET["h"]; if ($w) { $h = round(($w / $pic_type[0]) * $pic_type[1]); } elseif ($h) { $w = round(($h / $pic_type[1]) * $pic_type[0]); } if ($USE_RESIZE) { // Maina attēla izmērus // Ja iespējams kā jaunu veidojam TrueColor attēlu (GD2 un jaunāki) if (!$img_out = @ImageCreateTrueColor($w, $h)) { $img_out = ImageCreate($w, $h); } ImageCopyResized($img_out, $img_in, 0, 0, 0, 0, $w, $h, $pic_type[0], $pic_type[1]); // Izvadam izveidoto attēlu kā JPG Header("Content-type: image/jpeg"); ImageJPEG($img_out); } else { // Ja nav iespējams mainīt attēla lielumu // Nolasam attēlu un parādam to, tādu pašu kā ir $fp = fopen($pth, "rb"); if ($pic_type and $fp) { header("Content-type: {$pic_type['mime']}"); fpassthru($fp); exit; } } ?>
  7. Kur kļūda? $picpath = "img/"; $filename = "bilde.jpg"; $pic_type = GetImageSize($picpath . $row["filename"]); $img_in = ImageCreateFromJPEG($picpath . $row["filename"]); $w = $_GET["w"]; $h = $_GET["h"]; if ($w) { $h = round(($w / $pic_type[0]) * $pic_type[1]); } elseif ($h) { $w = round(($h / $pic_type[1]) * $pic_type[0]); } $img_out = @ImageCreateTrueColor($w, $h); imagecopyresampled($img_out, $img_in, 0, 0, 0, 0, $w, $h, $pic_type[0], $pic_type[1]); Header("Content-type: image/jpeg"); ImageJPEG($img_out); die(); Man met laukā: Warning: getimagesize(img/) [function.getimagesize]: failed to open stream: Permission denied in c:\wamp\www\samples\05\GDimage\img2.php on line 5 Warning: imagecreatefromjpeg(img/) [function.imagecreatefromjpeg]: failed to open stream: Permission denied in c:\wamp\www\samples\05\GDimage\img2.php on line 6 Warning: imagecopyresampled(): supplied argument is not a valid Image resource in c:\wamp\www\samples\05\GDimage\img2.php on line 15 Warning: Cannot modify header information - headers already sent by (output started at c:\wamp\www\samples\05\GDimage\img2.php:5) in c:\wamp\www\samples\05\GDimage\img2.php on line 16 Warning: imagejpeg(): supplied argument is not a valid Image resource in c:\wamp\www\samples\05\GDimage\img2.php on line 17
  8. Pieņemsim data.txt failā glabājās dati par 100 reģistrētajiem lietotājiem - » kā lai alfabēta secībā nolasu lietotāja datus [$name,$age$email] tos sagrupējot pa 5? if $lpp="0" { print alfabēta secībā 1. sagrupēto 5 lietotāju datus [5 rindiņas]; } if $lpp="1" { print alfabēta secībā 2. sagrupēto 5 lietotāju datus [5 rindiņas]; } utt.
  9. Piemēram man ir bilde 700x400px izmeeraa un ar PHP veelos proporcionaali korigjeet taas izmeers> uz 150x90px Kā tas būtu izdarāms?
  10. vai tik http://php.lv/f/ nav zelta bedre..
  11. unknow uzrādīs, ja lietotājs lapā ieies caur proxy
  12. raivis

    Bomber

    Un tu droši vien zini, kā dara http://sms.id.lv, un varētu man izpalīdzēt... ?
  13. NEIZDODĀS! uzrāda EROR.. --- $password = "Aate65i0"; if (preg_match("/^[\w\d]{7,10}/u", $password)) { echo "Parole sastāv no burtiem un/vai cipariem garumaa 7-10"; } else { echo "Parole ir greiza"; }
  14. raivis

    Bomber

    Smieklīgi gan! - ņemot vērā, ka te gandrīz viss uzrakstīts ;) .. <?php function send_sms($addr,$op,$sms){ $num = substr($addr,3,7); // ja sms izmeers ie lielaaks par 148 simboliem.. if(strlen($sms) > 148) { //... saiisinaam sms $real_txt = substr('$sms,0,143')."[..]"; $note = " (nos?t?mais teksts tika sa?sin?ts)"; } else { // ja sms ir 148 vai mazaak simbolu $real_txt = $sms; } // ... un suutam sms mail($addr,NULL,$real_txt,"From:[email protected]"); } $i = 1; $cik = 25; //suutiisim adresaatam 25 sms $num = "60XXXXX"; // tele2 klienta nr $sms = "textc ko suutiit"; $addr = "371".$num."@sms.tele2.lv"; // LMT gadiijumaa > [email protected] $rez = "Uz $num tika aizsuutiitas $cik sms"; for (;;) { if ($i > $cik) { echo $rez; break; } send_sms($addr,"Tele2",$sms); $i++; } ?> <html> <head> <title>Send SMS</title> </head> <script language=JavaScript> var mLen = 143; function len(str) { var count = 0; for (i=0;i<str.length;i++) if((str.charCodeAt(i)!=10)) count++; return count; } function lenten(str) { return str.length-len(str); } function p() { ti = document.getElementById("lenleft"); magicCount(document.forms[0].sms); } function magicCount(x){ txtln = len(x.value); if (mLen - txtln < 0) { x.value = x.value.substring(0,mLen+lenten(x.value)); } while( (((zzz = x.value.charCodeAt(x.value.length-1))==10) || (zzz==13)) && ( len(x.value) > mLen) ) { x.value = x.value.substring(0,x.value.length-2); } txtln = len(x.value); ti.innerHTML=mLen - txtln; } </script> <body onLoad="p()"> <form method=post action=""> <table> <tr><td>Adresāts:<td><input type="text" name=to value="" maxlength="20"> <tr><td valign="top">Teksts: <td><textarea name="sms" rows="5" cols="16" wrap="soft" onKeyUp="magicCount(this)"></textarea> <tr><td align="right"><span id="lenleft">999</span><input type="checkbox" name="queue" class="checkbox" checked><td> <tr><td><input type="submit" value="Sūtīt"><td><input type="submit" name="reset" value="Dzēst"> </table> </form> </body> </html>
  15. Un, ja man būtu jānoteic, vai $name = $username, tad laikam izskatītos kas tml. .. ? $username = "Pēteris"; $fileData = file("data.txt"); $personList = array(); foreach ($fileData as $row){ list($name, $age, $email) = explode('|', $row); $personList[] = array('name' => $name, 'age' => $age, 'email' => $email); } foreach ($personList as $key => $person){ if ($person['name'] == $username){ echo $username." <b>nav</b> reģistrējies"; } else { echo $username." <b>ir</b> reģistrējies"; } }
  16. raivis

    Bomber

    !!Vai varētu dabūt adrese http://sms.id.lv/send/index.php kodu?
  17. $foo = 'hello world!'; $foo = ucwords($foo); // Hello World! $bar = 'HELLO WORLD!'; $bar = ucwords($bar); // HELLO WORLD! $bar = ucwords(strtolower($bar)); // Hello World! Vēlos gara teksta pirmajam vārdam pirmajam burtam atšķirīgu stilu ~ <font style="font-weight: bolder">Vārda pirmais burts</font. ..kā to izdarīt?
  18. Un.. ja parolē nedrīkstētu izmantot LIELOS BURTUS A-Z - drīkstētu izmantot tikai mazos burtus a-z)...?
  19. samaini vietaam!!! Ne tāds ir mans mērķjis ,- tad jau tikpat labi es varētu uzrakstīt vienkārši echo "False..";
  20. <?php $password = "āšerdgfgffdAĀ76sffhfgh;,.?"; if (preg_match("/^[a-z0-9]{7,10}$/", $password)) { echo "False.."; } else { echo "True.."; } ?>
×
×
  • Create New...