BANI PE NET FORUM. DOWNLOAD FILME MUZICA JOCURI GRATIS
BANI MULTI este singurul forum de BANI PE NET care cuprinde si sectiune de WAREZ. Aici gasiti Pe langa cum sa faci BANI PE NET, Filme, Muzica, Programe, Jocuri DOWNLOAD GRATIS. Trailere filme noi. TE ASTEPTAM!
Lista Forumurilor Pe Tematici
BANI PE NET FORUM. DOWNLOAD FILME MUZICA JOCURI GRATIS | Inregistrare | Login

POZE BANI PE NET FORUM. DOWNLOAD FILME MUZICA JOCURI GRATIS

Nu sunteti logat.
Nou pe simpatie:
lovely_pink Profile
Femeie
25 ani
Bucuresti
cauta Barbat
25 - 48 ani
BANI PE NET FORUM. DOWNLOAD FILME MUZICA JOCURI GRATIS / OTHERS/Diverse / Cod pentru DELETE user  
Autor
Mesaj Pagini: 1
G@me
Administrator

Inregistrat: acum 16 ani
Postari: 181
COD PENTRU DELETE USER DIN MYSQL

Code:

<?php
$con = mysql_connect("host","user","pass");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("database", $con);

if (isset($_POST['Delete'])) {

$id=$_POST['username'];
$sql = "DELETE FROM users WHERE username='$id'";    
        $result = mysql_query($sql);
       

echo "$id deleted!<p>";
}



mysql_close($con);

?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="text" name="username" maxlength="60">
<input type="submit" name="Delete" value="Delete">



_______________________________________
Life Goes On.

pus acum 15 ani
   
G@me
Administrator

Inregistrat: acum 16 ani
Postari: 181
Cod pentru Add USER:

Code:

<?php 



$con = mysql_connect("host","username","pass");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("database", $con);

//This code runs if the form has been submitted
if (isset($_POST['submit'])) { 


// checks if the username is in use
if (!get_magic_quotes_gpc()) {
$_POST['username'] = addslashes($_POST['username']);
}
$usercheck = $_POST['username'];
$check = mysql_query("SELECT username FROM users WHERE username = '$usercheck'") 
or die(mysql_error());
$check2 = mysql_num_rows($check);

//if the name exists it gives an error
if ($check2 != 0) {
die('Sorry, the username '.$_POST['username'].' is already in use.');
}


// now we insert it into the database
$insert = "INSERT INTO users (username, password,xxx)
VALUES ('".$_POST['username']."', '".$_POST['pass']."', '".$_POST['reff']."')";
$add_member = mysql_query($insert);
?>


<h1>New User Added</h1>
<p><a href="http://bombastic.comxa.com/">See All Users!</a>
</p>
<?php 
} 
else 
{ 
?>


<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table border="0">
<tr><td>Username:</td><td>
<input type="text" name="username" maxlength="60">
</td></tr>
<tr><td>Password:</td><td>
<input type="password" name="pass" maxlength="10">
</td></tr>
<tr><td>Refferal:</td><td>
<input type="text" name="reff" maxlength="60">
</td></tr>
<tr><th colspan=2><input type="submit" name="submit" value="Add"></th></tr> </table>
</form>

<?php
}
?>



_______________________________________
Life Goes On.

pus acum 15 ani
   
G@me
Administrator

Inregistrat: acum 16 ani
Postari: 181
Cod pentru Edit User:

Code:

<?php
$con = mysql_connect("host","user","pass");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("databasename", $con);

if (isset($_POST['Edit'])) {

$username=$_POST['username'];
$password=$_POST['password'];
$xxx=$_POST['xxx'];

$id=$_POST['user'];
$sql = "UPDATE users SET username='$username',password='$password',xxx='$xxx' WHERE username='$id' ";    
        $result = mysql_query($sql);
       

echo "$id was edited!<p>";
}

mysql_close($con);
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
User:<input type="text" name="user" maxlength="60"><br>

Nume nou:<input type="text" name="username" maxlength="60"><br>
Parola:<input type="text" name="password" maxlength="60"><br>
Referal:<input type="text" name="xxx" maxlength="60">

