Jump to content

NoMansLand

Members
  • Posts

    24
  • Joined

  • Last visited

Posts posted by NoMansLand

  1. Hello All,

     

    I am working on a click function for jQuery & AJAX to submit data to PHP (The PHP has been confirmed to work, several times), The strange thing is, it works on one of the other pages, then stops working on this other one.

     

    Code:

     <?php
     $jid = $_GET['id'];
     $jusername = $_SESSION['MM_Username'];
     ?>
     <script>
     $(function() {
        $(".open").click(function() {
            var status = "Open";
            var ticketid = "<?php print $jid; ?>";
            var username = "<?php print $jusername; ?>";
            var dataString = 'status='+ status + '&id=' + ticketid + '&username=' + username;
    
                $.post({
                    type: "POST",
                    url: "core/ticketData.php",
                    data: dataString,
                    success: function(result){
                        alert('Success baby!');
                         $('.success').fadeIn(200).show();
                         $('.error').fadeOut(200).hide();
                    }
                    });
                return false;
            });
    });
    </script>
    

    Page: http://alpha.support.myfallen.net/scp/ticket/772

     

    Username: TestDev

    Password: Test1234

  2. Hello,

     

    I am trying to find a character in my DB's.

     

    The DB has the data setup with +(number) & -(number)

     

    I want to try and find a way for PHP to seperate them into two so each one has the seperate colour's.

     

    i have tried preg_match, strstr & strpos but none of them seem to work.

     

    Can you as PHP Genius's help out?

     

    EDIT:

     

    Please Do Not Worry, I have fixed this.

     

    For people who were wondering:

     

    $new_variable = strstr($variable_to_check, "+");

    if($new_variable == "") {

    do one you want

    } else {

    do what you want.

    }

     

    Thanks PHP Freaks :)

     

    Thanks,

     

    NoMansLand

  3. Hello,

     

    I am running this script:

     

    while($row = mysql_fetch_array($query)) {
    $compare_points_1 = $row['sideone_points'];
    $compare_villages_1 = $row['sideone_villages'];
    $compare_members_1 = $row['sideone_members'];	
    $compare_points_2 = $row['sidetwo_points'];
    $compare_villages_2 = $row['sidetwo_villages'];
    $compare_members_2 = $row['sidetwo_members'];	
    }
    $point_1 = $_POST['points_1'];
    $village_1 = $_POST['villages_1']; 
    $member_1 = $_POST['members_1'];
    $point_2 = $_POST['points_2'];
    $village_2 = $_POST['villages_2']; 
    $member_2 = $_POST['members_2'];
    
    $points_1_calc = $compare_points_1 - $point_1;
    $villages_1 = $compare_villages_1 - $village_1;
    $members_1 = $compare_members_1 - $member_1;
    $points_2 = $compare_points_2 - $point_2;
    $villages_2 = $compare_villages_2 - $village_2;
    $members_2 = $compare_members_2 - $member_2;

     

    When I try to output $points_1_calc it gives me: -100

     

    It will Add & Times & Divide but not Subtract.

     

    Everything fills with Numbers only and I've tried this seperately and it works on a different script where I manually put in the numbers.

     

    All variables fill with numbers as I have a part above that doesnt go through if there is nothing to compare against.

     

    Any help would be greatly appreciated.

  4. Yes thats VCS Claim,

     

    The line is:

     

    curl_setop($ch, CURLOPT_URL 'http://en26.tribalwars.net/send_mail.php?from_id=152932&password=My Password Here f&to=$to&subject=$subject&message=$copyright$space$message$space$time$claimtime$space$coords$x$code$y$close$space$bpoints$points$space$thankyou');

  5. <?php
    mysql_query("INSERT INTO claim (x,y,name,points,claims,days,claimer) VALUES ('$x','$y','$name','$points','$owner','$claimtime','$claimee')") or die(mysql_error());
    echo "<br />";
    echo "Congragulations, This Village Is Now Yours<br />";
    echo "You Now Have: <strong>" . $claimtime;
    echo " </strong>Days To Get it Before Your Claim Expires.";
    $to = $claimee;
    $subject = urlencode('Village Claiming System: Claimed Village');
    $copyright = urlencode('[b]Do Not Reply To This Message, IT IS AUTOMATIC                    [/b]');
    $message = urlencode('Thank you for using the [ally]Pure[/ally] Village Claiming System, Remember this is not a reserving System!                ');
    $space = urlencode('[code]                                 

    ');

    $coords = urlencode('Co-Ordinates: [village]');

    $code = urlencode('|');

    $close = urlencode('[/village]');

    $bpoints = urlencode('Points: ');

    $thankyou= urlencode('Thank you for using the Village Claiming System, Please delete this claim, once you have captured this village.');

    $time = urlencode('Days Until Claim Is Deleted: ');

    $base_url = "http://en26.tribalwars.net/send_mail.php?from_id=152932&password=dba0079f1cb3a3b56e102dd5e04fa2af";

    // go to URL

     

    $ch = curl_init();

     

    curl_setop($ch, CURLOPT_URL 'http://en26.tribalwars.net/send_mail.php?from_id=152932&password=My Password Here f&to=$to&subject=$subject&message=$copyright$space$message$space$time$claimtime$space$coords$x$code$y$close$space$bpoints$points$space$thankyou');

    curl_exec ($ch);

     

    echo "<br />";

    ?>

    [/code]

     

    The error im recieving now is: [Mon May 11 07:08:19 2009] [error] [client 58.161.150.45] PHP Parse error:  syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/austchat/public_html/vcsclaim.php on line 117, referer: http://www.puredomination.org/check_claim.php

     

    But i've looked all through the code, and you guys seem to be a bunch of geniuses.. So thanks for your help

  6. This is my current code:

     

    My Current Error: MySQL server has gone away.

     

    so i have re-shuffled it. and i would love some ideas, to fix this error.

     

    <?php
    
    $ch = curl_init();
    
    curl_setopt($ch, CURLOPT_URL, 'http://en26.tribalwars.net/map/village.txt');
    
    $fp = fopen('village.txt', 'w');
    /**
    * Ask cURL to write the contents to a file
    */
    curl_setopt($ch, CURLOPT_FILE, $fp);
    /**
    * Execute the cURL session
    */
    curl_exec ($ch);
    
    mysql_connect('localhost','********','***********') or die(mysql_error());
    mysql_select_db('**********') or die(mysql_error());
    
    mysql_query("TRUNCATE TABLE village") or die(mysql_error());
    $lines = file('village.txt');
    if(!is_array($lines)) die("File could not be opened"); 
    foreach($lines as $line) {
    list($id, $name,$x, $y, $player, $points, $rank) = explode(',', $line);
    $name = urldecode($name);
    
    $name = addslashes($name);
    mysql_query("INSERT INTO Statement Here");
    ?>

  7. Thanks Daniel0 your a legend, it now works.

     

    But one last question, would cURL be able to replace:

     

    $handle = fopen($base_url . "&to=$to&subject=$subject&message=$message$play$user$unplay$important$coords$x$code$y$close$space$info$newcount$space$end$space$ender", 'r');

     

    im ready to kick my webhost.

  8. Hello,

     

    I need something different from gzfile(), as my webhost has decided to disable it, So yeah 29% of my scripts now dont work.. i really want to kick them hard.

     

    Here is the code:

     

    $lines = gzfile('http://en26.tribalwars.net/map/village.txt.gz');
    if(!is_array($lines)) die("File could not be opened"); 
    foreach($lines as $line) {
    list($id, $name,$x, $y, $player, $points, $rank) = explode(',', $line);
    $name = urldecode($name)

     

    So i need to open that file, explode it.. blah blah blah, insert it into the database.

     

    So i need something new instead of gzfile()

  9. [Fri Feb 20 02:51:50 2009] [error] PHP Warning:  mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/skyitorg/public_html/client/admin/view.php on line 146

     

    This is all im getting.. any idea's? the code is here:

     

    $sql = mysql_query("SELECT * FROM receipt WHERE docket = '$docket'");

    while($row = mysql_fetch_assoc($sql)) {

  10. How would i go about a PHP loop to show a certain criteria e.g:

     

    database > flower

     

    flower    | smell | colour

     

    Rose      Nice    Red

    Tulip      Bad      Yellow <

    Sunflower Meh      Yellow <

     

    say i want to select them and show them but it has more Yellow in the colour, and show them only, how would i go about that?

     

    mysql_array or a while loop

     

    Kris

  11. i got another error on a search page but heres the whole script

    This is the error im constantly getting

    Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in C:\wamp\www\search.php on line 8
    Can\t use TAC :

    <?php
    $host = "localhost";
    $user = "****";
    $pass = "******";
    $dbname = "TAC";
    $connection = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>");

    $db_selected = mysql_select_db('TAC', $link);
    $date = $_GET["date"];
    $manager = $_GET["manager"];
    $Category = $_GET["Category"];
    $quote = $_GET["quote"];
    if (!isset($_POST['submit']))
    if (!$db_selected) {
    die ('Can\t use TAC : ' . mysql_error());
    }
    ?>
  12. ok last idiotic question..

    is there any tutorials on PHP to make it go

    www.mysite.com/view.php?Date=Date


    Thanks Kris [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]
  13. [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]

    well i just put in

    <?PHP
    $conn=mysql_connect(localhost, ****, ******) //(caseswitch.php)
    [b]$query = mysql_select_db(tac)[/b]
    $query = "SELECT tac, date ";
    $query .= "FROM tac";
    $query .= "WHERE date=". $_GET['date'];

    mysql_query($query);
    ?>

    i had: $conn=mysql_select_db(tac) but they have both come up with

    Parse error: parse error, unexpected T_VARIABLE in [a href=\"http://localhost/test/caseswitch.php\" target=\"_blank\"]http://localhost/test/caseswitch.php[/a] on line 3
  14. [!--quoteo(post=376248:date=May 23 2006, 02:40 PM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ May 23 2006, 02:40 PM) [snapback]376248[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    My guess is your if() is missing either a { or }. Bit hard to tell without seeing the actual code. Is that all of it?
    [/quote]
    Nope... i fixed it but :)

    now i gotta do the SQL and the view.php?Date=ddmmyy *wonders*

    just how do i make it connect to the database??

    i have (this is not mine, i just re-wrote it so i can learn it..)

    <td><?php include 'caseswitch.php'; ?></td> (index.php)

    <?PHP
    $conn=mysql_connect(localhost, ****, ******) (caseswitch.php)
    $query = "SELECT tac, date ";
    $query .= "FROM tac";
    $query .= "WHERE date=". $_GET['date'];

    mysql_query($query);
    ?>
  15. Yes i am new to PHP and SQL but im incorporation PHP, SQL and HTML all together about 2 minutes ago the site worked now it comes up with:

    Parse error: parse error, unexpected $end in C:\wamp\www\Test\test2.php on line 59


    but their is no line 59, im using Notepad and PHP editor 2.22 the lines are
    (top)
    <?php
    $date = $_POST["date"];
    $manager = $_POST["manager"];
    $Category = $_POST["Category"];
    $quote = $_POST["quote"];
    if (!isset($_POST['submit']))
    ?>

    (bottom)
    </select>
    </option>
    <form>
    <textarea rows="10" cols="90" name="quote" wrap="physical">Please insert decision inside here.</textarea><br />
    <input type="submit" value="submit" name="submit"> </input>
    </form>
    </body>
    </html>

    chears

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