Jump to content

Recommended Posts

Here is the exerpt causing issues:

 

if($_GET['step'] == "4"){


require_once("data.php");
require_once("install.parse.class.php");

mysql_select_db($database_conn_abrv, $conn_abrv);



$parseObj = new parsed();

$res = $parseObj->parse("install.sql");





echo "<br><b>Tables Inserted Successfully...</b><br><br><a href='install.php?step=5'>Continue...</a>";

}

 

 

 

thats the only thing that throws errors when on install.php?step=4

 

the error is:

 

 

Parse error: syntax error, unexpected T_VARIABLE in /home/sites/monkeypaw201.com/public_html/vabase/install.php on line 89
Link to comment
https://forums.phpfreaks.com/topic/115646-solved-unexpected-colon/
Share on other sites

Here is the entire page:

 

<?php

// VA Base Installation File
// Created By Lorenzo Aiello
// Do NOT Modify This File Unless you REALLY know what you are doing


if(isset($_GET['step'])){



if($_GET['step'] == "2"){

?>

<form name="form1" method="post" action="install.php?step=3">

  <table width="100%" border="0">

    <tr>

      <td>Database Server (Usually Localhost</td>

      <td><label>

        <input type="text" name="server" id="server" value="localhost">

      </label></td>

    </tr>

    <tr>

      <td>Database Name</td>

      <td><label>

        <input type="text" name="database" id="database">

      </label></td>

    </tr>

    <tr>

      <td>Database Username</td>

      <td><label>

        <input type="text" name="user" id="user">

      </label></td>

    </tr>
    <tr>

      <td>Database Password</td>

      <td><label>

        <input type="password" name="pass" id="pass">

      </label></td>

    </tr>

    <tr>

      <td> </td>

      <td><label>

        <input type="submit" name="button" id="button" value="Continue">

      </label></td>

    </tr>

  </table>

</form>

<?php

}


if($_GET['step'] == "3"){

echo 'Now creating a configuration file....<br><br>';

$ourFileName = "data.php";
$ourFileHandle = fopen($ourFileName, 'w') or die("<font color='red'>Error creating file</font>");
fclose($ourFileHandle);

$myFile = "data.php";
$fh = fopen($myFile, 'w') or die("<font color='red'>Error Writing to file</font>");
$stringData = '<?php ' . "\n" . '$SETTINGS = Array (' . "\n\n";
fwrite($fh, $stringData);
$stringData = '$hostname_conn_abrv';
fwrite($fh, $stringData);
$stringData = ' = "' . $_POST['server'] . '";   //database hostname, usually always localhost' . "\n";
fwrite($fh, $stringData);
$stringData = '$database_conn_abrv';
fwrite($fh, $stringData);
$stringData = ' = "' . $_POST['database'] . '"; //database name' . "\n";
fwrite($fh, $stringData);
$stringData = '$username_conn_abrv';
fwrite($fh, $stringData);
$stringData = ' = "' . $_POST['user'] . '"; // database username' . "\n";
fwrite($fh, $stringData);
$stringData = '$password_conn_abrv';
fwrite($fh, $stringData);
$stringData = ' = "' . $_POST['pass'] . '"; // database ' . "\n";
fwrite($fh, $stringData);
$stringData = "\n" . '$conn_abrv = mysql_pconnect($hostname_conn_abrv, $username_conn_abrv, $password_conn_abrv) or trigger_error(mysql_error(),E_USER_ERROR); 

' . "\n\n" . '

); ' . "\n" . ' ?>';
fwrite($fh, $stringData);
fclose($fh);

  

echo "File created successfully, <a href='install.php?step=4'>Continue</a>";

}


if($_GET['step'] == "4"){


require_once("data.php");
require_once("install.parse.class.php");

mysql_select_db($database_conn_abrv, $conn_abrv);



$parseObj = new parsed();

$res = $parseObj->parse("install.sql");





echo "<br><b>Tables Inserted Successfully...</b><br><br><a href='install.php?step=5'>Continue...</a>";

}



if($_GET['step'] == "5"){
$myFile = "data.php";
unlink($myFile);


echo "Congradulations! You just installed VABase. If you have any issues please let us know. It is necessary for you to delete this file for security purposes.";

}


}
else
{
echo "You are about to install VABase...<br><br>Are you sure you wish to continue? <a href='install.php?step=2'>Yes, thats what I'm here for...</a>";
}

