maydhyam 38 Posting Pro :)

yes, they do look peaceful when they sleep dont they?

Yes they do...
:):):)

So here is another 1 to ponder...

Since bread is square, why is sandwich meat round?

maydhyam 38 Posting Pro :)

insert into tablename (col1, col2, col3, ..) values ('val1','val2','val3',...) .

The values ('val1','val2','val3',...) ...how am I to derive that from $data?...

maydhyam 38 Posting Pro :)

Ok, so at this stage, this may seem to be a few rather dumb questions...but what is phpMyAdmin? Can't I use MySQL Query Browser?:$ :sweat: :icon_redface:

maydhyam 38 Posting Pro :)

I echoed these three statements...

while (($data = fgetcsv($handle, 100000, ',', '"')) !== FALSE)					
					{						
						echo $query = "INSERT INTO testtsttbills VALUES ('". implode("','", $data)."')";						
						echo "<br>";						
						echo $query = mysql_query($query,$conn);					
					}

here are the results...

INSERT INTO testtsttbills VALUES ('127000769106','630-3228','1/11/2007','7:58:46','DY','TRINIDAD','18683555181','4:00:00','0','3.2','3.2','P0')

Notice: Undefined variable: conn in /var/www/html/billUpload.php on line 207

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /var/www/html/billUpload.php on line 207

and nothing went into the database...

and this is what I set the upload location to:

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
upload_tmp_dir = "c:/uploads/tmp"

maydhyam 38 Posting Pro :)

nope, there's no specified tmp folder

maydhyam 38 Posting Pro :)

please correct me if I am wrong, but are you trying to upload and store a file?

I am trying to upload and store the data within the selected file...

maydhyam 38 Posting Pro :)

No, I didn't use a hidden input...
here's my code...

<tr>
    <td colspan="6">
		  	<form action="<? echo $_SERVER['REQUEST_URI']; ?>" enctype="multipart/form-data" method="post">
				<table>					
				  <tr>
					  <td>
					      <p align="left"><span class="style4 style25 style28">Bill Uploader</span></p>
					      <p align="left"><span class="style21 style29">The Bill Uploader works in 2 steps.</span></p>					  </td>
				  </tr>
   				  <tr><td><p>&nbsp;</p></td></tr>
				  <tr>
				  	<td>
				      <table width="950" border="0" align="center" cellpadding="1" cellspacing="0" >
						<tr>
						  <td><p>&nbsp;</p></td>
						  <td colspan="4" bgcolor="#006600">
						  	<p align="left" class="style32">
						  <span class="style21  style33">Step 1: Browse for file</span></p>						  </td>
						  <td><p>&nbsp;</p></td>
						</tr>
						<tr>
						  <td><p>&nbsp;</p></td>
						  <td bgcolor="#006600"><p>&nbsp;</p></td>
						  <td width="125" bgcolor="#006600" scope="row"><div align="left" class="style13 style29 style31">Browse</div></td>
						  <td width="356" bgcolor="#006600">
						  	<div align="left">
								<strong>
									<input type="file" name="file" />
								</strong>							</div>						  </td>
						  <td bgcolor="#006600"><p>&nbsp;</p></td>
						  <td><p>&nbsp;</p></td>
						</tr>
						<tr width="950">
						  <td><p>&nbsp;</p></td>
						  <td colspan="4" bgcolor="#006600">
						  	<p align="left"><strong>
							  <span class="style21 style30">Step 2: Upload the file selected</span></strong></p>						  						  </td>
						  <td><p>&nbsp;</p></td>
						</tr>
						<tr>
						  <td><p>&nbsp;</p></td>
						  <td bgcolor="#006600"><p>&nbsp;</p></td>
						  <td bgcolor="#006600"><p>&nbsp;</p></td>
						  <td bgcolor="#006600">
						  <div align="left">
						  	<strong>
					      		<input type="submit" value="Upload" name="btnSubmit" />
						  	</strong>						  </div>  						  </td>
						  <td bgcolor="#006600"><p>&nbsp;</p></td>
						  <td><p>&nbsp;</p></td>
						</tr>
					  </table>  				    </td>
				</tr>
			</table>
		</form>	</td>
  </tr>
  <tr>
  	<td colspan="6" >
		
	  <div align="left" class="style29">
		<?
			include ("./connect.php");
			global $conn;
			ini_set("display_errors", "1");
			error_reporting (E_ALL);
			
			if(count($_FILES) > 0)
			{
					$ext = "";
				$ext = substr(trim($_FILES["file"]["name"]), -4);
				$allowedext = array(".txt", ".csv", ".sql");
				
				if(in_array($ext, $allowedext))
				{
					$filename = $_FILES['file']['tmp_name'];
					//$fh = fopen($_FILES['file']['tmp_name'], 'r');
					$handle = fopen($filename, "r");
					
					while (($data = fgetcsv($handle, 100000, ',', '"')) !== FALSE)
					{
						$query = "INSERT INTO testtsttbills VALUES ('". implode("','", $data)."')";
						$query = @mysql_query($query,$conn);
					}		
					//$contents = fread($handle, filesize($filename));
					fclose($handle);		
					//echo $contents;
					echo "<div align='center'><font color='red'>The file was uploaded.</font></div>";
				}
				else
				{
					echo "<div align='center'><font color='red'>You are trying to upload an invalid file format. Please try again.</font></div>";
				} …
maydhyam 38 Posting Pro :)