<br><input type="submit" name="Edit" value="Edit">



_______________________________________
Life Goes On.

pus acum 15 ani
   
G@me
Administrator

Inregistrat: acum 16 ani
Postari: 181
RANDOM NUMBERS

Code:

<?php
$rand = rand(19999,99999);
 echo "<b><font color='red'>$rand</b>";

?>



_______________________________________
Life Goes On.

pus acum 15 ani
   
G@me
Administrator

Inregistrat: acum 16 ani
Postari: 181
COD CAPTCHA

cod pentru imagine:

captcha.php

Code:

<?php 
session_start(); 
$width = 80; 
$height = 20; 
$im = imagecreate($width, $height); 
$bg = imagecolorallocate($im, 0, 0, 0); 

// generate random string 
$len = 5; 
$chars = '0123456789'; 
$string = ''; 
for ($i = 0; $i < $len; $i++) { 
    $pos = rand(0, strlen($chars)-1); 
    $string .= $chars{$pos}; 
} 
$_SESSION['captcha_code'] = md5($string); 

// grid 
$grid_color = imagecolorallocate($im, 75, 0, 0); 
$number_to_loop = ceil($width / 20); 
for($i = 0; $i < $number_to_loop; $i++) { 
    $x = ($i + 1) * 20; 
    imageline($im, $x, 0, $x, $height, $grid_color); 
} 
$number_to_loop = ceil($height / 10); 
for($i = 0; $i < $number_to_loop; $i++) { 
    $y = ($i + 1) * 10; 
    imageline($im, 0, $y, $width, $y, $grid_color); 
} 



// write the text 
$text_color = imagecolorallocate($im, 255, 0, 0); 
$rand_x = rand(0, $width - 50); 
$rand_y = rand(0, $height - 15); 
imagestring($im, 10, $rand_x, $rand_y, $string, $text_color); 


header ("Content-type: image/png"); 
imagepng($im); 
?>

si codul pentru pagina normala care il include pe asta

index.php

Code:

<?php 
session_start(); 
if(isset($_POST['submit'])) { 
    if(isset($_POST['captcha_code']) && isset($_SESSION['captcha_code'])) { 
        if(md5($_POST['captcha_code']) == $_SESSION['captcha_code']) { 
            echo 'Result: CAPTCHA code correct.<br />'; 
        }else{ 
            echo 'Result: CAPTCHA code incorrect.<br />'; 
        } 
    }else{ 
        if(!isset($_POST['captcha_code'])) { 
            echo 'Result: No security code was entered.<br />'; 
        } 
        if(!isset($_SESSION['captcha_code'])) { 
            echo 'Result: No CAPTCHA was viewed.<br />'; 
        } 
    } 
} 
?> 
<form method="POST"> 
<img src="captcha.php" /> 
<br /> 
Enter the above text EXACTALY as it appears. Note: It is case sensitive<br /> 
<input type="text" name="captcha_code" />  
<br /> 
<input type="submit" name="submit" value="Submit" /> 
</form>



_______________________________________
Life Goes On.

pus acum 15 ani
   
G@me
Administrator

Inregistrat: acum 16 ani
Postari: 181
Cod Pentru SEARCH in baza de date dupa ID sau USERNAME:

Code:

<?php
$con = mysql_connect("HOST","USER","PASS");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("DATABASE", $con);

if (isset($_POST['Search'])) {


$username=$_POST['username'];
$id=$_POST['id'];


$result = mysql_query("SELECT * FROM users WHERE id='$id' OR username='$username' ");

  echo "<table border='1'>
<tr>
<th>Id</th>
<th>Username</th>
<th>Password</th>
<th>Refferal</th>
<th>Ip</th>
</tr>";



while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['id'] . "</td>";
  echo "<td>" . $row['username'] . "</td>";
  echo "<td>" . $row['password'] . "</td>";
  echo "<td>" . $row['xxx'] . "</td>";
  echo "<td>" . $row['Reffered'] . "</td>";
  echo "</tr>";
  }
echo "</table>";
}

?>


