FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Can I have some help with scripts for postmysite.frih.net





postmysite.com
I want to make a thread for my site for php scripting errors. I am still new to php and know I mite get a junk load of errors from each page or so. I want to ask as my first qustion. I get this error here http://www.postmysite.frih.net/inputing.php What does this mean? Your help would be most thankful the best I can do for you if you help me is put you on the credits on post my site credits for everyone to see.


Thank you. Very Happy
hexkid
postmysite.com wrote:
I get this error here http://www.postmysite.frih.net/inputing.php What does this mean?


Well ... you could have posted the error here and the part of the script that generates the error. The error is
Quote:
Parse error: syntax error, unexpected T_STRING in /home/postmysi/domains/postmysite.frih.net/public_html/inputing.php on line 11


This means PHP found a string (on line 11) when it didn't expect one. It may happen when you forget to close a previous quote, as in
Code:
<?php
$name = "postmysite;
echo "Hello, $name";
?>

Note there is no closing quote on line 2. For this script PHP says
Quote:
Parse error: parse error, unexpected T_STRING in /var/www/tmp/parse.php on line 3


The code above slightly reformatted is the same as
Code:
<?php
$name = "postmysite;\necho "
Hello, $name";
?>

PHP is expecting a semicolon and not the "Hello" at the start of line 3.
postmysite.com
I also have html codes in the script does the line 11 start in after <?php or is it the hole page? Also if it helps I will post the code

Code:
<DOCTYPE html PUBLIC "-//w3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtmll1/DTD/xhtml-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
<meta http-equiv="content type" content="text/html; charset=iso-8859-1" />
<title>Submit a site</title>
</head>

<body>

<?php//Script 11.6 - submit.php
ini_set (display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);