C:\
c:\dos
c:\dos\run
c:\dos\run, dos, run

venomlash commented: You are a true blue officer of the LOL. +2
maydhyam 38 Posting Pro :)

hi can is ask what is that white hat hacking??? can u teach me how to do it just a simple one
]

tnx

Technogeek,
This is not the forum to teach people how to hack. In this particular thread, we are only becoming more aware of the hackers and their behaviour so that we can protect ourselves in the future. It would be greatly appreciated if you can simply follow the thread.

Nick Evan commented: Good post +6
maydhyam 38 Posting Pro :)

Funny, very funny indeed maydhyam!

Thanks...:)...hope you all enjoy this as well...

A cat died and went to Heaven. God met her at the gates and said, 'You have been a good cat all these years. Anything you want is yours for the asking.'

The cat thought for a minute and then said, 'All my life I lived on a farm and slept on hard wooden floors. I would like a real fluffy pillow to sleep on.'

God said, 'Say no more.' Instantly the cat had a huge fluffy pillow.

A few days later, six mice were killed in an accident and they all went to Heaven together. God met the mice at the gates with the same offer that He made to the cat.

The mice said, 'Well, we have had to run all of our lives: from cats, dogs, and even people with brooms! If we could just have some little roller skates, we would not have to run again.'

God answered, 'It is done.' All the mice had beautiful little roller skates.

About a week later, God decided to check on the cat. He found her sound asleep on her fluffy pillow. God gently awakened the cat and asked, 'Is everything okay? How have you been doing? Are you happy?'

The cat replied, 'Oh, it is WONDERFUL. I have never been so happy in my life. The pillow is so fluffy, and those little Meals on Wheels you have …

maydhyam 38 Posting Pro :)

I also increased

memory_limit

and

max_execution_time

and nothing seems to work...

maydhyam 38 Posting Pro :)

I agree, that hacking is a skill (the actual technicality of which you would have to acquire on your own...if you want)...and like most things in life...it's what you do with this skill that then determines the difference between a White Hat and a Black Hat hacker...

But I remember reading a thread in one of the forums here in Daniweb, and the person was saying that their website was hacked, they also said that the hacker left them a message within their code...
how did they figure out their site was hacked?!?...
they said that they went onto their site 1 day and it was totally blank...when they looked at their code, they saw a chunk of code that wasn't there before...and they found it on all of their scripts (for the entire site, which apparently was huge)...

I am not exactly sure what type of site they have...but it can certainly make someone panic in that situation...

maydhyam 38 Posting Pro :)

Do Roman paramedics refer to IV's as "4's"?

:icon_smile:lol...good one...lol:icon_smile:

maydhyam 38 Posting Pro :)

Before God we are all equally wise - and equally foolish.

maydhyam 38 Posting Pro :)

Well I did increase

post_max_size = 100M

as well as

upload_max_filesize = 50M

and it still doesn't upload the larger file, only the smaller one...

