Jump to content
php.lv forumi

php paraksts


homers

Recommended Posts

Tatad googlē atrādu vēlamo skriptu viss aizgāja kamēr nepieslēdzu datubāzi.

Tatad rekur skripts

<?php 

$con = mysql_connect("localhost", "root", "******");
$db = mysql_select_db("rpg", $con);

$a = $_GET['user'];
$af=  mysql_query("SELECT vecums FROM lietotaaji WHERE vaards=$a");
$vecums = $af[0];

header("Content-type: image/png");

$im = imagecreate(315, 65);

$bg = imagecolorallocate($im, 255, 255, 255);

$textcolor = imagecolorallocate($im, 0, 0, 0);

imagestring($im, 3, 0, 0, $vecums, $textcolor);

imagepng($im);

?>

Gribu uzvilkt lietotaja informāciju, bet man rada vienkarši baltu lapu. Kāds var pateikt kas pa vainu?

Link to comment
Share on other sites

Vaina ir šajās rindās.

$a = $_GET['user'];
$af=  mysql_query("SELECT vecums FROM lietotaaji WHERE vaards=$a");
$vecums = $af[0];

 

pārējās pārbaudes piedzejosi pats

$a = isset($_GET['user']) ? mysql_real_escape_string($_GET['user']) : '';

$af = mysql_query("SELECT vecums FROM lietotaaji WHERE vaards='$a'");

list($vecums) = mysql_fetch_row($af);

Link to comment
Share on other sites

<?php 

$con = mysql_connect("localhost", "root", "dsdsata");
$db = mysql_select_db("rpg", $con);

$a = isset($_GET['user']) ? mysql_real_escape_string($_GET['user']) : '';
$af = mysql_query("SELECT vecums FROM lietotaaji WHERE vaards='$a'");
list($vecums) = mysql_fetch_row($af); 
$vecums = $af[0];

header("Content-type: image/png");

$im = imagecreate(315, 65);

$bg = imagecolorallocate($im, 255, 255, 255);

$textcolor = imagecolorallocate($im, 0, 0, 0);

imagestring($im, 3, 0, 0, $vecums, $textcolor);

imagepng($im);

?>

uzliku šadi, tapat balta lapa

Edited by homers
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...