Jump to content

Kevin-J

Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Kevin-J's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hey guys I fixed it. Thanks for your help!
  2. But im not getting a connection error.
  3. Well I in my config file its $config[prefix] so I changed it to that after what you said..but it still doesnt work. I do get a lil diffrent error though.
  4. I get this error when I try to use click.php Here is the code: <?php setcookie("newclick", "1", time()+10); define("VALID", "true"); require("includes/config.php"); require("functions/bfunc.php"); require("functions/vfunc.php"); $dbh=mysql_connect ("localhost", "myusernamehere", "mypasswordhere") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("vb3key"); if ($_GET[type] == 'aff') { $affs = mysql_fetch_array(mysql_query("SELECT * FROM " . $prefix . "affiliates WHERE id = '$_GET[aid]'")) or die(mysql_error()); $new = $affs[clicks] + 1; mysql_query("UPDATE " . $prefix . "affiliates SET clicks='$new' WHERE id='$affs[id]'") or die(mysql_error()); header("Location: $affs[url]"); } if (!isset($_GET[click]) and !isset($_GET[frame])) { error($em = "A critical error has occured."); } elseif ($_GET[frame] == "true") { process_frame($sitetitle, $_GET[urll], $tdir, $_GET[tut]); } else { $clicks = mysql_fetch_array(mysql_query("SELECT * FROM " . $prefix . "tutorials WHERE id = '$_GET[click]'")) or die(mysql_error()); $new = $clicks[clicks] + 1; mysql_query("UPDATE " . $prefix . "tutorials SET clicks='$new' WHERE id='$_GET[click]'") or die(mysql_error()); echo " <!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=iso-8859-1\" /> <title>$clicks[name] [$clicks[wname]]</title> </head> <frameset rows=\"90,*\" framespacing=\"0\" frameborder=\"yes\" border=\"0\"> <frame src=\"clicks.php?frame=true&urll=" . $clicks[url] . "&tut=$clicks[id]\" scrolling=\"no\" name=\"top\" /> <frame src=\"$clicks[url]\" name=\"main\" /> </frameset> <noframes> <body> <center>Sorry you do not have frames enabled. Here is the link of the tutorial:<br /> <a href=\"$clicks[url]\">$clicks[url]</a></center> </body> </noframes> </html> "; } ?> Whats going on?
  5. Alright umm..here is a code that includes it.. <?php include"connect.php"; include"functions.php"; list_categories(); switch($_GET['cat']) { case"$row[id]"; if(!isset($_POST['$row[id]'])) { if($_GET['id']) { $id = (int)$_GET['id']; $query3 = mysql_query("SELECT * FROM tutorials WHERE valid = '1' AND cat_id = '$id' ORDER BY id DESC"); while($row = mysql_fetch_array($query3)) { echo" <table width='100%'> <tr> <td width='52'> <img src='$row[image]' alt=''> </td> <td> <b><a href='viewtut.php?action=view&id=$row[id]'>$row[tutname]</a></b> $row[shortdes]. Author: <b>$row[author]</b> | Views: <b>$row[views]</b> | Date: <b>$row[date]</b> | </td> </tr> </table>"; } } } } ?>
  6. Why do I get this message error? here is functions.php <?php function list_categories() { $query = mysql_query("SELECT * FROM tutorials_categories"); while($row = mysql_fetch_array($query)) { $query2 = mysql_query("SELECT * FROM tutorials WHERE cat_id = '$row[id]'"); if(mysql_num_rows($query2) == 0) { echo" $row[catname] |"; } else { echo" <a href='$self?action=cat&id=$row[id]'>$row[catname]</a> |"; } } } function list_unval_tutorials() { echo"<strong>Un-Validated tutorials</strong>"; $query = mysql_query("SELECT * FROM tutorials WHERE valid = '0' ORDER BY id DESC"); while($row = mysql_fetch_array($query)) { echo" <table width='100%'> <tr> <td width='60%'> $row[tutname] </td> <td width='10%'> <a href='$self?action=mod&id=$row[id]'>Modify</a> </td> <td width='10%'> <a href='$self?action=delete&id=$row[id]'>Delete</a> </td> <td width='10%'> <a href='$self?action=view&id=$row[id]'>View</a> </td> <td width='10%'> <a href='$self?action=validate&id=$row[id]'>Validate?</a> </td> </tr> </table> "; } } function list_val_tutorials() { echo"<strong>Validated tutorials</strong>"; $query = mysql_query("SELECT * FROM tutorials WHERE valid = '1' ORDER BY id DESC"); while($row = mysql_fetch_array($query)) { echo" <table width='100%'> <tr> <td width='60%'> $row[tutname] </td> <td width='10%'> <a href='$self?action=mod&id=$row[id]'>Modify</a> </td> <td width='10%'> <a href='$self?action=delete&id=$row[id]'>Delete</a> </td> <td width='10%'> <a href='$self?action=view&id=$row[id]'>View</a> </td> </tr> </table> "; } echo""; } function del_tutorial() { if(!isset($_POST['delete'])) { if($_GET['id']) { $id = (int)$_GET['id']; $query = "DELETE FROM tutorials WHERE id = '$id' LIMIT 1"; mysql_query($query); echo"Tutorial Deleted"; } } } function val_tutorial() { if(!isset($_POST['validate'])) { if($_GET['id']) { $id = (int)$_GET['id']; $query = "UPDATE tutorials SET valid = '1' WHERE id = '$id' LIMIT 1"; mysql_query($query); echo"Tutorial Validated"; } } } function view_tutorial() { if(!isset($_POST['view'])) { if($_GET['id']) { $id = (int)$_GET['id']; $query = mysql_query("SELECT * FROM tutorials WHERE id = '$id' LIMIT 1"); while($row = mysql_fetch_array($query)) { echo"You are viewing: <b>$row[tutname]</b> $row[tuttext] Some other info: Author: $row[authname] | Date posted: $row[date] | "; } } } } function add_tut() { if(!isset($_POST['add_tut'])) { echo" <form action='$self?action=add_tut' name='addtutorials' method='post'> <table> <tr> <td> Tutorial name: </td> </tr> <tr> <td> <input type='text' name='tutname'> </td> </tr> <td> Author name: </td> </tr> <tr> <td> <input type='text' name='authname'> </td> </tr> <tr> <td> Categories: </td> </tr> <tr> <td> <select name='category'>"; $query = mysql_query("SELECT * FROM tutorials_categories ORDER BY id ASC"); while($row = mysql_fetch_array($query)) { echo"<option value='$row[id]'>$row[catname]"; } echo" </select> </td> </tr> <tr> <td> Image: </td> </tr> <tr> <td> <input type='text' name='image'> (40x40px) </td> </tr> <tr> <td> Email: </td> </tr> <tr> <td> <input type='text' name='email'> </td> </tr> <tr> <td> Tutorial Link: </td> </tr> <tr> <td> <textarea cols='50' rows='1' name='tuttext'></textarea><br /> </td> </tr> <tr> <td> Short description: </td> </tr> <tr> <td> <textarea cols='50' rows='5' name='shortdes'></textarea><br /> </td> </tr> <tr> <td> <input type='submit' name='add_tutorials' value='submit tutorial'> </td> </tr> </table> </form>"; } elseif(isset($_POST['add_tutorials'])) { $tutname = mysql_real_escape_string(strip_tags($_POST['tutname'])); $authname = mysql_real_escape_string(strip_tags($_POST['authname'])); $image = mysql_real_escape_string(strip_tags($_POST['image'])); $email = mysql_real_escape_string(strip_tags($_POST['email'])); $category = mysql_real_escape_string(strip_tags($_POST['category'])); $tuttext = $_POST['tuttext']; $shortdes = $_POST['shortdes']; $date = date("d.m.y"); $error = array(); if(empty($tutname)) { $error[] = "Please enter your tutorial name."; } if(empty($authname)) { $error[] = "Please enter your (the author's) name."; } if(empty($image)) { $error[] = "Please enter an image."; } if(empty($tuttext)) { $error[] = "Hello. You seem to have entered nothing into the tutorial link area."; } if(empty($shortdes)) { $error[] = "Enter a short description."; } if(count($error)>0) { echo"<font size='3' color='#CC0000'>ERROR:</font>"; foreach($error as $error2) echo"$error2"; } else { $mysql = "INSERT INTO tutorials(tutname, email, authname, image, tuttext, shortdes, valid, cat_id, date, views) VALUES('$tutname', '$email', '$authname', '$image', '$tuttext', '$shortdes', '0', '$category', '$date', '0')"; mysql_query($mysql); echo"Your tutorial has successfully been submitted for valadation."; } } } function mod_tut() { if(!isset($_POST['modify'])) { if($_GET['id']) { $id = (int)$_GET['id']; $query = mysql_query("SELECT * FROM tutorials WHERE id = '$id' LIMIT 1"); while($row = mysql_fetch_array($query)) { echo" <form name='modify' action='$self?action=mod&id=$row[id]' method='post'> <table> <tr> <td> Tutorial name: </td> </tr> <tr> <td> <input type='text' name='modtutname' value='$row[tutname]'> </td> </tr> <td> Author name: </td> </tr> <tr> <td> <input type='text' name='modauthname' value='$row[authname]'> </td> </tr> <tr> <td> Image: </td> </tr> <tr> <td> <input type='text' name='modimage' value='$row[image]'>(40x40px) </td> </tr> <tr> <td> Email: </td> </tr> <tr> <td> <input type='text' name='modemail' value='$row[email]'> </td> </tr> <tr> <td> Tutorial Text: </td> </tr> <tr> <td> <textarea cols='50' rows='20' name='modtuttext'>$row[tuttext]</textarea> </td> </tr> <tr> <td> Short description: </td> </tr> <tr> <td> <textarea cols='50' rows='5' name='modshortdes'>$row[shortdes]</textarea> </td> </tr> <tr> <td> <input type='submit' name='modify' value='modify'> </td> </tr> </table> </form>"; } } } elseif(isset($_POST['modify'])) { $modtutname = mysql_real_escape_string(strip_tags($_POST['modtutname'])); $modauthname = mysql_real_escape_string(strip_tags($_POST['modauthname'])); $modimage = mysql_real_escape_string(strip_tags($_POST['modimage'])); $modemail = mysql_real_escape_string(strip_tags($_POST['modemail'])); $modcategory = mysql_real_escape_string(strip_tags($_POST['modcategory'])); $modtuttext = $_POST['modtuttext']; $modshortdes = $_POST['modshortdes']; $err3 = array(); if(empty($modtutname)) { $error[] = "Please enter your tutorial name."; } if(empty($modauthname)) { $error[] = "Please enter your (the author's) name."; } if(empty($modimage)) { $error[] = "Please enter an image."; } if(empty($modtuttext)) { $error[] = "Hello. You seem to have entered nothing into the tutorial text area."; } if(empty($modshortdes)) { $error[] = "Enter a short description."; } if(count($err3)>0) { echo"ERROR:"; foreach($err3 as $err5) echo"$err5"; } else { if($_GET['id']) { $id = (int)$_GET['id']; $sql1 = "UPDATE tutorials SET tutname = '$modtutname' WHERE id = '$id'"; $sql2 = "UPDATE tutorials SET authname = '$modauthname' WHERE id = '$id'"; $sql3 = "UPDATE tutorials SET image = '$modimage ' WHERE id = '$id'"; $sql4 = "UPDATE tutorials SET email = '$modemail ' WHERE id = '$id'"; $sql5 = "UPDATE tutorials SET category = '$modcategory' WHERE id = '$id'"; $sql6 = "UPDATE tutorials SET tuttext = '$modtuttext' WHERE id = '$id'"; $sql7 = "UPDATE tutorials SET shortdes = '$modshortdes ' WHERE id = '$id'"; mysql_query($sql1); mysql_query($sql2); mysql_query($sql3); mysql_query($sql4); mysql_query($sql5); mysql_query($sql6); mysql_query($sql7); echo"Tutorial successfully updated."; } } } } function add_cat() { if(!isset($_POST['add_cat'])) { echo" <form action='$self?action=add_cat' name='addcategories' method='post'> <table> <tr> <td> Tutorial name: </td> </tr> <tr> <td> <input type='text' name='catname'> </td> </tr> <tr> <td> <input type='submit' name='add_categories' value='submit category'> </td> </tr> </table> </form>"; } elseif(isset($_POST['add_categories'])) { $catname = mysql_real_escape_string(strip_tags($_POST['catname'])); $error = array(); if(empty($catname)) { $error[] = "Please enter your tutorial name."; } if(count($error)>0) { echo"<font size='3' color='#CC0000'>ERROR:</font>"; foreach($error as $error2) echo"$error2"; } else { $mysql = "INSERT INTO tutorials_categories(catname) VALUES('$catname')"; mysql_query($mysql); echo"Your category has successfully been submitted."; } } } ?>
  7. 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.'); } ?>
×
×
  • 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.