if (isset ($_POST['submit'] {

if (!$problem) {//if there was any problems...

  if($fp = fopen ('../sites/sites.txt', ''ab')) {//Open the file.


     //Create the data to be written.
     $dir = time() . rand (0, 4596);
     $data = $_POST['sitename'] . "\t" . crypt($_POST['password']) . "\t" . $dir . "\n";
     //\r\n on Windows


     //write the data and close up!
     fwrite ($fp, $data);
     fclose ($fp);

     //Create the directory.
     mkdir ("../users/$dir");

     //Print a message
     Pront '<p>You have submited a site!!!! ;)</p>';

   } else {//couldn't write to the file.
       print '<p> Sorry, but a system error happend durring the submiting! :0</p>';
   }

  } else {//Forgot a field.
     print '<p>Please try again! :(</p>';
  }


 } else {//display the form.


//leave PHP and display the form.
?>
<form action="inputing.php" method="post">
Site URL: <input type="text" name="siteurl" size="30" /><br />
Site Descritpion: <input type="text" name="sitedes" size="30" /><br />
<input type="submit" name="submit" value="Sumbit The Site!">
</form>
<?php>
}//END Of SUBMIT IF.
?>
</body>
</html>
hexkid
postmysite.com wrote:
I also have html codes in the script does the line 11 start in after <?php or is it the hole page? Also if it helps I will post the code

Yes, it helps. It's line 11 of the whole page Smile


Wow!!! So many errors Sad

Check my ### comments before the lines with errors
Code:
<DOCTYPE html PUBLIC "-//w3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtmll1/DTD/xhtml-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
<meta http-equiv="content type" content="text/html; charset=iso-8859-1" />
<title>Submit a site</title>
</head>

<body>

<?php//Script 11.6 - submit.php

### no opening single quote, you mean ini_set ('display_errors', 1);
ini_set (display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);

### no close parenthesis, you mean if (isset($_POST['submit'])) {
if (isset ($_POST['submit'] {

### instruction and comment are opposite
if (!$problem) {//if there was any problems...

  ### watch your quotes
  if($fp = fopen ('../sites/sites.txt', ''ab')) {//Open the file.


     //Create the data to be written.
     $dir = time() . rand (0, 4596);
     $data = $_POST['sitename'] . "\t" . crypt($_POST['password']) . "\t" . $dir . "\n";
     //\r\n on Windows


     //write the data and close up!
     fwrite ($fp, $data);
     fclose ($fp);

     //Create the directory.
     mkdir ("../users/$dir");

     //Print a message
     ### "Pront" is not a PHP function
     Pront '<p>You have submited a site!!!! ;)</p>';

   } else {//couldn't write to the file.
       print '<p> Sorry, but a system error happend durring the submiting! :0</p>';
   }

  } else {//Forgot a field.
     print '<p>Please try again! :(</p>';
  }


 } else {//display the form.


//leave PHP and display the form.
?>
<form action="inputing.php" method="post">
Site URL: <input type="text" name="siteurl" size="30" /><br />
Site Descritpion: <input type="text" name="sitedes" size="30" /><br />
<input type="submit" name="submit" value="Sumbit The Site!">
</form>

### What's that ">" right after <?php
<?php>

### I didn't try to match the { and }.
### Possibly they match :)
}//END Of SUBMIT IF.
?>
</body>
</html>
postmysite.com
Cool, thanks for your input I will try to correct it after I enjoy some rain that is in my town now. Also on that <?php> I am used to wrighting html scripts alot so you can see why I did that.
postmysite.com
Strange it keeps showing the same error and I checked the lines and I did what you told me but it seems still not to work here is a update

Code:
<DOCTYPE html PUBLIC "-//w3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtmll1/DTD/xhtml-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
<meta http-equiv="content type" content="text/html; charset=iso-8859-1" />
<title>Submit a site</title>
</head>

<body>

<?php//Script 11.6 - inputing.php
ini_set (display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);

if (isset($_POST['submit'])) {

if (!$problem) {//if there was any problems...

if($fp = fopen ('../sites/sites.txt', ''ab')) {//Open the file.


     //Create the data to be written.
     $dir = time() . rand (0, 4596);
     $data = $_POST['sitename'] . "\t" . crypt($_POST['password']) . "\t" . $dir . "\n";
     //\r\n on Windows


     //write the data and close up!
     fwrite ($fp, $data);
     fclose ($fp);

     //Create the directory.
     mkdir ("../users/$dir");

     //Print a message
     Print '<p>You have submited a site!!!! ;)</p>';

   } else {//couldn't write to the file.
       print '<p> Sorry, but a system error happend durring the submiting! :0</p>';
   }

  } else {//Forgot a field.
     print '<p>Please try again! :(</p>';
  }


 } else {//display the form.



//leave PHP and display the form.
?>
<form action="inputing.php" method="post">
Site URL: <input type="text" name="siteurl" size="30" /><br />
Site Descritpion: <input type="text" name="sitedes" size="30" /><br />
<input type="submit" name="submit" value="Sumbit The Site!">
</form>
<?php
}//END Of SUBMIT IF.
?>
</body>
</html>
SlowWalkere
You're still missing the opening single quote in the "ini_set" call around line 11.

You have {ini_set (display errors', 1);}

Should be {ini_set ('display errors', 1);}

When you get an error like "unexpected T_STRING" it usually means you've forgotten a quote somewhere which makes it impossible for php to interpret the script properly.

- Walkere
postmysite.com
It is still complaning about this line in my script!

Code:
ini_set ('display errors', 1);}
hexkid
postmysite.com wrote:
It is still complaning about this line in my script!

Code:
ini_set ('display errors', 1);}


I suggest you read the PHP manual, starting with the section about strings.

The errors you still have in your script are very basic errors. You certainly do not expect anybody to correct every small error you let through ...

Imagine you want to display the double of a quantity, and you manage this code
Code:
echo $quantity + 2;
but it will not display double the quantity (if $quantity is 10 it will not print 20 but 12 instead). It is much better if you can solve these little problems by yourself rather than relying on the frihost community to do it for you.


Happy Coding Smile



PS: The "}" should not be part of the ini_set() line
SlowWalkere
Whoops. I didn't mean for you to actually put the curly braces into the code. I was just using those to separate it from the rest of the message. I guess I'll just stick with the standard code formatting in the future.

And like HexKid said, check out some of the documentation and try to learn the proper syntax to avoid these little errors. We're happy to help, but if you can eliminate them early on you'll save everyone a bunch of time.

- Walkere
postmysite.com
I find this strange I remove the code that tells if the site has been submited and now php is saying every thing in the php script area all has a error. Why is it doing this?
hexkid
postmysite.com wrote:
I find this strange I remove the code that tells if the site has been submited and now php is saying every thing in the php script area all has a error. Why is it doing this?


What editor do you use for editing your scripts?
I think Notepad is great (there are much greater substitutes) ... but try a code and syntax highlighting editor.
postmysite.com
I am using notepad are php editors good at detecting php script errors?
hexkid
postmysite.com wrote:
I am using notepad are php editors good at detecting php script errors?


Can you spot the error in this script?
It's a very basic script and I'm sure you can spot the error.
That was the Notepad view.

Now try the same script with syntax highlighting Smile
postmysite.com
Code:
<?php
$hello = 'Hello';
print("$hello ");
$name = 'hexkid's test';
print($name);
?>


I have not had the chance with playing around with printing in php if I did want to make text areas I use html. But I will tell you what I think I mite know with the script.

in line 3 I think the "" should be ' ' since I have not yet seen a php script have those in it. Also on line 4 I think there needs to be )) after $name if I am thinking mysql programming. That is all I can say. Well now I will look at the highlited text. Confused

EDIT I mist 2 I thought (comand) does not always has to be in all comands like ($hello) on line 3. Mad Well atleast I can always wach out for this stuff when I get into web site desgin class in high school hopfuly they will even teach php.
Related topics
Teikoku.frih.net
Cannot upload to ftp://me.frih.net
[RESOLVED] Unable to access any service with frih.net
[official] Feedback for the Frihost Staff
www.festakunvent.frih.net
[help] Puedo tener 2 subdominios.frih.net ???
frih.net for me is not working please help
how can i use the url: xxx.frih.net
Webspace.frih.net New site, please give feedback
changing frih.net domain's name
Can I have mail server on frih.net
se cayo frih.net?
frih.net down
MySQL issues on Frih.net server
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.