<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
User:<input type="text" name="username" maxlength="60"><br>
Or
ID:<input type="text" name="id" maxlength="60"><br>


<br><input type="submit" name="Search" value="Search">



_______________________________________
Life Goes On.

pus acum 15 ani
   
G@me
Administrator

Inregistrat: acum 16 ani
Postari: 181
SEARCH + edit user

Code:

<?php
$con = mysql_connect("HOST","USER","PASS");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("DATABASE", $con);

if (isset($_POST['Search'])) {


$us=$_POST['us'];
$id=$_POST['id'];


$result = mysql_query("SELECT * FROM users WHERE id='$id' OR username='$us' ");

  echo "<table border='1'>
<tr>
<th>Id</th>
<th>Username</th>
<th>Password</th>
<th>Refferal</th>
<th>Ip</th>
</tr>";



while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['id'] . "</td>";
  echo "<td>" . $row['username'] . "</td>";
  echo "<td>" . $row['password'] . "</td>";
  echo "<td>" . $row['xxx'] . "</td>";
  echo "<td>" . $row['Reffered'] . "</td>";
  echo "</tr>";
  }
echo "</table>";
}
mysql_close($con);
?>


<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
User:<input type="text" name="us" maxlength="60">
<br>Or
<br>ID:<input type="text" name="id" maxlength="60"><br>


<br><input type="submit" name="Search" value="Search">

<?

$con = mysql_connect("HOST","USER","PASS");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("DATABASE", $con);

if (isset($_POST['Edit'])) {

$username=$_POST['username'];
$password=$_POST['password'];
$xxx=$_POST['xxx'];

$id=$_POST['user'];
$sql = "UPDATE users SET username='$username',password='$password',xxx='$xxx' WHERE username='$id' ";    
        $result = mysql_query($sql);
       

echo "<br>$id was edited!<p>";
}

mysql_close($con);
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<br><br><h1><b>EDIT USER</b></h1>

<br>
User: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="user" maxlength="60"><br>

Nume nou:<input type="text" name="username" maxlength="60"><br>
Parola: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="password" maxlength="60"><br>
Referal: &nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="xxx" maxlength="60">

<br><input type="submit" name="Edit" value="Edit">



_______________________________________
Life Goes On.

pus acum 15 ani
   
3x
☻☻☻☻

Inregistrat: acum 16 ani
Postari: 134
ALT cod CAPTCHA

Code:

<?php 


session_start(); 
function strrand($length) 
{ 
$str = ""; 

while(strlen($str)<$length){ 
$random=rand(48,122); 
if( ($random>47 && $random<58) ){ 
$str.=chr($random); 
} 

} 

return $str; 
} 

$text = $_SESSION['string']=strrand(5); 
$img_number = imagecreate(55,17); 
$backcolor = imagecolorallocate($img_number,244,244,244); 
$textcolor = imagecolorallocate($img_number,0,0,0); 

imagefill($img_number,0,0,$backcolor); 

imagestring($img_number,50,1,1,$text,$textcolor); 

header("Content-type: image/png"); 
imagejpeg($img_number); 
?>



pus acum 15 ani
   
G@me
Administrator

Inregistrat: acum 16 ani
Postari: 181
COD pentru LR

Code:

<?
$suma=6;

echo "You will pay $suma $";
?>


<form action="https://sci.libertyreserve.com/" method="POST">
  <input type="hidden" name="lr_acc" value="U4788827"/>
  <input type="hidden" name="lr_amnt" value="<?php echo $suma ?>"/>
  <input type="hidden" name="lr_currency" value="LRUSD"/>
  <input type="hidden" name="lr_comments" value="Upgrade"/>
  <input type="hidden" name="lr_success_url" value="http://bombastic.comxa.com/success.html"/>
  <input type="hidden" name="lr_success_url_method" value="POST"/>
  <input type="hidden" name="lr_fail_url" value="http://bombastic.comxa.com/fail.html"/>
  <input type="hidden" name="lr_fail_url_method" value="POST"/>

  <input type="submit" />
</form>

Form Generator pentru LR


_______________________________________
Life Goes On.

pus acum 15 ani
   