maydhyam 38 Posting Pro :)

okie dokie....I see I got some reading to do...
Will keep you posted...

maydhyam 38 Posting Pro :)

Welcome to Daniweb
:)

maydhyam 38 Posting Pro :)

"Always aim at complete harmony of thought and word and deed.
Always aim at purifying your thoughts and everything will be well"
- Mahatma Gandhi

maydhyam 38 Posting Pro :)

The best way for me to relax and code is loud music...it oddly enough makes me concentrate even more...I guess it really doesn't distract me...

maydhyam 38 Posting Pro :)

Is it true we have gravity because the earth sucks?

Just remember...if the world didn't suck, we'd all fall off.
:)

maydhyam 38 Posting Pro :)

According to a news report, a certain private school in Abbotsford, was recently faced with a unique problem. A number of 12-year-old girls were beginning to use lipstick, and would put it on in the bathroom.That was fine, but after they put on their lipstick they would press their lips to the mirror, leaving dozens of little lip prints.

Every night the maintenance man would remove them, and the next day the girls would put them back. Finally the principal decided that something had to be done.

She called all the girls to the bathroom and met them there with the maintenance man. She explained that all these lip prints were causing a major problem for the custodian, who had to clean the mirrors every night. To demonstrate how difficult it had been to clean the mirrors, she asked the maintenance man to show the girls how much effort was required.

He took out a long-handled squeegee, dipped it in the toilet, and
cleaned the mirror with it.

Since then, there have been no lip prints on the mirror.

There are teachers.... and then there are educators.

ZZucker commented: great story! +1
maydhyam 38 Posting Pro :)

"C:\COFFEE.EXE NOT FOUND.
<a> abort, <r> retry, <f> fail?
"

maydhyam 38 Posting Pro :)

I have a concern about my program....the files that I want uploaded vary n size....would that affect the upload?
I did not set anything anywhere to enforce the file size to be uploaded, and only really small files are able to upload...

maydhyam 38 Posting Pro :)

"What goes around, comes around"

maydhyam 38 Posting Pro :)

:)

maydhyam 38 Posting Pro :)

Ok, I closed and re-opened IE, and I opened the page once more...it works now...hmmm...I guess I needed to have done that before...cool....
Thank you
:)

maydhyam 38 Posting Pro :)

hmmm...i don't understand why it not displaying here...let me try to load the page again....

maydhyam 38 Posting Pro :)

Ok, So I finally got it to work, I am able to select a csv file, and upload it to the database...I am curious though, I have a piece of javascript on the page with the php upload script, and now that my php upload script works, my javascript is not working....it's actually a date and time piece of code...how can i fix that?

<!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" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style28 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 18px;
	font-weight: bold;
	color: #006600;
}
.style29 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 14px;
	font-weight: bold;
}
-->
</style>


<style type="text/css">
<!--
.style27 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10px;
	font-weight: bold;
}
body {
	background-color: #CCFFCC;
}
.style30 {
	color: yellow;
	font-size: 14px;
	font-family: Verdana, Arial, Helvetica, sans-serif;
}
.style31 {
	color: #CCFFCC;
	font-weight: bold;
}
.style32 {color: yellow; font-weight: bold; }
.style33 {font-size: 14px; font-family: Verdana, Arial, Helvetica, sans-serif;}
-->
</style>
</head>

<body onload="goforit()">
<table width="200" border="0" align="center">
  <tr>
    <th colspan="6" scope="col"><img src="images/apBanner2.png" width="962" height="225" /></th>
  </tr>
  <tr>
    <td width="155"><img src="images/btnT.png" width="150" height="33" /></td>
    <td width="155"><img src="images/btnA.png" width="150" height="33" /></td>
    <td width="155"><img src="images/btnI.png" width="150" height="33" /></td>
    <td width="155"><img src="images/btnS.png" width="150" height="33" /></td>
    <td width="327" colspan="2">
		<div align="center">
		


  <script>
			/*
			Live Date Script- 
			© Dynamic Drive (www.dynamicdrive.com)
			For full source code, installation instructions, 100's more DHTML scripts, and Terms Of Use,
			visit http://www.dynamicdrive.com
			*/
			
			var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
			var …
