Search Results

Search found 4 results on 1 pages for 'hogofwar'.

Page 1/1 | 1 

  • GD PHP Base64 Picture (png) error

    - by hogofwar
    This is part of my code: $con = mysql_connect("localhost","username","passs"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("database", $con); if(mysql_num_rows(mysql_query("SELECT name FROM xbox_user WHERE name = '$user'"))){ // Code inside if block if userid is already there $result = mysql_query("SELECT name FROM xbox_user WHERE name = '$user'"); while($row = mysql_fetch_array($result)) { if ($row['date'] > $row['date']+100){ $src = imagecreatefrompng($result['XboxInfo']['TileUrl']); $base64= base64_encode(file_get_contents($result['XboxInfo']['TileUrl'])); $date = date("Ymd"); mysql_query("UPDATE xbox_user SET date = '$date' SET avatar = '$base64' WHERE name = '$user'"); }else{ $encode = $row['avatar']; //echo $encode; $rand = rand(1, 1337); file_put_contents('/tmp/'.$rand.'.png', base64_decode($row['avatar'])); //ERROR LINE $src = imagecreatefrompng('/tmp/'.$rand.'.png'); unlink('/tmp/'.$rand.'.png'); } } }else{ $src = imagecreatefrompng($result['XboxInfo']['TileUrl']); $base64= base64_encode(file_get_contents($result['XboxInfo']['TileUrl'])); $date = date("Ymd"); mysql_query("INSERT INTO xbox_user (name, avatar, date) VALUES ('$user', '$base64', '$date')"); } It comes up with multiple errors but I feel this one should be addressed first as the other could just be caused by the first error: Warning: imagecreatefrompng() [function.imagecreatefrompng]: '/tmp/628.png' is not a valid PNG file in /home/nah/public_html/experiment/xbox/draw3.php on line 60 It also does create an entry in my mysql DB

    Read the article

  • Another Call to a member function get_segment() on a non-object question

    - by hogofwar
    I get the above error when calling this code: <? class Test1 extends Core { function home(){ ?> This is the INDEX of test1 <? } function test2(){ echo $this->uri->get_segment(1); //this is where the error comes from ?> This is the test2 of test1 testing URI <? } } ?> I get the error where commentated. This class extends this class: <?php class Core { public function start() { require("funk/funks/libraries/uri.php"); $this->uri = new uri(); require("funk/core/loader.php"); $this->load = new loader(); if($this->uri->get_segment(1) != "" and file_exists("funk/pages/".$this->uri->get_segment(1).".php")){ include("funk/pages/". $this->uri->get_segment(1).".php"); $var = $this->uri->get_segment(2); if ($var != ""){ $home= $this->uri->get_segment(1); $Index= new $home(); $Index->$var(); }else{ $home= $this->uri->get_segment(1); $Index = new $home(); $Index->home(); } }elseif($this->uri->get_segment(1) and ! file_exists("funk/pages/".$this->uri->get_segment(1).".php")){ echo "404 Error"; }else{ include("funk/pages/index.php"); $Index = new Index(); $Index->home(); //$this->Index->index(); echo "<!--This page was created with FunkyPHP!-->"; } } } ?> And here is the contents of uri.php: <?php class uri { private $server_path_info = ''; private $segment = array(); private $segments = 0; public function __construct() { $segment_temp = array(); $this->server_path_info = preg_replace("/\?/", "", $_SERVER["PATH_INFO"]); $segment_temp = explode("/", $this->server_path_info); foreach ($segment_temp as $key => $seg) { if (!preg_match("/([a-zA-Z0-9\.\_\-]+)/", $seg) || empty($seg)) unset($segment_temp[$key]); } foreach ($segment_temp as $k => $value) { $this->segment[] = $value; } unset($segment_temp); $this->segments = count($this->segment); } public function segment_exists($id = 0) { $id = (int)$id; if (isset($this->segment[$id])) return true; else return false; } public function get_segment($id = 0) { $id--; $id = (int)$id; if ($this->segment_exists($id) === true) return $this->segment[$id]; else return false; } } ?> i have asked a similar question to this before but the answer does not apply here. I have rewritten my code 3 times to KILL and Delimb this godforsaken error! but nooooooo....

    Read the article

  • Call to a member function get_segment() error

    - by hogofwar
    I'm having this problem with this piece of PHP code: class Core { public function start() { require("funk/funks/libraries/uri.php"); $this->uri = new uri(); require("funk/core/loader.php"); $this->load = new loader(); if($this->uri->get_segment(1) != "" and file_exists("funk/pages/".$uri->get_segment(1).".php")){ Only a snippet of the code The best way I can explain it is that it is a class calling upon another class (uri.php) and i am getting the error: Fatal error: Call to a member function get_segment() on a non-object in /home/eeeee/public_html/private/funkyphp/funk/core/core.php on line 11 (the if($this-uri-get_segment(1) part) I'm having this problem a lot and it is really bugging me. the library code is: <?php class uri { private $server_path_info = ''; private $segment = array(); private $segments = 0; public function __construct() { $segment_temp = array(); $this->server_path_info = preg_replace("/\?/", "", $_SERVER["PATH_INFO"]); $segment_temp = explode("/", $this->server_path_info); foreach ($segment_temp as $key => $seg) { if (!preg_match("/([a-zA-Z0-9\.\_\-]+)/", $seg) || empty($seg)) unset($segment_temp[$key]); } foreach ($segment_temp as $k => $value) { $this->segment[] = $value; } unset($segment_temp); $this->segments = count($this->segment); } public function segment_exists($id = 0) { $id = (int)$id; if (isset($this->segment[$id])) return true; else return false; } public function get_segment($id = 0) { $id--; $id = (int)$id; if ($this->segment_exists($id) === true) return $this->segment[$id]; else return false; } } ?>

    Read the article

  • How do i use a transparent image in a transparent image using GD?

    - by hogofwar
    I have tried every way I can find but the background is always black. Is there any way to keep the transparency of the first image when GD ises it in PHP? I'm using imagecopymerge to use the image. though i am not sure if this is the right way. imagecopymerge($dest, $char, 0, 0, 0, 0, 150, 300, 100); The image is like so: http://filesmelt.com/dl/draw7.php.png See that the background is black whereas the roginal picture was transparent as the modified picture should be aswell

    Read the article

1