Hiding a Link Except for Admins

Discussion in 'PHP' started by yfs1, Jul 25, 2006.

  1. #1
    Im 99% done with a project but need one last thing

    I need to hide the following link

    <div align="right"><a href="<?php if($_SESSION['MM_UserGroup'] !== 'Admin') echo $LINK_BASE; ?>index.php?go=addpage&catid=<?php echo $row_category['id'];?>" title="Click to submit link" class="pageLink" style="color:<? echo $settings['catColor']; ?>">Add URL </a></div>
    PHP:
    to everyone but the Admin

    Thanks
     
    yfs1, Jul 25, 2006 IP
  2. coderlinks

    coderlinks Peon

    Messages:
    282
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hi,
    So you want to display the URL only when the MM_UserGroup thingy is equal to 'Admin'. right?
    
    <?php
    if($_SESSION['MM_UserGroup']=='Admin') // <-- you made mistake here
    {
    ?>
    <div align="right">
    <a href="<?php echo $LINK_BASE; ?>index.php?go=addpage&catid=<?php echo $row_category['id'];?>" title="Click to submit link" class="pageLink" style="color:<? echo $settings['catColor']; ?>">Add URL </a>
    </div> 
    <?php
    }
    ?>
    
    PHP:
    [EDIT] Added start tag
    Hope that was what you wanted :D !!
    Thomas
     
    coderlinks, Jul 25, 2006 IP
    yfs1 likes this.
  3. JBauer

    JBauer Guest

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    As written the link will always show up, but the $Link_base code changes. Is that what you wanted? Or should it be hidden completely? If so the correction will hide that link. (don't forget the <?php to start the code)
     
    JBauer, Jul 25, 2006 IP
  4. yfs1

    yfs1 User Title Not Found

    Messages:
    13,798
    Likes Received:
    922
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You are on the right track but I am a little confused with your code

    How come you are closing your code before you start ?>


    It should be hidden completely...I only want Admins to have the ability to add links (Thats the functionality the $link_base accomodates). I don't want visitors to be able to submit a link (or even see that they can)
     
    yfs1, Jul 25, 2006 IP
  5. coderlinks

    coderlinks Peon

    Messages:
    282
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hi,
    I hadn't put the starting tag as I thought it is a part of another script. I have added it now :D.

    Thomas
     
    coderlinks, Jul 25, 2006 IP
  6. yfs1

    yfs1 User Title Not Found

    Messages:
    13,798
    Likes Received:
    922
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I can get it in there now without errors but the link still stays there even if you aren't an Admin

    Heres the complete code (Yours starts at 49)

    <link href="include/mystyle.css" rel="stylesheet" type="text/css">
    <?php require_once('Connections/myconn.php'); ?>
    <?php
    $colname_category = "1";
    if (isset($_GET['id'])) {
      $colname_category = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
    }
    mysql_select_db($database_myconn, $myconn);
    $query_category = sprintf("SELECT * FROM categories WHERE id = %s", $colname_category);
    $category = mysql_query($query_category, $myconn) or die(mysql_error());
    $row_category = mysql_fetch_assoc($category);
    $totalRows_category = mysql_num_rows($category);
    
    unset($settings);
    $settings = mysql_fetch_assoc(mysql_query("select * from settings where id = '1'",$myconn));
    
    $colname_subcat = "1";
    if (isset($_GET['id'])) {
      $colname_subcat = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
    }
    $query_subcat = sprintf("SELECT * FROM categories WHERE fatherID = %s order by title asc", $colname_subcat);
    $subcat = mysql_query($query_subcat, $myconn) or die(mysql_error());
    $totalRows_subcat = mysql_num_rows($subcat);
    ?>
    <p class="pageLink"><a href="<?=$LINK_BASE?>" class="pageLink" style="color:<? echo $settings['catColor']; ?>">Home</a><? echo getBCrum($row_category['id'],$myconn); ?></p>
    <span class="pageTitle"><?php echo $row_category['title']; ?></span><br>
    <span class="pageText">&nbsp;<?php echo ucfirst($row_category['description']); ?></span><br>
    <?
    //print subcategory(s)
    $row = 1;
    print '<center><table border="0" callpadding="0" cellspacing="0"><tr><td valign="top" align="center">';			
    while($subcategory = mysql_fetch_assoc($subcat)){
    	//fetch children
    	$sql = "select * from pages where active = 'Yes' and catID = '" . $subcategory['id'] . "'";
    	//echo $sql;
    	$R = mysql_query($sql,$myconn) or die(mysql_error());
    	//print children links and total subcategories of children
    	$sql = "select * from settings where id = '1'";
    	$S = mysql_query($sql,$myconn);
    	$settings = mysql_fetch_assoc($S);
    	if($settings['stats'] == '1')
    		$stats = '('.mysql_num_rows($R).')';
    	print '<table border=0 cellpadding=8 cellspacing=0><tr><td align="center" valign="top"><a class="dirCatLink" style="color:'.$settings['catColor'].'" href="'.gLink($subcategory['title'],'subcat',$subcategory['id'],$myconn).'" title="'.$subcategory['description'].'" >'.$subcategory['title'].$stats.'</a>';?>&nbsp;<?php if($_SESSION['MM_UserGroup'] == 'Admin'){ ?><a href="../categories/edit.php?id=<? echo $subcategory['id']; ?>" class="pageLink">(Edit)</a><? } ?><?php print '</td></tr></table>';
    	if (($row/ceil($totalRows_subcat/2) == ceil($row/ceil($totalRows_subcat/2))) && ($row<$totalRows_subcat)) {print '</td><td nowrap>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td align="center" valign="top">';}
    	$row++;
    }
    print '</td></tr></table></center>';
    ?>
    <?php
    if($_SESSION['MM_UserGroup'] !== 'Admin')
    {
    ?>
    <div align="right">
    <a href="<?php echo $LINK_BASE; ?>index.php?go=addpage&catid=<?php echo $row_category['id'];?>" title="Click to submit link" class="pageLink" style="color:<? echo $settings['catColor']; ?>">Add URL </a>
    </div>
    <?php
    }
    ?>
    <table border=0 cellpadding=0 cellspacing=0 width="100%">
    	<tr>
    	  <td width="100%"><img src="images/spacer.gif" width=1 height=5></td>
    	</tr>
    	<tr>
    	  <td width="100%" style="background-color:<? echo $settings['lineColor']; ?>"><img src="images/spacer.gif" width=1 height=1></td>
    	</tr>
    	<tr>
    	  <td width="100%"><img src="images/spacer.gif" width=1 height=5></td>
    	</tr>
    </table>
    PHP:
     
    yfs1, Jul 25, 2006 IP
  7. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Try
    if($_SESSION['MM_UserGroup'] == 'Admin'){ 
    PHP:
    you had a not =
     
    mad4, Jul 25, 2006 IP
  8. coderlinks

    coderlinks Peon

    Messages:
    282
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Yea... I had corrected that in my code too. Your code had it set so that it would show only when 'Admin' was NOT set. And try reloading the page after you 'unbecome' admin. Maybe you are still seeing the browser cache with the link still in it.

    Another thing is:
    
    $query_category = sprintf("SELECT * FROM categories WHERE id = %s", $colname_category);
    
    PHP:
    You dont have to use sprintf like you do in C. You can directly do:
    
    $query_category = "SELECT * FROM categories WHERE id = '$colname_category';";
    
    PHP:
    And where do you set the SESSION variables. Are you sure they are being set correctly.
    Try adding this:
    
    echo $_SESSION['MM_UserGroup'];
    
    PHP:
    right before the if statement comparing it to 'Admin' to see if the correct values are being set.

    Thomas
     
    coderlinks, Jul 25, 2006 IP
  9. yfs1

    yfs1 User Title Not Found

    Messages:
    13,798
    Likes Received:
    922
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Lol, is was the not = (Which coder had previously corrected and I changed back without thinking)

    The original problem is now solved however when an admin tries to add a page it gives the following error:

    Here is the add_page code:

    <?php require_once('Connections/myconn.php'); ?>
    <?php
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
    
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
    //fetch settings into assoc array
    unset($settings);
    $settings = mysql_fetch_assoc(mysql_query("select * from settings where id = '1'",$myconn));
    
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    }
    if (($_POST['url'] != '') && ($_POST['url'] != 'http://')) {
    	if ($settings['preventDuplicates'] == 'category') {
    		$test_url = mysql_query("select id from pages where ( url = '" . addslashes($_POST['url']) . "' || url = '" . eregi_replace("/$", "", addslashes($_POST['url'])) . "' || url = '" . addslashes($_POST['url'] . '/') . "' || url = '" . eregi_replace("http\://www\.", "http://", addslashes($_POST['url'])) . "' || url = '" . eregi_replace("http\://", "http://www.", addslashes($_POST['url'])) . "' ) and active = 'Yes' and catID = '" . $_POST['catID'] . "'");
    	} elseif ($settings['preventDuplicates'] == 'sitewide') {
    		$test_url = mysql_query("select id from pages where ( url = '" . addslashes($_POST['url']) . "' || url = '" . eregi_replace("/$", "", addslashes($_POST['url'])) . "' || url = '" . addslashes($_POST['url'] . '/') . "' || url = '" . eregi_replace("http\://www\.", "http://", addslashes($_POST['url'])) . "' || url = '" . eregi_replace("http\://", "http://www.", addslashes($_POST['url'])) . "' ) and active = 'Yes'");
    	} else {
    		$test_url = mysql_query("select id from pages where id < '0'");
    	}
    	if (mysql_num_rows($test_url) > 0) {
    		$duplicate_error = true;
    	} else {
    		$duplicate_error = false;
    		$reciprocal_error = false;
    		$checktext = false;
    		// check for reciprocal links
    		$reciprocal_error_text_add = '';
    		if (($settings['reciprocalDomain'] == '1') && ($_POST['linkType'] == 'reciprocal') && ($_SESSION['MM_UserGroup'] !== 'Admin')) {
    			$lparseurl = @parse_url($_POST['url']);
    			$rparseurl = @parse_url($_POST['rLink']);
    			if ($lparseurl['host'] !== $rparseurl['host']) {
    				$reciprocal_error_text_add = ' Must be from same domain.';
    				$reciprocal_error = true;
    			}
    		} 
    		$checktext = str_replace("&lt;", "<", str_replace("&gt;", ">", $settings['reciprocalCheckText']));
    		if (($settings['reciprocalCheck'] == '1') && ($_POST['linkType'] == 'reciprocal') && ($_SESSION['MM_UserGroup'] !== 'Admin')) {
    			if (!$reciprocal_error) {
    				if (($_POST['rLink'] == '') || ($_POST['rLink'] == 'http://') || (!eregi("^http\://.{3,}$", $_POST['rLink']))) {
    					$reciprocal_error = true;
    				} else {
    					$buffer = '';
    					$fp = @fopen($_POST['rLink'], "r");
    					if ($fp) {
    					   while ($fp && !feof($fp)) {
    						   $buffer .= fgets($fp);
    					   }
    					   fclose($fp);
    					}
    					if (strpos($buffer, $checktext)) {
    						$reciprocal_error = false;
    					} else {
    						$reciprocal_error = true;
    					}
    				}
    			}
    		}
    		if ($_POST['linkType'] == 'sponsor') {
    			$midvalue = '1';
    		  	$exp = $settings['sponsorDays'];
    		} else {
    			$midvalue = '0';
    			$exp = '0';
    		}
    		if (($_POST['linkType'] == 'sponsor') || ($_POST['linkType'] == 'paid')) {
    			$completedvalue = '0';
    		} else {
    			$completedvalue = '1';
    		}
    		if ($_POST['linkType'] !== 'reciprocal') {
    			$_POST['rLink'] = '';
    			$checktext = '';
    		}
    		if (($_POST['linkType'] == 'free') || ($_POST['linkType'] == 'sponsor') || ($_POST['linkType'] == 'reciprocal') || ($_POST['linkType'] == 'paid')) {
    			$type_error = false;
    		} else {
    			$type_error = true;
    		}
    		if ($_SESSION['MM_UserGroup'] == 'Admin') {
    			$_POST['active'] = 'Yes';
    		}
    		if ($reciprocal_error) {
    			// reciprocal error
    		} elseif ($type_error) {
    			// type error
    		} else {
    			if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
    			  $insertSQL = sprintf("INSERT INTO pages (rLink, url, title, description, exp, keywords, active, ip, catID, email, mid, completed, reciprocalCheckText, pdate) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, NOW())",
    									GetSQLValueString($_POST['rLink'], "text"),
    								   GetSQLValueString($_POST['url'], "text"),
    								   GetSQLValueString($_POST['title'], "text"),
    								   GetSQLValueString($_POST['description'], "text"),
    								   $exp,  //fetch expire date from above
    								   GetSQLValueString($_POST['keywords'], "text"),
    								   GetSQLValueString($_POST['active'], "text"),
    								   GetSQLValueString($_POST['ip'], "text"),
    								   GetSQLValueString($_POST['catID'], "int"),
    								   GetSQLValueString($_POST['email'], "text"),
    								   GetSQLValueString($midvalue, "int"),
    								   GetSQLValueString($completedvalue, "int"),
    								   GetSQLValueString($checktext, "text"));					   
    			  mysql_select_db($database_myconn, $myconn);
    			  $Result1 = mysql_query($insertSQL, $myconn) or die(mysql_error());
    			  $gid = mysql_fetch_assoc(mysql_query("select max(id) as maxid from pages where url = '" . addslashes($_POST['url']) . "' limit 1"));
    			  $newid = $gid['maxid'];
    			  // Start Add for Google Sitemaps
    				$insertdate = date('Y-m-d');
    				$insertSQL2 = "UPDATE categories SET lastUpdate = '" . $insertdate . "' WHERE id='" . $_POST['catID'] . "'";
    				$Result2 = mysql_query($insertSQL2);
    			  // End Add For Google Sitemap
    			}
    		}
    		if (($_POST['linkType'] == 'sponsor') && ($_SESSION['MM_UserGroup'] !== 'Admin')) { // redirect to paypal
    			print '<script>window.location="https://www.paypal.com/xclick/business=' . urlencode($settings['paypalEmail']) . '&item_name=' . urlencode($settings['paypalSponsorItemName']) . '&item_number=' . urlencode($settings['paypalSponsorItemNumber']) . '&amount=' . urlencode($settings['sponsorPrice']) . '&no_shipping=1&return=' . paypalURL($settings['paypalReturn']) . '&no_note=1&currency_code=' . urlencode($settings['paypalCurrency']) . '&lc=' . urlencode($settings['paypalLc']) . '&notify_url=' . paypalURL($settings['paypalNotify']) . '&custom=' . $newid . '&on0=Url&os0=' . paypalURL($_POST['url']) . '"</script>';
    			exit;
    		}
    		if (($_POST['linkType'] == 'paid') && ($_SESSION['MM_UserGroup'] !== 'Admin')) { // redirect to paypal
    			print '<script>window.location="https://www.paypal.com/xclick/business=' . urlencode($settings['paypalEmail']) . '&item_name=' . urlencode($settings['paypalPaidItemName']) . '&item_number=' . urlencode($settings['paypalPaidItemNumber']) . '&amount=' . urlencode($settings['paidPrice']) . '&no_shipping=1&return=' . paypalURL($settings['paypalReturn']) . '&no_note=1&currency_code=' . urlencode($settings['paypalCurrency']) . '&lc=' . urlencode($settings['paypalLc']) . '&notify_url=' . paypalURL($settings['paypalNotify']) . '&custom=' . $newid . '&on0=Url&os0=' . paypalURL($_POST['url']) . '"</script>';
    			exit;
    		}
    		if (!$duplicate_error && !$reciprocal_error && !$type_error) {
    		 	print '<script>window.location="index.php?go=success"</script>';
    		}
    	}
    }
    ?>
    <link href="include/mystyle.css" rel="stylesheet" type="text/css">
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    }
    
    function MM_validateForm() { //v4.0
      var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
      for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
        if (val) { nm=val.name; if ((val=val.value)!="") {
          if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
            if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
          } else if (test!='R') { num = parseFloat(val);
            if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
            if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
              min=test.substring(8,p); max=test.substring(p+1);
              if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
        } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
      } if (errors) alert('The following error(s) occurred:\n'+errors);
      document.MM_returnValue = (errors == '');
    }
    <?php if($_SESSION['MM_UserGroup'] !== 'Admin'){ ?>
    function textCounter(field, countfield, maxlimit) { 
    	if (field.value.length > maxlimit) field.value = field.value.substring(0, maxlimit); 
    	else countfield.value = maxlimit - field.value.length; 
    } 
    <?php } ?>
    var form = "";
    var submitted = false;
    var error = false;
    var error_message = "";
    function check_input(field_name, field_size_min, field_size_max, message) {
      if (form.elements[field_name] && (form.elements[field_name].type != "hidden")) {
        var field_value = form.elements[field_name].value;
        if ((field_value == '') || (field_value.length < field_size_min) || (field_value.length > field_size_max)) {
          error_message = error_message + "* " + message + "\n";
          error = true;
        }
      }
    }
    function check_form(form_name) {
      if (submitted == true) {
        alert("This form has already been submitted. Please press OK and wait for this process to be completed.");
        return false;
      }
      error = false;
      form = form_name;
      error_message = "Errors have occured during the process of your form.\n\nPlease make the following corrections:\n\n";
      check_input("description", <?php echo $settings['descriptionMinLength'];?>, <?php echo $settings['descriptionMaxLength'];?>, "Description must be between <?php echo $settings['descriptionMinLength'];?> and <?php echo $settings['descriptionMaxLength'];?> characters in length.");
      if (error == true) {
    	alert(error_message);
    	return false;
      } else {
    	submitted = true;
    	return true;
      }
    }
    //-->
    </script>
    <p class="pageTitle">Submit URL For Approval
    <?php if ($duplicate_error) echo '<BR><font color="#ff0000">ERROR: URL already exists.</font>'; ?>
    </p>
    <table width="100%"  border="0" cellpadding="1" cellspacing="0" style="background-color:<?php echo $settings['tbColor']; ?>">
      <tr>
        <td><table width="100%"  border="0" cellpadding="1" cellspacing="0" style="background-color:<? echo $settings['tColor']; ?>">
          <tr>
            <td>
              <form method="post" name="form1" action="<?php echo $editFormAction; ?>" onSubmit="return check_form(form1);">
    <table align="center">
                  <tr valign="baseline">
                    <td align="right" nowrap class="colTextNoBG">Category</td>
                    <td class="rowTextNoBG">
    				<? 
    				$sql = "select title,description from categories where id = '" . $_REQUEST['catid'] . "'";
    				$R = mysql_query($sql,$myconn) or die(mysql_error());
    				$category = mysql_fetch_assoc($R);
    				?>
    				<div title="<? echo $category['desciption']; ?>"><? echo $category['title']; ?></div>
    				</td>
                  </tr>
                  <tr valign="baseline">
                    <td align="right" nowrap class="colTextNoBG">Url:</td>
                    <td class="rowTextNoBG"><input name="url" type="text" size="40" maxlength="255" value="<?php if ($_POST['url']) echo $_POST['url']; else echo 'http://';?>"></td>
                  </tr>
                  <tr valign="baseline">
                    <td align="right" nowrap class="colTextNoBG">Email:</td>
                    <td class="rowTextNoBG"><input name="email" type="text" id="email" size="40" value="<?php if ($_POST['email']) echo $_POST['email'];?>"></td>
                  </tr>
                  <tr valign="baseline">
                    <td align="right" nowrap class="colTextNoBG">Title:</td>
                    <td class="rowTextNoBG"><input name="title" type="text" size="40" maxlength="100" value="<?php if ($_POST['title']) echo $_POST['title'];?>"></td>
                  </tr>
                  <tr valign="baseline">
                    <td align="right" valign="top" nowrap class="colTextNoBG">Description:</td>
                    <td class="rowTextNoBG"><textarea name="description" cols="60" rows="5" <?php if($_SESSION['MM_UserGroup'] !== 'Admin'){ ?>onKeyDown="textCounter(form1.description,form1.remLen,<?php echo $settings['descriptionMaxLength'];?>);" onKeyUp="textCounter(form1.description,form1.remLen,<?php echo $settings['descriptionMaxLength'];?>);" <?php } ?>><?php if ($_POST['description']) echo $_POST['description'];?></textarea><?php if($_SESSION['MM_UserGroup'] !== 'Admin'){ ?><BR>
    				<input readonly type="text" name="remLen" size="4" maxlength="4" value="<?php echo $settings['descriptionMaxLength'];?>">
            characters remaining<?php } ?></td>
                  </tr>
    			  <tr valign="baseline">
                    <td align="right" nowrap class="colTextNoBG">Link Type:</td>
                    <td class="rowTextNoBG">
    				<?php
    					$linktypecount = ($settings['linkTypeFree'] + $settings['RlinkBox'] + $settings['linkTypeSponsor'] + $settings['linkTypePaid']);
    					if ($linktypecount == '1') {
    						$onetypetext = ' checked disabled ';
    					} else {
    						$onetypetext = false;
    					}
    				?>
    				<?php if ($settings['linkTypeSponsor'] == '1') { 
    					if ($settings['sponsorDays'] == '0') $sponsordaystext = 'Does not expire';
    					else $sponsordaystext = 'Expires in ' . $settings['sponsorDays'] . ' Days';
    				}
    				?>
    				
    				<?php if ($type_error) echo '<font color="#FF0000">Error: You must select a link type!</font><BR>';?><?php if ($settings['linkTypeFree'] == '1') { ?><input name="linkType" type="radio" id="linkType" value="free" <?php if (($_POST['linkType'] == 'free') && !$onetypetext) echo ' checked'; echo $onetypetext;?>> Free<BR><?php } ?>
    				<?php if ($settings['RlinkBox'] == '1') { ?><input name="linkType" type="radio" id="linkType" value="reciprocal" <?php if (($_POST['linkType'] == 'reciprocal') && !$onetypetext) echo ' checked'; echo $onetypetext;?>> Reciprocal<BR><?php } ?>
    				<?php if ($settings['linkTypePaid'] == '1') { ?><input name="linkType" type="radio" id="linkType" value="paid" <?php if (($_POST['linkType'] == 'paid') && !$onetypetext) echo ' checked'; echo $onetypetext;?>> Paid <?php echo $settings['currSign'] . $settings['paidPrice'];?><BR><?php } ?>
    				<?php if ($settings['linkTypeSponsor'] == '1') { ?><input name="linkType" type="radio" id="linkType" value="sponsor" <?php if (($_POST['linkType'] == 'sponsor') && !$onetypetext) echo ' checked'; echo $onetypetext;?>> Sponsor <?php echo $settings['currSign'] . $settings['sponsorPrice'] . ' - ' . $sponsordaystext;?><BR><?php } ?>
    				</td>
                  </tr>
    			  <? if ($settings['RlinkBox'] == '1') { ?>
                  <tr valign="baseline">
                    <td align="right" nowrap class="colTextNoBG">Reciprocal Link URL:</td>
                    <td class="rowTextNoBG"><?php if ($reciprocal_error) echo '<font color="#FF0000">Error: The link could not be validated!' . $reciprocal_error_text_add . '</font><BR>';?><input name="rLink" type="text" id="rLink" size="50" maxlength="255" value="<?php if ($_POST['rLink']) echo $_POST['rLink']; else echo 'http://';?>"></td>
                  </tr>
                  <tr valign="baseline">
                    <td align="right" nowrap class="colTextNoBG">&nbsp;</td>
                    <td class="rowTextNoBG">To validate the reciprocal link please include the<BR>
        following HTML code in the page at the URL<BR>
        specified above, before submitting this form:<br>
        <TEXTAREA class=text name=RECPR_TEXT readOnly cols=37 rows=3><?php echo stripslashes($settings['Rtext']); ?></TEXTAREA></td>
                  </tr>
    			  <? } ?>
                  <tr valign="baseline">
                    <td align="right" nowrap class="colTextNoBG">Keywords:</td>
                    <td class="rowTextNoBG"><input name="keywords" type="text" size="50" maxlength="100" value="<?php if ($_POST['keywords']) echo $_POST['keywords'];?>"></td>
                  </tr>
                  <tr valign="baseline">
                    <td align="right" nowrap class="colTextNoBG">&nbsp;</td>
                    <td class="rowTextNoBG"><input type="submit" onClick="MM_validateForm('url','','R','title','','R','keywords','','R','description','','R','linkType','','R','email','','RisEmail');return document.MM_returnValue"  value="Submit"></td>
                  </tr>
                </table>
                <input type="hidden" name="active" value="No">
                <input name="ip" type="hidden" id="ip" value="<? echo $_SERVER['REMOTE_ADDR']; ?>">
                <input type="hidden" name="MM_insert" value="form1">
                <span class="rowTextNoBG">
                <input name="catID" type="hidden" id="catID" value="<? echo $_REQUEST['catid']; ?>">
                </span>          </form>
              </td>
          </tr>
        </table></td>
      </tr>
    </table>
    PHP:
     
    yfs1, Jul 25, 2006 IP
  10. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #10
    It sounds like your database connection file is not connecting to the right place. Whats in the file (apart from the passwords :D)?
     
    mad4, Jul 25, 2006 IP
  11. yfs1

    yfs1 User Title Not Found

    Messages:
    13,798
    Likes Received:
    922
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Its pretty standard stuff

    <?php
    		# FileName="Connection_php_mysql.htm"
    		# Type="MYSQL"
    		# HTTP="true"
    		$hostname_myconn = "localhost";
    		$database_myconn = "xxxxxxxx";
    		$username_myconn = "xxxxxxxx";
    		$password_myconn = "xxxxxxxxx";
    		$LINK_BASE = "/resources/";
    		$myconn = mysql_connect($hostname_myconn, $username_myconn, $password_myconn) or trigger_error(mysql_error(),E_USER_ERROR); 
    		$instid = "1";
    		?>
    PHP:
    I messed around with the header quite a bit so I suppose it could have been passing some info it now needs. Im going to go back to the original and test it. lol

    Ok, after ruling out the rest of the code, I replaced coderlinks code with the original code and the Admin submission worked.

    So it is definately the new code that is causing the issue.

    I am going to try to figure out what is doing it but if anyone wants to jump in, I would appreciate it.

    If anyone wants to give a try to fixing this completely, I will Paypal you $10

    I will definately give you all the files you need or if your reputation/iTrader is at a respectable level and I recognize the user name, I could also give ftp access.

    Please PM me if you are interested.

    Thanks!
     
    yfs1, Jul 25, 2006 IP
  12. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Strange, I can't see why that new coe would affect the new problem. That error seems to indicate that the select query returned no results. If you have phpMyAdmin, try that same query in there and see what it says.
     
    T0PS3O, Jul 29, 2006 IP