Jump to content

Recommended Posts

For some reason my code produces no results can anyone see what i'm missing?

 

<?
session_start();
if (empty($_SESSION['username'])){
header("location:index1.php");
exit;
}

?>


<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="realitysoftware.ca" />
<title>My Creative Process Links - Post New Creative</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<style type="text/css">
<!--
.style1 {
color: #f73602;
font-weight: bold;
}
-->
</style>
</head>

<body>

<div id="main">
    	<div id="navbar"></div>
<div id="header">
       		<div id="left_bar_header"><span class="title_dark">MY CREATIVE </span>
           	  <span class="title"> PROCESS </span>
           	  <p>This site was developed as a link for the creative community. It is an area where we can come to get feed back on our ideas and designs. A great designer never forgets that everyone needs a second opinion sometimes.</p>
          </div>
       	  <div id="right_bar_header"><img src="images/head_bckg_right.jpg" alt="" /></div>
      </div>
        <div id="content">
          <table width="95%" border="0" align="center" cellpadding="5">
            <tr>
              <td><a href="/index.php">home</a> | <a href="/main_forum.php">review</a> | <a href="/create_topic.php">post</a> | <a href="/mindgames.php">mindgames</a> | <a href="/archive.php">archive</a>  | <a href="/brainstorm.php">brainstorm</a> | <a href="/my_account.php">my account</a> | <a href="/suggestion_box.php">suggestion box</a></td>
              <td><div align="right"><a href="/login.php">login</a></div></td>
            </tr>
          </table>
          <table width="95%" border="0" align="center">
            <tr>
              <td height="0" valign="top"><h1><span class="red">Post </span> Creative</h1></td>
              <td valign="top"> </td>
              <td valign="top"> </td>
              <td width="180" rowspan="4" valign="top"><div align="right">
                <p class="style1">Sponsored Links</p>
                <p><a href="/links/schools.php" target="_blank">Creative Schools</a></p>
                <p><a href="/links/careers.php" target="_blank">Creative Careers</a></p>
                <p><a href="/links/publications.php" target="_blank">Creative Publications</a></p>
                <p><a href="/links/professionals.php" target="_blank">Creative Professionals</a></p>
                <p><a href="/links/creative.php" target="_blank">General Creative Links</a></p>
                <p><a href="/links/photography.php" target="_blank">Photography Links</a></p>
                <p><a href="/links/art.php" target="_blank">Art Links</a></p>
                <p><a href="/links/design.php" target="_blank">Design links</a></p>
                <p><a href="/links/illustration.php" target="_blank">Illustration Links</a></p>
                <p><a href="/links/web.php" target="_blank">Web Links</a></p>
                <p><a href="/links/3d.php" target="_blank">3D Design Links</a></p>
                <p><a href="/links/id.php" target="_blank">Interior Design Links</a></p>
                  
              </div></td>
            </tr>
            <tr>
              <td valign="top"> </td>
              <td valign="top"> </td>
              <td valign="top"> </td>
            </tr>
            <tr>
              <td valign="top"><? echo $_SESSION['username'];?></td>
              <td valign="top"> </td>
              <td valign="top"> </td>
            </tr>
            <tr>
              <td valign="top"><p> </p>

<?php

include "config.php";

$file_name = $HTTP_POST_FILES['ufile']['name'];

$random_digit=uniqid("file_");

$new_file_name=$random_digit.$file_name;

$path= "file/".$new_file_name;

$tbl_name="forum_question";

$topic=$_POST['topic'];
$detail=$_POST['detail'];
$name=$_POST['name'];
$email=$_POST['email'];
$file=$_POST['file'];
$file_type=$_POST['file_type'];
$username=$_POST['username'];

$datetime=date("d/m/y h:i:s"); //create date time


$sql="INSERT INTO $tbl_name(username, topic, detail, name, email, file, file_type, datetime)VALUES('$username', '$topic', '$detail', '$name', '$email', '$new_file_name', '$file_type', '$datetime')";

if($result)
{
echo "hello";
if($ufile !=none)
{
if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
{
echo "Successful<BR/>";
echo "<a href=main_forum.php>View your topic</a>";

echo "File Name :".$new_file_name."<BR/>"; 
echo "File Size :".$HTTP_POST_FILES['ufile']['size']."<BR/>"; 
echo "File Type :".$HTTP_POST_FILES['ufile']['type']."<BR/>"; 
}
else
{
echo "Error";
}
}
}
?>

</td>
              <td valign="top"></td>
              <td valign="top"></td>
            </tr>
          </table>
          <p></p>
        	<p> </p>
       	  <div id="content">
            <div class="secondary_page_first_column" id="secondary_page_first_column"></div>
          </div>
      </div></div>
</body>
</html>

                

Link to comment
https://forums.phpfreaks.com/topic/104448-php-that-doesnt-work/
Share on other sites

following the variables you use, it would be:

$result = mysql_query($sql) or die (mysql_error());

and it would go right after this line:

$sql="INSERT INTO $tbl_name(username, topic, detail, name, email, file, file_type, datetime)VALUES('$username', '$topic', '$detail', '$name', '$email', '$new_file_name', '$file_type', '$datetime')";

Link to comment
https://forums.phpfreaks.com/topic/104448-php-that-doesnt-work/#findComment-534653
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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