G@me
Administrator

Inregistrat: acum 16 ani
Postari: 181
Cod Pentru MD5 encryption

Code:

<?php 

if (isset($_POST['MD5'])) {

$pisi=md5($_POST['md5']);


echo "<br> The pass is <b> $pisi</b>";
}
?>



<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<h3>MD5 password ENCRYPT</h3>
<table><tr><td>Password MD5:</td><td>
<input type="text" name="md5" maxlength="60">
</td></tr>
<tr><td colspan=2><input type="submit" name="MD5" ></td></tr> </table>



_______________________________________
Life Goes On.

pus acum 15 ani
   
G@me
Administrator

Inregistrat: acum 16 ani
Postari: 181
Cod pentru input type text cu o valoare cand apasam pe text dispare pentru a putea scrie si daca nu scriem nimik revine textul initial.

Code:

<script type="text/javascript">
function blank(a) { if(a.value == a.defaultValue) a.value = ""; }
function unblank(a) { if(a.value == "") a.value = a.defaultValue; }
</script> 
<input type="text" value="email goes here" onfocus="blank(this)" onblur="unblank(this)" />



_______________________________________
Life Goes On.

pus acum 15 ani
   
Bekali
☻☻☻☻

Inregistrat: acum 16 ani
Postari: 129
POST data submit in page refresh

Code:

if(opertion success)
{
// redirect to the same/some page.
header("Location: with.php");

}



Modificat de Bekali (acum 15 ani)


pus acum 15 ani
   
G@me
Administrator

Inregistrat: acum 16 ani
Postari: 181
Cod pt aflarea ultimilor 5 useri inregistrati

Code:

<?php
$con = mysql_connect("host","user","pass");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("DATABASE", $con);



$result = mysql_query("SELECT username FROM tb_users ORDER BY id DESC LIMIT 5");


  echo "<table border='0'>
<tr>
<th>Last 5 Users</th>
</tr>";



while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['username'] . "</td>";
 
  echo "</tr>";
  }


?>



_______________________________________
Life Goes On.

pus acum 15 ani
   
G@me
Administrator

Inregistrat: acum 16 ani
Postari: 181
Cod pentru TOTAL MEMBERS

Code:

<?php

include "connect.php" ;


$result = mysql_query("SELECT id FROM tb_users ORDER BY id DESC LIMIT 1");


  echo "<table border='0'>
<tr>
<th>Total Users</th>
</tr>";



while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['id'] . "</td>";
 
  echo "</tr>";
  }

?>



_______________________________________
Life Goes On.

pus acum 15 ani
   
G@me
Administrator

Inregistrat: acum 16 ani
Postari: 181
Cod pentru PROCENT

Code:

<?php
 
 
$percent = "10"; // without %
 
$total = "30"; // initial value
 
 
 
/* Calculate $percent% from $total */
 
$discount_value = ($total / 100) * $percent;
 
echo"$total";
echo"<br>$discount_value";
 
?>



_______________________________________
Life Goes On.

pus acum 15 ani
   
CARDEUS
☻☻☻

Inregistrat: acum 16 ani
Postari: 81
Uite un code pentru procent.

Code:

<? 
 
include "con.ini.php";
 
$result = mysql_query("SELECT * FROM tb_upgrade WHERE username='gaby' ");
 
while($row = mysql_fetch_array($result)){
 
 
$now= date('d.m.Y');
 
$expireplan=$row['expireplan'] ;
echo "<br>Expire Plan: $expireplan";
 
$date= $row['date'] ;
echo "<br>Upgrade: $date";
 
 
$id= $row['id'];
echo "<br>Tranzaction ID: $id";
 
 
$days_left= $expireplan  - $now ;
echo "<br>Days Left  $days_left";
 
 
$percentage= ($now - $date)*10 ;
$money= $row['money'];
echo"<br> Money :  $money " ;
echo"<br> Percentage :  $percentage %" ;
 
$real_money= ( $money / 100 ) * $percentage;
 
echo"<br> Real money: $real_money <br>";
 
}
?>



pus acum 15 ani
   
G@me
Administrator