maydhyam 38 Posting Pro :)

Hi there,

When the file is echoed, the data is displayed in a paragraph....when I read 10 lines of data, how can i get to output each line read into a new line?

maydhyam 38 Posting Pro :)

I got another:

"The truth is out there.....Anyone knows the URL?"

maydhyam 38 Posting Pro :)

"My Computer Can Beat Up Your Computer!!!"

...lol...

maydhyam 38 Posting Pro :)

That is good...
:):):)

maydhyam 38 Posting Pro :)

Hi R0bb0b,

I copied and pasted the code like you said and it works...it simply echoes the data...I want to encorporate it into my form and then I would enter the mysql part...Thanks for everything thus far...

I'll keep you posted...

maydhyam 38 Posting Pro :)

If you know the contents of the file is valid and there is no risk then this works fine up until the mysql_query part as that will depend on your query and table structure.

//All this takes place in 1 file?

    if(in_array($ext, $allowedext))
    {
        $filename = $_FILES['file']['tmp_name'];
        $fh = fopen($_FILES['file']['tmp_name'], 'r');
        $handle = fopen($filename, "r");
        $contents = fread($handle, filesize($filename));       
                                fclose($handle);
        
        echo $contents;
                //db conn stuff
                //mysql_query($contents);

    }

//So after the file is read, and closed, I upload it's data?

maydhyam 38 Posting Pro :)

The content in the file is as follows:

123456789876,111-1234,1/11/2007,7:58:46,XX,COUNTRY NAME,98765432123,4:00:00,0,3.2,3.2,P0

I have a piece of sql code which can do the upload through the MySQL Query Browser Application. Here it is:

load data local infile ".$filename." INTO table testtsttbills FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n'(account,service,date,time,timebandtype,destination,callednumber,mins,airtimecharge,tollcharge,amt,privatenumber)";

But I want to do the uploads through a webpage (so I can access it from anywhere I login to)

maydhyam 38 Posting Pro :)

Hi R0bb0b,
I am not too sure I follow what you're saying...

maydhyam 38 Posting Pro :)

Hello,

I have tried to redo my uploadBill.php file...and I do not know what else to do now...
I'll post the code, and I'll explain what I tried to do...

Here is my Display page where the user is allowed to select the desired file to be uploaded into the database.

billUpload.php

<?php
 include('uploadBill.php');
 ?>
 <tr>
  <td colspan="6">
   <form id="form" name="form" method="post" action="" enctype="multipart/form-data">
    <table>			          
     <tr>
      <td>
       <p align="left"><span class="style4 style25 style28"><a href="billUpload.php">Bill Uploader </a></span></p>
       <p align="left"><span class="style21 style29">The Bill Uploader works in 2 steps.</span></p>				  
      </td>
     </tr>
     <tr><td><p>&nbsp;</p></td></tr>
     <tr>
      <td>
       <table width="950" border="0" align="center" cellpadding="1" cellspacing="0" >
        <tr>
         <td><p>&nbsp;</p></td>
         <td colspan="4" bgcolor="#006600">
          <p align="left" class="style32"><span class="style21  style33">Step 1: Browse for file</span></p>						  
         </td>
         <td><p>&nbsp;</p></td>
        </tr>
        <tr>
         <td><p>&nbsp;</p></td>
         <td bgcolor="#006600"><p>&nbsp;</p></td>
         <td width="125" bgcolor="#006600" scope="row"><div align="left" class="style13 style29 style31">Browse</div></td>
         <td width="356" bgcolor="#006600">	<div align="left"><strong>	
          <input id="file" type="file" name="file" size="30" />
         </strong></div></td>
         <td bgcolor="#006600"><p>&nbsp;</p></td>
         <td><p>&nbsp;</p></td>
        </tr>
        <tr width="950">
         <td><p>&nbsp;</p></td>
         <td colspan="4" bgcolor="#006600">
          <p align="left"><strong><span class="style21 style30">Step 2: Upload the file selected</span></strong></p>					
         </td>
         <td><p>&nbsp;</p></td>
        </tr>
        <tr>						     
         <td><p>&nbsp;</p></td>
         <td bgcolor="#006600"><p>&nbsp;</p></td>
         <td bgcolor="#006600"><p>&nbsp;</p></td>
         <td bgcolor="#006600"><div align="left"><strong>
          <input name="btnSubmit" type="submit" id="btnSubmit" value="Upload" />
         </strong></div></td>
         <td bgcolor="#006600"><p>&nbsp;</p></td>
         <td><p>&nbsp;</p></td>
        </tr>
       </table>
      <? validateFile(); ?>
     </td>
    </tr>
   </table>
  </form>	
 </td>
