Jump to content

[SOLVED] Structure Help


darkfreaks

Recommended Posts

could someone straighten it out abit? it is all jumbled up and it isnt working right.

 

 

<?php
$strTitle = "Bulletin Board";
define('QUADODO_IN_SYSTEM', true);
require_once('includes/header2.php');
$logname = stripslashes($qls->user_info['username']);

$catid = $qls->Security->make_safe($_GET['catid']);
$covid = $qls->Security->make_safe($_GET['covid']);

if (empty($logname)) {
echo "You MUST be logged in to view this page";
}else{


include ('config.php');
$query1=trim(mysql_real_escape_string($query1));
$query1 = "SELECT * FROM vc_coven WHERE id='$covid'";
$result1 = mysql_query($query1);

$num=mysql_num_rows($result1);

mysql_close();

$i=0;
while ($i < $num) {

$id = mysql_result($result1,$i,"id");
$header = mysql_result($result1,$i,"header");
$name = mysql_result($result1,$i,"name");

include ('config.php');
$query6=trim(mysql_real_escape_string($query6));
$query6 = "SELECT * FROM vc_covenmembers WHERE covenname='$name' AND username='$logname'";
$result6 = mysql_query($query6);

$num=mysql_num_rows($result6);

mysql_close();

$i=0;
for ($i = 0; $i < $num; $i++) {

$status = mysql_result($result6,$i,"status");

echo "<form method='post' action='delete.php'>
<input type='hidden' name='catid' value='$covid'>
$header
<a href='../covens/$name'><h2>$name</h2></a>";

include ('config.php');
$query=trim(mysql_real_escape_string($query));
$query = "SELECT * FROM vc_coventopics WHERE catid='$catid'";
$result = mysql_query($query);
$link = mysql_connect("localhost", "chrxtr2_dbase", "l0v3sux
");
mysql_select_db("chrxtr2_dbase", $link);

$numrows=mysql_num_rows($result);




mysql_close();

$i=0;
while ($i < $num) {

$catid = mysql_result($result,$i,"catid");
$username = mysql_result($result,$i,"username");
$date = mysql_result($result,$i,"date");
$message = mysql_result($result,$i,"message");
$title = mysql_result($result,$i,"title");

echo "<table width=\"60%\" cellpadding=\"0\" cellspacing=\"0\">
<tr valign='top'>
<td width=\"10%\" align=\"center\">
<a href=\"../profile/$username\"><br>$username</a><br>
</td>
<td width=\"50%\">
<table border=\"0\" width=\"100%\" class=\"titlebar\">
<tr><td align=\"left\"><B>$title</B></td><td align=\"right\">
$date
</td></tr>
</table>
$message
</td></tr>
</table>
";

$i++;
};

echo "<p>";

include ('config.php');
$limit=25;
if(empty($_GET['page'])){ 
        $page = 1; 
        $s_limit = 0; 
    } else{ 
        $page = $_GET['page']; 
        $s_limit = ($page - 1) * $limit; 
    } 
    

$query2 = "SELECT * FROM vc_covenmessages WHERE catid='$catid' ORDER BY `id` DESC LIMIT  $s_limit,$limit";
$result2 = mysql_query($query2);

$num=mysql_num_rows($result2);
$blow = $num / $limit; 
    $blown = explode('.', $blow); 
    if(empty($blown[1])){ 
        $top = $blown[0]; 
    } else{ 
        $top = $blown[0] + 1; 
    } 
    // That tells us how many total pages we are going to have 
     
    // Variables for Previous and Next Links 
    $prev = $page - 1; 
    $next = $page + 1; 
     
    /* 
    Now we are going to put in the links, 
    <<PREV 1 2 3 (etc.) NEXT>> 
    */ 
    if($page == 1){ 
        echo '«PREV '; 
    } else{ 
        echo '<a href="data.php?page='. $prev .'">«PREV</a> '; 
    } 
    for($x = 1; $x < $page; $x += 1){ 
        echo '<a href="data.php?page='. $x .'">'. $x .'</a> '; 
    } 
    echo $page . ' '; 
    for($y = $page + 1; $y <= $top; $y += 1){ 
        echo '<a href="data.php?page='. $y .'">'. $y .'</a> '; 
    } 
    if($page == $top){ 
        echo 'NEXT»'; 
    } else{ 
        echo '<a href="data.php?page='. $next .'">NEXT»</a>'; 
    } 
     
    // Create Some Seperation from our results and the data 
    echo "\n<br>\n<br>\n"; 


mysql_close();

$i=0;
while ($i < $num) {

$catid = mysql_result($result2,$i,"catid");
$id = mysql_result($result2,$i,"id");
$username = mysql_result($result2,$i,"username");
$date = mysql_result($result2,$i,"date");
$message = mysql_result($result2,$i,"message");
$title = mysql_result($result2,$i,"title");

echo "<table width=\"60%\" cellpadding=\"0\" cellspacing=\"0\" class=\"cmessage\">
<tr valign='top'>
<td width=\"10%\" align=\"center\">
<a href=\"../profile/$username\"><br>$username</a><br>";
if ($status=="owner") {
echo "<input type='checkbox' name='id' value='$id'>";
};
if ($status=="admin") {
echo "<input type='checkbox' name='id' value='$id'>";
};
echo "</td>
<td width=\"50%\">
<table border=\"0\" width=\"100%\" class=\"titlebar\">
<tr><td align=\"left\"><B>$title</B></td><td align=\"right\">
$date
</td></tr>
</table>
$message
</td></tr>
</table>
";

$i++;
};

if ($status=="owner") {
echo "<input type='submit' name='deletemessage' value='Delete Message'>";
};
if ($status=="admin") {
echo "<input type='submit' name='deletemessage' value='Delete Message'>";
};
echo "</form>";
?>
<p>
<form name="sendmessage" id="sendmessage" method="post" action="messageleft.php">
<input type="hidden" name="date" id="date" value="<?php
$date_time = date('l M d, Y g:i A');
echo ($date_time); 
?>(GMT)">
<input type="hidden" name="username" value="<?php echo $logname; ?>"><br>
<input type="hidden" name="catid" value="<?php echo $catid; ?>"><br>
<input type="hidden" name="covid" value="<?php echo $covid; ?>"><br>
<br>
Title <input type="text" name="title" id="title" value="<?php echo $title; ?>"><br>
<textarea rows="10" cols="60" name="message" id="message"></textarea>
<br>
<input type="submit" id="submit" name="submit" value=" Send Message ">
</form>
<?php
$i++;
};
};
};
include ('includes/footer.php');
?>

Link to comment
Share on other sites

sorry this is the right code:

 

 

<?php
$strTitle = "Upload a pic";
define('QUADODO_IN_SYSTEM', true);
require_once('includes/header2.php');

$u = $qls->Security->make_safe($_GET['u']);
$pname = $qls->Security->make_safe($_GET['pname']);

$username = stripslashes($qls->user_info['username']);

include ('config.php');

$upload_dir = "gallery/";
$num_files = 5;
$size_bytes =512000; //512000 bytes = 500KB.
$limitedext = array(".gif",".jpg",".jpeg",".png");


   if (!is_dir("$upload_dir")) {
      die ("Error: The directory <b>($upload_dir)</b> doesn't exist");
   }
   //check if the directory is writable.
   if (!is_writeable("$upload_dir")){
      die ("Error: The directory <b>($upload_dir)</b> is NOT writable, Please CHMOD (777)");
   }


//if the form has been submitted, then do the upload process
//infact, if you clicked on (Upload Now!) button.
if (isset($_POST['upload_form'])){

       echo "<h3>Upload results:</h3>";

       //do a loop for uploading files based on ($num_files) number of files.
       for ($i = 1; $i <= $num_files; $i++) {

           //define variables to hold the values.
           $new_file = $_FILES['file'.$i];
           $file_name = $new_file['name'];
           //to remove spaces from file name we have to replace it with "_".
           $file_name = str_replace(' ', '_', $file_name);
           $file_tmp = $new_file['tmp_name'];
           $file_size = $new_file['size'];

           #-----------------------------------------------------------#
           # this code will check if the files was selected or not.    #
           #-----------------------------------------------------------#

           if (!is_uploaded_file($file_tmp)) {
              //print error message and file number.
              echo "File $i: Not selected.<br>";
           }else{
                 #-----------------------------------------------------------#
                 # this code will check file extension                       #
                 #-----------------------------------------------------------#

                 $ext = strrchr($file_name,'.');
                 if (!in_array(strtolower($ext),$limitedext)) {
	 echo "File $i: ($file_name) Wrong file extension. <br>";}
                 }else{
                       #-----------------------------------------------------------#
                       # this code will check file size is correct                 #
                       #-----------------------------------------------------------#

                       if ($file_size > $size_bytes){
	       echo "File $i: ($file_name) Faild to upload. File must be <b>". $size_bytes / 1024 ."</b> KB. <br>";}
                       }else{
                             #-----------------------------------------------------------#
                             # this code check if file is Already EXISTS.                #
                             #-----------------------------------------------------------#

                             if(file_exists($upload_dir.$file_name)){
		     echo "File $i: ($file_name) already exists.<br>";}
	       }else{
                                   #-----------------------------------------------------------#
                                   # this function will upload the files.   cool          #
                                   #-----------------------------------------------------------#
                                   if((move_uploaded_file($file_tmp,$upload_dir.$file_name)) {
$query = "INSERT INTO `vc_pics` (`username`,`pic`,`pname`) VALUES('{$username}','{$file_name}','{$pname}')";
mysql_query($query)or die(mysql_error());
			   echo "File $i: ($file_name) Uploaded.<br>";
                                   }else{
			   echo "File $i: Faild to upload.<br>";}
	 }#end of (move_uploaded_file).

                             }#end of (file_exists).

                       }#end of (file_size).
	       

               

           

   
       # print back button.
       echo "»<a href=\"$_SERVER[php_SELF]\">back</a>";
////////////////////////////////////////////////////////////////////////////////
//else if the form didn't submitted then show it.
}else{
    echo " <h3>Select files to upload!.</h3>
           Max file size = ". $size_bytes / 1024 ." KB";
    echo " <form method=\"post\" action=\"$_SERVER[php_SELF]\" enctype=\"multipart/form-data\">";
           // show the file input field based on($num_files).
           for ($i = 1; $i <= $num_files; $i++) {
               echo "Pic $i: <input type=\"file\" name=\"file". $i ."\"><br>
<input type=\"hidden\" name=\"username\" id=\"username\" value=\"$username\"><br>";
           }
    echo " <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"$size_bytes\">
           <input type=\"submit\" name=\"upload_form\" value=\"Upload Now!\">
           </form>";
}


include ('includes/footer.php');
?>

Link to comment
Share on other sites

UNexpected T_else on line 60

 

 

Line:

 

 }else{
                       #-----------------------------------------------------------#
                       # this code will check file size is correct                 #
                       #-----------------------------------------------------------#

                       if ($file_size > $size_bytes){
	       echo "File $i: ($file_name) Faild to upload. File must be <b>". $size_bytes / 1024 ."</b> KB. <br>";}
                       else{
                             #-----------------------------------------------------------#
                             # this code check if file is Already EXISTS.                #
                             #-----------------------------------------------------------#

                             if(file_exists($upload_dir.$file_name)){
		     echo "File $i: ($file_name) already exists.<br>";}
	       }else{
                                   #-----------------------------------------------------------#
                                   # this function will upload the files.   cool          #
                                   #-----------------------------------------------------------#
                                   move_uploaded_file($file_tmp,$upload_dir.$file_name);
$query = "INSERT INTO `vc_pics` (`username`,`pic`,`pname`) VALUES('{$username}','{$file_name}','{$pname}')";
mysql_query($query)or die(mysql_error());
			   echo "File $i: ($file_name) Uploaded.<br>";
                                   }else{
			   echo "File $i: Faild to upload.<br>";}
	 }#end of (move_uploaded_file).

                             }#end of (file_exists).

		     }
		     

Link to comment
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.