Jump to content

emediastudios

Members
  • Posts

    418
  • Joined

  • Last visited

Posts posted by emediastudios

  1. I am in need of a shopping cart i can integrate into an existing site.

    Does someone have one i can buy from them, If so how much and what functions does the cart have, i want to be able to simple create a database, make a connection, upload the files and use include file to put the products inside a table on my sites.

    Must have admin, categories, and the ability to add colours and other attributes to the products.

    Pay Pal and money order or check payments.

    In AUD currency too.

    Thanks Ross 

  2. My code is pulled out of another form and im trying to get it to upload a pdf

    There are some errors with the " " in the $content .= part.

     

    <?PHP
    if(isset($_GET['action']))
    {
        $action=addslashes($_GET['action']);
    }
    
    $content .=	'<form enctype=\"multipart/form-data\" action=\"?action=douploadn\" method=\"POST\">
    Upload Newsletter<br>
    <p>
    <label>File:</label><input type=\"file\" name=\"newsletter\" size=\"15\">
    </p>
    <p>
    <label></label><input type=\"Submit\" value=\"Upload\">
    </form>';
    
    if ($action == "douploadn") {
    
    $filetype = $_FILES['newsletter']['type'];
    
    if($filetype == "application/pdf") {
    
      $target_path = "newsletter/";
      $target_path = $target_path . basename( $_FILES['newsletter']['name']); 
      if(move_uploaded_file($_FILES['newsletter']['tmp_name'], $target_path)) { $ok = "The file has been uploaded!"; } else { $ok = "There was an error when uploading the file!"; }
    
      $fn=basename( $_FILES['newsletter']['name']); 
    
      echo "<center>$ok<br>You can see the file here: <a href=\"newsletter/".basename( $_FILES['newsletter']['name'])."\">".basename( $_FILES['newsletter']['name'])."</a>";
    
      mysql_query("UPDATE newsletter SET newsname='$fn' WHERE newsid='1'");
    
    } else {
    
      Header("Location: index.php?action=wrongtype");
    
    }
    
    } 
    	?>

     

    any  help be great

     

  3. yeah thats all there. here is all the code.

    <?PHP
    $content .= "<td valign=\"bottom\"><br><a href='admin.php?p=temp_models&id=".$info[tempmodelid]."'><strong>Delete this application</strong></a><br>".$info[name]."<br><a href='mailto:".$info[email]."?subject=Jimmys Promotions and Modelling Agency Model Application'>".$info[email]."</a><br><a href=images/applications/".$info[picname]."rel=lightbox><img src='images/applications/".$info[picname]."' alt='".$info[name]."' width='300'/><a/><br><br></td>";
    ?>

     

  4. Hi everyone.

    A simple one, never the lesss doing my head in

    <a href=images/applications/".$info[picname]." rel=lightbox>

    I cant get it to work, in the source code of the site it looks as above, and lightbox dont work. It should look like this in the page source

    <a href=images/applications/".$info[picname]."rel="lightbox">

     

    but i get errors when i put the "" around lightbox

    I tried putting slashes there and no luck

     

  5. I have a email form and want to add the record to my database.

    I also want to add a image upload, i have added the field but dont know how to get it working.

    my email form below.

    <?php
    error_reporting(E_ALL);
    session_start();
    
    require_once 'includes/include.php';
    
    switch ($_REQUEST['action']) {
    
    case 'scouting':
    
    foreach($_POST as $key=>$value){
    $$key = $value;
    }
    
    if ((!$name) || (!$email) || (!$comments) || (!$survey)) {
    $error_msg = 'Fields marked * are required to submit the form';
    
    }elseif (($_SESSION['security_code'] != $security_code) && (!empty($_SESSION['security_code']))){
    $error_msg = 'Please fill in the Verification Image field';
    }
    echo "$error_msg","<br><br>";
    
    if ($error_msg == ''){
    
    
    foreach($_POST as $key=>$value){
    $$key = htmlentities(stripslashes($value));
    }
    
    $companyname = 'Jimmys Promotions and Model Agency';
    $companyemail = 'rorryss@estuos.com.au';
    
    
    $headers  = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "From: ".$name." <".$email.">\r\n";
    $headers .= "Reply-To: ".$name." <".$email.">\r\n";
    $to = "".$companyname."<".$companyemail.">";
    $subject = "Model Apllication";
    $message = '<style type="text/css">
    <!--
    .style {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    }
    -->
    </style>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    	<tr>
        <td class="style">
    <b>Details:</b><br /><br />
    <b>Name:</b> '.$name.'<br />
    <b>Email:</b> '.$email.'<br />
    <b>Ph No:</b> '.$phone.'<br /><br />
    <b>Query:</b><br /><br />
    '.$comments.'<br /><br />
    <b>Survey:</b><br />
    '.$survey.'
        </td>
      	</tr>
    </table>';
    
    mail($to, $subject, $message, $headers);
     	$images_dir = "images/applications";
    
    
    echo '<table width="99%" border="0" cellpadding="0" cellspacing="0">
      	<tr>
        <td><br />Hi '.$name.',<p />Thanks for your enquiry. One of our friendly staff will be in touch with you shortly.<p />Regards<p />The team @ '.$companyname.'</td>
      	</tr>
    </table>';
    
    }else{
    
    foreach($_POST as $key=>$value){
    $$key = htmlentities(stripslashes($value));
    }
    
    $counter = 1;
    $number_of_fields = 1;
    
    echo '<form id="form" name="Contact Form" method="post" action="'.$_SERVER['PHP_SELF'].'?action=scouting" enctype="multipart/form-data">
    <table width="550" border="0">
      	<tr>
        <td width="199" class="contacttext"><span class="star">*</span><span class="col_box_1"> Your name: </span></td>
        <td width="341"><input name="name" type="text" class="fields" id="name" value="'.$name.'" /></td>
      	</tr>
      	<tr>
        <td class="contacttext"><span class="star">*</span><span class="col_box_1"> E-mail address: </span></td>
        <td><input name="email" type="text" class="fields" id="email" value="'.$email.'" /></td>
      	</tr>
      	<tr>
        <td class="contacttext_1">Phone: </td>
        <td><input name="phone" type="text" class="fields" id="phone" value="'.$phone.'" /></td>
      	</tr>
      	<tr>
        <td class="contacttext"><span class="star">*</span> How did you hear about us? </td>
        <td><select name="survey" class="fields" id="survey">
    <option value="">Please select</option>
    <option '. ($survey=='Magazine' ? 'selected' : '') .' value="Magazine">Magazine</option>
    <option '. ($survey=='Internet' ? 'selected' : '') .' value="Internet">Internet</option>
    <option '. ($survey=='Newspaper' ? 'selected' : '') .' value="Newspaper">Newspaper</option>
    <option '. ($survey=='Billboard' ? 'selected' : '') .' value="Billboard">Billboard</option>
    <option '. ($survey=='Yellow pages' ? 'selected' : '') .' value="Yellow pages">Yellow pages</option>
    <option '. ($survey=='Referal' ? 'selected' : '') .' value="Referal">Referal</option>
    <option '. ($survey=='Mail out' ? 'selected' : '') .' value="Mail out">Mail out</option>
    <option '. ($survey=='Drive by' ? 'selected' : '') .' value="Drive by">Drive by</option>
    <option '. ($survey=='Other' ? 'selected' : '') .' value="Other">Other</option>
        </select></td>
      	</tr>
      	<tr>
        <td class="contacttext"><span class="star">* </span>Comments:: </td>
        <td><textarea name="comments" cols="30" rows="6" class="fields" id="comments">'.$comments.'</textarea></td>
      	</tr>
      	<tr>
        <td class="contacttext"><span class="star">*</span> Recent snapshot: (max 2meg)</td>
        <td>';
    while($counter <= $number_of_fields){
    echo '
    <input class="fields2" name="imagename[]" type="file"><br />';
    $counter++;
    }
      	echo '</tr>
      	<tr>
        <td class="contacttext"><span class="star">*</span> Verification Image: </td>
        <td><input name="security_code" type="text" class="fields" /></td>
      	</tr>
      	<tr>
        <td> </td>
        <td><img src="./captcha.php?width=100&height=40&characters=5" border="1" /></td>
      	</tr>
      	<tr>
        <td><input name="Submit" type="submit" class="font_5" value="submit" /></td>
        <td> </td>
      	</tr>
    </table>
    </form>';
    
    }
    
    break;
    
    }
    
    
    ?>

     

    My database is as follows

    Database name = jimmy

     

    Fields

    ---------------------------------------

    tempmodelid

    name

    email

    phone

    comments

    photofilename

    date.

     

    Be so stoked if someone could help me out.

     

  6. hi every one.

    I am having trouble getting these two scripts to merge into one.

     

    They both exist in different files and i have edited them a bit but just cant get it right.

    This is my email script, it works fine.

    <?php
    error_reporting(E_ALL);
    session_start();
    
    require_once 'includes/include.php';
    
    switch ($_REQUEST['action']) {
    
    case 'scouting':
    
    foreach($_POST as $key=>$value){
    $$key = $value;
    }
    
    if ((!$name) || (!$email) || (!$comments) || (!$survey)) {
    $error_msg = 'Fields marked * are required to submit the form';
    }elseif (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { 
        $error_msg = 'Invalid email address'; 
    }elseif (($_SESSION['security_code'] != $security_code) && (!empty($_SESSION['security_code']))){
    $error_msg = 'Please fill in the Verification Image field';
    }
    echo "$error_msg","<br><br>";
    
    if ($error_msg == ''){
    
    
    
    foreach($_POST as $key=>$value){
    $$key = htmlentities(stripslashes($value));
    }
    
    $companyname = 'Jimmys Promotions and Model Agency';
    $companyemail = 'ryetss@emstr.com.au';
    
    
    $headers  = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "From: ".$name." <".$email.">\r\n";
    $headers .= "Reply-To: ".$name." <".$email.">\r\n";
    $to = "".$companyname."<".$companyemail.">";
    $subject = "Model Apllication";
    $message = '<style type="text/css">
    <!--
    .style {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    }
    -->
    </style>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    	<tr>
        <td class="style">
    <b>Details:</b><br /><br />
    <b>Name:</b> '.$name.'<br />
    <b>Email:</b> '.$email.'<br />
    <b>Ph No:</b> '.$phone.'<br /><br />
    <b>Query:</b><br /><br />
    '.$comments.'<br /><br />
    <b>Survey:</b><br />
    '.$survey.'
        </td>
      	</tr>
    </table>';
    
    mail($to, $subject, $message, $headers);
    
    echo '<table width="99%" border="0" cellpadding="0" cellspacing="0">
      	<tr>
        <td><br />Hi '.$name.',<p />Thanks for your enquiry. One of our friendly staff will be in touch with you shortly.<p />Regards<p />The team @ '.$companyname.'</td>
      	</tr>
    </table>';
    
    }else{
    
    foreach($_POST as $key=>$value){
    $$key = htmlentities(stripslashes($value));
    }
    
    $counter = 1;
    $number_of_fields = 1;
    
    echo '<form id="form" name="Contact Form" method="post" action="'.$_SERVER['PHP_SELF'].'?action=scouting" enctype="multipart/form-data">
    <table width="550" border="0">
      	<tr>
        <td width="199" class="contacttext"><span class="star">*</span><span class="col_box_1"> Your name: </span></td>
        <td width="341"><input name="name" type="text" class="fields" id="name" value="'.$name.'" /></td>
      	</tr>
      	<tr>
        <td class="contacttext"><span class="star">*</span><span class="col_box_1"> E-mail address: </span></td>
        <td><input name="email" type="text" class="fields" id="email" value="'.$email.'" /></td>
      	</tr>
      	<tr>
        <td class="contacttext_1">Phone: </td>
        <td><input name="phone" type="text" class="fields" id="phone" value="'.$phone.'" /></td>
      	</tr>
      	<tr>
        <td class="contacttext"><span class="star">*</span> How did you hear about us? </td>
        <td><select name="survey" class="fields" id="survey">
    <option value="">Please select</option>
    <option '. ($survey=='Magazine' ? 'selected' : '') .' value="Magazine">Magazine</option>
    <option '. ($survey=='Internet' ? 'selected' : '') .' value="Internet">Internet</option>
    <option '. ($survey=='Newspaper' ? 'selected' : '') .' value="Newspaper">Newspaper</option>
    <option '. ($survey=='Billboard' ? 'selected' : '') .' value="Billboard">Billboard</option>
    <option '. ($survey=='Yellow pages' ? 'selected' : '') .' value="Yellow pages">Yellow pages</option>
    <option '. ($survey=='Referal' ? 'selected' : '') .' value="Referal">Referal</option>
    <option '. ($survey=='Mail out' ? 'selected' : '') .' value="Mail out">Mail out</option>
    <option '. ($survey=='Drive by' ? 'selected' : '') .' value="Drive by">Drive by</option>
    <option '. ($survey=='Other' ? 'selected' : '') .' value="Other">Other</option>
        </select></td>
      	</tr>
      	<tr>
        <td class="contacttext"><span class="star">* </span>Comments:: </td>
        <td><textarea name="comments" cols="30" rows="6" class="fields" id="comments">'.$comments.'</textarea></td>
      	</tr>
      	<tr>
        <td class="contacttext"><span class="star">*</span> Recent snapshot: (max 2meg)</td>
        <td>';
    while($counter <= $number_of_fields){
    echo '
    <input class="fields2" name="imagename[]" type="file"><br />';
    $counter++;
    }
      	echo '</tr>
      	<tr>
        <td class="contacttext"><span class="star">*</span> Verification Image: </td>
        <td><input name="security_code" type="text" class="fields" /></td>
      	</tr>
      	<tr>
        <td> </td>
        <td><img src="./captcha.php?width=100&height=40&characters=5" border="1" /></td>
      	</tr>
      	<tr>
        <td><input name="Submit" type="submit" class="font_5" value="submit" /></td>
        <td> </td>
      	</tr>
    </table>
    </form>';
    
    }
    
    break;
    
    }
    
    
    ?>

     

    and i have edited a old script below to match the above database at stuff but i cant get them to work together.

     

    <?php // Store folder for images
    	$images_dir = "images/applications";
    
    	// Insert the record making photofilname 0
    	mysql_query("INSERT INTO tempmodels (name, email, phone, comments, photofilename, dateadded) VALUES('$name', '$email','$phone','$comments,'$photofilename, '0', NOW())");
    $tempmodelid = mysql_insert_id();
    
    	// Counter for multiple fileupload
    $counter = 0;
    
    // Limit file types allowed to be updated
    $known_photo_types = array(
    'image/pjpeg' => 'jpg',
    'image/jpeg' => 'jpg');
    
    // Convert posted photofilename
    $photofilename = $_FILES['photofilename'];
    
    while($counter <= count($_FILES['photofilename']['tmp_name'])) {
    
    if($photofilename['size'][$counter] > 0) {
    
    if(!array_key_exists($photofilename['type'][$counter], $known_photo_types)) {
    echo 'File '.($counter+1).' is not a accepted file type!<br />';
    
    }else{	
    
    // Rename the photo to the record id
    $filetype = $photofilename['type'][$counter];
    $extention = $known_photo_types[$filetype];
    $filename = $tempmodelid.".".$extention;
    
    // Update filename in the database
    $sql = mysql_query("UPDATE tempmodels SET photofilename='$filename' WHERE tempmodelid = $tempmodelid");
    
    // Copy the file to the image store folder
    move_uploaded_file($photofilename['tmp_name'][$counter], $images_dir."/".$filename);
    
     }
    }
    $counter++;
    }
    ?>

     

  7. If i have this at the top of my login.php

    session_start();

    $_SESSION = $password;

     

    Apache crashes

     

    what about this code in the file

    if($count==1){

    // Register $username, $password and redirect to file

    session_register("username");

    session_register("password");

    session_register("admin_id");

    header("Location: admin.php");

     

  8. I dont know what im doing wrong, i used your script but now it just freezes when i login.

    This is what i have.

    Login page.

     

    <?php 
    
    require_once('include/include.php'); 
    session_start();
    #Form has been submitted?
    if((isset($_POST['login'])) AND ($_POST['login'] == 'Login')){
    ob_start();
    $host="localhost"; // Host name 
    $username="root"; // Mysql username 
    $password="5050888202"; // Mysql password 
    $db_name="jimmy"; // Database name 
    $tbl_name="admin"; // Table name 
    
    
    
    #Check for blanks and clean data
    $errors_login = array(); #Initiate error variable
    
    if(empty($_POST['username'])) $errors_login[] = 'You must enter a username.'; else $clean['username'] = htmlspecialchars($_POST['username']);
    if(empty($_POST['password'])) $errors_login[] = 'You must enter a password.'; else $clean['password'] = htmlspecialchars($_POST['password']);
    
    //verify password...
    $get_pass = mysql_query("SELECT * FROM `admin` WHERE password = '".$_POST['password']."'");
    $q = ($get_pass);
        if(!$q) { 
    $errors_login[] = 'Wrong password.'; 
    }
    
    	//verify user...
    $get_user = mysql_query("SELECT * FROM `admin` WHERE username = '".$_POST['username']."' ");
    $q = ($get_user);
        if(!$q) { 
    $errors_login[] = 'Wrong username.'; 
    }
    
    //check that username is only letters or numbers
    if (! preg_match('/^[a-zA-Z0-9]+$/i', $_POST['username'])){
    	$errors_login[]= "Your username must be <i><b>ONLY</b></i> letters or numbers.";
    }
    //check that password is only letters or numbers
    if (! preg_match('/^[a-zA-Z0-9]+$/i', $_POST['password'])){
    	$errors_login[]= "Your password must be <i><b>ONLY</b></i> letters or numbers.";
    }
    
    
    // Connect to server and select databse.
    mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
    mysql_select_db("$db_name")or die("cannot select DB");
    
    // Define $username and $password 
    $username=$_POST['username']; 
    $password=$_POST['password']; 
    
    // To protect MySQL injection (more detail about MySQL injection)
    $username = stripslashes($username);
    $password = stripslashes($password);
    $username = mysql_real_escape_string($username);
    $password = mysql_real_escape_string($password);
    
    $sql="SELECT admin_id FROM $tbl_name WHERE username='$username' and password='$password'";
    $result=mysql_query($sql);
    
    
    // Mysql_num_row is counting table row
    $count=mysql_num_rows($result);
    // If result matched $username and $password, table row must be 1 row
    
    if($count==1){
    // Register $username, $password and redirect to file
    session_register("username");
    session_register("password"); 
    session_register("admin_id"); 
    header("Location: admin.php");
    }
    else {
    
    ob_end_flush();
    }
    }
    ?>

     

    Admin Page.

     

    <?php
    include_once('include/include.php');
    if(isset($_SESSION['admin_id']))  // YOU NEED THE SESSION IN ORDER TO PROCEED.
    {
      if($_GET[p] == ""){
         $content .= "<a href='admin.php?p=upload_image'>Upload Photos</a><br>";
     $content .= "<a href='logout.php?p=logout'>Logout</a><br>";
      }
      else
      {
         if(file_exists($_GET[p].'.php')) 
         {
            include($_GET[p].'.php');
         }
      }
    }
    else 
    {
      $content .= "You Must Be Logged In To Do That.";
      include('admin_layout.php');
    }
    ?>

    Thanks for all your help

  9. My code is now this.

    <?php
    include_once('include/include.php');
    if(!session_is_registered(admin_id)){
      if($_GET[p] == ""){
       $content .= "<a href='admin.php?p=upload_image'>Upload Photos</a><br>";
       $content .= "<a href='logout.php?p=logout'>Logout</a><br>";
    }
      else{
       if(file_exists($_GET[p].'.php')) include($_GET[p].'.php');
      }
    }
    else if(session_is_registered(admin_id)){
    $content .= "You must be logged in to do that";
    }
    include('admin_layout.php');
    ?>

     

    But i can still access the file without logging in first after logging out using the above logout script.

     

    My login script is this.

    #Form has been submitted?
    if((isset($_POST['login'])) AND ($_POST['login'] == 'Login')){
    ob_start();
    $host="localhost"; // Host name 
    $username="root"; // Mysql username 
    $password="*********"; // Mysql password 
    $db_name="jimmy"; // Database name 
    $tbl_name="admin"; // Table name 
    
    
    
    #Check for blanks and clean data
    $errors_login = array(); #Initiate error variable
    
    if(empty($_POST['username'])) $errors_login[] = 'You must enter a username.'; else $clean['username'] = htmlspecialchars($_POST['username']);
    if(empty($_POST['password'])) $errors_login[] = 'You must enter a password.'; else $clean['password'] = htmlspecialchars($_POST['password']);
    
    //verify password...
    $get_pass = mysql_query("SELECT * FROM `admin` WHERE password = '".$_POST['password']."'");
    $q = ($get_pass);
        if(!$q) { 
    $errors_login[] = 'Wrong password.'; 
    }
    
    	//verify user...
    $get_user = mysql_query("SELECT * FROM `admin` WHERE username = '".$_POST['username']."' ");
    $q = ($get_user);
        if(!$q) { 
    $errors_login[] = 'Wrong username.'; 
    }
    
    //check that username is only letters or numbers
    if (! preg_match('/^[a-zA-Z0-9]+$/i', $_POST['username'])){
    	$errors_login[]= "Your username must be <i><b>ONLY</b></i> letters or numbers.";
    }
    //check that password is only letters or numbers
    if (! preg_match('/^[a-zA-Z0-9]+$/i', $_POST['password'])){
    	$errors_login[]= "Your password must be <i><b>ONLY</b></i> letters or numbers.";
    }
    
    
    // Connect to server and select databse.
    mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
    mysql_select_db("$db_name")or die("cannot select DB");
    
    // Define $username and $password 
    $username=$_POST['username']; 
    $password=$_POST['password']; 
    
    // To protect MySQL injection (more detail about MySQL injection)
    $username = stripslashes($username);
    $password = stripslashes($password);
    $username = mysql_real_escape_string($username);
    $password = mysql_real_escape_string($password);
    
    $sql="SELECT admin_id FROM $tbl_name WHERE username='$username' and password='$password'";
    $result=mysql_query($sql);
    
    
    // Mysql_num_row is counting table row
    $count=mysql_num_rows($result);
    // If result matched $username and $password, table row must be 1 row
    
    if($count==1){
    // Register $username, $password and redirect to file "templates.php"
    session_register("username");
    session_register("password"); 
    session_register("admin_id"); 
    header("Location: admin.php");
    }
    else {
    
    ob_end_flush();
    }
    }
    ?>

  10. I wanted to have my script amended so that if session admin_id wasnt regitered it would direct them to the login.php file.

    Just a small "if" statement.

     

    <?php
    include_once('include/include.php');
    if(!session_is_registered(admin_id)){
      if($_GET[p] == ""){
       $content .= "<a href='admin.php?p=upload_image'>Upload Photos</a><br>";
      }
      else{
       if(file_exists($_GET[p].'.php')) include($_GET[p].'.php');
      }
    }
    else $content .= "You Must Be Logged In To Do That.";
    include('admin_layout.php');
    ?>

  11. Also, looks like you forgot to add the single quote at start, correct me if I'm wrong,

    <?php
    if($secret == "89"){ 
    $content .= '
    <form id="news" form action="history_edit.php" method="post">
      <table width="500" border="0">
        <tr>
          <td colspan="2" class="orangelink"><strong>Update History</strong></td>
        </tr>
        <tr>
          <td width="108">Text</td>
          <td width="182"><label>
            <textarea name="history" cols="60" rows="12" class="fields" id="history"><?php echo $history; ?></textarea>
          </label></td>
        </tr>
        <tr>
          <td colspan="2"><label>
            <input name="Submit" type="submit" class="fields" id="Submit" value="Submit" />
          </label></td>
        </tr>
    </table>
    </form>
    ';
    }
    else $content .= "You Must Be Logged In To Do That.";
    ?>

     

    Also, looks like you forgot to add the single quote at start, correct me if I'm wrong,

    <?php
    if($secret == "89"){ 
    $content .= '
    <form id="news" form action="history_edit.php" method="post">
      <table width="500" border="0">
        <tr>
          <td colspan="2" class="orangelink"><strong>Update History</strong></td>
        </tr>
        <tr>
          <td width="108">Text</td>
          <td width="182"><label>
            <textarea name="history" cols="60" rows="12" class="fields" id="history"><?php echo $history; ?></textarea>
          </label></td>
        </tr>
        <tr>
          <td colspan="2"><label>
            <input name="Submit" type="submit" class="fields" id="Submit" value="Submit" />
          </label></td>
        </tr>
    </table>
    </form>
    ';
    }
    else $content .= "You Must Be Logged In To Do That.";
    ?>

    I missed the quote in the cut and paste, buts it in my file, the code didnt work.my code just showed <?php echo $history; ?> in the text box, the code you supplied me with displays and empty text box

  12. Hey everyone, still a newbe, but should of worked this out,

    I got this code on top of my file

     <?php
    include_once('includes/include.php');
    $query = "SELECT * FROM history where id =1";
    $result = mysql_query($query) or die(mysql_error());
    while($news=mysql_fetch_array($result)){
    
    $history .= "$news[history]";
    
    }
    
    ?>

    and i want to add the varible to show in the text box so i can see all the text, make my changes then hit update.

    I tried many versions of the below  code but it dont work.

    <?php
    if($secret == "89"){ 
    $content .='
    <form id="news" form action="history_edit.php" method="post">
      <table width="500" border="0">
        <tr>
          <td colspan="2" class="orangelink"><strong>Update History</strong></td>
        </tr>
        <tr>
          <td width="108">Text</td>
          <td width="182"><label>
            <textarea name="history" cols="60" rows="12" class="fields" id="history"><?php echo"$history"; ?></textarea>
          </label></td>
        </tr>
        <tr>
          <td colspan="2"><label>
            <input name="Submit" type="submit" class="fields" id="Submit" value="Submit" />
          </label></td>
        </tr>
    </table>
    </form>
    ';
    }
    else $content .= "You Must Be Logged In To Do That.";
    ?>
    
    
    

     

  13. Hi everyone

    I have this code that i want to only run if the session is registered.

    <?php
    include_once('includes/include.php');
    
    $themename=$_POST['themename'];
    $query = "INSERT INTO theme SET themename='$themename'";
    $result = mysql_query($query) or die(mysql_error());
    header("Location: admin.php"); 
    
    
    ?>

    what code would i put at the top of the file to stop anyone running this script, sorry but im a newbe.

  14. <?php
    include_once('includes/include.php');
    $password = "*******";
    
    
    if($_POST[password] == "" && $_SESSION[passed] != "y"){
      $content .= "<form method='post' action='admin.php'><input type='password' name='password' value='password'><input type=submit></form>";
    }
    else if($_POST[password] != ""){
      if($password == $_POST[password]){
       $_SESSION[passed] = "y";
      }
      else{
        echo "<script>window.location = 'admin.php';</script>";
      }
    }
    if($_SESSION[passed] == "y"){
    
    
    $title=$_POST['title'];
    $date=$_POST['date'];
    $text=$_POST['text'];
    
    
    $query = "INSERT INTO news SET id='', title='$title', date='$date', text='$text'";
    $result = mysql_query($query) or die(mysql_error());
    
    header("Location: admin.php"); 
    }
      else{ 
      echo "You Must Be Logged In To Do That";
      }
    
    ?>

     

    My form looks like this

     

    <?php
    $content .= '<form action="news_edit.php" method="post"><table width="500">
      <tr>
        <td colspan="2"><span class="bolder">Manage News</span></td>
        </tr>
      <tr>
        <td><span class="bolder">Title</span></td>
        <td>
          <input type="text" name="title" id="title" />
    </td>
      </tr>
      <tr>
        <td><span class="bolder">Date</span></td>
        <td><input type="text" name="date" id="date" /></td>
      </tr>
      <tr>
        <td valign="top"><span class="bolder">News</span></td>
        <td>
          <textarea name="text" id="text" cols="45" rows="5"></textarea></td>
      </tr>
      <tr>
        <td><input name="id" type="hidden" value="id" /></td>
        <td><input type="reset" name="reset" id="reset" value="Reset" />
          <input type="submit" name="submit" id="submit" value="Submit" /></td>
      </tr>
    </table>
    </form>';
    }
    ?>

     

     

    (edited by kenrbnsn to add

    
    

    tags)

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