The official web hosting company for the BlueVoda Website Builder. You are currently viewing our support forum as a guest which gives you limited (read only) access. By joining our support forum you will be able to ask questions, participate in discussions and receive assistance. Registration is fast and simple. Click Here To Join our support forum today! We look forward to helping you build and publish a fantastic website.
Can you please post here this part of your script ? Including the lines before and after the query
Navaldesign Logger Lite:Low Cost, Customizable, multifeatured Login script Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart DBTechnosystems.comForms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more.... Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!
<?
// Replace the variable values below
// with your specific database information.
$host = "localhost";
$user = "*********"; hid username for this purpose
$pass = "********"; hid password for this purpose
$db = "******_dbConfigphp"; hid first section for this purpose
// This part sets up the connection to the
// database (so you don't need to reopen the connection
// again on the same page).
$ms = mysql_pconnect($host, $user, $pass);
if ( !$ms )
{
echo "Error connecting to database.\n";
}
// Then you need to make sure the database you want
// is selected.
mysql_select_db($db);
?>
<?php
// dbConfig.php is a file that contains your
// database connection information. This
// tutorial assumes a connection is made from
// this existing file.
include ("dbConfig.php");
//Input vaildation and the dbase code
if ( $_GET["op"] == "reg" )
{
$bInputFlag = false;
foreach ( $_POST as $field )
{
if ($field == "")
{
$bInputFlag = false;
}
else
{
$bInputFlag = true;
}
}
// If we had problems with the input, exit with error
if ($bInputFlag == false)
{
die( "Problem with your registration info. "
."Please go back and try again.");
}
// Fields are clear, add user to database
// Setup query
$q = "INSERT INTO `dbUsers` (`username`,`password`,`email`) "
."VALUES ('".$_POST["username"]."', "
."PASSWORD('".$_POST["password"]."'), "
."'".$_POST["email"]."')";
// Run query
$r = mysql_query($q);
// Make sure query inserted user successfully
if ( !mysql_insert_id() )
{
die("Error: User not added to database.");
}
else
{
// Redirect to thank you page.
Header("Location: register.php?op=thanks");
}
} // end if
//The thank you page
elseif ( $_GET["op"] == "thanks" )
{
echo "<h2>Thanks for registering!</h2>";
}
//The web form for input ability
else
{
echo "<form action=\"?op=reg\" method=\"POST\">\n";
echo "Username: <input name=\"username\" MAXLENGTH=\"16\"><br />\n";
echo "Password: <input type=\"password\" name=\"password\" MAXLENGTH=\"16\"><br />\n";
echo "Email Address: <input name=\"email\" MAXLENGTH=\"25\"><br />\n";
echo "<input type=\"submit\">\n";
echo "</form>\n";
}
// EOF
?>
<?php
session_start();
// dBase file
include "dbConfig.php";
if ($_GET["op"] == "login")
{
if (!$_POST["username"] || !$_POST["password"])
{
die("You need to provide a username and password.");
}
// Create query
$q = "SELECT * FROM `dbUsers` "
."WHERE `username`='".$_POST["username"]."' "
."AND `password`=PASSWORD('".$_POST["password"]."') "
."LIMIT 1";
// Run query
$r = mysql_query($q);
if ( $obj = @mysql_fetch_object($r) )
{
// Login good, create session variables
$_SESSION["valid_id"] = $obj->id;
$_SESSION["valid_user"] = $_POST["username"];
$_SESSION["valid_time"] = time();
// Redirect to member page
Header("Location: members.php");
}
else
{
// Login not successful
die("Sorry, could not log you in. Wrong login information.");
}
}
else
{
//If all went right the Web form appears and users can log in
echo "<form action=\"?op=login\" method=\"POST\">";
echo "Username: <input name=\"username\" size=\"15\"><br />";
echo "Password: <input type=\"password\" name=\"password\" size=\"8\"><br />";
echo "<input type=\"submit\" value=\"Login\">";
echo "</form>";
}
?>
<?php
session_start();
if (!$_SESSION["valid_user"])
{
// User not logged in, redirect to login page
Header("Location: login.php");
}
// Member only content
// ...
// ...
// ...
// Display Member information
echo "<p>User ID: " . $_SESSION["valid_id"];
echo "<p>Username: " . $_SESSION["valid_user"];
echo "<p>Logged in: " . date("m/d/Y", $_SESSION["valid_time"]);
// Display logout link
echo "<p><a href=\"logout.php\">Click here to logout!</a></p>";
?>
This is what is always returned when I try to do this Naval:
I use the "localhost" in the below information but it keeps returning with $Host as "Martech-Inc.biz which is the domain and not the "Localhost"
ERROR: Unknown Punctuation String @ 1
STR: <?
SQL: <?
// Replace the variable values below
// with your specific database information.
$host = "Martech-Inc.biz ";<?
// Replace the variable values below
// with your specific database information.
$host = "Martech-Inc.biz ";<?
// Replace the variable values below
// with your specific database information.
$host = "Martech-Inc.biz ";<?
// Replace the variable values below
// with your specific database information.
$host = "Martech-Inc.biz ";<?
// Replace the variable values below
// with your specific database information.
$host = "Martech-Inc.biz ";<?
// Replace the variable values below
// with your specific database information.
$host = "Martech-Inc.biz ";
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '$dbh=mysql_connect ("localhost", "wgnfqog_RamIndus", "This is where I typed my password") or die ('I ca' at line 1
inside the dbConfig.php file is the following:
<?
// Replace the variable values below
// with your specific database information.
$host = "localhost";
$user = "*********"; hid username for this purpose
$pass = "********"; hid password for this purpose
$db = "******_dbConfigphp"; hid first section for this purpose
// This part sets up the connection to the
// database (so you don't need to reopen the connection
// again on the same page).
$ms = mysql_pconnect($host, $user, $pass);
if ( !$ms )
{
echo "Error connecting to database.\n";
}
// Then you need to make sure the database you want
// is selected.
mysql_select_db($db);
?>
<?php
// dbConfig.php is a file that contains your
// database connection information. This
// tutorial assumes a connection is made from
// this existing file.
include ("dbConfig.php");
//Input vaildation and the dbase code
if ( $_GET["op"] == "reg" )
{
$bInputFlag = false;
foreach ( $_POST as $field )
{
if ($field == "")
{
$bInputFlag = false;
}
else
{
$bInputFlag = true;
}
}
// If we had problems with the input, exit with error
if ($bInputFlag == false)
{
die( "Problem with your registration info. "
."Please go back and try again.");
}
// Fields are clear, add user to database
// Setup query
$q = "INSERT INTO `dbUsers` (`username`,`password`,`email`) "
."VALUES ('".$_POST["username"]."', "
."PASSWORD('".$_POST["password"]."'), "
."'".$_POST["email"]."')";
// Run query
$r = mysql_query($q);
// Make sure query inserted user successfully
if ( !mysql_insert_id() )
{
die("Error: User not added to database.");
}
else
{
// Redirect to thank you page.
Header("Location: register.php?op=thanks");
}
} // end if
//The thank you page
elseif ( $_GET["op"] == "thanks" )
{
echo "<h2>Thanks for registering!</h2>";
}
//The web form for input ability
else
{
echo "<form action=\"?op=reg\" method=\"POST\">\n";
echo "Username: <input name=\"username\" MAXLENGTH=\"16\"><br />\n";
echo "Password: <input type=\"password\" name=\"password\" MAXLENGTH=\"16\"><br />\n";
echo "Email Address: <input name=\"email\" MAXLENGTH=\"25\"><br />\n";
echo "<input type=\"submit\">\n";
echo "</form>\n";
}
// EOF
?>
<?php
session_start();
// dBase file
include "dbConfig.php";
if ($_GET["op"] == "login")
{
if (!$_POST["username"] || !$_POST["password"])
{
die("You need to provide a username and password.");
}
// Create query
$q = "SELECT * FROM `dbUsers` "
."WHERE `username`='".$_POST["username"]."' "
."AND `password`=PASSWORD('".$_POST["password"]."') "
."LIMIT 1";
// Run query
$r = mysql_query($q);
if ( $obj = @mysql_fetch_object($r) )
{
// Login good, create session variables
$_SESSION["valid_id"] = $obj->id;
$_SESSION["valid_user"] = $_POST["username"];
$_SESSION["valid_time"] = time();
// Redirect to member page
Header("Location: members.php");
}
else
{
// Login not successful
die("Sorry, could not log you in. Wrong login information.");
}
}
else
{
//If all went right the Web form appears and users can log in
echo "<form action=\"?op=login\" method=\"POST\">";
echo "Username: <input name=\"username\" size=\"15\"><br />";
echo "Password: <input type=\"password\" name=\"password\" size=\"8\"><br />";
echo "<input type=\"submit\" value=\"Login\">";
echo "</form>";
}
?>
<?php
session_start();
if (!$_SESSION["valid_user"])
{
// User not logged in, redirect to login page
Header("Location: login.php");
}
// Member only content
// ...
// ...
// ...
// Display Member information
echo "<p>User ID: " . $_SESSION["valid_id"];
echo "<p>Username: " . $_SESSION["valid_user"];
echo "<p>Logged in: " . date("m/d/Y", $_SESSION["valid_time"]);
// Display logout link
echo "<p><a href=\"logout.php\">Click here to logout!</a></p>";
?>
The connection code seems corect. Can you email me a link to the published script so i can take a look ? However, the script you posted is NOT the same that gives you the error message: it has a different variable and different "or die(....) etc. Are you sure you are running the correct script ? or the correct dbConfig.php file ?
Navaldesign Logger Lite:Low Cost, Customizable, multifeatured Login script Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart DBTechnosystems.comForms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more.... Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!
Ok, i suppose i had to click on New User. Nothing happens, a get a 404 page not found error.
Navaldesign Logger Lite:Low Cost, Customizable, multifeatured Login script Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart DBTechnosystems.comForms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more.... Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!
Running same script as well as the dbConfig.php file.
I insist. It is NOT the same. Just look at the variables and the text to convince yourself:
$dbh=mysql_connect ("localhost", "wgnfqog_RamIndus", "This is where I typed my password") or die ('I ca' at line 1
inside the dbConfig.php file is the following:
<?
// Replace the variable values below
// with your specific database information.
$host = "localhost";
$user = "*********"; hid username for this purpose
$pass = "********"; hid password for this purpose $db = "******_dbConfigphp";
if ( !$ms )
{
echo "Error connecting to database.\n";
As you see the error messages are different from what you get (pink colour) and the variables are different (green clour)
Navaldesign Logger Lite:Low Cost, Customizable, multifeatured Login script Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart DBTechnosystems.comForms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more.... Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!
No, it doesn't work. The form has no action, so it sends nowhere, the encoding is set to text / plain instead of multipart / form data.
I nderstand that you might want to learn yourself, however, a pro script with customized pages to have the same template as your site would cost only a fraction of your time worth.
Navaldesign Logger Lite:Low Cost, Customizable, multifeatured Login script Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart DBTechnosystems.comForms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more.... Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!
When I filled in the form and clicked submit it took me to a completely different action.php page.... How would I name a second action.php thank you page so it only opens into the correct page for the members only section.
If you need to change the scripts where the form sends the info, you need to add an extension BEFOR the .php, like action2.php
Or simply save and upload your action script as login.php or whatever else you want.
Navaldesign Logger Lite:Low Cost, Customizable, multifeatured Login script Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart DBTechnosystems.comForms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more.... Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!
After all information had been supplied the Submit should send the data to the database right? Then send a Thank You page back to the person registering.
Now what I came across is after the submit had been clicked the person is sent back to the Registration page only for some odd reason the Registration page being sent to has warnings posted at the top of the page.
And no Thank You page opens up instead....
Below is the information warning shown after submit is clicked.
Warning: include(dbConfig.php) [function.include]: failed to open stream: No such file or directory in /home/wgnfqog/public_html/action2.php on line 124
Warning: include(dbConfig.php) [function.include]: failed to open stream: No such file or directory in /home/wgnfqog/public_html/action2.php on line 124
Warning: include() [function.include]: Failed opening 'dbConfig.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/wgnfqog/public_html/action2.php on line 124
Username:
Password:
Email Address:
Now as you see above it does show as if it is wanting the New Member to login.... Which should not appear until they click a link which will appear in the Thank You page taking them to the login page.....
The login page is still being created so I know it doesnt appear just yet.
As well as the Members Main Page still needs to be created.
Why am I receiving the second page with the code attached instead of the Thank You page. I have the Thank You page as http://Martech-Inc.biz/thankyou.php which also appears to show the code at the top of the page as with the Registration Page.....
Robert, i can't really answer you. I would need time both to debug the errors and to understant the logical flow of your script. Time that unfortunately i don't have. Sorry
Navaldesign Logger Lite:Low Cost, Customizable, multifeatured Login script Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart DBTechnosystems.comForms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more.... Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!
Comment