473,769 Members | 6,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

associate user account with filename

am trying to associate username with filename in a upload script.
I get this error:
Parse error: syntax error, unexpected T_STRING in /home/fhlinux169/c/
clashoff.co.uk/user/htdocs/upload.php on line 42

This is my script any ideas.Am really stuck.
<?php
$host=""; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name=""; // Database name
$tbl_name=""; // Table name
$target = "";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;

//This is our size condition
$upload_size = $_FILES['uploaded']['size'];
if ($upload_size 1000000000000)
{
echo "Your file is too large.<br>";
$ok=0;
}

//This is our limit file type condition
$upload_type = $_FILES['uploaded']['type'];
if ($upload_type =="text/php")
{
echo "No PHP files<br>";
$ok=0;
}

//Here we check that $ok was not set to 0 by an error
if ($ok==0)
{
Echo "Sorry your file was not uploaded";
}

//If everything is ok we try to upload it
else
{
if(move_uploade d_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ".
basename( $_FILES['uploaded']['name']). " has been uploaded";
$myfilename=bas ename( $_FILES['uploaded']['name'])

mysql_connect(" $host", "$username" , "$password" )or die("cannot
connect");
mysql_select_db ("$db_name") or die("cannot select DB");
$sql="update $tbl_name set filename = '$myfilename' WHERE
username='sessi on_is_registere d('myusername') ' ";
mysql_query($sq l);
}
else
{
echo "Sorry, there was a problem uploading your file.";
}
}
?>

<html>
<body>
<a href="/user.php">Retur n to User Page</a</form>
</body>
</html>

Sep 14 '07 #1
6 1481
On 14.09.2007 14:21 Reggie wrote:
am trying to associate username with filename in a upload script.
I get this error:
Parse error: syntax error, unexpected T_STRING in /home/fhlinux169/c/
clashoff.co.uk/user/htdocs/upload.php on line 42

This is my script any ideas.Am really stuck.
The error has nothing to do with your actual problem. It's just a
parsing error, you're missing the comma or something like this. Check
line 42 of your script.

--
gosha bine

makrell ~ http://www.tagarga.com/blok/makrell
php done right ;) http://code.google.com/p/pihipi
Sep 14 '07 #2
Reggie wrote:
>
am trying to associate username with filename in a upload script.

I get this error:
Parse error: syntax error, unexpected T_STRING in /home/fhlinux169/c/
clashoff.co.uk/user/htdocs/upload.php on line 42
Why don't you just look at line 42 then?
$myfilename=bas ename( $_FILES['uploaded']['name'])

