Jump to content

Gayner

Members
  • Posts

    549
  • Joined

  • Last visited

    Never

Posts posted by Gayner

  1. Prettty much this is all in my index.php

     

    <?php
    if (isset($_GET['view'])) {
    echo $_GET['view'];
    
    exit;
    }
    if (isset($_GET['Id'])) {
    
    // Get all the data from the "example" table
    $result = mysql_query('SELECT id,user_name,date FROM users WHERE id = '.$_GET['Id'].'') 
    or die(mysql_error());  
    
    // keeps getting the next row until there are no more to get
    while($data = mysql_fetch_array($result)) {
    // Print out the contents of each row into a table
    $username = $data['user_name'];
    echo "<title> Viewing User: $username</title>";
    echo '<a href=\'index.php\'>Pray4Life</a> -> Viewing Profile: <a href=./?Id='.$data['id'].'>'.$username.'</a>';
    } 
    exit;
    }
    else {
    navbar("<a href=./?>Pray4Life</a>", "Prayer List", "Prayer Center -> Main"); 
    }
    ?>
    <fieldset><legend>Prayer List</legend>
    <table class="ftb">
    <colgroup align="left">
    <col width="30%" align="left"></col>
    <col width="12%" align="left"></col>
    <col width="7%"></col>
    <col width="7%"></col>
    <col width="18%" align="left"></col>
    </colgroup>
    <tr>
    <th align='left'>Prayer Title</th>
    <th>Author</th>
    
    <th>Replies</th>
    <th>Views</th>
    <th>Last Reply</th>
    </tr>
    
    <?php
    
    $query="SELECT `id`,title,time,level,nameid,name,prays FROM prays ORDER by id DESC";
    $result=mysql_query($query);
    
    while($row=mysql_fetch_array($result))
    {
    if (!$row['prays'])
    $prays = "0";
    else
    $prays = $row['prays'];
    if (!$row['nameid']) 
    $l = ''.$row['name'].'';
    else
    $l = '<a href="?Id='.$row['nameid'].'">'.$row['name'].'</a>';
    $color_one = ' class="bc1"'; 
       $color_two = ''; 
       static $i = 0;
       $color = ($i % 2) ? $color_one : $color_two;
       $i++;
    echo '<tr'.$color.'>
       <td><a href="?view='.$row['id'].'"><b>'.$row['title'].' </b></a> ('.$prays.' Prayers) </td>
    
       <td>'.$l.'<br><span class="desc">'.$row['time'].'</span></td>
       <td>15,117</td>
       <td>448,857</td>
       <td class="lc"><a href="user.php?i=219525">Arsenic_Touch</a><br><span class="desc">1 hours, 2 minutes ago</span></td>
    </tr>';
    
    }
    
    mysql_free_result($result);
    ?>
    </table></tr>
    </fieldset>

     

    it works fine and i am used to wear all my code is at but wil this type of coding slow down php? i mean not coding but like if they all bunched up?

  2. The posted code cannot produce that error (if the posted query executes so that $result is a result resource, there would be an 'id' index.) It would take seeing your whole actual code to be able to determine what is causing the error. I suspect you have different $query/$result variables and line 46 is doing something else.

     

     

    no

     

    look

     

     

    <?php
    if (!isset($_SESSION['user_name'])) {
    //			<td align="right">Private?:</td>
    
    		//<td><input type="checkbox" name="private" value="1"/></td>
    //echo 'Since you are a Guest, or not <a href=register.php>Registered</a>, you can still Submit a Prayer! <br>';
    $l = "<img src=images/warn.png> If you would like to Keep Track of your Prayers and so on, Please just make a account by Clicking <a href=register.php>here!</a> *It's Free! <br> ";
    $pray =
    '<td class="cL" align="right">Your Name:</td>
    		<td><input type="text" name="name" value="" size="30" maxlength="100"/> (Since you dont have a account, You can leave this blank if you want)</td>';
    }
    else
    {
    $l = "";
    }
    ?>	
    <div><br>
    <div class="fR ab"><a href="post.php?c=0&f=34">New Topic</a></div>
    <div class="pager">Page 1 of 4138 <b>1</b><a href="forum.php?f=34&o=25">2</a><a href="forum.php?f=34&o=50">3</a><a href="forum.php?f=34&o=75">4</a></div>
    
    </div><fieldset><legend>Prayer Titles</legend>
    <table class="ftb">
    <colgroup align="center">
    <col></col>
    <col width="50%" align="left"></col>
    <col width="18%" align="left"></col>
    <col width="7%"></col>
    <col width="7%"></col>
    <col width="18%" align="left"></col>
    </colgroup>
    <tr>
    <th></th>
    <th nowrap>Topic Title</th>
    <th>Author</th>
    
    <th>Replies</th>
    <th>Views</th>
    <th nowrap>Last Reply</th>
    </tr>
    <?php
    
    $query  = "SELECT `id`,title,time,level,nameid FROM prays";
    $result = mysql_query($query);
    
    while($row = mysql_fetch_row($result))
    {
    echo $row['id'];
    }
    
    mysql_free_result($result);
    ?>
    <tr>
    <td><div class="e2"></div></td>
    <td>Sticky:  <a href="topic.php?t=16597993&f=34"><b>Donate For Me Please&#33;</b></a> <span class="mpl"><a href="topic.php?t=16597993&f=34&o=0">1</a>  <a href="topic.php?t=16597993&f=34&o=10">2</a>  <a href="topic.php?t=16597993&f=34&o=20">3</a>  <a class="mpll" href="topic.php?t=16597993&f=34&o=15110">»1512</a></span></td>
    
    <td><a href="user.php?i=189153">Lajo</a><img src="/images/i6.gif"><br><span class="desc">Mar 27 08 07:26pm</span></td>
    <td>15,117</td>
    <td>448,857</td>
    <td class="lc"><a href="user.php?i=219525">Arsenic_Touch</a><img src="/images/i60.gif"><br><span class="desc">1 hours, 2 minutes ago</span></td>
    </tr>
    </table></tr>
    

     

    that's my whole .php

  3. It's not exactly clear what problem you are describing, but I suspect that once someone enters the correct captcha value, they can keep submitting values to your form processing code?

     

    You need to unset or clear $_SESSION["key"] in the form processing code so that a different correct captcha value must be entered for each submission. You must also test if $_SESSION["key"] is set (see the isset function) and that the value equals what was entered in the form field (a lot of people make the mistake of just testing if it is equal to what was entered in the form field, but if you visit their form processing code without visiting the form and enter nothing, nothing does equal nothing and the captcha test passes.)

     

    Hi sir ur exactly right!!

     

    But i have a problem now trying to pull my data from mysql.. i do this all time but ever sence i went on localhost it's a problem with Undefined index...

     

    Instead of making a new topic, (Cause i'll get warned) i'll ask u guys here:

     

     

     

    <?php
    $query  = "SELECT id,title,time,level,nameid FROM prays";
    $result = mysql_query($query);
    
    while($row = mysql_fetch_row($result))
    {
    echo $row['id'];
    }
    
    mysql_free_result($result);
    ?>

     

    This code is fine, but i get this error:

     

    Notice: Undefined index: id in C:\wamp\www\view.php on line 46
    
    Notice: Undefined index: id in C:\wamp\www\view.php on line 46
    
    Notice: Undefined index: id in C:\wamp\www\view.php on line 46
    
    Notice: Undefined index: id in C:\wamp\www\view.php on line 46

     

    I am getting way to much Undefinded Index error this is pissing me off my code is just FINE

  4. Users will just re submit and not have to enter the new captcha.. ? Lol but if i refresh the page, the captcha auto makes a new1 so u cant submit.

     

    But if u enter captcha code alrdy, then submit form correctly, and press refresh to auto submit form, it does it? This is a major security risk here is my code, thanks:

     

    session_start();
    
    $RandomStr = md5(microtime());// md5 to generate the random string
    $text = rand(10000,99999);
    $_SESSION["key"] = $text;
    $height = 25;
    $width = 35;
    
    $image_p = imagecreate($width, $height);
    $black = imagecolorallocate($image_p, 100, 5, 5);
    $white = imagecolorallocate($image_p, 155, 155, 025);
    $font_size = 16;
    $text=substr($_SESSION['key'],0,3);
    imagestring($image_p, $font_size, 5, 5, $text, $white);
    imagejpeg($image_p, null, 80); 
    

     

    then my HTML:

     

    <tr class="bts ce"><td colspan=2><b>Security Code Confirmation</b></td></tr>
    
    	<tr>
    		<td align="right">Your unique security code<input type="hidden" name="secId" value="76c2b0e6f20ed0f1b209bcf39dee8e06"></td>
    		<td>
    			<img src="php_captcha.php">
    			<br><span class="desc">If The images are broke, please contact us.</span></span>
    		</td>
    	</tr>

     

    Is there a way so people cant auto submit form?

     

    Captcha  works if u refresh but people can just auto submit the form and it will keep submiiting...

  5. I have a image, it's a blue style off photoshop applied to a random .gif image

     

    can i use a php function or something that get's the hex color from that image only the main hex color and return it back to me so i can use it. /

  6. isset returns a boolean, if you want to check the data in a cookie do this:

     

    if(isset($_COOKIE['skinid']) && $_COOKIE['skinid'] == "heelo")

     

    Will work, as it first checks if the cookie isset if it is then it tests the data in that cookie.

     

    why the hell . i dont want to use isset.. while i code my website i aint putting isset around all ym stuff that's ridicilous is there another way so that IT DOESNT POP UP UNIDENTIFIED INDEX ERRORS PLZ

  7. bcz if i put that, that stupid ass unidefined index error will pop up.

     

     

    all i want to know is how the helld o i make this shorter? why do i have to all this .... stupid isset is a stupid function burn in hell!

     

    if(isset($_COOKIE['skinid']) && $_COOKIE['skinid'] == 'default')
    {
    echo '<style type="text/css" media="all">@import url(1.css);</style>';
    }
    if(isset($_COOKIE['skinid']) && $_COOKIE['skinid'] == 1)
    {
        echo '<style type="text/css" media="all">@import url(2.css);</style>';
    }
    if(!isset($_COOKIE['skinid']))
    {
        echo '<style type="text/css" media="all">@import url(2.css);</style>';
    }

     

    why do i have to use this only way it works w/o unidenified index errors.

  8. setcookie("skinid", 5, time()+60*60*24*60, "/");

     

    I will use that,

     

    But..

     

     

    now i want to make it so

     

    if $_COOKIE['skinid'] == "5"

     

    echo bla bal

     

    is that correct way?

    Will this work for every individual user?

     

    Cause i'll make a get function so that user clicks on button and changes skinid in cookie, like changing theme. :-)

  9. Gayner something else you do to make sure that $god is  set before calling it. Welcome to the wonderful ternary operator.

     

    <?php
    // make $god equal $_GET['god'] if its set else make it empty ""
      $god = isset($_GET['god'] === true ? $_GET['god'] : "";
    // you could add some filtering right there also
    // $god = isset($_GET['god'] === true ? mysql_real_escape_string(strip_tags($_GET['god'])) : "";
    
      if($god == "Enter"){
    
       // stuff
    
      }

     

    Thanks so much code for such little code i want to do, but i guess that's php, i love the terny operator tho thx

  10. because isset() checks to see if that variable is set.

     

    So, if $_GET['God'] is set, then isset($_GET['God']) will translate to "true" but it won't give you the value of $_GET['God']

     

    if you want to check to make sure $_GET['God'] is not only set, but set to something specific, use:

    if ($isset($_GET['God']) && $_GET['God'] == "Enter")

     

    so it checks to see if $_GET['God'] is set at all, and if it is (only if it is) it will then check the value.

     

     

    oh, lol

     

    ok thanks so i'll add the &&

     

    wat about a | will that work too ?

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