Oferta Web Blog

Tehnologii Web de Ultima Generatie

Follow me on TwitterRSS Feeds

  • Home
  • Despre noi

search free domain names script in php (automatic whois in php)

Jul 30th

Posted by oferta web in General

No comments

This script will allow you to search free domain names.

error_reporting(E_ALL);
ini_set('display_errors', 1);

include_once('whois.main.php');
include_once('whois.utils.php');

$whois = new Whois();

// Set to true if you want to allow proxy requests
$allowproxy = false;

// uncomment the following line to get faster but less acurate results
// $whois->deep_whois = false;

// To use special whois servers (see README)
//$whois->UseServer('uk','whois.nic.uk:1043?{hname} {ip} {query}');
//$whois->UseServer('au','whois-check.ausregistry.net.au');

// uncomment the following line to add support for non ICANN tld's
// $whois->non_icann = true;

$caractere = array('a','b','c','d','e','f','g','h','i','j','k','l','m',
'n','o','p','r','s','t','u','q','w','x','y','z');
//you can also add '1','2','3',etc if you want numbers

//we start with 3 letters, because almost ALL 2 letters names are alraedy taken.

foreach($caractere as $c1){
foreach($caractere as $c2){
foreach($caractere as $c3){
$query = $c1.$c2.$c3.".com"; //replace .com with .info , .net, .eu , .de etc etc

$ok=1;

// if ( ($c1 !== $c2) && ($c1 !== $c3) && ($c2 !== $c3)) $ok=0; //only names with at least 2 equals chars (uncomment if you want it)

if($ok){
$result = $whois->Lookup($query);

$winfo = '';

$utils = new utils;
$winfo = $utils->showHTML($result);

//print_r($result['rawdata']);

if(empty($result['rawdata'][16])) {
echo $query." Available
";
} else {
echo "";
}
}

}
}

}

//-------------------------------------------------------------------------

function extract_block (&$plantilla,$mark,$retmark='')
{
$start = strpos($plantilla,'');
$final = strpos($plantilla,'');

if ($start === false || $final === false) return;

$ini = $start+7+strlen($mark);

$ret=substr($plantilla,$ini,$final-$ini);

$final+=8+strlen($mark);

if ($retmark===false)
$plantilla=substr($plantilla,0,$start).substr($plantilla,$final);
else
{
if ($retmark=='') $retmark=$mark;
$plantilla=substr($plantilla,0,$start).'{'.$retmark.'}'.substr($plantilla,$final);
}

return $ret;
}
?>

of course you will need the included files.

Full download here. http://ofertaweb.ro/downloads/view.download/9/51.html

and see example.php :)

auto whois, automatic whois in php, script php, search domain names in php, whois script php

cool jquery countdown script/module

Jul 8th

Posted by oferta web in General

No comments

Just finished coding a very cool jQuery countdown module for joomla.

http://ofertaweb.ro/demos/cool_jquery_countdown/light/

View code
Title: cool jQuery countdown - light version
Description: the light version

http://ofertaweb.ro/demos/cool_jquery_countdown/dark/

View code
Title: cool jQuery countdown - dark version
Description: the dark version

download here: http://ofertaweb.ro/downloads/view.download/11/47.html

cool jquery countdown, joomla module jquery, jquery countdown joomla, jquery joomla module

how to Ajax-ify module what means your name

Jul 7th

Posted by oferta web in General

No comments

Here’s how you can make this cool module ajax like.

Download the original module

First install the component and the module normal way.

New what_means_your_name.php file

<?php
/**
* @version 1.1
* @package Joomla
* @copyright Copyright (C) 2010 ofertaweb.ro
* @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
*/

// no direct access
defined(‘_JEXEC’) or die(‘Restricted access’);

$myabsoluteurl=JURI::base();
$url = $myabsoluteurl.’modules/mod_what_means_your_name/’;
$user =& JFactory::getUser();
$uname = $user->name;
?>
<div id=’name_form’ style=’text-align: center’>
<form name=’name_form’ method=’post’><label>Write your name here: </label>
<input name=’name2check’ id=’name2check’ type=’text’ maxchars=’20′ length=’6′ value=’<?php echo $uname; ?>’>
<input type=’submit’ id=’nc_submit’ value=’check name’>
</form>
</div>

<!–  you may want to remove the below line if jquery is already loaded –>
<script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js”></script>

