Jump to content

HoTDaWg

Members
  • Posts

    275
  • Joined

  • Last visited

Posts posted by HoTDaWg

  1. Assuming it's a unix-like server, write any script and set a cron job to run it.  You can write a PHP script which is called from the command line.  There's plenty of cron documentation online.

     

    interesting, i would love to learn about this ability however i am on a shared cpanel-utilizing host. is this still possible?

     

    HoTDaWg

  2. geez this is killing me,

     

    check it out i think its the same error:

    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 'read,ip FROM actions WHERE read='nope'' at line 1
    

     

    *sigh* KILLING ME:@ herere is the script again:

    <?php
    $connection = mysql_connect('localhost','xxxx','XXXXXX');
    mysql_select_db('xXXXXXXXX');
    
    echo'<table width="375" height="0" cellpadding="0" cellspacing="0" border="1"><tr><td>Id:</td><td>Action:</td><td>Date:</td><td>Ip:</td></tr><tr>';
    $sql = "SELECT id,action,`date`,read,ip FROM actions WHERE read='nope'";
    $result = mysql_query($sql,$connection)or die(mysql_error());
    $num_results = mysql_num_rows($result);
    
    if($num_results == null){
    echo "No results to display!";
    }else{
    while($row = mysql_fetch_assoc($result)){
    echo'<td>'.$row['id'].'</td><td>'.$row['action'].'</td><td>'.$row['date'].'</td><td>'.$row['ip'].'</td></tr><tr>';
    }
    }
    
    echo'</table>';
    ?>
    

    thanks again

     

    HoTDaWg

  3. thanks for your response:)

     

    ouch...

    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 'read,ip FROM actions WHERE read='nope'' at line 1
    

     

    thanks for your help all i have to go to sleep now but i will bring this topic back up tomorrow if u can, post a reply today and i will check it out asap

     

    nightey night and thanks again

    HoTDaWg

  4. weird, i am getting the following error.

    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 'read,ip FROM actions WHERE read='nope'' at line 1
    

    heres the updated script:

    <?php
    //connection stuff
    
    echo'<table width="375" height="0" cellpadding="0" cellspacing="0" border="1"><tr><td>Id:</td><td>Action:</td><td>Date:</td><td>Ip:</td></tr><tr>';
    $sql = "SELECT id,action,date,read,ip FROM actions WHERE read='nope'";
    $result = mysql_query($sql,$connection)or die(mysql_error());
    $num_results = mysql_num_rows($result);
    
    if($num_results == 0){
    echo "No results to display!";
    }else{
    while($row = mysql_fetch_assoc($result)){
    echo'<td>'.$row['id'].'</td><td>'.$row['action'].'</td><td>'.$row['date'].'</td><td>'.$row['ip'].'</td></tr><tr>';
    }
    }
    
    echo'</table>';
    ?>
    

    and my database:

    
    -- 
    -- Table structure for table `actions`
    -- 
    
    CREATE TABLE `actions` (
      `id` int(11) NOT NULL auto_increment,
      `action` varchar(255) default NULL,
      `date` varchar(255) default NULL,
      `read` varchar(255) NOT NULL default '',
      `ip` varchar(255) default NULL,
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
    
    -- 
    -- Dumping data for table `actions`
    -- 
    

     

    ??? whats goin on...

    any help would be greatly appreciated thanks

     

    HoTDaWg

  5. how do i echo a statement like "There are no results to display." with a code like this?:

    <?php
    //connection stuff here....
    
    echo'<table width="375" height="0" cellpadding="0" cellspacing="0" border="1"><tr><td>Id:</td><td>Action:</td><td>Date:</td><td>Ip:</td></tr><tr>';
    $sql = "SELECT id,action,date,read,ip FROM actions WHERE read='nope'";
    $result = mysql_query($sql,$connection)or die(mysql_error());
    
    while($row = mysql_fetch_assoc($result)){
    echo'<td>'.$row['id'].'</td><td>'.$row['action'].'</td><td>'.$row['date'].'</td><td>'.$row['ip'].'</td></tr><tr>';
    }
    
    echo'</table>';
    ?>
    

     

    thanks for any help possible

     

    HoTDaWg

  6. there are three mistakes with this post:

     

    1. state WHAT error you are getting.

    2. please use the [ code ] tags

    3. there is a seperate forum for O.O.P

     

    keep this in mind.

     

    HoTDaWg

  7. although i dont get what you are doing (but dats cuzza my noobishness),

     

    its a good habbit to include your connection when executing a query.

    <?php
    $result2 = mysql_query($sql2,$connection);
    ?>
    

     

    also...at the risk of insulting you (which is completely unintentional)...why dont you just make ur script:

     

    <?php
    include( 'connect.php' );
    
    $a=$_POST['src1'];
    $b=$_POST['title1'];
    $c=$_POST['spkr1'];
    $d=$_POST['src2'];
    $e=$_POST['title2'];
    $f=$_POST['spkr2'];
    
    
    $sql = "INSERT INTO video_sem (src,name,spkr) VALUES  ('$a','$b','$c','$d','$e','$f')";
    
    $results = mysql_query($sql,$connection);
    
    ?>
    

     

    I am curious to know why are you making two seperate insert into commands? Having two seperate forms does not necessairily mean you need two seperate insert commands...

    HoTDaWg

     

  8. okay,

     

    thanks so much for the in-depth explanation and help. No errors...the problem is that upon pressing submit all it says is:

    The Email field was was not complete
    

     

    the code is now:

    <?php
    error_reporting(E_ALL);
    $ip = $_SERVER['REMOTE_ADDR'];
    $date = date('l, F j, Y @ g:i:s A e');
    $sitename = "*****";
    $slogan = "*****";
    $subscribetext= "Join...NOW!";
    $emailform = '<form method="POST" name="addsubscriber" action="http://www.*****.com/index.php?mode=emailsubmit"><br>'.$subscribetext.'<br>Email:<input name="emailaddress" maxlength="80" value=""><br><input type="submit" value="Submit!"></form>';
    $conn = mysql_connect("localhost","*****","*****");
    mysql_select_db("*****");
    $adminemail = '*****@*****.com';
    
    $mode = isset($_GET['mode']) && !empty($_GET['mode']) ? $_GET['mode'] : "home";
    
    $contentecho = array();
    switch($mode){
    case 'emailsubmit':
    $emailerror = array();
    $email = isset($_POST['mode']) && !empty($_POST['mode']);
    	if(isset($email) && strlen($email) < 1){
    	$emailerror['email'] = '<li><font color="#FF0000">The Email field was was not complete</font></li>';
    	}
    	if(strlen($email) > 80){
    	$emailerror['email'] .= '<li><font color="#FF0000">The Email field exeeds the limit of 80 characters</font></li>';
    	}
    	if(isset($email) && preg_match('|[^-_.@a-z\d]|i', $email)){
    	$emailerror['email'] .= '<li><font color="#FF0000">The Email Field contains invalid characters. Alphanumeric, @,-,and _ characters are the only characters accepted due to security reasons.</font></li>';
    	}
    	$emailexists = "SELECT email FROM subscribers WHERE email='$email'";
    	$selectemailexists = mysql_query($emailexists,$conn);
    		if(mysql_num_rows($selectemailexists) > 0){
    		$emailerror['email'] .='<li><font color="#FF0000">This Email is already registered as a subscriber.</font></li>';
    		}
    	if(count($emailerror) < 1){
    	$usercode = rand(0,1000000);
    	$status = 'blank';
    	$insertemail = "INSERT INTO subscribers(`id`,`email`,`usercode`,`date`,`ip`,`status`) VALUES('','$email','$usercode','$date','$ip','$status')";
    	$insertemailnow = mysql_query($insertemail,$conn);
    		if($insertemailnow){
    		$message="Thanks for registering on our website! Open a new window and go to http://www.*****.com/index.php?email=$email&mode=verify&usercode=$usercode to complete your registration. Thanks.";
          		$to = &$email;
          		$subject = 'Validate This Email';
          		$headers = 'From: *****@*****.com' . "\r\n" .
          		'Reply-To: *****@*****.com' . "\r\n" .
    //This statement helps out with spam filters
          		'X-Mailer: PHP/' . phpversion();
    //Send the email
          		$mailnow = mail($to, $subject, $message, $headers,"bakhtawarawan@gmail.com");
    			if($mailnow){
    			$contentecho ='Thank you for registering. A verification email has been dispatched to your email address. Please check your spam/junk mail folders if the email does not appear in your inbox. If the email does not appear at all within 24 hours contact the administrator. Thanks again.';
    			}else{
    			$contentecho ='An error occurred with your submission, the verification email was not sent. Please try again.';
    			}
    		}else{
    		$contentecho ='An error occurred with your submission. Please try again.';
    		}
    	}else{
    		foreach ($emailerror as $error){
    		$echoemailerrors = ''.$error.'';
    		} 
    	$content = array();
    	$content['text'] = 'The following errors were found in your submission:<br>'.$echoemailerrors.'<br>';
    	$content['text'] .= ''.$emailform.'';
    		foreach ($content as $text){
    		$contentecho = ''.$text.'';
    		}
    	}
    break;
    //BEGIN VERIFY
    case 'verify':
    $usercode = $_GET['usercode'];
    $email = $_GET['email'];
    $validateerror = array();
    	if(empty($usercode) || empty($email)){
    	$validateerror['empty'] .= '<li><font color="#FF0000">This page was accessed incorrectly.</font></li>';
    	}
    $validatetrue = "SELECT email,usercode FROM subscribtions WHERE email='$email' usercode='$usercode' status='good'";
    $validatetruenow = mysql_query($validatetrue,$conn);
    	if(mysql_num_rows($validatetruenow) > 0){
    	$validateerror['already_exists'] .= '<li><font color="#FF0000">This email is already subscribed and validated.</font></li>';
    	}
    	if(count($validateerror) > 0){
    	$status = "good";
    	$updateemail = "UPDATE subscribers SET status='$status' WHERE usercode='$usercode'";
    	$updatemailnow = mysql_query($insertemail,$conn);
    		if($updateemailnow){
    		$action = "New Email added to subscribers list";
    		$insertaction = "INSERT INTO actions(`id`,`action`,`date`,`ip`) VALUES('','$action','$date','$ip')";
    		$actionsubmit = mysql_query($insertaction,$conn);
    				if($actionsubmit){
    				$contentecho .='Your email has been successfully added to our subscribers list. Expect a newsletter soon! Thank you for your interest.';
    				}else{
    				$contentecho .='Your email has been successfully added to our subscribers list. Expect a newsletter soon! Thank you for your interest.';
    				}
    		}else{
    		$contentecho .='<li><font color="#FF0000">An error occurred with your verification. Please try again.</font></li>';
    		}
    	}else{
    		foreach($validateerror as $errorkind){
    		$contentecho .= ''.$errorkind.'';
    		}
    	}
    break;
            case 'home':
    $contentecho =''.$emailform.'';
            break;        
    default:
    $contentecho =''.$emailform.'';
    break;
    }
    ?>
    
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Welcome!</title>
    
    </head>
    <body bgcolor="#999999" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <center>
    <table width="750" height="0" cellpadding="0" cellspacing="0" border="0" style="Border: 1px solid #000000;">
    <tr>
    <td bgcolor="#666666" valign="top"><font color="#FFFFFF" face="arial"><b>Under construction</font></b></td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" valign="top">
    <table width="98%" border="0">
            <font face="arial" size="3">
            Our website is under construction, bare with us as we create it.<b>Thanks for your consideration.</b><br>
    <b>Check back soon!</b><br><br>
    <i>The <?php echo $sitename; ?> Team</i></font>
    </table>
    </td>
    </tr>
    <tr>
    <td bgcolor="#0099FF" valign="top"><font color="#FFFFFF" size="3" face="arial"><B>Sign up for email updates today!</B></font></td>
    </tr>
    <tr>
    <td bgcolor="#CCCCCC" valign="top">
    <center>
    <table width="98%" border="0">
    <?php 	
    echo $contentecho;
     ?>
    </table>
    </center>
    </td>
    </tr>
    </table>
    </center>
    <h4 align="center">Our website is graciously hosted by <a href="http://guildwutang.com/">X ER Game Hosting</a></h4>
    </body>
    </html>
    

    ???

     

    any help would be greatly appreciated thanks...

     

    HoTDaWg

  9. first things first, register globals isn't good to use.

    second, use isset

     

    for example line 19

     

    if(strlen($email) < 1){

     

    should be

     

    if(isset($email) && strlen($email) < 1){

     

    line 20 you have

     

    $emailerror['email'] .= '<li><font color="#FF0000">The Email field was was not complete</font></li>';

     

    to fix this add to the beginning of your script

     

    $emailerror['email'] = '';

     

    this should help you understand the other errors

    im sorry, but i do not quite understand what adding

    <?php
    $emailerror['email'] = ''
    ?>
    

    would do...Would someone please explain for me?

     

    thanks and sorry,

     

    HoTDaWg

  10. :S thanks for the help, i am pretty sure i have register globals enabled... lemme double check....yea man i do.

     

    ouch, check out the number of errors now ???

    Notice: Undefined variable: email in /home/xdesigns/public_html/index.php on line 19
    
    Notice: Undefined index: email in /home/xdesigns/public_html/index.php on line 20
    
    Notice: Undefined variable: email in /home/xdesigns/public_html/index.php on line 22
    
    Notice: Undefined variable: email in /home/xdesigns/public_html/index.php on line 25
    
    Notice: Undefined variable: email in /home/xdesigns/public_html/index.php on line 28
    
    Notice: Undefined variable: echoemailerrors in /home/xdesigns/public_html/index.php on line 59
    
    Notice: Undefined index: text in /home/xdesigns/public_html/index.php on line 62
    

     

    the code is now:

    <?php
    error_reporting(E_ALL);
    $ip = $_SERVER['REMOTE_ADDR'];
    $date = date('l, F j, Y @ g:i:s A e');
    $sitename = "hahahaa";
    $slogan = "hahahaa";
    $subscribetext= "Join...NOW!";
    $emailform = '<form method="POST" name="addsubscriber" action="http://www.hahahaa.com/index.php?mode=emailsubmit"><br>'.$subscribetext.'<br>Email:<input name="emailaddress" maxlength="80" value=""><br><input type="submit" value="Submit!"></form>';
    $conn = mysql_connect("localhost","hahahaa","hahahaa");
    mysql_select_db("hahahaa");
    $adminemail = 'hahahaa';
    
    $mode = isset($_GET['mode']) && !empty($_GET['mode']) ? $_GET['mode'] : "home";
    $contentecho = array();
    switch($mode){
    case 'emailsubmit':
    $emailerror = array();
    	if(strlen($email) < 1){
    	$emailerror['email'] .= '<li><font color="#FF0000">The Email field was was not complete</font></li>';
    	}
    	if(strlen($email) > 80){
    	$emailerror['email'] .= '<li><font color="#FF0000">The Email field exeeds the limit of 80 characters</font></li>';
    	}
    	if(preg_match('|[^-_.@a-z\d]|i', $email)){
    	$emailerror['email'] .= '<li><font color="#FF0000">The Email Field contains invalid characters. Alphanumeric, @,-,and _ characters are the only characters accepted due to security reasons.</font></li>';
    	}
    	$emailexists = "SELECT email FROM subscribers WHERE email='$email'";
    	$selectemailexists = mysql_query($emailexists,$conn);
    		if(mysql_num_rows($selectemailexists) > 0){
    		$emailerror['email'] .='<li><font color="#FF0000">This Email is already registered as a subscriber.</font></li>';
    		}
    	if(count($emailerror) < 1){
                    $email = $_POST["emailaddress"];
    	$usercode = rand(0,1000000);
    	$status = 'blank';
    	$insertemail = "INSERT INTO subscribers(`id`,`email`,`usercode`,`date`,`ip`,`status`) VALUES('','$email','$usercode','$date','$ip','$status')";
    	$insertemailnow = mysql_query($insertemail,$conn);
    		if($insertemailnow){
    		$message="Thanks for registering on our website! Open a new window and go to http://www.hahahaa.com/index.php?email=$email&mode=verify&usercode=$usercode to complete your registration. Thanks.";
          		$to = &$email;
          		$subject = 'Validate This Email';
          		$headers = 'From: hahahaa' . "\r\n" .
          		'Reply-To: hahahaa' . "\r\n" .
    //This statement helps out with spam filters
          		'X-Mailer: PHP/' . phpversion();
    //Send the email
          		$mailnow = mail($to, $subject, $message, $headers,"bakhtawarawan@gmail.com");
    			if($mailnow){
    			$contentecho ='Thank you for registering. A verification email has been dispatched to your email address. Please check your spam/junk mail folders if the email does not appear in your inbox. If the email does not appear at all within 24 hours contact the administrator. Thanks again.';
    			}else{
    			$contentecho ='An error occurred with your submission. Please try again.';
    			}
    		}else{
    		$contentecho ='An error occurred with your submission. Please try again.';
    		}
    	}else{
    		foreach ($emailerror as $error){
    		$echoemailerrors .= ''.$error.'';
    		} 
    	$content = array();
    	$content['text'] .= 'The following errors were found in your submission:<br>'.$echoemailerrors.'<br>';
    	$content['text'] .= ''.$emailform.'';
    		foreach ($content as $text){
    		$contentecho .= ''.$text.'';
    		}
    	}
    break;
    //BEGIN VERIFY
    case 'verify':
    $usercode = $_GET['usercode'];
    $email = $_GET['email'];
    $validateerror = array();
    	if(empty($usercode) || empty($email)){
    	$validateerror['empty'] .= '<li><font color="#FF0000">This page was accessed incorrectly.</font></li>';
    	}
    $validatetrue = "SELECT email,usercode FROM subscribtions WHERE email='$email' usercode='$usercode' status='good'";
    $validatetruenow = mysql_query($validatetrue,$conn);
    	if(mysql_num_rows($validatetruenow) > 0){
    	$validateerror['already_exists'] .= '<li><font color="#FF0000">This email is already subscribed and validated.</font></li>';
    	}
    	if(count($validateerror) > 0){
    	$status = "good";
    	$updateemail = "UPDATE subscribers SET status='$status' WHERE usercode='$usercode'";
    	$updatemailnow = mysql_query($insertemail,$conn);
    		if($updateemailnow){
    		$action = "New Email added to subscribers list";
    		$insertaction = "INSERT INTO actions(`id`,`action`,`date`,`ip`) VALUES('','$action','$date','$ip')";
    		$actionsubmit = mysql_query($insertaction,$conn);
    				if($actionsubmit){
    				$contentecho .='Your email has been successfully added to our subscribers list. Expect a newsletter soon! Thank you for your interest.';
    				}else{
    				$contentecho .='Your email has been successfully added to our subscribers list. Expect a newsletter soon! Thank you for your interest.';
    				}
    		}else{
    		$contentecho .='<li><font color="#FF0000">An error occurred with your verification. Please try again.</font></li>';
    		}
    	}else{
    		foreach($validateerror as $errorkind){
    		$contentecho .= ''.$errorkind.'';
    		}
    	}
    break;
            case 'home':
    $contentecho =''.$emailform.'';
            break;        
    default:
    $contentecho =''.$emailform.'';
    break;
    }
    ?>
    
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Welcome!</title>
    
    </head>
    <body bgcolor="#999999" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <center>
    <table width="750" height="0" cellpadding="0" cellspacing="0" border="0" style="Border: 1px solid #000000;">
    <tr>
    <td bgcolor="#666666" valign="top"><font color="#FFFFFF" face="arial"><b>Under construction</font></b></td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" valign="top">
    <table width="98%" border="0">
            <font face="arial" size="3">
            Our website is under construction, bare with us as we create it.<b>Thanks for your consideration.</b><br>
    <b>Check back soon!</b><br><br>
    <i>The <?php echo $sitename; ?> Team</i></font>
    </table>
    </td>
    </tr>
    <tr>
    <td bgcolor="#0099FF" valign="top"><font color="#FFFFFF" size="3" face="arial"><B>Sign up for email updates today!</B></font></td>
    </tr>
    <tr>
    <td bgcolor="#CCCCCC" valign="top">
    <center>
    <table width="98%" border="0">
    <?php 	
    echo $contentecho;
     ?>
    </table>
    </center>
    </td>
    </tr>
    </table>
    </center>
    <h4 align="center">Our website is graciously hosted by <a href="http://guildwutang.com/">X ER Game Hosting</a></h4>
    </body>
    </html>
    

  11. thank you both for your help, however, more errors :(

     

    once the submit button is pressed the following errors come up:

    Notice: Undefined variable: mode in /home/xdesigns/public_html/index.php on line 19
    
    Notice: Undefined variable: mode in /home/xdesigns/public_html/index.php on line 72
    
    Notice: Undefined variable: mode in /home/xdesigns/public_html/index.php on line 106
    

     

    i have changed the code too:

    <?php
    error_reporting(E_ALL);
    $ip = $_SERVER['REMOTE_ADDR'];
    $date = date('l, F j, Y @ g:i:s A e');
    $sitename = "hahahaa";
    $slogan = "hahahaa";
    $subscribetext= "Join...NOW!";
    $emailform = '<form method="POST" name="addsubscriber" action="http://www.hahahaa.com/index.php?mode=emailsubmit"><br>'.$subscribetext.'<br>Email:<input name="emailaddress" maxlength="80" value=""><br><input type="submit" value="Submit!"></form>';
    $conn = mysql_connect("localhost","hahahaa","hahahaa");
    mysql_select_db("hahahaa");
    $adminemail = 'hahahaa';
    
    if (!isset($_GET['mode'])) {
    $mode = "home";
    }
    
    $contentecho = array();
    switch($mode){
    case 'emailsubmit':
    $emailerror = array();
    	if(strlen($email) < 1){
    	$emailerror['email'] .= '<li><font color="#FF0000">The Email field was was not complete</font></li>';
    	}
    	if(strlen($email) > 80){
    	$emailerror['email'] .= '<li><font color="#FF0000">The Email field exeeds the limit of 80 characters</font></li>';
    	}
    	if(preg_match('|[^-_.@a-z\d]|i', $email)){
    	$emailerror['email'] .= '<li><font color="#FF0000">The Email Field contains invalid characters. Alphanumeric, @,-,and _ characters are the only characters accepted due to security reasons.</font></li>';
    	}
    	$emailexists = "SELECT email FROM subscribers WHERE email='$email'";
    	$selectemailexists = mysql_query($emailexists,$conn);
    		if(mysql_num_rows($selectemailexists) > 0){
    		$emailerror['email'] .='<li><font color="#FF0000">This Email is already registered as a subscriber.</font></li>';
    		}
    	if(count($emailerror) < 1){
                    $email = $_POST["emailaddress"];
    	$usercode = rand(0,1000000);
    	$status = 'blank';
    	$insertemail = "INSERT INTO subscribers(`id`,`email`,`usercode`,`date`,`ip`,`status`) VALUES('','$email','$usercode','$date','$ip','$status')";
    	$insertemailnow = mysql_query($insertemail,$conn);
    		if($insertemailnow){
    		$message="Thanks for registering on our website! Open a new window and go to http://www.hahahaa.com/index.php?email=$email&mode=verify&usercode=$usercode to complete your registration. Thanks.";
          		$to = &$email;
          		$subject = 'Validate This Email';
          		$headers = 'From: hahahaa' . "\r\n" .
          		'Reply-To: hahahaa' . "\r\n" .
    //This statement helps out with spam filters
          		'X-Mailer: PHP/' . phpversion();
    //Send the email
          		$mailnow = mail($to, $subject, $message, $headers,"bakhtawarawan@gmail.com");
    			if($mailnow){
    			$contentecho ='Thank you for registering. A verification email has been dispatched to your email address. Please check your spam/junk mail folders if the email does not appear in your inbox. If the email does not appear at all within 24 hours contact the administrator. Thanks again.';
    			}else{
    			$contentecho ='An error occurred with your submission. Please try again.';
    			}
    		}else{
    		$contentecho ='An error occurred with your submission. Please try again.';
    		}
    	}else{
    		foreach ($emailerror as $error){
    		$echoemailerrors .= ''.$error.'';
    		} 
    	$content = array();
    	$content['text'] .= 'The following errors were found in your submission:<br>'.$echoemailerrors.'<br>';
    	$content['text'] .= ''.$emailform.'';
    		foreach ($content as $text){
    		$contentecho .= ''.$text.'';
    		}
    	}
    break;
    //BEGIN VERIFY
    case 'verify':
    $usercode = $_GET['usercode'];
    $email = $_GET['email'];
    $validateerror = array();
    	if(empty($usercode) || empty($email)){
    	$validateerror['empty'] .= '<li><font color="#FF0000">This page was accessed incorrectly.</font></li>';
    	}
    $validatetrue = "SELECT email,usercode FROM subscribtions WHERE email='$email' usercode='$usercode' status='good'";
    $validatetruenow = mysql_query($validatetrue,$conn);
    	if(mysql_num_rows($validatetruenow) > 0){
    	$validateerror['already_exists'] .= '<li><font color="#FF0000">This email is already subscribed and validated.</font></li>';
    	}
    	if(count($validateerror) > 0){
    	$status = "good";
    	$updateemail = "UPDATE subscribers SET status='$status' WHERE usercode='$usercode'";
    	$updatemailnow = mysql_query($insertemail,$conn);
    		if($updateemailnow){
    		$action = "New Email added to subscribers list";
    		$insertaction = "INSERT INTO actions(`id`,`action`,`date`,`ip`) VALUES('','$action','$date','$ip')";
    		$actionsubmit = mysql_query($insertaction,$conn);
    				if($actionsubmit){
    				$contentecho .='Your email has been successfully added to our subscribers list. Expect a newsletter soon! Thank you for your interest.';
    				}else{
    				$contentecho .='Your email has been successfully added to our subscribers list. Expect a newsletter soon! Thank you for your interest.';
    				}
    		}else{
    		$contentecho .='<li><font color="#FF0000">An error occurred with your verification. Please try again.</font></li>';
    		}
    	}else{
    		foreach($validateerror as $errorkind){
    		$contentecho .= ''.$errorkind.'';
    		}
    	}
    break;
            case 'home':
    $contentecho =''.$emailform.'';
            break;        
    default:
    $contentecho =''.$emailform.'';
    break;
    }
    ?>
    
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Welcome!</title>
    
    </head>
    <body bgcolor="#999999" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <center>
    <table width="750" height="0" cellpadding="0" cellspacing="0" border="0" style="Border: 1px solid #000000;">
    <tr>
    <td bgcolor="#666666" valign="top"><font color="#FFFFFF" face="arial"><b>Under construction</font></b></td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" valign="top">
    <table width="98%" border="0">
            <font face="arial" size="3">
            Our website is under construction, bare with us as we create it.<b>Thanks for your consideration.</b><br>
    <b>Check back soon!</b><br><br>
    <i>The <?php echo $sitename; ?> Team</i></font>
    </table>
    </td>
    </tr>
    <tr>
    <td bgcolor="#0099FF" valign="top"><font color="#FFFFFF" size="3" face="arial"><B>Sign up for email updates today!</B></font></td>
    </tr>
    <tr>
    <td bgcolor="#CCCCCC" valign="top">
    <center>
    <table width="98%" border="0">
    <?php 	
    echo $contentecho;
     ?>
    </table>
    </center>
    </td>
    </tr>
    </table>
    </center>
    <h4 align="center">Our website is graciously hosted by <a href="http://guildwutang.com/">X ER Game Hosting</a></h4>
    </body>
    </html>
    

     

    tthanks for any help possible,

     

    HoTDaWg

  12. one problem is that im getting the following error:

    Parse error: syntax error, unexpected T_VARIABLE, expecting T_CASE or T_DEFAULT or '}' in /home/xdesigns/public_html/index.php on line 18
    

    now,  before it would give me some error along the lines of:

    Warning: undefined index mode.
    

    even then, it would insert the stuff into the db but give an error message that an unexpected error occurred. it wouldnt even send the email.

    here is my script:

    <?php
    error_reporting(E_ALL);
    $ip = $_SERVER['REMOTE_ADDR'];
    $date = date('l, F j, Y @ g:i:s A e');
    $sitename = "Yadayada";
    $slogan = "Slogan here";
    $subscribetext= "Join...NOW!";
    $emailform = '<form method="POST" name="addsubscriber" action="http://www.mysite.com/index.php?mode=emailsubmit"><br>'.$subscribetext.'<br>Email:<input name="emailaddress" maxlength="80" value=""><br><input type="submit" value="Submit!"></form>';
    $conn = mysql_connect("localhost","*********","*******");
    mysql_select_db("************");
    $adminemail = '***********';
    
    if (!isset($_GET['mode'])) {
    $mode = "home";
    }
    
    switch($mode){
    $contentecho = array();
    $email = $_POST["emailaddress"];
    case 'emailsubmit':
    $emailerror = array();
    	if(strlen($email) < 1){
    	$emailerror['email'] .= '<li><font color="#FF0000">The Email field was was not complete</font></li>';
    	}
    	if(strlen($email) > 80){
    	$emailerror['email'] .= '<li><font color="#FF0000">The Email field exeeds the limit of 80 characters</font></li>';
    	}
    	if(preg_match('|[^-_.@a-z\d]|i', $email)){
    	$emailerror['email'] .= '<li><font color="#FF0000">The Email Field contains invalid characters. Alphanumeric, @,-,and _ characters are the only characters accepted due to security reasons.</font></li>';
    	}
    	$emailexists = "SELECT email FROM subscribers WHERE email='$email'";
    	$selectemailexists = mysql_query($emailexists,$conn);
    		if(mysql_num_rows($selectemailexists) > 0){
    		$emailerror['email'] .='<li><font color="#FF0000">This Email is already registered as a subscriber.</font></li>';
    		}
    	if(count($emailerror) < 1){
    	$usercode = rand(0,1000000);
    	$status = 'blank';
    	$insertemail = "INSERT INTO subscribers(`id`,`email`,`usercode`,`date`,`ip`,`status`) VALUES('','$email','$usercode','$date','$ip','$status')";
    	$insertemailnow = mysql_query($insertemail,$conn);
    		if($insertemailnow){
    		$message="Thanks for registering on our website! Open a new window and go to http://www.*********.com/index.php?email=$email&mode=verify&usercode=$usercode to complete your registration. Thanks.";
          		$to = &$email;
          		$subject = 'Validate This Email';
          		$headers = 'From: ****@******.com' . "\r\n" .
          		'Reply-To: ****@******.com' . "\r\n" .
    //This statement helps out with spam filters
          		'X-Mailer: PHP/' . phpversion();
    //Send the email
          		$mailnow = mail($to, $subject, $message, $headers,"****@******.com");
    			if($mailnow){
    			$contentecho ='Thank you for registering. A verification email has been dispatched to your email address. Please check your spam/junk mail folders if the email does not appear in your inbox. If the email does not appear at all within 24 hours contact the administrator. Thanks again.';
    			}else{
    			$contentecho ='An error occurred with your submission. Please try again.';
    			}
    		}else{
    		$contentecho ='An error occurred with your submission. Please try again.';
    		}
    	}else{
    		foreach ($emailerror as $error){
    		$echoemailerrors .= ''.$error.'';
    		} 
    	$content = array();
    	$content['text'] .= 'The following errors were found in your submission:<br>'.$echoemailerrors.'<br>';
    	$content['text'] .= ''.$emailform.'';
    		foreach ($content as $text){
    		$contentecho .= ''.$text.'';
    		}
    	}
    break;
    //BEGIN VERIFY
    case 'verify':
    $usercode = $_GET['usercode'];
    $email = $_GET['email'];
    $validateerror = array();
    	if(empty($usercode) || empty($email)){
    	$validateerror['empty'] .= '<li><font color="#FF0000">This page was accessed incorrectly.</font></li>';
    	}
    $validatetrue = "SELECT email,usercode FROM subscribtions WHERE email='$email' usercode='$usercode' status='good'";
    $validatetruenow = mysql_query($validatetrue,$conn);
    	if(mysql_num_rows($validatetruenow) > 0){
    	$validateerror['already_exists'] .= '<li><font color="#FF0000">This email is already subscribed and validated.</font></li>';
    	}
    	if(count($validateerror) > 0){
    	$status = "good";
    	$updateemail = "UPDATE subscribers SET status='$status' WHERE usercode='$usercode'";
    	$updatemailnow = mysql_query($insertemail,$conn);
    		if($updateemailnow){
    		$action = "New Email added to subscribers list";
    		$insertaction = "INSERT INTO actions(`id`,`action`,`date`,`ip`) VALUES('','$action','$date','$ip')";
    		$actionsubmit = mysql_query($insertaction,$conn);
    				if($actionsubmit){
    				$contentecho .='Your email has been successfully added to our subscribers list. Expect a newsletter soon! Thank you for your interest.';
    				}else{
    				$contentecho .='Your email has been successfully added to our subscribers list. Expect a newsletter soon! Thank you for your interest.';
    				}
    		}else{
    		$contentecho .='<li><font color="#FF0000">An error occurred with your verification. Please try again.</font></li>';
    		}
    	}else{
    		foreach($validateerror as $errorkind){
    		$contentecho .= ''.$errorkind.'';
    		}
    	}
    break;
            case 'home':
    $contentecho =''.$emailform.'';
            break;        
    default:
    $contentecho =''.$emailform.'';
    break;
    }
    ?>
    
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Welcome!</title>
    
    </head>
    <body bgcolor="#999999" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <center>
    <table width="750" height="0" cellpadding="0" cellspacing="0" border="0" style="Border: 1px solid #000000;">
    <tr>
    <td bgcolor="#666666" valign="top"><font color="#FFFFFF" face="arial"><b>Under construction</font></b></td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" valign="top">
    <table width="98%" border="0">
            <font face="arial" size="3">
            Our website is under construction, bare with us as we create it.<b>Thanks for your consideration.</b><br>
    <b>Check back soon!</b><br><br>
    <i>The <?php echo $sitename; ?> Team</i></font>
    </table>
    </td>
    </tr>
    <tr>
    <td bgcolor="#0099FF" valign="top"><font color="#FFFFFF" size="3" face="arial"><B>Sign up for email updates today!</B></font></td>
    </tr>
    <tr>
    <td bgcolor="#CCCCCC" valign="top">
    <center>
    <table width="98%" border="0">
    <?php 	
    echo $contentecho;
     ?>
    </table>
    </center>
    </td>
    </tr>
    </table>
    </center>
    <h4 align="center">Our website is graciously hosted by <a href="http://guildwutang.com/">X ER Game Hosting</a></h4>
    </body>
    </html>
    

    thanks for any help possible.

     

    HoTDaWg

  13. i changed the code too:

    <?php
    $conn = mysql_connect('********','******','*********');
    mysql_select_db('***********');
    
    $rowsPerPage = "4";
    $pageNum = "1";
    
    if(isset($_GET['page'])){
      $pageNum = $_GET['page'];
    }
    
    $offset = ($pageNum - 1) * ($rowsPerPage);
    
    $sql = "SELECT id,itemname,itemprice,itemdescription FROM items ".
    "LIMIT $offset,$rowsPerPage";
    $result = mysql_query($sql,$conn)or die(mysql_error());
    
    while($row = mysql_fetch_assoc($result)){
    echo "$id";
    echo "$itemname";
    echo "$itemprice";
    echo "$itemdescription";
    }
    
    mysql_free_result($result);
    mysql_close($conn);
    ?>
    

     

    but now it shows a blank page. ??? i do, of course have content in the table, check it out:

    CREATE TABLE `items` (
      `id` int(11) NOT NULL auto_increment,
      `itemname` varchar(255) default NULL,
      `itemprice` varchar(255) default NULL,
      `itemdescription` varchar(255) default NULL,
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=21 ;
    
    -- 
    -- Dumping data for table `items`
    -- 
    
    INSERT INTO `items` VALUES (1, 'Couch', '$1.00', 'A comfy couch!');
    INSERT INTO `items` VALUES (2, 'Cars', '$100.00', 'A comfy car!');
    INSERT INTO `items` VALUES (3, 'Couch', '$1.00', 'A comfy couch!');
    INSERT INTO `items` VALUES (4, 'Couch', '$1.00', 'A comfy couch!');
    INSERT INTO `items` VALUES (5, 'Couch', '$1.00', 'A comfy couch!');
    INSERT INTO `items` VALUES (6, 'Couch', '$1.00', 'A comfy couch!');
    INSERT INTO `items` VALUES (7, 'Couch', '$1.00', 'A comfy couch!');
    INSERT INTO `items` VALUES (8, 'Couch', '$1.00', 'A comfy couch!');
    INSERT INTO `items` VALUES (9, 'Couch', '$1.00', 'A comfy couch!');
    INSERT INTO `items` VALUES (10, 'Couch', '$1.00', 'A comfy couch!');
    INSERT INTO `items` VALUES (11, 'Couch', '$1.00', 'A comfy couch!');
    INSERT INTO `items` VALUES (12, 'Couch', '$1.00', 'A comfy couch!');
    INSERT INTO `items` VALUES (13, 'Couch', '$1.00', 'A comfy couch!');
    INSERT INTO `items` VALUES (14, 'Couch', '$1.00', 'A comfy couch!');
    INSERT INTO `items` VALUES (15, 'Couch', '$1.00', 'A comfy couch!');
    INSERT INTO `items` VALUES (16, 'Couch', '$1.00', 'A comfy couch!');
    INSERT INTO `items` VALUES (17, 'Couch', '$1.00', 'A comfy couch!');
    INSERT INTO `items` VALUES (18, 'Couch', '$1.00', 'A comfy couch!');
    INSERT INTO `items` VALUES (19, 'Couch', '$1.00', 'A comfy couch!');
    INSERT INTO `items` VALUES (20, 'Couch', '$1.00', 'A comfy couch!');
    

     

    wierd ...

     

    HoTDaWg

  14. im sorry it was a mistake on my part when i was posting. in the real script the quote is there. also, appologies for my lack of explaining things. i get the following error upon loading of the page.

    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 '0,4' at line 1
    

     

    sorry, i just got this new kickin book on Ajax (w00t w00t). lol, only a nerd would get excited:P

     

    thanks for any help,

     

    HoTDaWg

  15. hi, i know this script is very basic but i cant figure out what im doing wrong.

    take a look:

    <?php
    $conn = mysql_connect('localhost','xxxxxxx',xxxxxx');
    mysql_select_db('xxxxxxxxxxxx');
    
    $rowsPerPage = "4";
    $pageNum = "1";
    
    if(isset($_GET['page'])){
      $pageNum = $_GET['page'];
    }
    
    $offset = ($pageNum - 1) * ($rowsPerPage);
    
    $sql = "SELECT id,itemname,itemprice,itemdescription FROM items".
    "LIMIT $offset,$rowsPerPage";
    $result = mysql_query($sql,$conn)or die(mysql_error());
    
    while($row = mysql_fetch_assoc($result)){
    echo "$id";
    echo "$itemname";
    echo "$itemprice";
    echo "$itemdescription";
    }
    
    mysql_free_result($result);
    mysql_close($conn);
    ?>
    

    any help would be great.

     

    HoTDaWg

     

  16. <?php
    define('inform',true);
    //the key addition^^^
    $zender_geslacht = $_POST['geslacht'];
    $zender_naam = $_POST['contactpersoon'];
    $zender_bedrijf = $_POST['bedrijf'];
    
    $zender_adres_straat = $_POST['adresStraat'];
    $zender_adres_nummer = $_POST['adresNummer'];
    $zender_adres_postcode = $_POST['adresPostcode'];
    $zender_adres_gemeente = $_POST['adresGemeente'];
    
    $zender_contact_tel = $_POST['contactTel'];
    $zender_contact_fax = $_POST['contactFax'];
    $zender_contact_email = $_POST['contactEmail'];
    
    $zender_bericht = $_POST['vragen_opmerkingen'];
    
    $to = 'peter@luchtballon.be';
    $subject = 'Luchtballon.be Aanvraag';
    
    $message =  $zender_geslacht . ' ' . $zender_naam . "\r\n" .
    		'Bedrijf: ' . $zender_bedrijf . 
    		"\r\n" . "\r\n" .
    		'Straat: ' . $zender_adres_straat . "\r\n" .
    		'Nummer: ' . $zender_adres_nummer . "\r\n" .
    		'Postcode: ' . $zender_adres_postcode . "\r\n" .
    		'Gemeente: ' . $zender_adres_gemeente .
    		"\r\n" . "\r\n" .
    		'Telefoon: ' . $zender_contact_tel . "\r\n" .
    		'Fax: ' . $zender_contact_fax . "\r\n" .
    		'Email: ' . $zender_contact_email .
    		"\r\n" . "\r\n" .
    		'Bericht: ' . $zender_bericht;
    
    $headers = 	'From: ' . $zender_contact_email . "\r\n" .
       			'Reply-To: ' . $zender_contact_email . "\r\n" .
       			'X-Mailer: PHP/' . phpversion();
    
    if(isset($_POST['contactEmail']) && isset($_POST['vragen_opmerkingen'])) {
    header("Location: contacteer-webmaster-succes.php");
    mail($to, $subject, $message, $headers);
    }
    else {
    header("Location: contacteer-webmaster.php");
    }
    ?>
    

    then...

    <?php
    if(isset($_POST['contactEmail']) && isset($_POST['vragen_opmerkingen']) && (defined('inform')) {
    //main addition here as well. ^^^^^^
    header("Location: contacteer-webmaster-succes.php");
    }
    else {
    header("Location: contacteer-webmaster.php");
    }
    <html>
    blabla thanks blabla
    </html>
    ?>

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