Inregistrat: acum 16 ani
Postari: 181
Cod pentru a calcula suma unei coloane dintr-un tabel

Code:

$verry = mysql_query("SELECT SUM(money) FROM tb_upgrade WHERE username='$username' ");
while($ho = mysql_fetch_array($verry))
  {
  
  $bo=$ho['SUM(money)'];
  echo "<br>Total Investments : $bo "; 
  echo "<br />";
  }



_______________________________________
Life Goes On.

pus acum 15 ani
   
G@me
Administrator

Inregistrat: acum 16 ani
Postari: 181
Cod pentru a vedea diferenta de zile intre 2 date diferite din luni/ ani diferiti.

Code:

<?php

$date1 = "15/5/2003";
$date2 = "30/11/2008";

$d1 = explode("/",$date1);
$d2 = explode("/",$date2);

$days = floor(abs(mktime(0,0,0,$d1[1],$d1[0],$d1[2]) - mktime(0,0,0,$d2[1],$d2[0],$d2[2])) / (60*60*24));

echo $days;

?>



_______________________________________
Life Goes On.

pus acum 15 ani
   
G@me
Administrator

Inregistrat: acum 16 ani
Postari: 181
Cod pentru a vedea de cate ori apare un ip inregistrat. Pt a vedea daca s-au facut mai multe conturi dupa acelasi ip. Campul ip_address e variabila in cazul nostru... o putem inlocui cu numele userilor sau cu varsta..

Code:

<?php


include "con.ini.php";

$query = "SELECT COUNT(DISTINCT ip_address)  FROM ip"; 
     
$result = mysql_query($query) or die(mysql_error());


while($ro = mysql_fetch_array($result)){
    

$bo=$ro['COUNT(DISTINCT ip_address)'];
echo "Number of Distinct IP: $bo";

}



$resulte = mysql_query("SELECT ip_address, COUNT(*)  FROM ip GROUP BY ip_address") 
or die(mysql_error());  

echo "<table border='1'>";
echo "<tr> <th>Number</th> <th>Ip</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $resulte )) {
    // Print out the contents of each row into a table
    echo "<tr><td>"; 
    echo $row['COUNT(*)'];
    echo "</td><td>"; 
    echo $row['ip_address'];
    echo "</td></tr>"; 
} 

echo "</table>";

?>



_______________________________________
Life Goes On.

pus acum 15 ani
   
aditzu'
☻☻☻

Inregistrat: acum 16 ani
Postari: 64
Alt cod pentru search intr-o baza de date. codul este din 2 fisiere.
Este interesant in search.php cum a luat variabila din prima si a transformat-o in

Code:

'%".$searchterm."%'

pentru  a cauta totul cu %% in baza de date.
index.html

Code:

<html>
        <head>
                <title>Search Test</title>
        </head>
        <body topmargin="0" leftmargin="0">
                <form action="search.php" method="post">
                        Search Term <input type="text" name="searchterm"><br />
                        <input type="submit" value="Search">
                </form>
        </body>
</html>

si search.php:

Code:

<?php
/*set varibles from form */
$searchterm = $_POST['searchterm'];
trim ($searchterm);
/*check if search term was entered*/
if (!$searchterm){
        echo 'Please enter a search term.';
}
/*add slashes to search term*/
if (!get_magic_quotes_gpc())
{
$searchterm = addslashes($searchterm);
}

/* connects to database */
@ $dbconn = new mysqli('host', 'username', 'password', 'database'); 
if (mysqli_connect_errno()) 
{
 echo 'Error: Could not connect to database.  Please try again later.';
 exit;
}
/*query the database*/
$query = "select * from tablename where tablerow like '%".$searchterm."%'";
$result = $dbconn->query($query);
/*number of rows found*/
$num_results = $result->num_rows;

echo '<p>Found: '.$num_results.'</p>';
/*loops through results*/
for ($i=0; $i <$num_results; $i++)
{
 $num_found = $i + 1;
 $row = $result->fetch_assoc();
 echo "$num_found. ".($row['tablerow'])." <br />";
}
/*free database*/
$result->free();
$dbconn->close();
?>