<script type=”text/javascript”>
$(document).ready(function() {
$(‘#nc_submit’).click(function(){
$(“#results”).fadeOut(500);
var name = $(‘#name2check’).val();
$.ajax({
url: ‘<?php echo $url; ?>process.php’,
type: ‘POST’,
data: ‘name2check=’ + name,

success: function(result){

$(‘#results’).empty().remove();
$(‘#name_form’).append(‘<div id=”results”>’+result+’</div>’);
$(‘#results’).hide();
$(‘#results’).fadeIn(1000);
}
});

return false;
});

});
</script>

and now add a new php file process.php. Modify what is with RED

//process.php

<?php
/**
* @version 1.1
* @package Joomla
* @copyright Copyright (C) 2010 ofertaweb.ro
* @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
*/

$link = mysql_connect(‘database_ip’,'user’,'password‘);
mysql_select_db(‘joomla_db‘);
if(!empty($_POST['name2check']))
{
$name = htmlspecialchars(stripslashes($_POST['name2check']));
$max_results = 5;
$show_gender = 1;
$show_origin = 1;
$query = “SELECT * FROM prefix_names WHERE name LIKE ‘%$name%’ LIMIT $max_results”;
$res=mysql_query($query);
while($row=mysql_fetch_assoc($res))
{
echo “<p>”;
echo “<strong>Meaning:</strong> “.$row['meaning'];
if($show_gender==1) echo “<br /><strong>Gender: </strong>”.$row['gender'];
if($show_origin==1) echo “<br /><strong>Origin: </strong>”.$row['origin'];
echo “</p>”;
}
}
?>

joomla, jquery, modify joomla module, what means your name module

youtube api – script de cautare si afisare automata a videoclipurilor

Jul 2nd

Posted by oferta web in General

No comments

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<meta name=”Keywords” http-equiv=”Keywords” content=”Fabio Capello,football,world cup,germany,england” />
<title>Fashion of hats – summer 2010</title>
</head>

<body>
<h2>keywords this page has: Fabio Capello,football,world cup,germany,england</h2>
<p>random between first and second video order by &quot;most views&quot; on youtube regarding the above keywords</p>
<p>&nbsp;</p>

<?php
error_reporting(E_ALL);
ini_set(‘display_errors’, ‘1′);

require_once ‘Zend/Loader.php’;
Zend_Loader::loadClass(‘Zend_Gdata_YouTube’);
$yt = new Zend_Gdata_YouTube();

//——— params———-
$keywords = ‘Fabio Capello,football,world cup,germany,england’;

$order = “relevance”; //you can use relevance, published, viewCount, rating

$width = 660;
$height = 405;

$color1 =’0xDDDDDD’;
$color2 = ‘0×999999′;

$show_description = 1; //0 if not
$show_tags = 1; //0 if not

$display = 1; // 0 – video with most views. 1 – random between fist and second video that matches
//——— params———-

function printVideoEntry($videoEntry)
{
// the videoEntry object contains many helper functions
// that access the underlying mediaGroup object
/*
echo ‘Video: ‘ . $videoEntry->getVideoTitle() . “<br />”;
echo ‘Video ID: ‘ . $videoEntry->getVideoId() . “<br />”;
echo ‘Updated: ‘ . $videoEntry->getUpdated() . “<br />”;
echo ‘Description: ‘ . $videoEntry->getVideoDescription() . “<br />”;
echo ‘Category: ‘ . $videoEntry->getVideoCategory() . “<br />”;
echo ‘Tags: ‘ . implode(“, “, $videoEntry->getVideoTags()) . “<br />”;
echo ‘Watch page: ‘ . $videoEntry->getVideoWatchPageUrl() . “<br />”;
echo ‘Flash Player Url: ‘ . $videoEntry->getFlashPlayerUrl() . “<br />”;
echo ‘Duration: ‘ . $videoEntry->getVideoDuration() . “<br />”;
echo ‘View count: ‘ . $videoEntry->getVideoViewCount() . “<br />”;
echo ‘Rating: ‘ . $videoEntry->getVideoRatingInfo() . “<br />”;
echo ‘Geo Location: ‘ . $videoEntry->getVideoGeoLocation() . “<br />”;
echo ‘Recorded on: ‘ . $videoEntry->getVideoRecorded() . “<br />”;

echo “Thumbnails:<br />”;
$videoThumbnails = $videoEntry->getVideoThumbnails();

foreach($videoThumbnails as $videoThumbnail) {
echo “<img src=’”. $videoThumbnail['url'].”‘”;
echo ‘ height=’ . $videoThumbnail['height'];
echo ‘ width=’ . $videoThumbnail['width'] . “/> “;
}
*/

//<object width=”1300″ height=”765″><param name=”movie” value=”http://www.youtube-nocookie.com/v/_nDF11mR9yo&hl=en_US&fs=1&color1=0×402061&color2=0×9461ca&hd=1&border=1″></param><param name=”allowFullScreen” value=”true”></param><param name=”allowscriptaccess” value=”always”></param><embed src=”http://www.youtube-nocookie.com/v/_nDF11mR9yo&hl=en_US&fs=1&color1=0×402061&color2=0×9461ca&hd=1&border=1″ type=”application/x-shockwave-flash” allowscriptaccess=”always” allowfullscreen=”true” width=”1300″ height=”765″></embed></object>
//<object width=”1300″ height=”765″><param name=”movie” value=”http://www.youtube-nocookie.com/v/_nDF11mR9yo&hl=en_US&fs=1&hd=1&border=1″></param><param name=”allowFullScreen” value=”true”></param><param name=”allowscriptaccess” value=”always”></param><embed src=”http://www.youtube-nocookie.com/v/_nDF11mR9yo&hl=en_US&fs=1&hd=1&border=1″ type=”application/x-shockwave-flash” allowscriptaccess=”always” allowfullscreen=”true” width=”1300″ height=”765″></embed></object>

$video_info = array(
‘videoid’ => $videoEntry->getVideoId(),
‘description’ => $videoEntry->getVideoDescription(),
‘tags’ => implode(“, “, $videoEntry->getVideoTags())
);

return $video_info;
}

function printVideoFeed($videoFeed,$display)
{
$random = rand(0,1);

if( $display == 0 )
{
return printVideoEntry($videoFeed[0]);
}

if( $display == 1 )
{
return printVideoEntry($videoFeed[$random]);
}

}

function searchAndPrint($searchTerms,$display,$order)
{
$yt = new Zend_Gdata_YouTube();
$yt->setMajorProtocolVersion(2);
$query = $yt->newVideoQuery();
$query->setOrderBy($order);
$query->setSafeSearch(‘none’);
$query->setVideoQuery($searchTerms);

// Note that we need to pass the version number to the query URL function
// to ensure backward compatibility with version 1 of the API.
$videoFeed = $yt->getVideoFeed($query->getQueryUrl(2));
return printVideoFeed($videoFeed,$display);
}

$video_info = searchAndPrint($keywords,$display,$order);

$output = ”

<object width=’”.$width.”‘ height=’”.$height.”‘>
<param name=’movie’ value=’http://www.youtube.com/v/”.$video_info['videoid'].”&amp;hl=en_US&amp;fs=1?color1=”.$color1.”&amp&color2=”.$color2.”&amp;hd=1&amp;border=1′</param>
<param name=’allowFullScreen’ value=’true’></param>
<param name=’allowScriptAccess’ value=’always’></param>
<param name=’hd’ value=’1′></param>
<embed src=’http://www.youtube.com/v/”.$video_info['videoid'].”&amp;hl=en_US&amp;fs=1?color1=”.$color1.”&amp&color2=”.$color2.”&amp;hd=1&amp;border=1′
type=’application/x-shockwave-flash’
allowfullscreen=’true’
allowscriptaccess=’always’
width=’”.$width.”‘ height=’”.$height.”‘>
</embed>
</object>

“;

echo “<div name=’youtube_video’ style=’width=”.$width.”px; height=”.$height.”px’>”;
echo $output;
if( ($show_description!=0) || ($show_tags !=0)){
echo “<div style=’padding:15px’>”;
if($show_description==1) echo $video_info['description'].”<br />”;
if($show_tags==1) echo “Tags: “.$video_info['tags'];
echo “</div>”;
}
echo “</div>”;
?>

<h2>The FA have announced that Fabio Capello   will stay on as <a href=”http://uk.eurosport.yahoo.com/football/england/”>England</a> manager despite the team’s woeful performance at the <a href=”http://uk.eurosport.yahoo.com/football/world-cup/”>World Cup</a>.</h2>
<p>And the 64-year-old Italian said he was more determined than   ever to succeed after the FA unanimously decided to keep faith with him.</p>
<p>Capello and his squad came under fire after England’s shoddy World   Cup performance ended in a humiliating 4-1 last-16 defeat by <a href=”http://uk.eurosport.yahoo.com/football/germany/”>Germany</a> on   Sunday.</p>
<p>Shortly before the World Cup began the FA had confirmed that Capello   would remain in charge until the 2012 European Championship but the   failure in <a href=”http://uk.eurosport.yahoo.com/football/south-africa/”>South Africa</a> cast doubts over his future.</p>
<p>However, after days of speculation it was agreed at a meeting of the   Club England Board that Capello, who earns £6 million a year, would   remain in charge.</p>
<p>&quot;I am more determined than ever to succeed with the England team,&quot;   Capello said.</p>
<p>&quot;(Club England chairman) Sir Dave Richards has called me to tell me   everyone at the FA wants me to continue. I explained it is very   important we use the disappointment as a motivation in the future.</p>
<p>&quot;I can assure the fans I am now fully focused on our European   qualifying fixtures, starting with the friendly against Hungary in   August.</p>
<p>&quot;I am extremely proud to be the England manager, it means so much to   me and I am determined to succeed.&quot;</p>
<p>The decision was taken at a meeting between Richards and his fellow   Club England board members – former England midfielder Trevor Brooking,   Alex Horne and Club England managing director Adrian Bevington – and   then approved by the FA’s main board..</p>
<p>&quot;We are all still extremely disappointed at our performance in South   Africa, and we believed it was important that we took some time to   reflect on everything in a calm and considered manner back in England,&quot;   Richards said.</p>
<p>&quot;After fully discussing our performance we remain convinced that   Fabio is the best man for the job.&quot;</p>
<p>Capello’s first task will be to restore public confidence in the   squad, and his own abilities.</p>
<p>The former AC Milan and Real Madrid coach’s tactics and selection   policy were castigated by the media and public alike as England toiled   through the group stage.</p>
<p>A 1-1 draw with the United States and a 0-0 stalemate with Algeria   left England needing a 1-0 win over Slovenia to move through to the   knockout stages in second place in their group.</p>
<p>England were then outplayed by a youthful Germany side who inflicted   their worst ever World Cup defeat.</p>
<p>With an ageing squad, Capello will be under pressure to quickly   inject some vitality into the team as European championship qualifiers   against Bulgaria and <a href=”http://uk.eurosport.yahoo.com/football/switzerland/”>Switzerland</a> loom.</p>
<p>Frank Lampard and Steven Gerrard have almost certainly played in   their last World Cup finals while former captain John Terry, whose   outspoken comments were criticised by Capello in South Africa, is also   close to 30.</p>
<p>&quot;We will look to introduce new players to give the team new energy   and I will use all my experience to take England forward,&quot; Capello said.</p>
<h2>&nbsp;</h2>
</body>
</html>

php and youtube, script youtube in php, youtube api, youtube search script

Script statistici counter strike in php

Jun 24th

Posted by oferta web in General

No comments

Tutorial cum facem un script de statistici pentru counter-strike.

Putem vedea numarul jucatorilor, harta si multe multe multe altele.

pasul 1:

downloadati de aici http://sourceforge.net/projects/gameq/ libraria gameq si dezarhivat-o pe server.

$result = $db->fetchAssoc(‘SELECT server FROM tabel_servere ORDER BY id DESC’);
// aici puteti folosi un mysql_fetch_assoc

foreach($result as $res){ // prelucram rezultatele

$server = $res['server'];

$servers += array($server => array(‘cssource’, $server, ‘27015′)); //initializam lista de servere. (daca este decat 1 singur server inlocuiti $server cu ip-ul lui.
}

//mai jos, pur si simplu copy-paste din fisierul de exemple de la gameq

$gq = new GameQ();  //initializam GameQ-ul

// You can optionally specify some settings
$gq->setOption(‘timeout’, 200);

// You can optionally specify some output filters,
// these will be applied to the results obtained.
$gq->setFilter(‘normalise’);
$gq->setFilter(’sortplayers’, ‘gq_ping’);

// Send requests, and parse the data
$results = $gq->requestData();

// Some functions to print the results
function print_results($results) {

foreach ($results as $id => $data) {

printf(“<h2>%s</h2>\n”, $id);
print_table($data);
}

}

function print_table($data) {

$gqs = array(‘gq_online’, ‘gq_address’, ‘gq_port’, ‘gq_prot’, ‘gq_type’);

if (!$data['gq_online']) {
printf(“<p>The server did not respond within the specified time.</p>\n”);
return;
}

print(“<table><thead><tr><td>Variable</td><td>Value</td></tr></thead><tbody>\n”);

foreach ($data as $key => $val) {

if (is_array($val)) continue;

$cls = empty($cls) ? ” : ”;

if (substr($key, 0, 3) == ‘gq_’) {
$kcls = (in_array($key, $gqs)) ? ‘always’ : ‘normalise’;
$key = sprintf(“<span class=\”key-%s\”>%s</span>”, $kcls, $key);
}

printf(“<tr%s><td>%s</td><td>%s</td></tr>\n”, $cls, $key, $val);
}

print(“</tbody></table>\n”);

}

?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en” lang=”en”>
<head>
<title>GameQ – Example script</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<style type=”text/css”>
* {
font-size: 9pt;
font-family: Verdana, sans-serif;
}
h1 {
font-size: 12pt;
}
h2 {
margin-top:2em;
font-size: 10pt;
}
table {
border: 1px solid #000;
background-color: #DDD;
border-spacing:1px 1px;
}
table thead {
font-weight: bold;
background-color: #CCC;
}
table tr.uneven td {
background-color:#FFF;
}
table td {
padding: 5px 8px;
}
table tbody {
background-color: #F9F9F9;
}
.note {
color: #333;
font-style:italic;
}
.key-always {
color:red;
font-weight:bold;
}
.key-normalise {
color:red;
}
</style>
</head>
<body>
<h1>GameQ – Example script</h1>
<div>
Players are never displayed in this example. <br/>
<span>Bold, red</span> variables are always set by gameq.
Additionally, the normal <span>red</span> variables are always set when the normalise filter is enabled.<br/>
gq_online will always contain a boolean indicating if the server responded to the request.<br/>
<br/>
Click <a href=”list.php”>here</a> for a list of supported games.
</div>
<?php
print_results($results); //foarte important sa adaugam asta :)
?>

nu este chiar pentru super incepatori in php dar sper sa va descurcati.

scriptul poate fi vazut ca demo aici: http://godlike.ro/ la top-ul serverelor (mi-a trebuit decat numele serverelor)

counter, script counter php, script statistici counter strike, statistici counter in php

script procesare plata prin sms – Procesare coduri SMS-uri

Jun 8th

Posted by oferta web in General

No comments

Dupa ce primim fisierele cu codurile valide trebuie sa facem cumva sa le procesam.

De obicei se trimit in format .csv (adica un .txt cu newline intre randuri).

Tutorial:

I.

Primul pas este sa uploadam undeva fisierul si sa il citim linie cu linie.

<?php
$handle = @fopen(“8548.csv”, “r”);
if ($handle) {
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
echo trim($buffer);

}
fclose($handle);
}
?>

Apoi le punem intr-o baza de date pentru a le manipula mai usor. Folosim functia trim pentru a inlatura newline-ul de la sfarsitul unui cod.

<?php

$link = mysql_connect(“ip_ul serverului db”,”useru”,”parola”);
mysql_select_db(“coduri_sms”); //sau cum se cheama baza de date cu sms-uri

$handle = @fopen(“8548.csv”, “r”);
if ($handle) {
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
$cod = trim($buffer);

mysql_query(“INSERT INTO 8548(cod) VALUES(‘$cod’)”);

}
fclose($handle);
}

mysql_close($link);
?>

Unde 8548 este un tabel care are doar o singura coloana – primary key numita cod. (il deschidem si stergem prima linie care e goala).

Se repeta procedeul pentru fiecare nr. de telefon (adica fiecare fisier csv) primit si se fac tabele cu ele.

Bun. Primul pas l-am rezolvat si avem codurile in tabele.

II. Procesarea efectiva a codului.

1. luam username-ul/emailul si alte informatii care ne-ar putea fi de folos.

2. verificam daca e valid codul intr-un tabel, daca da atunci procesam, daca NU atunci verificam in alt tabel iar in caz ca nu e valid il redirectionam catre o pagina de eroare unde ii logam ip-ul, data etc.

3. afisam cate credite are pe username-ul respectiv.

codul de mai jos nu este 100% complet, dar va indruma catre directia cea buna.

<?php

include “functions.php”;

$ip = get_real_ip(); //o functie buna de luat ip-ul adevarat

verificare_ip_banat($ip); //daca greseste codul de mai multe ori ii banati ip-ul

//valabil pentru joomla!. dar aici apare pagina dupa ce userul se logheaza.
$user =& JFactory::getUser();
$username = $user->username;
$email = $user->email;

//nu mai este necesar sa scrieti mysql_connect daca folositi joomla ptr. ca e deja conectat la mysql
if(!mysql_select_db(“coduri_sms”)) die(“Error”);

if(!empty($_POST['cod']))
{
$cod = htmlspecialchars($_POST['cod']);

$query =mysql_query(“SELECT COUNT(*) FROM 8685 WHERE cod=’$cod’”);
if(!$query) die(“Eroare! #1 Va rugam contactati un administrator!”);
$valid = mysql_fetch_array($query);
if($valid[0]==1){

//echo “cod valid! – 3 EURO”;

//sterge codul din baza de date
$query=mysql_query(“DELETE FROM 8685 WHERE cod=’$cod’”);

//1. ia cate credite are (daca nu are fa-i cont cu 0.

$query = mysql_query(“SELECT * FROM procesari WHERE username=’$username’”);

$num = mysql_num_rows($query);
if($num==0){
//fa-i cont;
$query=mysql_query(“INSERT INTO procesari(username,credite) VALUES(‘$username’,'27′)”);
}else{
$row=mysql_fetch_assoc($query);
$credite=$row['credite'];
$credite=$credite+27;
$query=mysql_query(“UPDATE procesari SET credite=’$credite’ WHERE username=’$username’”);

echo “<strong>Multumim pentru incarcare.</strong>”;
}

}else{

$query =mysql_query(“SELECT COUNT(*) FROM 7685 WHERE cod=’$cod’”);
if(!$query) die(“Eroare!”);
$valid = mysql_fetch_array($query);
if($valid[0]==1){
//echo “cod valid! – 10 EURO”;
//sterge codul din baza de date
$query=mysql_query(“DELETE FROM 7685 WHERE cod=’$cod’”);

//1. ia cate credite are (daca nu are fa-i cont cu 0).

$query = mysql_query(“SELECT * FROM procesari WHERE username=’$username’”);

$num = mysql_num_rows($query);
if($num==0){
//fa-i cont;
$query=mysql_query(“INSERT INTO procesari(username,credite) VALUES(‘$username’,'30′)”);
}else{
$row=mysql_fetch_assoc($query);
$credite=$row['credite'];
$credite=$credite+30;

$query=mysql_query(“UPDATE procesari SET credite=’$credite’ WHERE username=’$username’”);

echo “<strong>Multumim pentru incarcare.</strong>”;

}
}
else {
//cod invalid

echo ”

<script type=’text/javascript’>
<!–
window.location = ‘http://godlike.ro/eroare.php’
//–>
</script>

“;
}

}

}

?>

<h3> Bine ai venit <?php echo $username; ?> </h3>

<?php

$res = mysql_query(“SELECT * FROM procesari WHERE username=’$username’”);

if(mysql_num_rows($res) == 0) echo “In contul tau se afla: <span style=’color:#FF000;font-weight:bold;’>0 credite</span>”;else {
$row=mysql_fetch_assoc($res);
echo “In contul tau se afla: <span style=’color:#FF0000;font-weight:bold;’>”.$row['credite'].” de credite</span>”;
}

?>

<p>Incarcare credite</p>
<div style=”background-color:#A9D0F5; font-weight:bold; padding: 10px”>
<p>I. Comanda Credite</p>

<form method=”post” action=”http://www.godlike.ro/incarca-credite.html”>
<table width=”649″ border=”0″>
<tr>
<td width=”141″>Cod:</td>
<td width=”349″><input name=”cod” type=”text” maxlength=”30″ />
Codul care va vine prin SMS!</td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><label>
<input type=”submit” name=”comanda” id=”comanda” value=”Incarca Credite” />
</label></td>
</tr>
</table>
</form>
</div>
<p>

Spor la treaba!

procesare coduri sms, script procesare plata sms, script sms-uri

jQuery, php mysql si paginatie

Jun 5th

Posted by oferta web in General

No comments

Cum faceti paginatie cu jquery, php si mysql.

Exemplu: http://www.ofertaweb.ro/localitati_romania/

index.php

->

<html>
<head>
<title>Populatia localitatilor din Romania – jQuery & Pagination with Php&MySQL</title>
<script src=”js/jquery-1.3.2.min.js”></script>
<script src=”js/jquery-ui-1.7.custom.min.js”></script>
<script src=”js/controller.js”></script>

</head>

<link  rel=”stylesheet” href=”css/live.css” type=”text/css”>

<body>
<h1>Populatia Localitatilor din Romania</h1>

<div id=”form”>
<input type=”text” id=”searchbox” name=”searchbox” />
<div id=”buttonContainer”>
<a id=”submitbutton” href=”#”><span id=”buttontext”>Cauta</span></a>
</div>
</div>
<div id=”resultsContainer”></div>

</body>
</html>

——————

search.php

<?php

if(isset($_GET['query'])) { $query = $_GET['query']; } else { $query = “”; }

/*
Place code to connect to your DB here.
*/
$con = mysql_connect(“ipul_db”,”user”,”parola”);
$db = mysql_select_db(“localitati_din_romania”); // de exemplu

$tbl_name=”populatie”;        //your table name
// How many adjacent pages should be shown on each side?
$adjacents = 3;

/*
First get total number of rows in data table.
If you have a WHERE clause in your query, make sure you mirror it here.
*/
$query2 = “SELECT COUNT(*) as num FROM $tbl_name WHERE localitate LIKE ‘%$query%’”;
$total_pages = mysql_fetch_array(mysql_query($query2));
$total_pages = $total_pages[num];
echo “<strong>In total sunt: “.$total_pages.” rezultate </strong>”;

/* Setup vars for query. */
$targetpage = “search.php”;     //your file name  (the name of this file)
$limit = 10;                                 //how many items to show per page
$page = $_GET['page'];
if($page)
$start = ($page – 1) * $limit;             //first item to display on this page
else
$start = 0;                                //if no page var is given, set start to 0

/* Get data. */
$sql = “SELECT * FROM $tbl_name WHERE localitate LIKE ‘%$query%’ LIMIT $start, $limit”;
$result = mysql_query($sql);

/* Setup page vars for display. */
if ($page == 0) $page = 1;                    //if no page var is given, default to 1.
$prev = $page – 1;                            //previous page is page – 1
$next = $page + 1;                            //next page is page + 1
$lastpage = ceil($total_pages/$limit);        //lastpage is = total pages / items per page, rounded up.
$lpm1 = $lastpage – 1;                        //last page minus 1

/*
Now we apply our rules and draw the pagination object.
We’re actually saving the code to a variable in case we want to draw it more than once.
*/
$pagination = “”;
if($lastpage > 1)
{
$pagination .= “<div class=\”pagination\”>”;
//previous button
if ($page > 1)
$pagination.= “<a href=\”$targetpage?page=$prev\”><- inapoi </a>”;
else
$pagination.= “<span class=\”disabled\”><- inapoi </span>”;

//pages
if ($lastpage < 7 + ($adjacents * 2))    //not enough pages to bother breaking it up
{
for ($counter = 1; $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= “<span class=\”current\”>$counter</span>”;
else
$pagination.= “<a href=\”$targetpage?page=$counter\”>$counter</a>”;
}
}
elseif($lastpage > 5 + ($adjacents * 2))    //enough pages to hide some
{
//close to beginning; only hide later pages
if($page < 1 + ($adjacents * 2))
{
for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
{
if ($counter == $page)
$pagination.= “<span class=\”current\”>$counter</span>”;
else
$pagination.= “<a href=\”$targetpage?page=$counter\”>$counter</a>”;
}
$pagination.= “…”;
$pagination.= “<a href=\”$targetpage?page=$lpm1\”> $lpm1 </a>”;
$pagination.= “<a href=\”$targetpage?page=$lastpage\”> $lastpage </a>”;
}
//in middle; hide some front and some back
elseif($lastpage – ($adjacents * 2) > $page && $page > ($adjacents * 2))
{
$pagination.= “<a href=\”$targetpage?page=1\”> 1 </a>”;
$pagination.= “<a href=\”$targetpage?page=2\”> 2 </a>”;
$pagination.= “…”;
for ($counter = $page – $adjacents; $counter <= $page + $adjacents; $counter++)
{
if ($counter == $page)
$pagination.= “<span class=\”current\”>$counter</span>”;
else
$pagination.= “<a href=\”$targetpage?page=$counter\”>$counter</a>”;
}
$pagination.= “…”;
$pagination.= “<a href=\”$targetpage?page=$lpm1\”> $lpm1 </a>”;
$pagination.= “<a href=\”$targetpage?page=$lastpage\”> $lastpage </a>”;
}
//close to end; only hide early pages
else
{
$pagination.= “<a href=\”$targetpage?page=1\”>1</a>”;
$pagination.= “<a href=\”$targetpage?page=2\”>2</a>”;
$pagination.= “…”;
for ($counter = $lastpage – (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= “<span class=\”current\”> $counter </span>”;
else
$pagination.= “<a href=\”$targetpage?page=$counter\”> $counter </a>”;
}
}
}

//next button
if ($page < $counter – 1)
$pagination.= “<a href=\”$targetpage?page=$next\”> inainte -> </a>”;
else
$pagination.= “<span class=\”disabled\”> inainte -> </span>”;
$pagination.= “</div>\n”;
}
?>

<table cellspacing=”5″>
<tr>
<td>
<strong>Localitate</strong>
</td>
<td>
<strong>Judet</strong>
</td>
<td>
<strong>Populatie</strong>
</td>
</tr>
<?php

while($row = mysql_fetch_array($result))
{
echo “<tr>”;
echo “<td>”;
echo $row['localitate'];
echo “</td>”;
echo “<td>”;
echo $row['judet'];
echo “</td>”;
echo “<td>”;
echo $row['populatie'];
echo “</td>”;

echo “</tr>”;

}
?>
</table>
<?=$pagination?>

<?php
mysql_close($con);
?>

javascripturi-le le puteti lua dand view-source pe pagina exemplu.

Bafta :)

joomla, jquery, localitati romania, php mysql si paginatie

pagini cu judetele si localitatile din romania

May 28th

Posted by oferta web in General

No comments

Testam daca ne avantajeaza sa punem linkuri catre pagini cu localitatile din romania avand cuvinte cheie.

gen: http://ofertaweb.ro/webdesign/ALBA/ALBA.htm

http://ofertaweb.ro/webdesign/ALBA/BISTRA/BISTRA.htm

Cum am generat paginile ?

- Se ia o baza de date cu localitatea / judetul / populatia (de preferat) etc.

- Se genereaza un template avand ca textul care trebuie inlocuit ceva gen @@@ si %%%

se incarca template-ul intr-un script, folosind str_replace(“@@@”,$judet,$continut) generam fisiere pentru fiecare localitate in parte.

spre exemplu:

$cont = file_get_contents(“http://ofertaweb.ro/test.php”);

$link = mysql_connect($ip_baza_de_date,’user’,'parola’);
if(!$link) die(“Failed to connect to database!”);
$status = mysql_select_db(‘localitati_romania’);
if(!$status) die(“Failed to select database!”);

$judet = “VRANCEA”; //< de exemplu!
$handle = fopen($filename,”w+”);
$cont = str_replace(“@@@”,$judet,$cont);

$links = “Webdesign in: <br /><ul>”;
$loc = mysql_query(“SELECT * FROM localitati WHERE judet=’$judet’”);
while($rand = mysql_fetch_assoc($loc)){

$links = $links. “<li>”;
$links = $links. “<a href=’http://ofertaweb.ro/webdesign/”.$judet.”/”.$rand['localitate'].”/”.$rand['localitate'].”.htm’>”.$rand['localitate'].”</a> populatie “.$rand['populatie'].” locuitori”;
$links = $links. “</li>”;
$links = $links . “</ul><ul>”;
}

$cont = str_replace(“%%%”,$links,$cont);

echo $cont;
$cont = str_replace($judet,”@@@”,$cont);
$cont = str_replace($links,”%%%”,$cont);

————

daca sunteti interesati de mai multe detalii cu privire la acesta procedura va rugam lasati un comentariu :)

foldere in php, generare fisiere, generare pagini, php

>Dual login: phpbb si website (+integrare forum in site)

May 22nd

Posted by oferta web in joomla

No comments

>http://www.jfusion.orgExemplu: http://godlike.ro/

Useri se pot loga atat pe website cat si pe forum cu acelasi user/parola iar dupa logare apare cate mesaje necitite ai etc.
Se arata cine este online (cu avatar) si ultimele mesaje de pe forum.

—— totul super-customizabil.

HOW TO:
1. Se instaleaza joomla si se completeaza cu sectiuni, module, articole pluginuri si un template cat de cat bine facut.
2. Se ia extensia asta: http://www.jfusion.org/index.php/downloads/category/1-latest_release
si se instaleaza.

Partea mai grea: configurarea ei:

Plugin General Details

When the user details have changed in the JFusion master plugin, should these details be automatically updated in this software? Bifeaza Yes la toate

La configuration:

joomla_int
Edit plugin
Current Joomla Site Disabled Disabled Enabled Enabled Good ConfigGood Config 17 EnabledEnabled Public Frontend
phpbb3
Edit plugin
Configure plugin
phpBB3 Enabled Disabled Enabled Enabled Good ConfigGood Config 402 EnabledEnabled REGISTERED

adica master sa fie phpBB3 si sa fie bifat dual login

configurarea pluginului de phpbb:
Full URL to Software http://godlike.ro/forum/
Full Path to Software: standard: /var/www/godlike/forum
Cookie Domain godlike.ro

Cookie Path /

restul standard. atentie insa la Table Prefix sa treceti prefixul de la forum phpbb3_ sau phpbb_ sau ce aveti

Login Identifier Username

apoi selectati What method would you like to use for phpbb3 dual login: let create cookies…

si cam asta ar fi tot.

vedeti la ca modules apar 3 module un-enabled. bifati enable la modulele de login, how is online, si last forum activity si configurati-le dupa dorinta (cati sa arate, dimensiunea avatarului, cate posturi pe forum etc etc).

——————————————————————————
prima oara este mai greu, eu tin minte ca am stat aprox. 30 min pana l-am facut sa mearga.

forum, joomla, php, phpbb

>RDS – Internet Sharing in Windows 7 sau cum dai net la doua calculatoare de la RDS

May 12th

Posted by oferta web in windows 7

3 comments

>Varianta mai scumpa (dar nu mai tii un calculator pe post de server) – iei un router care suporta PPOE (99% suporta… il configurezi…etc)

Varianta ieftina – fara router.

Se ia un calculator cu Windows 7 care va sta mai mult timp deschis si se pune pe el inca o placa de retea.

Control Panel -> Network and Internet -> Network Connections

  • se da click pe RDS (conexiunea ppoe) si se da proprieties -> sharing
  • bifezi primele doua (allow other… si establish …) si la home network connection selectezi Local Area Connection 2 (adica conexiunea pe care o ai cu calc. la care vrei sa dai net).
  • Apoi langa ICS vezi un buton de setting, dai click pe el si bifezi acolo protocoalele care te intereseaza (http, https, pop3…)

pasul 2:

  • dai disconnect la RDS si connect din nou
  • te duci pe adaptorul placii de reatea care face legatura cu calc. la care vrei sa ii dai net si vezi ce ip i-a pus (o sa vezi ceva de genul 192.168.137.1)

pasul 3:

  • pe calculatorul la care vrei sa ii dai net setezi ip-ul pe manual si pui 192.168.137.2, subnet mask: 255.255.255.0,  gateway: 192.168.137.1, preffered dns: 192.168.137.1

acum ar trebui sa iti mearga netul…. daca nu iti merge scoate cablul si baga-l iara.
FELICITARI, tocmai imi datorezi o bere :) )))

daca ai windows XP pe calculatorul server citeste mai jos.

Varianta pentru windows XP:

pe placa 2 din calculatorul “server”:

IP: 192.168.0.1
SUBNET MASK: 255.255.255.0
GATEWAY: lasi necompletat


DNS #1: IP Internet de pe placa 1

DNS #2: 192.168.0.1

Pe PC-ul caruia vrei sa ii dai net:

IP: 192.168.0.2
SUBNET MASK: 255.255.255.0
GATEWAY: 192.168.0.1

DNS #1: IP internet
DNS #2: “192.168.0.1″


=====================================
nu am testat varianta pe xp ptr. ca am trecut rapid la windows 7. banuiesc ca merge si fara sa pui dns 1 cu ip-ul internetului… (si lasi doar 192.168.0.1).


spor la treaba si faceti bookmark la postul asta ptr. ca data viitoare nu o sa stiti cum sa setati conexiunea :) )))