</tr>

:'( Here is the part that gives me the trouble...

I called the function validateFile(); in the above code...in this function, I am putting the file name chosen from the user's search into a variable $fileName , I am also trying to know the file type that was entered.

The following piece of code …

maydhyam 38 Posting Pro :)

:):):)
Very true...

maydhyam 38 Posting Pro :)

Why is it that people say they "slept like a baby" when babies wake up
like every two hours?

maydhyam 38 Posting Pro :)

:)
Thanks...

maydhyam 38 Posting Pro :)

You gain strength, courage and confidence by every experience in which you really stop to look fear in the face. You must do the thing you think you cannot do. ~ Eleanor Roosevelt

maydhyam 38 Posting Pro :)

Errr....ok.....
I created the code hoping that it'll work, but after you have explained it to me, I realized that I did crap...
I do not know php much, but I would look at what you said, and work on it from there...
I'll keep you posted...
Thank You

maydhyam 38 Posting Pro :)

I bought an external harddrive
and it makes me wanna cry
you see, it makes a ticking sound
and it's pass warranty, so I am bound
I stare at it asking myself what to do
when all I can think of I'm gonna have to fix you.

maydhyam 38 Posting Pro :)

"Our Geeks' Lounge forum is the place to chat about anything. Have fun and relax in this forum."
I copied this from the forum instructions...so, I guess this thread can be allowed...since it could be considered as 'anything'...

maydhyam 38 Posting Pro :)

I just realized that i posted my last post there in the wrong forum....kindly excuse it...
Thank You

maydhyam 38 Posting Pro :)

What are you looking at? Haven't you ever seen a computer before?

maydhyam 38 Posting Pro :)

Sagittarius

maydhyam 38 Posting Pro :)

I am from a small island (in the Caribbean), and we don't have such lavish theme parks here...just a few rides in the mall's car park....I grew up looking at cartoons, and I have always dreamed of going to Disney Land...I am in my mid twenties now, and just last year I was able to visit Disney's Magic Kingdom...it was a feeling like no other...too overwhelming to explain...I constantly looked on in awe (unless I was on the rides...which I thoroughy enjoyed)...

As we grow older, we got so much responsibilities on our shoulders that we forgot the kid inside all of us...when I went to Disney...the kid within me and myself were re-kindled...:) That's a great reason for keeping the theme parks alive...

Oh, and I went in April 2007...on that particular day there was a coldfront so at time the place was really cold (I am an islander so I was excited about the cold wind feeling), but also at time, it got really hot...much like where I am from...so it was really enjoyable for me...

maydhyam 38 Posting Pro :)

THIS IS A GOOD AND SIMPLE REASONING!!
A mechanic was removing a cylinder-head from the motor of a Harley motorcycle when he spotted a well-known cardiologist in his shop.

The cardiologist was there waiting for the service manager to come take a look at his bike when the mechanic shouted across the garage, "Hey Doc, want to take a look at this?"

The cardiologist, a bit surprised, walked over to where the mechanic was working on the motorcycle. The mechanic straightened up, wiped his hands on a rag and asked, "So Doc, look at this engine. I open its heart, take the valves out, repair any damage, and then put them back in, and when I finish, it works just like new.

So how come I make $39,675 a year and you get the really big bucks ($1,695,759) when you and I are doing basically the same work?"

The cardiologist paused, smiled and leaned over, then whispered to the mechanic..."Try doing it with the engine running."

maydhyam 38 Posting Pro :)

"Our Geeks' Lounge forum is the place to chat about anything. Have fun and relax in this forum."
I copied this from the forum instructions...so, I guess this thread can be allowed...since it could be considered as 'anything'...