Jump to content

brosjr

Members
  • Posts

    26
  • Joined

  • Last visited

About brosjr

  • Birthday 02/27/1976

Profile Information

  • Gender
    Male
  • Location
    Brazil

brosjr's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi everyone; The point is, I have a string to break, it contains data and a simple code (//&//) that is exploded to generate an array of values, like: M//&// Neves//&//salas 1 a 6//&// //&// Manual//&// //&// 70165900//&// Bras//&// Text Than I get the $explodedarray: Array ( [0] => M [1] => Neves [2] => salas 1 a 6 [3] => [4] => Manual [5] => [6] => 70165900 [7] => Bras [8] => Text) The problem is, a simple if comparison is not working: if($explodedarray[0] == 'M'){ echo 'yes'; }else{ echo 'no'; } It returns 'no'. Even if I try another comparison like: if($explodedarray[5] == ''){ echo 'yes'; }else{ echo 'no'; } It also returns 'no'. Any idea? Thankx Danilo Jr.
  2. Thank you kicken but that worked just for downloading the pdf as file it didn't help to opening the document on the page. But I thied the below object tag and it worked, not as I expected once I can't handle with it's zoom options, maybe because of encoded strings, but it's fine. <object data='<?php echo data_uri($conta, 'application/pdf');?>' type='application/pdf' width='720' height='900'> </object> Thankx Danilo Jr.
  3. Hi all, On my project some PDF documents and images are storage outside the web public folder, so I just can't reach then just with a simple link and I need to display then on a page. $fileDir = '../data/contas'; For images I use the code below (this solution I found on web): $fileDir = '../data/contas/'; function data_uri($conta, $mime) { $contents = file_get_contents($conta); $base64 = base64_encode($contents); return "data:$mime;base64,$base64"; ) <img src="<?php echo data_uri($conta, 'image/png');?>" width="720"> When I see the HTML code I got <img src="data:image/png;base64,/9j/4AAQSkZJRgABA...(huge amount of string)...FXYq/wD/2Q==" width="720"> and the images are displayed correctly. The problem occurs on PDF files, I use the same function, as follow below and the PDF document is not displaying, there is no error message just a gray background where the document were to be shown. <EMBED SRC='<?php echo data_uri($conta, 'application/pdf');?>#view=FitH,top&toolbar=1&navpanes=0&scrollbar=1&zoom=scale' WIDTH="720" HEIGHT="900" ALIGN="TOP"></EMBED> When I look at the HTML code it shows: <EMBED SRC='data:application/pdf;base64,JVBERi0xLjIK...(huge amount of string)...YK#view=FitH,top&toolbar=1&navpanes=0&scrollbar=1&zoom=scale' WIDTH="720" HEIGHT="900" ALIGN="TOP"></EMBED> Any ideia how can I show the PDF files? Or there is another way to access the files outside web public folder on server to display then? Thankx Danilo Jr.
  4. requinix, The numbers stored on $rest array are already arranged as you sugested, and it does not matter wich number comes first, it only returns the name associated to that first number and not the others. Thank you for the tip, next time I'll not use paraphrased version of the code
  5. Hello all, I had some kind of same problem before and I made very hard changes on the project for that to work, but now I'm experiecing a sort of same problem and I can't change it at all so deep. I have group of number in an array that I explode: array($numbers = explode("|", $rest)); Than I "foreach it": foreach ($numbers as $n=>$num){ $sqlname = mysql_query("select name from table where number = '{$num}'"); $name = mysql_fetch_row($sqlname); echo $num." - ".$name[0]; } The result is: 51.399.517 - Danilo Piva Junior 57.716.524 - 02.067.142 - 51.629.749 - 51.109.841 - 59.852.855 - As it can be seen, the foreach returns each number ($num) holded on the array correctly, but when it need query a value from database it only returns the first value, it does not return each name ($name[0]) as expected. Please Thankx Danilo Jr.
  6. Sorry, the problem occurs when $rscad hold more than one value, not $rsnome. It's like the foreach could only execute once.
  7. Hi everyone, I wrote a script that run correctly on localhost but on server it crachs. The code is: foreach($rscad as $cc=>$contashoje){ array($date = explode("-", $contashoje->vence)); $data = $date[2]."/".$date[1]."/".$date[0]; $pstnome = $conn->query("select nomeconta from tbcontas_nome where idnomeconta = $contashoje->idnomeconta"); $rsnome = $pstnome->fetchAll( PDO::FETCH_OBJ ); $arraydatacad .= "<p style='line-height:120%;'>● <strong>" .$rsnome->nomeconta ."</strong> - R$ " .$contashoje->valor ." com vencimento em " .$data .";"; } On localhost the script works fine and if I ask this code prints the two $rsnome result like: Array ( [0] => stdClass Object ( [nomeconta] => Telefones Oi 0023, 5480 e 5482 ) ) Array ( [0] => stdClass Object ( [nomeconta] => Telefone Oi 6569 ) ) But on server the same script prints the second result as empty: Array ( [0] => stdClass Object ( [nomeconta] => Telefones Oi 0023, 5480 e 5482 ) ) Array ( ) The problem happens when $rsnome has two or more values, when it holds only one value, even on server, the script works correctly. Somebody ? Thanks in advance! Danilo Jr.
  8. Hi all, I wrote a script that put some values into a database, when I look directly at phpMyAdmin it is shown like this Econômica. But when I query this the result comes Econ�mica. I searched all over and I tried the utf8_decode and other ways and nothing, it always changes the portuguese accents with �s. Please Thankx
  9. brosjr

    srtpos?

    Hi everyone, I'm writing a script that uses CURL to capture some data to analise it. While this I have to find a little part of a string in many other strings from an array, so I'm using srtpos, but it's returning strange values. For exemple, when I use the string, like below, it echos "9", and it's ok. $strarray = 'SD55555 |FIL|END|'; $find = 'FIL'; $pos = strpos($strarray , $find); echo $pos; But when I use the same estructure to find the same thing from the array, where $arrayhist[1] = 'SD55555 |FIL|END|', it returns nothing. $strarray = $arrayhist[1]; $find = 'FIL'; $pos = strpos($strarray , $find); echo $pos; Even strange, if instead of 'FIL' I try to find 'SD' it returns "0". And if I try to find just 'D' it also returns nothing. Some clue? :-\ Thankx Danilo Jr.
  10. PFMaBiSmAd, My server has set register_globals as OFF and now everything is working fine! Thank you! Danilo Jr.
  11. PFMaBiSmAd, My server does not allow me to set such feature, but it makes sense once on my wamp localhost the register_globals is set as OFF. I'll check and hope for this solution. Thanks a lot! Danilo Jr.
  12. Hi all, I'm in trouble with a strange problem. At the system login a script sets a $_SESSION['status'], this keeps user status for admin (a), user (u), and so on... In another part of the system I need to post a value also called 'status': <input value="N" type="hidden" name="status"/> and this 'status' value has nothing to do with 'status' session. The problem is that when I post the value 'N' it overwrite the session value, crashing the system then. The most strange is that on the localhost the problem does not happen, it only occurs on the server. Any clue? Thankx Danilo Jr.
  13. denno020, after add the session_start() on the dddl.php page the values were shown fine. Thank you
  14. hi all, I have a form that pass some $_POST values to a page that sets a session like this: session_start(); $_SESSION['TESTE'] = array ($_POST['sexo'],$_POST['nome'],$_POST['senha'],$_POST['senha2'],$_POST['login']); header ("Location: dddl.php"); Then the dddl.php should print the values on this line: print_r ($_SESSION['TESTE']) ; But when i run the application the dddl.php page returns this error: Notice: Undefined variable: _SESSION in C:\Users\Danilo\wamp\www\CNTur\dddl.php on line 2 Why it's not setting or why can't I reach the values? When I run the following code on the same page the session values are returned correctly: session_start(); $_SESSION['TESTE'] = array ($_POST['sexo'],$_POST['nome'],$_POST['senha'],$_POST['senha2'],$_POST['login']); print_r ($_SESSION['TESTE']) ; Thankx Danilo Jr.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.