Jump to content

contra10

Members
  • Posts

    402
  • Joined

  • Last visited

    Never

Posts posted by contra10

  1. There are basically two options yes or no...if yes is clicked then the result is sentence 1 if no then result is sentence 2 and the form should not display after either one is clicked

     

    ALLOW THIS To BE PUBLIC?
    <?php
    mysql_connect("localhost", "root", "") or die(mysql_error()); 
    mysql_select_db("registration") or die(mysql_error());
    
    if(is_numeric($_GET['eid'])){
    
    $id = $_GET['eid'];
    }
    
    $idp = mysql_real_escape_string($_POST['idev']);
    if (isset($_POST['true'])){
    
    mysql_query("UPDATE `events` SET `val` = 'true' WHERE `eid` = '$idp'");
    
    
    if (isset($_POST['false'])){
    
    mysql_query("UPDATE `events` SET `val` = 'false' WHERE `eid` = '$idp'");
    
    
    ?>
    	Sentence 2
    <?php
    }else{
    ?>
    Sentence 1
    <?php
    }else{
    ?>
    
    		<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" >
    <input type="submit" name ="true" value="Yes">
    <?php echo "<input type='hidden' name='idev' value='$id'>"?>
    <input type="submit" name ="false" value="No">
    </form>
    <?php
    }
    ?>
    
    

     

    how can i get rid of title too

  2. this is what i tried...i get my "query was empty"

     

    <?php
    mysql_connect("localhost", "root", "") or die(mysql_error()); 
    mysql_select_db("registration") or die(mysql_error());
    
    if(is_numeric($_GET['eid'])){
    
    $id = $_GET['eid'];
    }
    
    $idp = mysql_real_escape_string($_POST['idev']);
    if (isset($_POST['true'])){
    
    mysql_query("UPDATE events SET value = 'true' WHERE eid = '$idp'");
    mysql_query($sql) or die(mysql_error());
    
       // Create the URL string
       $url = "http://localhost/events/createvisible.php?eid=$id"; 
       
       // Final Echo the meta tag
       echo('<meta HTTP-EQUIV="REFRESH" content="0; url='.$url.'">');
    }
    if (isset($_POST['false'])){
    
    mysql_query("UPDATE events SET value = 'false' WHERE eid = '$idp'");
    mysql_query($sql) or die(mysql_error());
    
       // Create the URL string
       $url = "http://localhost/events/createvisible.php?eid=$idp"; 
       
       // Final Echo the meta tag
       echo('<meta HTTP-EQUIV="REFRESH" content="0; url='.$url.'">');
    }
    
    
    ?>
    
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" >
    <input type="submit" name ="true" value="Yes">
    <?php echo "<input type='hidden' name='idev' value='$id'>"?>
    <input type="submit" name ="false" value="No">
    </form>
    

  3. i cant seem to update a value

     

    <?php
    mysql_connect("localhost", "root", "") or die(mysql_error()); 
    mysql_select_db("registration") or die(mysql_error());
    
    if(is_numeric($_GET['eid'])){
    
    $id = $_GET['eid'];
    }
    
    if (isset($_POST['true'])){
    
    mysql_query("UPDATE events SET value = 'true' WHERE eid = '$id'");
    }
    if (isset($_POST['false'])){
    
    mysql_query("UPDATE events SET value = 'false' WHERE eid = '$id'");
    }
    
    
    ?>
    
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" >
    <input type="submit" name ="true" value="Yes">
    <input type="submit" name ="false" value="No">
    </form>
    

  4. i'm trying to order by Date posted

     

    <?php
    $query = "SELECT * FROM events WHERE country='$postcountry' and continent='$postcontinent' and state_province = '$poststate'";
    if(isset($_POST['submit']) and ($_POST['continent']) and ($_POST['country']) and ($_POST['state']) and ($_POST['eva']) and ($_POST['event']) and ($_POST['city'])){$query .= "and `evcity` = '$postcity' ORDER BY dateposted DESC";}
    ?>
    

     

    instead it orders by when it was inputted into sql

  5. i have a dropdown menu that loads when clicked...but an option should be shown simply when the page is loaded...instead i have to click another option to get the code to work and then click back onto the option that is already supposed to be selected...

     

    basically my selected dropdown does not get any results in the second dropdown... i.e "Arts" does not show the sub categories in the next dropdown menu unless i click another dropdown option and go back to the "Arts" option...

     

    here's my coding

    events.php

    <script type="text/javascript">
    
    
    // event lists
    var event = new Array();
    
    event['arts'] = ['Acting','Dancing','Paint/Draw', 'Poetry', 'Theater'];
    event['business'] = ['Meeting'];
    event['cause'] = ['Assembly','Fundraiser','Protest','Rally','Meeting'];
    event['cultural'] = ['Gathering','Tradition'];
    event['entertainment'] = ['Amusement Park','Bowling','Comedy','Movies'];
    event['education'] = ['California','Graduation','New York'];
    event['fashion'] = ['Fashion Show','Chihuahua','Jalisco'];
    event['justforfun'] = ['California','Florida','New York'];
    event['outdoors'] = ['Group Trip','Vacation'];
    event['party'] = ['Barbeque','','Club Party','Slumber Party'];
    event['political'] = ['Convention','Policy','Speaker'];
    event['private'] = ['Invitations Only'];
    event['sport'] = ['Baja California','Chihuahua','Tournament'];
    event['other'] = ['Ceremony','Other','Religious'];
    
    
    
    function setevent(){
    
      evaSel = document.getElementById('eva');
      eventSel = document.getElementById('event');
    
      eventList = event[evaSel.value];
    
      changeSelect(eventSel, eventList);
      setsubevent();
    
    }
    
    
    function changeSelect(fieldObj, valuesAry, optTextAry, selectedValue) {
    
      //Clear the select list
      fieldObj.options.length = 0;
    
      //Set the option text to the values if not passed
      optTextAry = (optTextAry)?optTextAry:valuesAry;
    
      //Itterate through the list and create the options
      for (var i=0; i<valuesAry.length; i++) {
        selectFlag = (selectedValue && selectedValue==valuesAry[i])?true:false;
        fieldObj.options[fieldObj.length] = new Option(optTextAry[i], valuesAry[i], false, selectFlag);
      }
    
    }
    </script>
    

     

    and

     

    html

    <tr><td>
    <b>Category:</td>
    <td>
    <select name="eva" id="eva" onchange="setevent();">
      <option value="arts" selected>Arts</option>
      <option value="cause">Cause</option>
        <option value="cultural">Cultural</option>
       <option value="entertainment">Entertainment</option>
        <option value="education">Education</option>
      <option value="fashion">Fashion</option>
      <option value="justforfun">Just for Fun</option>
      <option value="outdoors">Outdoors</option>
      <option value="party">Party</option>
        <option value="political">Political</option>
      <option value="private">Private</option>
        <option value="sport">Sport</option>
        <option value="cause">Other</option>
    </select>
    <select name="event" id="event"  STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #72A4D2;">
    <option value=""></option>
    [code]

  6. in my inbox if i select more than one checkbox, all of the ones selected don't delete at one time...only one gets deleted at a time here is my code

    <?php
    		mysql_connect("localhost", "root", "") or die(mysql_error()); 
    mysql_select_db("registration") or die(mysql_error());
    
    
     $friendq= "SELECT * FROM inbox WHERE recusername = '$username' ORDER BY iid DESC";
    $friendnames = mysql_query($friendq) or die(mysql_error());
    
    while($friend = mysql_fetch_array($friendnames)) 
    { 
    $friendid= "{$friend['sendid']}";
    $friendusername= "{$friend['recusername']}";
    	$sendingusername= "{$friend['sendusername']}";
    $date= "{$friend['date']}";
    $title= "{$friend['title']}";
    	$msgid= "{$friend['iid']}";
     	$colorvalue= "{$friend['value']}"; 
    $recievingid="{$friend['recid']}"; 
    
    $bgcc=1;
    
    	echo "<tr>";
    	echo"<td><Input type = 'Checkbox' Name ='checkbox' value ='$msgid'></td>";
     echo "<td align='left' width='10%' height='50'>";
    echo"<a href ='http://localhost/profile/index.php?user=$friendid' ><img src='http://localhost/image/imagereplace.php?id=$friendid'></a>";
      echo "</td>";
    	if ($bgcc == $colorvalue){
    	echo"<td width= '90%' align='center' bgcolor='#DEDAD7'><a style='text-decoration:none' href ='http://localhost/inbox/message.php?msg=$msgid' >";
    	}else{
    		echo"<td width= '90%' align='center' bgcolor='black'><a style='text-decoration:none' href ='http://localhost/inbox/message.php?msg=$msgid' >";
    	}
    	echo"<FONT FACE='ariel' SIZE='3' color='#0094f7'><b>$title<br><br></font></td></tr>";
    	echo "<tr><td></td><td></td>";
    	echo "<td align='right' bgcolor='#DEDAD7'><FONT FACE='ariel' SIZE='2' color='#0094f7'>Sent by <b>$sendingusername</b> on $date</font></a></td>";
    echo "</tr>";
    }
    
    ?>
    <?php
    
    // Post Edit: Might want to connect to mysql, you MUST be conected to mysql before you call mysql_escape_String or mysql_real_escape_String.
    $ch = mysql_connect("localhost","root","");
    
    // If there is a form being submitted?
    if(isset($_POST['checkbox']) && isset($_POST['delete'])){
    
    // Santize this client input?
    $checkboxid = mysql_real_escape_string($_POST['checkbox']);
    
    // Execute and store the mysql result resource
    $result = mysql_query("DELETE FROM `inbox` WHERE `iid`='".$checkboxid."'") or die(mysql_error());
    
    // Execute the mysql query and store the result resource
    $result = mysql_query("SELECT `recid` FROM `inbox` WHERE `recid` = '".$id."'") or die(mysql_error());
    
    // Loop each result row
    while($row = mysql_fetch_array($result,MYSQL_BOTH)){
    	$rep = $row['recusername'];
    }
    
    // Create the URL string
    $url = "http://localhost/inbox/"; // Should this be $rep ?????
    
    // Finall Echo the meta tag
    echo('<meta HTTP-EQUIV="REFRESH" content="0; url='.$url.'">');
    }
    ?>
    
    <input type="submit" name="delete" value="delete">
    </table>
    </form>
    

  7. i thought that was going to work...looked perfect...it still doesn't echo the id number i checked to see if my mysql was connect in regards to tables and rows and they are fine

     

    heres my full form code the updated code, sry for length

     

    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    <table border="1" width="600" align="left">
    <tr><td height="20" width="10%" align="center">Delete</td>
    <td>Messages</td></tr>
    <br>
    <br>
    <br>
    <br>
    <?php
    		mysql_connect("localhost", "root", "") or die(mysql_error()); 
    mysql_select_db("registration") or die(mysql_error());
    
    if(is_numeric($_GET['user'])){
    
    $id = $_GET['user'];
    }
    
    
     $friendq= "SELECT * FROM inbox WHERE recid = '$id' ORDER BY iid DESC";
    $friendnames = mysql_query($friendq) or die(mysql_error());
    
    while($friend = mysql_fetch_array($friendnames)) 
    { 
    $friendid= "{$friend['sendid']}";
    $friendusername= "{$friend['recusername']}";
    	$sendingusername= "{$friend['sendusername']}";
    $date= "{$friend['date']}";
    $title= "{$friend['title']}";
    	$msgid= "{$friend['iid']}";
     	$colorvalue= "{$friend['value']}"; 
    $recievingid="{$friend['recid']}"; 
    
    $bgcc=1;
    
    	echo "<tr>";
    	echo"<td><Input type = 'Checkbox' Name ='checkbox' value ='$msgid'></td>";
     echo "<td align='left' width='10%' height='50'>";
    echo"<a href ='http://localhost/profile/index.php?user=$friendid' ><img src='http://localhost/image/imagereplace.php?id=$friendid'></a>";
      echo "</td>";
    	if ($bgcc == $colorvalue){
    	echo"<td width= '90%' align='center' bgcolor='#DEDAD7'><a style='text-decoration:none' href ='http://localhost/inbox/message.php?msg=$msgid' >";
    	}else{
    		echo"<td width= '90%' align='center' bgcolor='black'><a style='text-decoration:none' href ='http://localhost/inbox/message.php?msg=$msgid' >";
    	}
    	echo"<FONT FACE='ariel' SIZE='3' color='#0094f7'><b>$title<br><br></font></td></tr>";
    	echo "<tr><td></td><td></td>";
    	echo "<td align='right' bgcolor='#DEDAD7'><FONT FACE='ariel' SIZE='2' color='#0094f7'>Sent by <b>$sendingusername</b> on $date</font></a></td>";
    echo "</tr>";
    }
    
    ?>
    <?php
    
    // Post Edit: Might want to connect to mysql, you MUST be conected to mysql before you call mysql_escape_String or mysql_real_escape_String.
    $ch = mysql_connect("localhost","root","");
    
    // If there is a form being submitted?
    if(isset($_POST['checkbox']) && isset($_POST['delete'])){
    
    // Santize this client input?
    $checkboxid = mysql_real_escape_string($_POST['checkbox']);
    
    // Execute and store the mysql result resource
    $result = mysql_query("DELETE FROM `inbox` WHERE `iid`='".$checkboxid."'") or die(mysql_error());
    
    // Sanity Check? (Sanity check basicall means check if the values are what the should be).
    if(is_numeric($_GET['user'])){
    	$id = $_GET['user'];
    }else{
    	echo "no id";
    }
    
    // Select he mysql db. is this needed? u should only need one database.
    mysql_select_db("registration") or die(mysql_error());
    
    // Execute the mysql query and store the result resource
    $result = mysql_query("SELECT `recid` FROM `inbox` WHERE `recid` = '".$id."'") or die(mysql_error());
    
    // Loop each result row
    while($row = mysql_fetch_array($result,MYSQL_BOTH)){
    	$rep = $row['recid'];
    }
    
    // Create the URL string
    $url = "http://localhost/inbox/index.php?user=".$rep; 
    
    // Finall Echo the meta tag
    echo('<meta HTTP-EQUIV="REFRESH" content="0; url='.$url.'">');
    }
    ?>
    <input type="submit" name="delete" value="delete">
    </table>
    </form>
    

  8. could this code be possible?

     

    <?php
    
    echo "$recievingid";
    if (isset($_POST['checkbox']) and ($_POST['delete'])) { 
    
    $checkboxid = mysql_real_escape_string($_POST['checkbox']);	
    mysql_query("DELETE FROM inbox WHERE iid='$checkboxid'");
    ?>
    <meta HTTP-EQUIV="REFRESH" content="0; url=<?php
    if(is_numeric($_GET['user'])){
    
    $id = $_GET['user'];
    }
    
    mysql_connect("localhost", "root", "") or die(mysql_error()); 
    mysql_select_db("registration") or die(mysql_error());
    
    $fr= "SELECT `recid` FROM `inbox` WHERE `recid` = '$id'";
    $fri = mysql_query($fr) or die(mysql_error());
    
    while($frie = mysql_fetch_array($fri)) 
    { 
    $rep="{$frie['recid']}"; 
    }
    echo "http://localhost/inbox/index.php?user=$recievingid";?>">
    <?php
    }
    
    
    ?>
    

     

    im trying to use php but i can't echo the value in the header...however if i input the actual userid then it works and if i echo $recievingid above the code i can see the value...just doesn't work in the url...trying it without header location...everything echoes correctly in the url except the variable doesn't show

     

    i tried it with

    echo "http://localhost/inbox/index.php?user=$rep";?>">
    

    as well

  9. perhaps i don't understand ob_function() fully...in my header file i have two header redirects which i changed to this

    <?php
    if ($pass != $info['password']) 
    { 
    ob_start();
    header("Location: http://localhost/"); 
    ob_end_flush();
    } 
    //otherwise they are shown the admin area 
    else{
    $user = "{$row2['id']}";
    $userq = "{$row['username']}";
    
    echo "<a style='text-decoration:none' href='http://localhost/profile/index.php?user=$user'><FONT FACE='ariel' SIZE='2' color='#DEDAD7'><b>$userq</b></FONT></a>";
    echo " ";
    echo "<a style='text-decoration:none' href='http://localhost/logout/logout.php'><FONT FACE='ariel' SIZE='2' color='#5f5f5f'>Logout</FONT></a>"; 
    } 
    }
    }
    else
    
    //if the cookie does not exist, they are taken to the login screen 
    { 
    ob_start();
    header("Location: http://localhost/"); 
    ob_end_flush();
    } 
    mysql_close();
    ?>
    

     

    in my inbox file i put this

    <?php
    
    
    if (isset($_POST['checkbox']) and ($_POST['delete'])) { 
    
    $checkboxid = mysql_real_escape_string($_POST['checkbox']);	
    mysql_query("DELETE FROM inbox WHERE iid='$checkboxid'");
    }
    ob_start();
    header("Location:http://localhost/inbox/index.php?user=$id");
    ob_end_flush();
    
    ?>
    

     

    i still get the same problem...i can \t think of a way to redesign my code... as the header is used to detect on every page whether or not a person is logged in via a cookie

  10. basically after i delete a message...after i click delete that message the message is suppose to disappar and all my other messages should be displayed...instead of now when i delete a message it deletes and i can't view the other messages in the table unless i click back

  11. i'm trying to be able to delete a message and still be redirected to the same page...I tried the header() function but i aleready have it set in my header.php...when i run this code i can transfer back to my inbox.php but the userid is no longer in the url so the first part of the script does not run heres the code

     

    <?php
    
    if (isset($_POST['checkbox']) and ($_POST['delete'])) { 
    
    $checkboxid = mysql_real_escape_string($_POST['checkbox']);	
    mysql_query("DELETE FROM inbox WHERE iid='$checkboxid'");
    
    
    ?>
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    <table border="1" width="600" align="left">
    <tr><td height="20" width="10%" align="center">Delete</td>
    <td>Messages</td></tr>
    <br>
    <br>
    <br>
    <br>
    <?php
    		mysql_connect("localhost", "root", "") or die(mysql_error()); 
    mysql_select_db("registration") or die(mysql_error());
    
    if(is_numeric($_GET['user'])){
    
    $id = $_GET['user'];
    }
    
    
     $friendq= "SELECT * FROM inbox WHERE recid = '$id' ORDER BY iid DESC";
    $friendnames = mysql_query($friendq) or die(mysql_error());
    
    while($friend = mysql_fetch_array($friendnames)) 
    { 
    $friendid= "{$friend['sendid']}";
    $friendusername= "{$friend['recusername']}";
    	$sendingusername= "{$friend['sendusername']}";
    $date= "{$friend['date']}";
    $title= "{$friend['title']}";
    	$msgid= "{$friend['iid']}";
     	$colorvalue= "{$friend['value']}"; 
    
    $bgcc=1;
    
    	echo "<tr>";
    	echo"<td><Input type = 'Checkbox' Name ='checkbox' value ='$msgid'></td>";
     echo "<td align='left' width='10%' height='50'>";
    echo"<a href ='http://localhost/profile/index.php?user=$friendid' ><img src='http://localhost/image/imagereplace.php?id=$friendid'></a>";
      echo "</td>";
    	if ($bgcc == $colorvalue){
    	echo"<td width= '90%' align='center' bgcolor='#DEDAD7'><a style='text-decoration:none' href ='http://localhost/inbox/message.php?msg=$msgid' >";
    	}else{
    		echo"<td width= '90%' align='center' bgcolor='black'><a style='text-decoration:none' href ='http://localhost/inbox/message.php?msg=$msgid' >";
    	}
    	echo"<FONT FACE='ariel' SIZE='3' color='#0094f7'><b>$title<br><br></font></td></tr>";
    	echo "<tr><td></td><td></td>";
    	echo "<td align='right' bgcolor='#DEDAD7'><FONT FACE='ariel' SIZE='2' color='#0094f7'>Sent by <b>$sendingusername</b> on $date</font></a></td>";
    echo "</tr>";
    }
    ?>
    <?php
    }else{
    	?>
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    <table border="1" width="600" align="left">
    <tr><td height="20" width="10%" align="center">Delete</td>
    <td>Messages</td></tr>
    <br>
    <br>
    <br>
    <br>
    <?php
    		mysql_connect("localhost", "root", "") or die(mysql_error()); 
    mysql_select_db("registration") or die(mysql_error());
    
    if(is_numeric($_GET['user'])){
    
    $id = $_GET['user'];
    }
    
    
     $friendq= "SELECT * FROM inbox WHERE recid = '$id' ORDER BY iid DESC";
    $friendnames = mysql_query($friendq) or die(mysql_error());
    
    while($friend = mysql_fetch_array($friendnames)) 
    { 
    $friendid= "{$friend['sendid']}";
    $friendusername= "{$friend['recusername']}";
    	$sendingusername= "{$friend['sendusername']}";
    $date= "{$friend['date']}";
    $title= "{$friend['title']}";
    	$msgid= "{$friend['iid']}";
     	$colorvalue= "{$friend['value']}"; 
    
    $bgcc=1;
    
    	echo "<tr>";
    	echo"<td><Input type = 'Checkbox' Name ='checkbox' value ='$msgid'></td>";
     echo "<td align='left' width='10%' height='50'>";
    echo"<a href ='http://localhost/profile/index.php?user=$friendid' ><img src='http://localhost/image/imagereplace.php?id=$friendid'></a>";
      echo "</td>";
    	if ($bgcc == $colorvalue){
    	echo"<td width= '90%' align='center' bgcolor='#DEDAD7'><a style='text-decoration:none' href ='http://localhost/inbox/message.php?msg=$msgid' >";
    	}else{
    		echo"<td width= '90%' align='center' bgcolor='black'><a style='text-decoration:none' href ='http://localhost/inbox/message.php?msg=$msgid' >";
    	}
    	echo"<FONT FACE='ariel' SIZE='3' color='#0094f7'><b>$title<br><br></font></td></tr>";
    	echo "<tr><td></td><td></td>";
    	echo "<td align='right' bgcolor='#DEDAD7'><FONT FACE='ariel' SIZE='2' color='#0094f7'>Sent by <b>$sendingusername</b> on $date</font></a></td>";
    echo "</tr>";
    }
    ?>
    <input type="submit" name="delete" value="delete">
    </table>
    </form>
    	<?php
    	}
    ?>
    

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