Jump to content


This topic is now archived and is closed to further replies.


The timed project, A few questions about various things

Recommended Posts

Ok, I am working on that project to try and do within a very quick period of time, as I said in another post I have until wednesday.

Now, I have 2 pages done, part of the system is finished, and I ran into a few walls, and don't know where to go from here.

<!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">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<h4>Program Start</h4>
<p>All Fields Required</p>
<form name="program1" id="program1" action="program2.php" method="post">
<label for="username">Username:</label>
<input name="username" id="username" type="text" maxlength="150"
value="<?php echo stripslashes($_GET['username']); ?>" /><br />
<label for="email">Email Address:</label>
<input name="email" id="email" type="text" maxlength="150"
value="<?php echo stripslashes($_GET['email']); ?>" /><br />
<label for="verifyemail">Verify Email:</label>
<input name="verifyemail" id="verifyemail" type="text" maxlength="150"
value="<?php echo stripslashes($_GET['verifyemail']); ?>" /><br />
<label for="password">Password:</label>
<input name="password" id="password" type="password" maxlength="150" /><br />
<label for="vpass">Verify Password:</label>
<input name="vpass" id="vpass" type="password" maxlength="150" /><br />
<label for="sdn">Requested Sub Domain:</label>
<input name="sdn" id="sdn" type="text" maxlength="255"
value="<?php echo stripslashes($_GET['subdomain']); ?>" /><br />
<input name="submit" id="submit" type="submit" value="continue" />

// db connection info
mysql_connect("localhost", "#####", "#####");
// set errorhandler to blank
$errorhandler = "";
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);
$vpass = mysql_real_escape_string($_POST['vpass']);
$email = mysql_real_escape_string($_POST['email']);
$verifyemail = mysql_real_escape_string($_POST['verifyemail']);
$subdomain = mysql_real_escape_string($_POST['sdn']);
// validation, and checking for duplicates in database
if ($username == "") {
$errorhandler .= "The username was left blank.<br />";
if ($password == "") {
$errorhandler .= "The password was left blank.<br />";
if ($password != $vpass) {
$errorhandler .= "The password fields don't match.<br />";
if ($email == "") {
$errorhandler .= "The email was left blank.<br />";
}else {
$selectemail = "SELECT * FROM userinfo WHERE email = '$email';";
$queryemail = mysql_query($selectemail);
if ($rowemail = mysql_fetch_array($queryemail)) {
$errorhandler .= "The email already exists in the database, please use another one.<br />";

if ($verifyemail != $email) {
$errorhandler .= "The email addresses don't match.<br />";
if ($subdomain == "") {
$errorhandler .= "The subdomain was left blank.<br />";
}else {
$selectsn = "SELECT * FROM subdomain WHERE subdomainname = '$subdomain';";
$querysn = mysql_query($selectsn);
if ($rowsn = mysql_fetch_array($querysn)) {
$errorhandler .= "That domain name exists already.  Please choose pick another one.<br />";

// display any errors, with link to fix them
if ($errorhandler != "") {
echo "<span style=\"color:red;\">";
echo $errorhandler;
echo "</span>";
echo "<a href=\"program1.php?username={$username}&email={$email}&verifyemail={$verifyemail}&subdomain={$subdomain}\" title=\"Return to page 1\">Return To Page One</a>";
// check for errorhandler, if empty continue with program
if ($errorhandler == "") {
// set sessions
$_SESSION['username'] = $username;
$_SESSION['password'] = md5($password);
$_SESSION['email'] = $email;
$_SESSION['subdomain'] = $subdomain;
$_SESSION['controller'] = true;
// display message
<p>The registration so far was successfully.  Please choose one of the following links to either continue on with registration, or exit out of registration completely.</p>
// show links
echo "<a href=\"program3.php\" title=\"Continue\">Continue</a>";
echo "<br />";
echo "<a href=\"exit.php\" title=\"Exit\">Exit</a>";

Now I am ready to start up program3.php everything is tested so far, and it all works, as I develop other parts it may need to be tweaked, or when I build in new features.  But so far everything works out properly.
Now i am onto program3.php but ran into some problems, since he is in a hurry to just get it started, I wasn't going to style the pages
I am having 2 pages
they are basic pages, that have no design, just basic xhtml markup(later designs will be built into them, more template pages added, and even search engine optimization done with them as they are created in order to make them all search engine friendly)
I am currently running into a few problems, I am stuck on.

1. I have hte database schema already totally worked out.
[quote]Database schema
userid - (int(30), Auto Inc, Primary Id)
username – (varchar(200))
Password – (varchar(100))
Emailaddress – (varchar(100))
subdomainname – (varchar(255))

userid (Association purposes)

That is the database
I know I have to make modifications, because I have to build a small cms into the templates page(get to that in a minute)

Now that I have given you all my information, here are the problems I am having difficulties with.

Problem 1-
I don't understand how to make the next part work.  I need to make it to where all the information from the program2.php page, which is all put in a session, so saving state is already taken care of.  Now when it comes time to get to program3.php I have to allow them to check which template. I don't understand this whole process, and the templates have to have a cms built in somehow.
Like they choose the template, then type in the text that will appear in the template
The php does the rest.  So I was thinking of having the templates pictures side by side, with radial buttons below them, this could be how they choose one, then a text field for the cms.

I don't understand however, how I can do this.  I have to have a basic template1.php and template2.php with what I want on it, and a cms built into it, but I don't understand how there going to interact.  because the basic template1.php and template2.php have to be remained untouch, while another duplicate page, named index.php each time. 

The other thing I am not getting is, they have to choose a template, and choose text, then they go to view there results, like a picture or something of there results, they they pay through paypal, then with paypals IPN "Instant Payment Notification" I have to take that information, and
1. create the subdomain
2. Database the user information
3. Create the database information for the created sub-domain
4. Move the template that was created, over into the subdomain, and somehow associate them within the database.

because when they log in there admin later, they have to be able to edit there cms.

Any ideas on general theory, something to point me in the right direction??

Share this post

Link to post
Share on other sites
It must have been the way I phrased my question.

let me refine the question some, maybe then someone can help

I am wondering about how to make my template interact with my script.

I have a template1.php and a template2.php I need them to remain untouched, then i have a cms, setup to allow them to change the text on the templates.
That is the first problem
the second is
I need to be able to temporarily hold all the information so I can put it into practice after the stuff comes back from paypal, any advice would be appreciated.

Share this post

Link to post
Share on other sites


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.