?>

this looks like the problem to me the way the Syntax is being highlighted.

 

$stringData = "\n" . '$conn_abrv = mysql_pconnect($hostname_conn_abrv, $username_conn_abrv, $password_conn_abrv) or trigger_error(mysql_error(),E_USER_ERROR); 

' . "\n\n" . '

); ' . "\n" .  ?>';

 

 

this looks like the problem to me the way the Syntax is being highlighted.

 

$stringData = "\n" . '$conn_abrv = mysql_pconnect($hostname_conn_abrv, $username_conn_abrv, $password_conn_abrv) or trigger_error(mysql_error(),E_USER_ERROR); 

' . "\n\n" . '

); ' . "\n" .  ?>';

 

 

 

The Data.php file saved just fine...

Try this:

 

<?php

// VA Base Installation File
// Created By Lorenzo Aiello
// Do NOT Modify This File Unless you REALLY know what you are doing


if(isset($_GET['step'])){



if($_GET['step'] == "2"){

?>

<form name="form1" method="post" action="install.php?step=3">

  <table width="100%" border="0">

    <tr>

      <td>Database Server (Usually Localhost</td>

      <td><label>

        <input type="text" name="server" id="server" value="localhost">

      </label></td>

    </tr>

    <tr>

      <td>Database Name</td>

      <td><label>

        <input type="text" name="database" id="database">

      </label></td>

    </tr>

    <tr>

      <td>Database Username</td>

      <td><label>

        <input type="text" name="user" id="user">

      </label></td>

    </tr>
    <tr>

      <td>Database Password</td>

      <td><label>

        <input type="password" name="pass" id="pass">

      </label></td>

    </tr>

    <tr>

      <td> </td>

      <td><label>

        <input type="submit" name="button" id="button" value="Continue">

      </label></td>

    </tr>

  </table>

</form>

<?php

}


if($_GET['step'] == "3"){

echo 'Now creating a configuration file....<br><br>';

$ourFileName = "data.php";
$ourFileHandle = fopen($ourFileName, 'w') or die("<font color='red'>Error creating file</font>");
fclose($ourFileHandle);

$myFile = "data.php";
$fh = fopen($myFile, 'w') or die("<font color='red'>Error Writing to file</font>");
$stringData = '<?php ' . "\n" . '$SETTINGS = Array (' . "\n\n";
fwrite($fh, $stringData);
$stringData = '$hostname_conn_abrv';
fwrite($fh, $stringData);
$stringData = ' = "' . $_POST['server'] . '";   //database hostname, usually always localhost' . "\n";
fwrite($fh, $stringData);
$stringData = '$database_conn_abrv';
fwrite($fh, $stringData);
$stringData = ' = "' . $_POST['database'] . '"; //database name' . "\n";
fwrite($fh, $stringData);
$stringData = '$username_conn_abrv';
fwrite($fh, $stringData);
$stringData = ' = "' . $_POST['user'] . '"; // database username' . "\n";
fwrite($fh, $stringData);
$stringData = '$password_conn_abrv';
fwrite($fh, $stringData);
$stringData = ' = "' . $_POST['pass'] . '"; // database ' . "\n";
fwrite($fh, $stringData);
$stringData = "\n" . '$conn_abrv = mysql_pconnect($hostname_conn_abrv, $username_conn_abrv, $password_conn_abrv) or trigger_error(mysql_error(),E_USER_ERROR); 

' . "\n\n" . '

); ' . "\n" .  '?>';
fwrite($fh, $stringData);
fclose($fh);

  

echo "File created successfully, <a href='install.php?step=4'>Continue</a>";

}


if($_GET['step'] == "4"){


require_once("data.php");
require_once("install.parse.class.php");

mysql_select_db($database_conn_abrv, $conn_abrv);



$parseObj = new parsed();

$res = $parseObj->parse("install.sql");





echo "<br><b>Tables Inserted Successfully...</b><br><br><a href='install.php?step=5'>Continue...</a>";

}



if($_GET['step'] == "5"){
$myFile = "data.php";
unlink($myFile);


echo "Congradulations! You just installed VABase. If you have any issues please let us know. It is necessary for you to delete this file for security purposes.";

}


}
else
{
echo "You are about to install VABase...<br><br>Are you sure you wish to continue? <a href='install.php?step=2'>Yes, thats what I'm here for...</a>";
}