mysql_connect(" $host", "$username" , "$password" )or die("cannot
connect");
Pretty obvious, you missed a semicolon in the line above 42.

Bye!
Sep 14 '07 #3
On Sep 14, 3:23 pm, Anonymous <anonym...@nowh ere.invalidwrot e:
Reggie wrote:
am trying to associate username with filename in a upload script.
I get this error:
Parse error: syntax error, unexpected T_STRING in /home/fhlinux169/c/
clashoff.co.uk/user/htdocs/upload.php on line 42

Why don't you just look at line 42 then?
$myfilename=bas ename( $_FILES['uploaded']['name'])
mysql_connect(" $host", "$username" , "$password" )or die("cannot
connect");

Pretty obvious, you missed a semicolon in the line above 42.

Bye!
Where did i miss a semicolon.I cant see it.Am new to PHP

Sep 14 '07 #4
On Sep 14, 8:20 am, Reggie <joelregisfo... @hotmail.comwro te:
>
Where did i miss a semicolon.I cant see it.Am new to PHP
Little things like that happen all to often - to all of us. :-)

Sep 14 '07 #5
On 14 Sep, 16:20, Reggie <joelregisfo... @hotmail.comwro te:
On Sep 14, 3:23 pm, Anonymous <anonym...@nowh ere.invalidwrot e:


Reggie wrote:
am trying to associate username with filename in a upload script.
I get this error:
Parse error: syntax error, unexpected T_STRING in /home/fhlinux169/c/
clashoff.co.uk/user/htdocs/upload.php on line 42
Why don't you just look at line 42 then?
$myfilename=bas ename( $_FILES['uploaded']['name'])
mysql_connect(" $host", "$username" , "$password" )or die("cannot
connect");
Pretty obvious, you missed a semicolon in the line above 42.
Bye!

Where did i miss a semicolon.I cant see it.Am new to PHP- Hide quoted text -

- Show quoted text -
Of course you can't see it, it's not there! that is what missing
means.

Look at line 41, it has no semicolon, so php carries on reading to
line 42 and finds a string, when by now it should have had a semicolon.

Sep 14 '07 #6
Reggie wrote:
>
On Sep 14, 3:23 pm, Anonymous <anonym...@nowh ere.invalidwrot e:
Reggie wrote:
am trying to associate username with filename in a upload script.
I get this error:
Parse error: syntax error, unexpected T_STRING in /home/fhlinux169/c/
clashoff.co.uk/user/htdocs/upload.php on line 42
Why don't you just look at line 42 then?
$myfilename=bas ename( $_FILES['uploaded']['name'])
mysql_connect(" $host", "$username" , "$password" )or die("cannot
connect");
Pretty obvious, you missed a semicolon in the line above 42.

Bye!

Where did i miss a semicolon.I cant see it.Am new to PHP
You missed it here:

$myfilename=bas ename( $_FILES['uploaded']['name']) <-
Sep 14 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
4791
by: DC Gringo | last post by:
Using latest SP Win2k and .NET versions, I have a .NET application running on server1 with a SQL Server database running on server2. I have the Windows user account passwords sync'd for server1\aspnet (installed by .NET Framework and server2\aspnet (created by me--this machine has no .NET Framework on it). The aspnet user on the database server (server2) has access to the database. I still get: Login failed for user '(null)'. Reason:...
12
1975
by: Quentin Huo | last post by:
Hi: I am working in win 2003 and ASP.NET. I tried to modify the user rights from an ASPX (writen in C#) page through running xcacls. But failed. What I did is: Process myProcess = new Process(); myProcess.StartInfo.FileName = "cmd.exe";
1
1215
by: Indepth | last post by:
Overview: We're creating a ASP.NET app in C# that calls some C# programs we've created. Our DB server is on a w2k3 machine and using our w2k machines as our web server. Without setting an Identity in the web.config we can not access the DB on the w2k3 machine at all. So a temporary solution we had was to use the w2k3 machine as the DB and Web server but this isn't the setup that has be requested to duplicate. Problem: When we set an...
7
1717
by: kris_scheyer | last post by:
Hi, I have a little .exe file that I want the C# code behind of my web application to execute as a different user. The executable is supposed to take a screenshot of the server's display and save the image and it has to be run under the currently logged on user otherwise the generated image just turns out black. My problem is when I click the button on the browser thats supposed to run the exe file a message box appears on the server...
7
3876
by: John.NET | last post by:
Hi, First please forgive that this is a repost as the first time I didn't have my proper nospam email configured... I'm writing a web service where one method will launch another .NET program under a specified user's account. It launches fine as the NT AUTHORITY\NETWORK SERVICE user when I dont specify a username/password for the ProcessStartInfo but I am having trouble getting it to work when I specify any other username/password...
4
15644
by: BD | last post by:
Hi all. Running SQL2K SP4 on W2K3 Standard, SP4. I have just refreshed a database on one server with a backup from another. The database had existed previously on the target server, and I am just refreshing its contents. I used the following approach 1) From the target server, create a SQL script with users and roles 2) From the source server, back up the db
0
1392
by: Maurice LING | last post by:
"The Python Papers" (http://pythonpapers.org), ISSN 1834-3147, is an online e-journal, covering articles on Python in the community, industry and academia. We were established in the second half of 2006 and launched our first issue in November 2006. Since then, we have released 3 more issues. Recently, we have also initiated a monograph series, which will be known as "The Python Papers Monograph Series"...
2
2129
by: Paul Shapiro | last post by:
I saw a recent note here that user file uploads should be directed to a subfolder of App_Data to avoid site recompilation each time a file is uploaded. That worked fine on my development machine, but when I deployed to a test site at my web host, it fails: Access to the path '...\App_Data\PDFFiles\Filename.pdf' is denied. How do I set permissions to allow writing a file into that folder? Is this something I do in my page or site...
0
9587
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.