pus acum 14 ani
   
Big_BOss
☻☻☻☻

Inregistrat: acum 16 ani
Postari: 115
Un cod pentru a vedea ce sistem de operare (OS) foloseste cel care viziteaza site-ul
Se poate include foarte usor cu include_once "sistem.php"; 
si se poate da un echo la variabila   echo "You are using ".$CurrOS;  sau se poate folosi variabila  $CurrOS pentru a
introduce in baza de date.
COD pentru sistem.php

Code:

<?php 
    $OSList = array 
      (
              // Match user agent string with operating systems
              'Windows 3.11' => 'Win16',
              'Windows 95' => '(Windows 95)|(Win95)|(Windows_95)',
              'Windows 98' => '(Windows 98)|(Win98)',
              'Windows 2000' => '(Windows NT 5.0)|(Windows 2000)',
              'Windows XP' => '(Windows NT 5.1)|(Windows XP)',
              'Windows Server 2003' => '(Windows NT 5.2)',
              'Windows Vista' => '(Windows NT 6.0)|(Windows Vista)',
              'Windows 7' => '(Windows NT 6.1)|(Windows 7)',
              'Windows NT 4.0' => '(Windows NT 4.0)|(WinNT4.0)|(WinNT)|(Windows NT)',
              'Windows ME' => 'Windows ME',
              'Open BSD' => 'OpenBSD',
              'Sun OS' => 'SunOS',
              'Linux' => '(Linux)|(X11)',
              'Mac OS' => '(Mac_PowerPC)|(Macintosh)',
              'QNX' => 'QNX', 
              'BeOS' => 'BeOS',
              'OS/2' => 'OS/2',
              'Search Bot'=>'(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves/Teoma)|(ia_archiver)'
      );
      // Loop through the array of user agents and matching operating systems
      foreach($OSList as $CurrOS=>$Match)
      {
              // Find a match
              if (eregi($Match, $_SERVER['HTTP_USER_AGENT']))
              {
                      // We found the correct match
                      break;
              }
      }
      // You are using ...
      echo "You are using ".$CurrOS;
?>



pus acum 14 ani
   
Big_BOss
☻☻☻☻

Inregistrat: acum 16 ani
Postari: 115
Cod pentru a vedea ce browser foloseste cel care ne viziteaza site-ul
poate fi inclus cu include_once "browser.php"; in orice pagina si luat browserul cu ajutorul variabilei $ua['name']
si introdus in baza de date



COD pentru browser.php

Code:

<?php
function getBrowser() 
{ 
    $u_agent = $_SERVER['HTTP_USER_AGENT']; 
    $bname = 'Unknown';
    $platform = 'Unknown';
    $version= "";

    //First get the platform?
    if (preg_match('/linux/i', $u_agent)) {
        $platform = 'linux';
    }
    elseif (preg_match('/macintosh|mac os x/i', $u_agent)) {
        $platform = 'mac';
    }
    elseif (preg_match('/windows|win32/i', $u_agent)) {
        $platform = 'windows';
    }
    
    // Next get the name of the useragent yes seperately and for good reason
    if(preg_match('/MSIE/i',$u_agent) && !preg_match('/Opera/i',$u_agent)) 
    { 
        $bname = 'Internet Explorer'; 
        $ub = "MSIE"; 
    } 
    elseif(preg_match('/Firefox/i',$u_agent)) 
    { 
        $bname = 'Mozilla Firefox'; 
        $ub = "Firefox"; 
    } 
    elseif(preg_match('/Chrome/i',$u_agent)) 
    { 
        $bname = 'Google Chrome'; 
        $ub = "Chrome"; 
    } 
    elseif(preg_match('/Safari/i',$u_agent)) 
    { 
        $bname = 'Apple Safari'; 
        $ub = "Safari"; 
    } 
    elseif(preg_match('/Opera/i',$u_agent)) 
    { 
        $bname = 'Opera'; 
        $ub = "Opera"; 
    } 
    elseif(preg_match('/Netscape/i',$u_agent)) 
    { 
        $bname = 'Netscape'; 
        $ub = "Netscape"; 
    } 
    
    // finally get the correct version number
    $known = array('Version', $ub, 'other');
    $pattern = '#(?<browser>' . join('|', $known) .
    ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
    if (!preg_match_all($pattern, $u_agent, $matches)) {
        // we have no matching number just continue
    }
    
    // see how many we have
    $i = count($matches['browser']);
    if ($i != 1) {
        //we will have two since we are not using 'other' argument yet
        //see if version is before or after the name
        if (strripos($u_agent,"Version") < strripos($u_agent,$ub)){
            $version= $matches['version'][0];
        }
        else {
            $version= $matches['version'][1];
        }
    }
    else {
        $version= $matches['version'][0];
    }
    
    // check if we have a number
    if ($version==null || $version=="") {$version="?";}
    
    return array(
        'userAgent' => $u_agent,
        'name'      => $bname,
        'version'   => $version,
        'platform'  => $platform,
        'pattern'    => $pattern
    );
} 

