Jump to content

only one

Members
  • Posts

    437
  • Joined

  • Last visited

    Never

Posts posted by only one

  1. yes everything should work besides

     

    echo '

    <script type="text/javascript">

    <!--

    window.location = "create.php?page=3;"

    //-->

    </script>';

     

    try it the other way round

     

    echo "

    <script type'text/javascript'>

    <!--

    window.location = 'create.php?page=3';

    //-->

    </script>";

     

  2. can i see the rest of the pages you have included, i think its something to do with

     

    <? if ($preuserID == 0) {

    include ("../oops.htm");

    die;

    } ?>

     

    its dieing your code whet $preuserID isnt set..., check oops.htm aswell, is it coming from the right directory?

  3. you may call me an idiot because i get this allot..

     

    im trying to insert the value of the radio button but it keeps inserting it as 0, anyone help?

     

    <?php
    session_start();
    echo "<font face=Arial size=2>";
    $poll = $_GET['poll'];
    $ip = $_SERVER['REMOTE_ADDR'];
    include("cons.php");
    
    $checkip = mysql_num_rows(mysql_query("SELECT ip FROM polls WHERE ip = '$ip' AND poll = '$poll'"));
    if($checkip>0){ header("location: pollresults.php");
    }else{
    
    $checkpoll = mysql_num_rows(mysql_query("SELECT id FROM poll WHERE id = '$poll'"));
    if($checkpoll==0){ echo "No such poll";
    }else{
    
    $query = mysql_query("SELECT * FROM poll WHERE id = '$poll'");
    while ($row = mysql_fetch_array($query)) {
    
    if (!isset($_POST[submit])) {
    echo "
    <form acion='$_SERVER[php_SELF]' method=POST>
    <label><input name=radio type=radio value=option1 />$row[option1]</label><br />
    <label><input name=radio type=radio value=option2 />$row[option2]</label><br />";
    if(!$row[option3]==NULL){ echo "<label><input name=radio type=radio value=option3 />$row[option3]</label><br />"; }
    if(!$row[option4]==NULL){ echo "<label><input name=radio type=radio value=option4 />$row[option4]</label><br />"; }
    if(!$row[option5]==NULL){ echo "<label><input name=radio type=radio value=option5 />$row[option5]</label><br />"; }
    if(!$row[option6]==NULL){ echo "<label><input name=radio type=radio value=option6 />$row[option6]</label><br />"; }
    if(!$row[option7]==NULL){ echo "<label><input name=radio type=radio value=option7 />$row[option7]</label><br />"; }
    if(!$row[option8]==NULL){ echo "<label><input name=radio type=radio value=option8 />$row[option8]</label><br />"; }
    if(!$row[option9]==NULL){ echo "<label><input name=radio type=radio value=option9 />$row[option9]</label><br />"; }
    if(!$row[option10]==NULL){ echo "<label><input name=radio type=radio value=option10 />$row[option10]</label><br />"; }
    echo "<input name=submit type=submit value=Vote></form>";
    }
    
    if (isset($_POST[submit])) {
    if($radio==NULL){
    echo "<font color=#ff0000>Error</font>: Please select something to vote for<br />
    <form acion='$_SERVER[php_SELF]' method=POST>
    <label><input name=radio type=radio value=option1 />$row[option1]</label><br />
    <label><input name=radio type=radio value=option2 />$row[option2]</label><br />";
    if(!$row[option3]==NULL){ echo "<label><input name=radio type=radio value=option3 />$row[option3]</label><br />"; }
    if(!$row[option4]==NULL){ echo "<label><input name=radio type=radio value=option4 />$row[option4]</label><br />"; }
    if(!$row[option5]==NULL){ echo "<label><input name=radio type=radio value=option5 />$row[option5]</label><br />"; }
    if(!$row[option6]==NULL){ echo "<label><input name=radio type=radio value=option6 />$row[option6]</label><br />"; }
    if(!$row[option7]==NULL){ echo "<label><input name=radio type=radio value=option7 />$row[option7]</label><br />"; }
    if(!$row[option8]==NULL){ echo "<label><input name=radio type=radio value=option8 />$row[option8]</label><br />"; }
    if(!$row[option9]==NULL){ echo "<label><input name=radio type=radio value=option9 />$row[option9]</label><br />"; }
    if(!$row[option10]==NULL){ echo "<label><input name=radio type=radio value=option10 />$row[option10]</label><br />"; }
    echo "<input name=submit type=submit value=Vote></form>";
    }else{
    $radio = $_POST[radio];
    echo "<font color=#00ff00>Succesfully</font>: Casted vote<br /><a href=pollresults.php>Click here to view the results</a>";
    mysql_query("INSERT INTO polls(`ip`, `foroption`, `poll`)VALUES('$ip', '$radio', '$poll')");
    
    }}}}}
    echo "</font>";
    
    ?>[code]
    
    updated code, still isnt working

    [/code]

  4. <?php
        // This blurb starts the session for the users.
        session_start();
        header("Cache-control: private"); // Fix for ie6
    
    ?>
    <?php 
    $msg = "Please Log In!"; ?>
    <?php   
    if($_SESSION['username']==NULL)  
    {    
    header("location: ../login.php");
    echo ("<script langauge=\"javascript\">alert(\"".$msg."\");</script>");
    }
    else {
    include("headermem.php"); ?>
    <center><font color=white> Are you sure you want to logout?</font></center><br> 
    <center><a href=/index.php>Yes</a> | <?php unset($_SESSION['username']); ?>
    
    <a href=javascript:history.back()>No</a>"; 
    <?php include 'footermem.php'; 
    }
    ?>

     

    try that

     

    edit:

    if you want to make a logout page array $_SESSION['username']

  5. in $mess just add those variables..

     

    $mess = "<html>\n"

    ."<head>\n"

    ."<title>Test Mail</title>\n"

    ."</head>\n"

    ."<body>\n"

    ."This is an html email test<br />\n"

    ."<p><b>Your order has been processed. Please print this email as your reference</b></p>\n"

    ."<p>Your purchases were:-</p>\n" your variables go here..

    ."</body>\n</html>\n";

     

  6. ok..

    heres something to get you started

     

    <?php
    session_start();
    //get the poll id
    $poll=$_GET['poll'];
    //check if they have submited anything
    $checkip = mysql_num_rows(SELECT ip FROM poll WHERE ip = '$_SERVER[REMOTE_ADDR]' AND poll = '$poll');
    if(!$checkip){
    //if the forum hasent been submited echo it
    if (isset($_POST[submit])) {
    echo "
    <form acion='$_SERVER[php_SELF]' method=POST>
    <label><input name=radio type=radio value=image1 />image1</label><br />
    <label><input name=radio type=radio value=image2 />image2</label><br />
    <label><input name=radio type=radio value=image3 />image3</label><br />
    <label><input name=radio type=radio value=image4 />image4</label><br />
    <label><input name=radio type=radio value=image5 />image5</label><br />
    <input name=submit type=submit value=submit>
    </forum>
    ";
    }else{
    //else insert the values into your table.. you can edit this bit to suit you
    mysql_query(INSERT INTO poll(`ip`, `radio`, `poll`)VALUES('$_SERVER[REMOTE_ADDR]', '$radio', '$poll')); }
    //if the ip has submitted something echo the results
    }else{
    
    $checkimage1= mysql_num_rows(SELECT radio FROM poll WHERE radio = 'image1' AND poll = '$poll');
    $checkimage2= mysql_num_rows(SELECT radio FROM poll WHERE radio = 'image2' AND poll = '$poll');
    $checkimage3= mysql_num_rows(SELECT radio FROM poll WHERE radio = 'image3' AND poll = '$poll');
    $checkimage4= mysql_num_rows(SELECT radio FROM poll WHERE radio = 'image4' AND poll = '$poll');
    $checkimage5= mysql_num_rows(SELECT radio FROM poll WHERE radio = 'image5' AND poll = '$poll');
    $sum1 = $checkimage1 + $checkimage2 + $checkimage3 + $checkimage4 + $checkimage5;
    $forimage1 = 100 * $checkimage1 / $sum1;
    $forimage2 = 100 * $checkimage2 / $sum1;
    $forimage3 = 100 * $checkimage3 / $sum1;
    $forimage4 = 100 * $checkimage4 / $sum1;
    $forimage5 = 100 * $checkimage5 / $sum1;
    echo "
    image1: $forimage1 % - $checkimage1 votes<br>
    image2: $forimage2 % - $checkimage2 votes<br>
    image3: $forimage3 % - $checkimage3 votes<br>
    image4: $forimage4 % - $checkimage4 votes<br>
    image5: $forimage5 % - $checkimage5 votes<br>
    in total there have been $sum1 votes
    ";
    ?>

     

    $poll is determined by the the page.. page.php?poll=1 etc..

     

    i havent tested this code, but im pretty sure it will work

     

    you will also need a table in your database called poll with the feilds..

     

    poll, radio and ip

  7. if (($HTTP_POST_FILES['file']['type']=="image/gif") || ($HTTP_POST_FILES['file']['type']=="image/pjpeg") || ($HTTP_POST_FILES['file']['type']=="image/jpeg") || ($HTTP_POST_FILES['file']['type']=="image/png")) {

    let it go on

    }else{

    dont...

     

    :D

     

    edit bold bits

  8. i dont really like using \n, try using a <br>

    <?php
    	$result = mysql_query("SELECT * FROM aimicons ORDER BY id DESC");
    while ($row = mysql_fetch_object($result)) {
    echo "<img src=\"aimicons/" .$row->image. "\" border=\"1\"> <br>";
    }
    mysql_free_result($result);
    ?>

  9. yea, you can store a url in a database...

     

    <?php
    $url = $_SERVER['SERVER_NAME'] $_SERVER['PHP_SELF']; 
    mysql_query("INSERT INTO table(`url`) VALUES ('http://$url')") //edit this
    ?>

     

    something like that?

  10. if you want to show the same companys banner in two places on the page just use 2 variables..

     

    <?php

    $ban1 = "/Banners/apiana_leaderboard_728x90.jpg";

    $secondban1 = "banner..";

    $url1 = "# target=_blank";

     

    $randomNum = rand (1,4);

     

    $image = ${'ban'.$randomNum};

    $image2 = ${'scondban'.$randomNum};

    $url= ${'url'.$randomNum};

     

    Print "<a href=".$url." mce_href=".$url."><img src=".$image." border=0></a>";

    ?>

     

    now just echo $image2 further don the page..

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