Jump to content

rjcfan4ever

Members
  • Posts

    87
  • Joined

  • Last visited

    Never

Posts posted by rjcfan4ever

  1. I got some errors in a PHP script but I don't know any adjust for them  :shrug:

     

    PHP Error Message

     

    Warning: session_start() [function.session-start]: open(/home/a3125714/temporary/sessions/sess_6d97c6e55f38d56becda0d9f5ad368db, O_RDWR) failed: No such file or directory (2) in /home/a3125714/public_html/include/config.php on line 17

     

     

    PHP Error Message

     

    Warning: require_once(/home/a3125714/smarty/libs/Smarty.class.php) [function.require-once]: failed to open stream: No such file or directory in /home/a3125714/public_html/include/config.php on line 32

     

     

    PHP Error Message

     

    Fatal error: require_once() [function.require]: Failed opening required '/home/a3125714/smarty/libs/Smarty.class.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/a3125714/public_html/include/config.php on line 32

     

     

     

    Here is the config.php code:

    <?
    $config = array();
    
    // Begin Configuration
    // This Template was Downloaded From GrabTemplates.com
    $config['basedir']     =  '';
    $config['baseurl']     =  '';
    
    $DBTYPE = 'mysql';
    $DBHOST = '';
    $DBUSER = '';
    $DBPASSWORD = '';
    $DBNAME = '';
    // End Configuration
    
    ini_set('session.save_path', $config['basedir']. '/temporary/sessions');
    session_start();
    
    $config['adminurl']      =  $config[baseurl].'/administrator';
    $config['cssurl']      =  $config[baseurl].'/css';
    $config['imagedir']      =  $config[basedir].'/images';
    $config['imageurl']      =  $config[baseurl].'/images';
    $config['picdir']      =  $config[basedir].'/pics';
    $config['picurl']      =  $config[baseurl].'/pics';
    $config['tpicdir']      =  $config[basedir].'/pics/thumbs';
    $config['tpicurl']      =  $config[baseurl].'/pics/thumbs';
    $config['membersprofilepicdir']      =  $config[imagedir].'/membersprofilepic';
    $config['membersprofilepicurl']      =  $config[imageurl].'/membersprofilepic';
    $config['mbgdir']      =  $config[imagedir].'/mbg';
    $config['mbgurl']      =  $config[imageurl].'/mbg';
    
    require_once($config[basedir].'/smarty/libs/Smarty.class.php');
    require_once($config[basedir].'/libraries/mysmarty.class.php');
    require_once($config[basedir].'/libraries/SConfig.php');
    require_once($config[basedir].'/libraries/SError.php');
    require_once($config[basedir].'/libraries/adodb/adodb.inc.php');
    require_once($config[basedir].'/libraries/phpmailer/class.phpmailer.php');
    require_once($config[basedir].'/libraries/SEmail.php');
    
    function strip_mq_gpc($arg)
    {
      if (get_magic_quotes_gpc())
      {
      	$arg = str_replace('"',"'",$arg);
      	$arg = stripslashes($arg);
        return $arg;
      } 
      else
      {
        $arg = str_replace('"',"'",$arg);
        return $arg;
      }
    }
    
    $conn = &ADONewConnection($DBTYPE);
    $conn->PConnect($DBHOST, $DBUSER, $DBPASSWORD, $DBNAME);
    @mysql_query("SET NAMES 'UTF8'");
    $sql = "SELECT * from config";
    $rsc = $conn->Execute($sql);
    
    if($rsc){while(!$rsc->EOF)
    {
    $field = $rsc->fields['setting'];
    $config[$field] = $rsc->fields['value'];
    STemplate::assign($field, strip_mq_gpc($config[$field]));
    @$rsc->MoveNext();
    }}
    
    if ($_REQUEST['language'] != "")
    {
    if ($_REQUEST['language'] == "english")
    {
    	SESSION_REGISTER("language");
    	$_SESSION[language] = "english";
    }
    elseif ($_REQUEST['language'] == "spanish")
    {
    	SESSION_REGISTER("language");
    	$_SESSION[language] = "spanish";
    }
    elseif ($_REQUEST['language'] == "french")
    {
    	SESSION_REGISTER("language");
    	$_SESSION[language] = "french";
    }
    }
    
    if ($_SESSION['language'] == "")
    {
    SESSION_REGISTER("language");
    $_SESSION[language] = "english";
    }
    
    if ($_SESSION['language'] == "english")
    {
    include("lang/english.php");
    }
    elseif ($_SESSION['language'] == "spanish")
    {
    include("lang/spanish.php");
    }
    elseif ($_SESSION['language'] == "french")
    {
    include("lang/french.php");
    }
    else
    {
    include("lang/english.php");
    }
    
    for ($i=0; $i<count($lang)+1; $i++)
    {
    STemplate::assign('lang'.$i, $lang[$i]);
    }
    
    STemplate::assign('baseurl',       $config['baseurl']);
    STemplate::assign('basedir',       $config['basedir']);
    STemplate::assign('adminurl',       $config['adminurl']);
    STemplate::assign('cssurl',       $config['cssurl']);
    STemplate::assign('imagedir',        $config['imagedir']);
    STemplate::assign('imageurl',        $config['imageurl']);
    STemplate::assign('picdir',        $config['picdir']);
    STemplate::assign('picurl',        $config['picurl']);
    STemplate::assign('tpicdir',        $config['tpicdir']);
    STemplate::assign('tpicurl',        $config['tpicurl']);
    STemplate::assign('membersprofilepicdir',        $config['membersprofilepicdir']);
    STemplate::assign('membersprofilepicurl',        $config['membersprofilepicurl']);
    STemplate::assign('mbgdir',        $config['mbgdir']);
    STemplate::assign('mbgurl',        $config['mbgurl']);
    STemplate::setCompileDir($config['basedir']."/temporary");
    STemplate::setTplDir($config['basedir']."/themes");
    
    ?>

  2. I got an comment script of internet and created a mysql database but if someone sumbit a message it just works.. But if a second person want to sumbit an message he doesn't work D:

     

    Script:

    $host = "localhost"; 
    $user = "username"; 
    $pass = "password"; 
    $db = "database"; 
    
    mysql_connect($host, $user, $pass) OR die ("Could not connect to the server."); 
    mysql_select_db($db) OR die("Could not connect to the database."); 
           
    $name = stripslashes($_POST['txtName']); 
    $message = stripslashes($_POST['txtMessage']); 
    
    if (!isset($_POST['txtName'])) { 
    
        $query = "SELECT id, name, message, DATE_FORMAT(date, '%D %M, %Y @ %H:%i') as newdate FROM guests ORDER BY id DESC"; 
        $result = mysql_query($query); 
         
        while ($row = mysql_fetch_object($result)) { 
    
    ?> 
    
    <p><strong><?php echo $row->message; ?></strong> 
    <br />Posted by <?php echo $row->name; ?> on <?php echo $row->newdate; ?></p> 
    
    <?php 
             
        } 
         
    ?> 

     

    Live view: http://theelephantcrew.awardspace.info/thehappytutorials.php

  3. I'd wanna delete the security code of my guestbook script but I don't know exactly what to delete, can you maybe help me?

     

    Here is the script:

    <?php 
    session_start();
    
    if( isset($_POST['submit'])) {
       if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) {
    	// Insert you code for processing the form here, e.g emailing the submission, entering it into a database. 
    	echo 'Thank you. Your message said "'.$_POST['message'].'"';
    	unset($_SESSION['security_code']);
       } else {
    	// Insert your code for showing an error message here
    	echo 'Sorry, you have provided an invalid security code';
       }
    } else {
    ?>
    <h1>Guestbook with Captcha</h1>
    <form action="form.php" method="post">
    <table>
    <tr>
    	<td>Name</td><td> <input type="text" name="name" id="name" /></td>
    </tr>
    <tr>
    	<td>Email</td><td> <input type="text" name="email" id="email" /></td>
    </tr>
    <tr>
    	<td valign="top">Message</td><td> <textarea rows="5" cols="30" name="message" id="message"></textarea></td>
    </tr>
    <tr>
    
    </tr>
    <tr>
    	<td><td valign="top">Security Code</td><td>
    	<img src="CaptchaSecurityImages.php?width=100&height=40&characters=5" /><br />
    	<input id="security_code" name="security_code" type="text" />
    	</td></td><td>
    	<input type="submit" name="submit" value="Submit" />
    	</td>
    </tr>
    </table>
    </form>
    
    <?php
    }
    ?>

  4. I am making a contact script and I put a code into this script where he can read the users login name and e-mail adress and that gives the error.

     

    Here is the script: (He gives an syntax error on the last line)

    <?php
    if(!empty($_SESSION['LoggedIn']) && !empty($_SESSION['Username']))
    {
     ?>
    
    Username:<input type="text" value="<?php echo  $_SESSION['Username'];?>" id="username"/><br/>
    Email: <input type="text" value="<?php echo  $_SESSION['EmailAddress'];?>" id="email"/>
    <?php
    /* Set e-mail recipient */
    $myemail  = "you@domain.com";
    
    /* Check all form inputs using check_input function */
    $yourname = check_input($_POST['yourname'], "Enter your name");
    $subject  = check_input($_POST['subject'], "Write a subject");
    $email    = check_input($_POST['email']);
    $website  = check_input($_POST['website']);
    $likeit   = check_input($_POST['likeit']);
    $how_find = check_input($_POST['how']);
    $comments = check_input($_POST['comments'], "Write your comments");
    
    /* If e-mail is not valid show error message */
    if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))
    {
        show_error("E-mail address not valid");
    }
    
    /* If URL is not valid set $website to empty */
    if (!preg_match("/^(https?:\/\/+[\w\-]+\.[\w\-]+)/i", $website))
    {
        $website = '';
    }
    
    /* Let's prepare the message for the e-mail */
    $message = "Hello!
    
    Your contact form has been submitted by:
    
    Name: $yourname
    E-mail: $email
    URL: $website
    
    Like the website? $likeit
    How did he/she find it? $how_find
    
    Comments:
    $comments
    
    End of message
    ";
    
    /* Send the message using mail() function */
    mail($myemail, $subject, $message);
    
    /* Redirect visitor to the thank you page */
    header('Location: thanks.htm');
    exit();
    
    /* Functions we used */
    function check_input($data, $problem='')
    {
        $data = trim($data);
        $data = stripslashes($data);
        $data = htmlspecialchars($data);
        if ($problem && strlen($data) == 0)
        {
            show_error($problem);
        }
        return $data;
    }
    
    function show_error($myError)
    {
    ?>
        <html>
        <body>
    
        <b>Please correct the following error:</b><br />
        <?php echo $myError; ?>
    
        </body>
        </html>
    <?php
    exit();
    }
    ?>

  5. Now I got another problem.. He keeps erroring

     

    here is the script, he says syntax error on line 85

     

    <?php
    if(!empty($_SESSION['LoggedIn']) && !empty($_SESSION['Username']))
    {
     ?>
    
    Username:<input type="text" value="<?php echo  $_SESSION['Username'];?>" id="username"/><br/>
    Email: <input type="text" value="<?php echo  $_SESSION['EmailAddress'];?>" id="email"/>
    <?php
    /* Set e-mail recipient */
    $myemail  = "you@domain.com";
    
    /* Check all form inputs using check_input function */
    $yourname = check_input($_POST['yourname'], "Enter your name");
    $subject  = check_input($_POST['subject'], "Write a subject");
    $email    = check_input($_POST['email']);
    $website  = check_input($_POST['website']);
    $likeit   = check_input($_POST['likeit']);
    $how_find = check_input($_POST['how']);
    $comments = check_input($_POST['comments'], "Write your comments");
    
    /* If e-mail is not valid show error message */
    if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))
    {
        show_error("E-mail address not valid");
    }
    
    /* If URL is not valid set $website to empty */
    if (!preg_match("/^(https?:\/\/+[\w\-]+\.[\w\-]+)/i", $website))
    {
        $website = '';
    }
    
    /* Let's prepare the message for the e-mail */
    $message = "Hello!
    
    Your contact form has been submitted by:
    
    Name: $yourname
    E-mail: $email
    URL: $website
    
    Like the website? $likeit
    How did he/she find it? $how_find
    
    Comments:
    $comments
    
    End of message
    ";
    
    /* Send the message using mail() function */
    mail($myemail, $subject, $message);
    
    /* Redirect visitor to the thank you page */
    header('Location: thanks.htm');
    exit();
    
    /* Functions we used */
    function check_input($data, $problem='')
    {
        $data = trim($data);
        $data = stripslashes($data);
        $data = htmlspecialchars($data);
        if ($problem && strlen($data) == 0)
        {
            show_error($problem);
        }
        return $data;
    }
    
    function show_error($myError)
    {
    ?>
        <html>
        <body>
    
        <b>Please correct the following error:</b><br />
        <?php echo $myError; ?>
    
        </body>
        </html>
    <?php
    exit();
    }
    ?>

  6. I need a Contact me script, what directly knows the user his username and password.

    Someone maybe knows such a script?

    Here is my login page and members page:

    <?php include "base.php"; ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">  
    <head>  
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
    <title>User Management System (Tom Cameron for NetTuts)</title>
    <link rel="stylesheet" href="style.css" type="text/css" />
    </head>  
    <body>  
    <div id="main">
    <?php
    if(!empty($_SESSION['LoggedIn']) && !empty($_SESSION['Username']))
    {
     ?>
        
        <h1>Member Area</h1>
      	 <p>Thanks for logging in! You are <b><?=$_SESSION['Username']?><b> and your email address is <b><?=$_SESSION['EmailAddress']?></b>.</p>
         test
      	 <p> </p>
        </p>
        <ul>
          <li><a href="logout.php">Logout.</a></li>
        </ul>
        
        <?php
    }
    elseif(!empty($_POST['username']) && !empty($_POST['password']))
    {
     $username = mysql_real_escape_string($_POST['username']);
        $password = md5(mysql_real_escape_string($_POST['password']));
        
     $checklogin = mysql_query("SELECT * FROM users WHERE Username = '".$username."' AND Password = '".$password."'");
        
        if(mysql_num_rows($checklogin) == 1)
        {
        	 $row = mysql_fetch_array($checklogin);
            $email = $row['EmailAddress'];
            
            $_SESSION['Username'] = $username;
            $_SESSION['EmailAddress'] = $email;
            $_SESSION['LoggedIn'] = 1;
            
        	 echo "<h1>Success</h1>";
            echo "<p>We are now redirecting you to the member area.</p>";
             echo "<meta http-equiv='refresh' content='2;url=index2.php' />";
        }
        else
        {
        	 echo "<h1>Error</h1>";
            echo "<p>Sorry, your account could not be found. Please <a href=\"index2.php\">click here to try again</a>.</p>";
        }
    }
    else
    {
    ?>
        
       <h1>Member Login</h1>
        
       <p>Thanks for visiting! Please either login below, or <a href="register.php">click here to register</a>.</p>
        
    <form method="post" action="index.php" name="loginform" id="loginform">
    <fieldset>
    	<label for="username">Username:</label><input type="text" name="username" id="username" /><br />
    	<label for="password">Password:</label><input type="password" name="password" id="password" /><br />
    	<input type="submit" name="login" id="login" value="Login" />
    </fieldset>
    </form>
        
       <?php
    }
    ?>
    </div>
    </body>
    </html>

  7. Hi, i can't sumbite any text on my members area.

    Here is the code: (The login script is also in the script)

    <?php include "base.php"; ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">  
    <head>  
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
    <title>User Management System (Tom Cameron for NetTuts)</title>
    <link rel="stylesheet" href="style.css" type="text/css" />
    </head>  
    <body>  
    <div id="main">
    <?php
    if(!empty($_SESSION['LoggedIn']) && !empty($_SESSION['Username']))
    {
     ?>
        
        <h1>Member Area</h1>
      	 <p>Thanks for logging in! You are <b><?=$_SESSION['Username']?><b> and your email address is <b><?=$_SESSION['EmailAddress']?></b>.</p>
      	 <p> </p>
        </p>
        <ul>
          <li><a href="logout.php">Logout.</a></li>
        </ul>
        
        <?php
    }
    elseif(!empty($_POST['username']) && !empty($_POST['password']))
    {
     $username = mysql_real_escape_string($_POST['username']);
        $password = md5(mysql_real_escape_string($_POST['password']));
        
     $checklogin = mysql_query("SELECT * FROM users WHERE Username = '".$username."' AND Password = '".$password."'");
        
        if(mysql_num_rows($checklogin) == 1)
        {
        	 $row = mysql_fetch_array($checklogin);
            $email = $row['EmailAddress'];
            
            $_SESSION['Username'] = $username;
            $_SESSION['EmailAddress'] = $email;
            $_SESSION['LoggedIn'] = 1;
            
        	 echo "<h1>Success</h1>";
            echo "<p>We are now redirecting you to the member area.</p>";
             echo "<meta http-equiv='refresh' content='2;url=index2.php' />";
        }
        else
        {
        	 echo "<h1>Error</h1>";
            echo "<p>Sorry, your account could not be found. Please <a href=\"index2.php\">click here to try again</a>.</p>";
        }
    }
    else
    {
    ?>
        
       <h1>Member Login</h1>
        
       <p>Thanks for visiting! Please either login below, or <a href="register.php">click here to register</a>.</p>
        
    <form method="post" action="index.php" name="loginform" id="loginform">
    <fieldset>
    	<label for="username">Username:</label><input type="text" name="username" id="username" /><br />
    	<label for="password">Password:</label><input type="password" name="password" id="password" /><br />
    	<input type="submit" name="login" id="login" value="Login" />
    </fieldset>
    </form>
        
       <?php
    }
    ?>
    </div>
    </body>
    </html>

  8. Hi! I am searching days for just a comment system that works, I need the comment system of youtube. (If you login you don't have to write your name in the comment system, the system must automaticly know your name from the login). Someone can help me?

     

    Thank you :D

     

    Rjcfan4ever

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