// now try it
$ua=getBrowser();
$yourbrowser= "Your browser: " . $ua['name'] . " " . $ua['version'] . " on " .$ua['platform'] . " reports: <br >". $ua['userAgent'] ;

?>



pus acum 14 ani
   
Artisasaa
☻☻☻☻

Inregistrat: acum 16 ani
Postari: 122
Un cod pentru micsorarea unui text dint-o baza de date , afisand un numar limitat de carectere.

Code:

function myTruncate($string, $limit, $break=".", $pad="...")
{
  // return with no change if string is shorter than $limit
  if(strlen($string) <= $limit) return $string;

  // is $break present between $limit and the end of the string?
  if(false !== ($breakpoint = strpos($string, $break, $limit))) {
    if($breakpoint < strlen($string) - 1) {
      $string = substr($string, 0, $breakpoint) . $pad;
    }
  }
    
  return $string;
}

aici avem textul care poate fii o variabila din baza de date

Code:

$description = "The World  Wide Web. When your average person on the street refers to
the Internet, they're usually thinking of the World Wide Web. The Web is basically a
series of documents shared with the world written in a coding language called Hyper Text
Markup Language or HTML. When you see a web page, like this one, you downloaded a document
from another computer which has been set up as a Web Server.";

si aici se faci propiu zis micsorarea textului

Code:

$shortdesc = myTruncate($description, 300);
  echo "<p>$shortdesc</p>";

Aici o alta varianta Truncating to a maximum length :

Code:

function myTruncate2($string, $limit, $break=" ", $pad="...")
{
  // return with no change if string is shorter than $limit
  if(strlen($string) <= $limit) return $string;

  $string = substr($string, 0, $limit);
  if(false !== ($breakpoint = strrpos($string, $break))) {
    $string = substr($string, 0, $breakpoint);
  }

  return $string . $pad;
}

Sursa:


pus acum 14 ani
   
Bekali
☻☻☻☻

Inregistrat: acum 16 ani
Postari: 129
Cod pentru recaptcha

intram pe recaptcha.com si ne facem cont la google pentru a primi 2 key
una privata si una publica

apoi intram si downloadam recaptchalib.php
avem neaparata nevoie de el
se downloadeaza de aici:

si apoi punem codul pe site:

Code:

require_once('recaptchalib.php');

$privatekey = "44444444444444ccccccccccccccccccccccccccy5fCF" ;
$resp = recaptcha_check_answer ($privatekey,
                                $_SERVER["REMOTE_ADDR"],
                               $_POST["recaptcha_challenge_field"],
                               $_POST["recaptcha_response_field"]);
if (!$resp->is_valid)
   {
  echo '<font color="red">COD INTRODUS GRESIT!.</font> <a href="cere.php" >Inapoi</a>';
   }

else{
aici punem ce vrem sa se intample daca este corect codul
}


si mai avem de pus 

<script type="text/javascript"
       src="http://www.google.com/recaptcha/api/challenge?k=644444444444444444444">
    </script>
    <noscript>
       <iframe src="http://www.google.com/recaptcha/api/noscript?k=644444444444444444444444444"
           height="300" width="500" frameborder="0"></iframe><br>
       <textarea name="recaptcha_challenge_field" rows="3" cols="40">
       </textarea>
       <input type="hidden" name="recaptcha_response_field"
           value="manual_challenge">
    </noscript>