internet sharing, rds, windows 7
1234»
    • Recent comments
    • Popular posts
    • Archives
    • Tags
    • Categories
    • curs php (3)
    • General (13)
    • introducere mysql in php (3)
    • joomla (1)
    • mysql (3)
    • php video tutorial (10)
    • scripturi php (2)
    • valori (1)
    • visitor ip in php (1)
    • webforms (1)
    • webscraping (1)
    • website with phpbb (1)
    • windows 7 (1)
    • yahoo messenger script (1)
    administrare server amx modx automatic whois in php auto whois contact form cu capcha contact form in php counter counter strike foldere in php forum generare fisiere generare pagini internet sharing ip real ip vizitatori joomla joomla module jquery jquery jquery countdown joomla localitati romania php php and youtube phpbb php benchmark page php capcha php mysql si paginatie php scrapping procesare coduri sms rds script counter php script php script procesare plata sms script sms-uri script statistici counter strike script youtube in php search domain names in php servere statistici counter in php timp generare pagina viteza incarcare pagina webscraping what means your name module windows 7 youtube api youtube search script
    • July 2010 (4)
    • June 2010 (3)
    • May 2010 (3)
    • March 2010 (1)
    • February 2010 (2)
    • January 2010 (21)
    • >Curs 1 – Introducere in PHP (4)
    • >Curs 3 – numere, cicluri, comentarii (3)
    • >Informatii de contact (3)
    • >RDS – Internet Sharing in Windows 7 sau cum dai net la doua calculatoare de la RDS (3)
    • >Curs 7 – debugging in php, ce faci cand nu intelegi ce ai gresit (2)
    • >Script administrare server counter strike – accese, amx modx (1)
    • youtube api – script de cautare si afisare automata a videoclipurilor (0)
    • >Primul tau program in php (0)
    • >Misiune si Valori PHP Video Tutorials (0)
    • >Curs 4 Arrayuri (0)
    • ofertaweb: am retestat acum 2 min. merge 100% metoda!
    • oferta web: pai... Control Panel\Network and Internet\Network Connections dai 2 clicuri pe local area...
    • gandacus: "te duci pe adaptorul placii de reatea care face legatura cu calc. la care vrei sa ii dai net si...
    • Anonymous: >sallut all sunt jucator de cs de cam un an am 16 ani si joc de obicei cu numele de -UzZY- .Sunt...
    • Andrei: >din pacate nu...daca vrei cu http://keepvid.com/ sa le iei de pe youtube
    • Decs: >Nu il pot downloada de undeva? Sunt greu de cap si online e incomod de invatat.
    • Anonymous: >ok ms o sa incerc sper sa am totusi si rabdare ;)) ... si dak imi va iesi ceva cu sigurantza am sa...
    • Andrei: >salut. momentan sunt foarte prins in alte lucruri, dupa cum vezi nici nu am mai pus un tutorial...
  • cauta ceva in blog

  • Categorii

    • curs php
    • General
    • introducere mysql in php
    • joomla
    • mysql
    • php video tutorial
    • scripturi php
    • valori
    • visitor ip in php
    • webforms
    • webscraping
    • website with phpbb
    • windows 7
    • yahoo messenger script
  • Blogroll

    • Oferta Web Main Page 10
  • Tags

    administrare server amx modx automatic whois in php auto whois contact form cu capcha contact form in php counter counter strike foldere in php forum generare fisiere generare pagini internet sharing ip real ip vizitatori joomla joomla module jquery jquery jquery countdown joomla localitati romania php php and youtube phpbb php benchmark page php capcha php mysql si paginatie php scrapping procesare coduri sms rds script counter php script php script procesare plata sms script sms-uri script statistici counter strike script youtube in php search domain names in php servere statistici counter in php timp generare pagina viteza incarcare pagina webscraping what means your name module windows 7 youtube api youtube search script
    • Facebook Notifications

      • Irina Buda and Andreea Craciun Ⓥ are now friends, as you suggested. You can suggest more people Andreea knows.
        7 days ago
      • Luciana Dodu accepted your friend request.
        13 days ago
Mystique theme by digitalnature | Powered by WordPress
RSS Feeds XHTML 1.1 Top