Kevin-J Posted February 10, 2007 Share Posted February 10, 2007 Alright, I have a tutorial website script that lets people submit tutorials and and view others and I can accept or deny them. It works fine http://gfxnation.com/tutorials/ Now my problem is it does not match my vb forums. I want to add the scripts to the cmps. Alright well everytime I try to view the files I get an error "You cannot view this file". I found that it has a"die" which is giving me the error. I tried deleting it but then I get a worse error. Can someone please help me get rid of this? Here is the script of the submit.php. <?php if (!defined('VALID')) { die('You cannot view this file'); } if ($config[submit] == 1) { $content[] = output($message = 'Sorry, tutorial submission has been disabled by the administrator.'); return; } if (rownum($config, 'categories') == 0) { $content[] = output('Sorry but no categories have been setup, therefore no tutorials can be submitted.<br /> Please contact the administrator at <b>' . $config[email] . '</b> and remind him to create a category.'); return; } if (!isset($_GET[action])) { for ($str = mysql_query('SELECT * FROM ' . $config[prefix] . 'categories'); $cat_array = mysql_fetch_array($str) { $goin .= '<option>' . $cat_array[category] . '</option>'; } $vars[] = '[#all_cats_in_options]'; $vars[] = '[#bballowed]'; $replace[] = $goin; $replace[] = bbcode_setting($config); $content[] = quick_process($page = 'template_submit.html', $config, $vars, $replace) . '<br />' . create_bbcode_table($config); } elseif ($_GET[action] == 'submit') { if (!$_POST[name] or !$_POST[wname] or !$_POST[url] or !$_POST[descrip] or !$_POST[category]) { $content[] = output($message = 'Sorry but you left a required field blank.'); return; } if (preg_match("/^https?:\/\//", $_POST[preview]) != true and preg_match("/uploads\//", $_POST[preview]) != true) { $_POST[preview] = 'http://' . $_POST[preview]; } $t_array = mysql_fetch_array(mysql_query('SELECT * FROM ' . $config[prefix] . 'tutorials WHERE name=\'' . $_POST[name] . '\' or url=\'' . $_POST[url] . '\'')) or $good = 1; if ($good != 1) { $content[] = output($message = 'Sorry but the tutorial URL or name you\'ve entered has already been used.'); return; } if (!isset($_POST[nopre])) { if (@getimagesize("$_POST[preview]")) { list($img_width, $img_height, $img_type, $attr) = getimagesize("$_POST[preview]"); if ($img_width != 40 or $img_height != 40) { $content[] = success($return, $succ = 'Sorry, either the image width or the image height does not equal 40px.'); return; } } elseif ($_FILES[userfile][size] != 0) { if ($_FILES[userfile][size] < 40360) { $ext = preg_replace('/^.*?\./', '.', $_FILES[userfile][name]); $name = str_replace($ext, '', $_FILES[userfile][name]); $name = preg_replace('/(.{8}).*/', "$1", $name); $name = $name . preg_replace('/(.{4}).*/', "$1", md5($name . rand(1, 9999))) . $ext; $types = array('image/gif','image/pjpeg', 'image/jpeg'); //@chmod('uploads/', 0777); if (!in_array($_FILES[userfile][type], $types)) { $content[] = success($return, 'Sorry, your image filetype is not supported.'); unlink($_FILES[userfile][tmp_name]); return; } else { if (move_uploaded_file($_FILES[userfile][tmp_name], "uploads/$name") == false) { $content[] = success($return, 'Sorry, your file was not uploaded successfully.'); @unlink($_FILES[userfile][tmp_name]); return; } } list($img_width, $img_height, $img_type, $attr) = getimagesize("uploads/$name"); if ($img_width != 40 or $img_height != 40) { $content[] = success($return, 'Sorry, either the image width or the image height does not equal 40px.'); unlink('uploads/' . $name); return; } $_POST[preview] = 'uploads/' . $name; //@chmod('uploads/', 0744); } else { $tail = intval(($_FILES[userfile][size]) / 1024); $content[] = success($return, 'File is too big (' . intval(($_FILES[userfile][size]) / 1024) . 'kb ) > 15kb'); return; } } else { $content[] = success($return, 'You must either check use default preview or post a proper preview image.'); return; } } else { $default = mysql_fetch_array(mysql_query('SELECT * FROM ' . $config[prefix] . "categories WHERE category='$_POST[category]'")); $_POST[preview] = $default[preview]; } $newid = rownum($config, 'tutorials') + 1; $tstamp = time(); mysql_query('INSERT INTO ' . $config[prefix] . 'tutorials VALUES(\'' . $newid . '\', \'' . htmlspecialchars($_POST[name]) . '\', \'' . htmlspecialchars($_POST[wname]) . '\', \'' . htmlspecialchars($_POST[url]) . '\', \'' . htmlspecialchars($_POST[category]) . '\', \'' . $tstamp . '\', \'0\', \'' . process_bbcode($config, $_POST[descrip], 0) . '\', \'0\', \'0\', \'0\', \'' . htmlspecialchars($_POST[preview]) . '\', \'0\')') or die(mysql_error()); $content[] = success($return, 'Thank you, your submission will be reviewed asap.'); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/37868-some-vbulliten-help/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.