tutorial aici:

Modificat de Bekali (acum 13 ani)


pus acum 13 ani
   
Andrei
☻☻☻

Inregistrat: acum 16 ani
Postari: 89
Cod pentru button mouse over effect

pus acum 13 ani
   
DeXter
☻☻☻

Inregistrat: acum 16 ani
Postari: 67
COD jQuery Scroll to Top Control v1.1


cel mai simplu cod

Trebuie adaugate 2 linii de cod:

Code:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

<script type="text/javascript" src="scrolltopcontrol.js"></script>

iar cel de la google il putem pune si pe el pe servar e necesar pt a putea rula orice cod jquery
mai trebuie sa uploadam o poza up.png

si codul pt scrolltopcontrol.js:

Code:

//** jQuery Scroll to Top Control script- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com.
//** Available/ usage terms at http://www.dynamicdrive.com (March 30th, 09')
//** v1.1 (April 7th, 09'):
//** 1) Adds ability to scroll to an absolute position (from top of page) or specific element on the page instead.
//** 2) Fixes scroll animation not working in Opera. 


var scrolltotop={
    //startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control
    //scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top).
    setting: {startline:100, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]},
    controlHTML: '<img src="up.png" style="width:48px; height:48px" />', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol"
    controlattrs: {offsetx:5, offsety:5}, //offset of control relative to right/ bottom of window corner
    anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links

    state: {isvisible:false, shouldvisible:false},

    scrollup:function(){
        if (!this.cssfixedsupport) //if control is positioned using JavaScript
            this.$control.css({opacity:0}) //hide control immediately after clicking it
        var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto)
        if (typeof dest=="string" && jQuery('#'+dest).length==1) //check element set by string exists
            dest=jQuery('#'+dest).offset().top
        else
            dest=0
        this.$body.animate({scrollTop: dest}, this.setting.scrollduration);
    },

    keepfixed:function(){
        var $window=jQuery(window)
        var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx
        var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety
        this.$control.css({left:controlx+'px', top:controly+'px'})
    },

    togglecontrol:function(){
        var scrolltop=jQuery(window).scrollTop()
        if (!this.cssfixedsupport)
            this.keepfixed()
        this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false
        if (this.state.shouldvisible && !this.state.isvisible){
            this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0])
            this.state.isvisible=true
        }
        else if (this.state.shouldvisible==false && this.state.isvisible){
            this.$control.stop().animate({opacity:0}, this.setting.fadeduration[1])
            this.state.isvisible=false
        }
    },
    
    init:function(){
        jQuery(document).ready(function($){
            var mainobj=scrolltotop
            var iebrws=document.all
            mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode
            mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body')
            mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>')
                .css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'})
                .attr({title:'Scroll Back to Top'})
                .click(function(){mainobj.scrollup(); return false})
                .appendTo('body')
            if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text
                mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text
            mainobj.togglecontrol()
            $('a[href="' + mainobj.anchorkeyword +'"]').click(function(){
                mainobj.scrollup()
                return false
            })
            $(window).bind('scroll resize', function(e){
                mainobj.togglecontrol()
            })
        })
    }
}

scrolltotop.init()



pus acum 13 ani
   
DeXter
☻☻☻

Inregistrat: acum 16 ani
Postari: 67
Cod pentru a inlocui un buton cu o imagine

Code:

It should be
<input type="image" id="myimage" [...] >

So "image" instead of "submit". It will still be a button which submits on click.

If your image is bigger than the button which is shown; let's say the image is 200x200 pixels; add this to your stylesheet:
#myimage {
    height: 200px;
    width: 200px;
}

or directly in the button tag:
<input type="image" id="myimage" style="height:200px;width:200px;" [...] >

Aici un tutorial:


iar aici un generator online :
 

sau


Modificat de DeXter (acum 12 ani)


pus acum 12 ani
   
Pagini: 1  

Mergi la