?>

 

I noticed a missing '

Hopefully it fixes it.

Okay, what line is the error one?

 

Parse error: syntax error, unexpected ';', expecting ')' in /home/sites/monkeypaw201.com/public_html/vabase/data.php on line 4

 

It says 4 so i assume line 4 of active code which would be if u could lines

 

mysql_select_db($database_conn_abrv, $conn_abrv);

 

or this: if you could PHP lines

 

$parseObj = new parsed();

data.php

is throwing same error

 

<?php 
$SETTINGS = Array (

$hostname_conn_abrv = "localhost";   //database hostname, usually always localhost
$database_conn_abrv = "name"; //database name
$username_conn_abrv = "user"; // database username
$password_conn_abrv = "pass"; // database 

$conn_abrv = mysql_pconnect($hostname_conn_abrv, $username_conn_abrv, $password_conn_abrv) or trigger_error(mysql_error(),E_USER_ERROR); 

); 
?>

<?php 
$SETTINGS = Array (

$hostname_conn_abrv = "localhost";   //database hostname, usually always localhost
$database_conn_abrv = "name"; //database name
$username_conn_abrv = "user"; // database username
$password_conn_abrv = "pass"; // database 

); 
//whats the above doing!!! thats not valid!
//move it out of the array!
$conn_abrv = mysql_pconnect($hostname_conn_abrv, $username_conn_abrv, $password_conn_abrv) or trigger_error(mysql_error(),E_USER_ERROR); 

?>
Try this instead!
<?php
$SETTINGS = Array (

"hostname_conn_abrv" => "localhost",   //database hostname, usually always localhost
"database_conn_abrv" => "name", //database name
"username_conn_abrv" => "user", // database username
"password_conn_abrv" => "pass" // database 

); 
$conn_abrv = mysql_pconnect($hostname_conn_abrv, $username_conn_abrv, $password_conn_abrv) or trigger_error(mysql_error(),E_USER_ERROR); 
?>
Or more likly

<?php
$hostname_conn_abrv = "localhost";   //database hostname, usually always localhost
$database_conn_abrv = "name"; //database name
$username_conn_abrv = "user"; // database username
$password_conn_abrv = "pass"; // database 

$conn_abrv = mysql_pconnect($hostname_conn_abrv, $username_conn_abrv, $password_conn_abrv) or trigger_error(mysql_error(),E_USER_ERROR); 


output:

 

?php $SETTINGS = Array ( "hostname_conn_abrv" => "localhost", //database hostname, usually always localhost "database_conn_abrv" => "name", //database name "username_conn_abrv" => "user", // database username "password_conn_abrv" => "pass" // database ); $conn_abrv = mysql_pconnect($hostname_conn_abrv, $username_conn_abrv, $password_conn_abrv) or trigger_error(mysql_error(),E_USER_ERROR); ?>

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/sites/monkeypaw201.com/public_html/vabase/install.php on line 137

 

Tables Inserted Successfully...

 

Continue...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.