Jump to content

Iryk

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Posts posted by Iryk

  1. I have rewritten my code partially...

    [code]<?php
      $db_username = $_POST['db_username'];
      $db_password = $_POST['db_password'];
      $db_host = $_POST['db_host'];

    $connect = mysql_connect("$db_host","$db_username","$db_password") or die("<center><span style='color: red; font: 8pt verdana'>Database information is wrong. Please go back and retype the information.</span></center>");

    if ($your_password != $retype_password) {
    echo "<center><span style='color: red; font: 8pt verdana'>Your passwords do not match. Please go back and retype the information.</span></center>";
    } else {

    $dat = date("D j M, Y");
    $title = $_POST['site_title'];
    $description = $_POST['site_description'];
    $copyright = $_POST['site_copyright'];
    $url = $_POST['site_url'];
    $banner = $_POST['site_banner'];
    $username = $_POST['your_username'];
    $password = md5($_POST['your_password']);
    $location = $_POST['your_location'];
    $email = $_POST['your_email'];
    $avatar = $_POST['your_avatar'];
    $website = $_POST['your_website'];
    $signature = $_POST['your_signature'];

          $installed = '$installed';
          $new_content = "<?
    " . $installed . " = 'yes';
    mysql_connect('" . $db_host . "','" . $db_username . "','" . $db_password . "');
    ?>";
          $file = fopen('../db_connect.php', 'a');
          fwrite($file,$new_content);
        fclose($file);

          include("../db_connect.php");
          mysql_query("INSERT INTO user (user, pass, website, email, avatar, location, sig) VALUES ('$username','$password', '$website', '$email', '$avatar','$location','$signature')");
          mysql_query("INSERT INTO staff VALUES ('$username','Admin','0')");
          mysql_query("INSERT INTO site VALUES ('$title','$description','$dat','Blue','$copyright','$url','$banner')");

          echo '<center><span style="color:green;font-size:8pt;font-family: verdana">The installation was successful.</span><br><a href="../index.php"><span style="font-size:8pt;font-family: verdana">Go to the homepage</span></a></center>';
    }
    ?>[/code]
  2. I have a form on a different page and I am getting no errors on this page (install_process.php). But the information that I entered in the form is not being entered into the database... Can some one please tell me what I have done wrong?

    [code]<?php
      $db_username = $_POST['db_username'];
      $db_password = $_POST['db_password'];
      $db_host = $_POST['db_host'];

    $connect = 'mysql_connect($db_host,$db_username,$db_password)';
    if(empty($connect)) {
    echo "<center><span style='color: red; font: 8pt verdana'>Database information is wrong. Please go back and retype the information.</span></center>";
    } else {

    if ($your_password != $retype_password) {
    echo "<center><span style='color: red; font: 8pt verdana'>Your passwords do not match. Please go back and retype the information.</span></center>";
    } else {

    $dat = date("D j M, Y");
    $title = $_POST['site_title'];
    $description = $_POST['site_description'];
    $copyright = $_POST['site_copyright'];
    $url = $_POST['site_url'];
    $banner = $_POST['site_banner'];
    $username = $_POST['your_username'];
    $password = md5($_POST['your_password']);
    $location = $_POST['your_location'];
    $email = $_POST['your_email'];
    $avatar = $_POST['your_avatar'];
    $website = $_POST['your_website'];
    $signature = $_POST['your_signature'];

          $installed = '$installed';
          $new_content = "<?
    " . $installed . " = 'yes';
    mysql_connect('" . $db_host . "','" . $db_username . "','" . $db_password . "');
    ?>";
          $file = fopen('../db_connect.php', 'a');
          fwrite($file,$new_content);
        fclose($file);

          include("../db_connect.php");
          mysql_query("INSERT INTO user (user, pass, website, email, avatar, location, sig) VALUES ('$username','$password', '$website', '$email', '$avatar','$location','$signature')");
          mysql_query("INSERT INTO staff VALUES ('$username','Admin','0')");
          mysql_query("INSERT INTO site VALUES ('$title','$description','$dat','Blue','$copyright','$url','$banner')");

          echo '<center><span style="color:green;font-size:8pt;font-family: verdana">The installation was successful.</span><br><a href="../index.php"><span style="font-size:8pt;font-family: verdana">Go to the homepage</span></a></center>';
        }
    }
    ?>[/code]
  3. OK thank you soo much! but now i get these errors:

    Warning: fopen() expects at least 2 parameters, 1 given in /fpgs/fpgshttpd/majestic-neo/blah/ssCommunity/ssCommunity/install_process.php on line 34

    Warning: fwrite(): supplied argument is not a valid stream resource in /fpgs/fpgshttpd/majestic-neo/blah/ssCommunity/ssCommunity/install_process.php on line 35

    Warning: fclose(): supplied argument is not a valid stream resource in /fpgs/fpgshttpd/majestic-neo/blah/ssCommunity/ssCommunity/install_process.php on line 36
  4. [code]<?php
    $db_username = $_POST['db_username'];
    $db_password = $_POST['db_password'];
    $db_host = $_POST['db_host'];

    if($your_password != "$retype_password") {
    echo "<center><span style='color: red; font: 8pt verdana'>Your passwords do not match. Please go back and retype the information.</span></center>";
    } else {

    $con = mysql_connect("$db_host","$db_username","$db_password");
    if (!$con)
      {
      echo "<center><span style='color: red; font: 8pt verdana'>Database information is wrong. Please go back and retype the information.</span></center>";
      } else {

    $dat = date("D j M, Y");
    $title = $_POST['site_title'];
    $description = $_POST['site_description'];
    $copyright = $_POST['site_copyright'];
    $url = $_POST['site_url'];
    $banner = $_POST['site_banner'];
    $username = $_POST['your_username'];
    $password = md5($_POST['your_password']);
    $location = $_POST['your_location'];
    $email = $_POST['your_email'];
    $avatar = $_POST['your_avatar'];
    $website = $_POST['your_website'];
    $signature = $_POST['your_signature'];

    mysql_query("INSERT INTO user (user, pass, website, email, avatar, location, sig) VALUES ('$username','$password', '$website', '$email', '$avatar','$location','$signature')");
    mysql_query("INSERT INTO staff VALUES ('$username','Admin','0')");
    mysql_query("INSERT INTO site VALUES ('$title','$description','$dat','Blue','$copyright','$url','$banner')");

    $new_content '<? mysql_connect("$db_host","$db_username","$db_password"); ?>';
    $file = fopen('db_connect.php');
    fwrite('$file','$new_content');
    fclose($file);
    }
    ?>[/code]

    Here is the error i get:

    Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /fpgs/fpgshttpd/majestic-neo/blah/ssCommunity/ssCommunity/install_process.php on line 34
  5. OH yeah... lol... Well I fixed that... Now its not reading the COOKIE. Also is it possible to use the date() function instead of the time()?

    [code]<?
    if($setCookie == "yes") {
    setcookie(adventCalendar, doNotWarn, time() + 3600);
    header("Location: http://neopets.com/winter/adventcalendar.phtml");
    } else {
    if(isset($_COOKIE['adventCalendar'])) {
    echo '<font color="green">Advent Calendar</font><br>';
    } else {
    echo '<a href="adventCalendar.php?setCookie=yes"><font color="red">Advent Calendar</font></a><br>';
    }
    }
    ?>[/code]
  6. I am trying to make a session/cookie that will last until the next day (ie. if is Mon. then it expires on Tue). But everytime the page is visited the script doesn't create a cookie. I am have checked and made sure I had cookies enabled and everything. Please Help!

    [code]<?
    if($setCookie == "yes") {
    setcookie('adventCalendar', doNotWarn, time()+1);
    header("Location: http://neopets.com/winter/adventcalendar.phtml");
    } else {
    if(!isset($_COOKIE["adventCalendar"])) {
    echo '<a href="adventCalendar.php?setCookie=yes"><font color="red">Advent Calendar</font></a><br>';
    } else {
    echo '<a href="http://neopets.com/winter/adventcalendar.phtml"><font color="green">Advent Calendar</font></a><br>';
    }
    }
    echo $_COOKIE["adventCalendar"];
    ?>[/code]
  7. [code]<?php
    //featured game
    //initiate curl
    $ch = curl_init();

    //give curl the url to visit
    curl_setopt($ch, CURLOPT_URL,"http://www.neopets.com/weather.phtml");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    //load the page into a variable
    $result=curl_exec ($ch);
    //close the connection
    curl_close ($ch);
    //split each line into a value in an array
    $lines = explode("\n", $result);

    //cycle through each line in the array until we find a specific pattern
    foreach ($lines as $line_num => $line) {
    //get image and url
    $pattern = 'Average temperature today is \<b>([^\']*)\<\/b> degrees C (\<b>([^\']*)\<\/b> degrees F)\<p>\<center>\<img src=\'([^\']*)\' width=150 height=150 border=0>/';
    if (preg_match($pattern, $line, $matches)) {  
    $temp = $matches[1];
    $image = $matches[3];
    }
    }
    echo "$tempĀ° C<br><img src='$image'>";
    ?>[/code]

    What am i doing wrong here is the url to the page:

    [a href=\"http://majestic-neo.com/v.3/portal/\" target=\"_blank\"]http://majestic-neo.com/v.3/portal/[/a]

    Error:

    Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash in /fpgs/fpgshttpd/majestic-neo/v.3/portal/weather.php on line 20
  8. [code]<?
    $query = "SELECT * FROM `topics` WHERE `Category`='$category' ORDER BY `ID` DESC LIMIT 0,30";
    $result = "mysql_query(" . $query . ")";
    $get = "mysql_fetch_array(" . $result . ")";
    $i = 1;
        echo "<table>";
        while($get) {
            $id = $get['ID'];
            $topic = $get['Topic'];
            $author = $get['Author'];
            $date = $get['Date'];
            $replies = mysql_num_rows(mysql_query("SELECT * FROM `replies` WHERE `Topic`='" . $topic . "'"));
                if($i % 2 == "1") {
                    $bgcolor = "#E4E4E4"; } else {
                    $bgcolor = "#EEEEEE"; }
                    echo "<tr bgcolor='" . $bgcolor . "'>";
                    echo "<td width='50%'>" . $topic . "</td>";
                    echo "<td width='20%'>" . $author . "</td>";
                    echo "<td width='20%'>" . $date . "</td>";
                    echo "<td width='10%'>" . $replies . "</td>";
                    echo "</tr>";
            $i++;
        }
        echo "</table>";
    ?>[/code]

    It is only giving the result of m for my values. Can some one please tell me what I am doing wrong?
  9. [code]<?
    $color = poop;
    $species = aisha;
    $url = "http://images.neopets.com/pets/".$species."_".$color."_baby.gif";
    if(!is_readable($url)) {
    $size = getimagesize("$url");
    $width = $size[0];
    if($width == "150") {
    echo "<img src='$url'>";
    }
    }
    ?>[/code]

    Error:
    [i]Warning: getimagesize(http://images.neopets.com/pets/aisha_poop_baby.gif) [function.getimagesize]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /fpgs/fpgshttpd/majestic-neo/pet_db/pets.php on line 6[/i]

    I want the script to find out if the image really does exist then if it does it will show the image. But if the image doesn't exist then it will show nothing. Xould someone please tell me what I am doing wrong.
  10. The change could not be made.
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Map SET Collected='4',three='yes' WHERE User='Iryk'' at line 1

    That is what I got... and my variables are coming from the url after you click one of the images, w/ a ? mark, on them.
  11. [code]<?php
    include("db_connect.php");
    if($piece == "1") { $i = one; }
    if($piece == "2") { $i = two; }
    if($piece == "3") { $i = three; }
    if($piece == "4") { $i = four; }
    if($piece == "5") { $i = five; }
    if($piece == "6") { $i = six; }
    if($piece == "7") { $i = seven; }
    if($piece == "8") { $i =eight; }
    if($piece == "9") { $i = two; }
    if($change == "yes") {
      $col = $collected;
      $col++;
      $query_1 = "UPDATE $map SET Collected='$col',$i='$change' WHERE User='$user'";
      mysql_query($query_1) or die("The change could not be made.");
      echo "You're map pieces for <b>$map</b> have been updated.";
    }
    ?>[/code]

    That code doesn't work and I have no clue why... on this url below it gives you a map that you are allowd to change by clicking on a piece:

    [a href=\"http://majestic-neo.com/pet_db/maps.php?map_num=1\" target=\"_blank\"]http://majestic-neo.com/pet_db/maps.php?map_num=1[/a]

    This url is the url that you get for changing a piece to the image without a ? mark on it:

    [a href=\"http://majestic-neo.com/pet_db/update.php?map=Secret%20Laboratory%20Map&user=Iryk&piece=5&change=yes&collected=3\" target=\"_blank\"]http://majestic-neo.com/pet_db/update.php?...yes&collected=3[/a]

    If anyone knows why the script isn't working please help and give me a working script.
  12. [code]<?
    include("db_connect.php");
    if($change == "yes") {
      $col = $collected++;
      mysql_query("UPDATE `$map` SET $piece='yes' WHERE User='$user'");
      mysql_query("UPDATE `$map` SET Collected='$col' WHERE User='$user'");
      echo "You're map pieces for <b>$map</b> have been updated.";
    }
    ?>[/code]

    That code doesn't seem to be working... any ideas why?

    Here is the URL that is suppose to make the code work:

    [a href=\"http://majestic-neo.com/pet_db/update.php?map=Secret%20Laboratory%20Map&user=Iryk&piece=3&change=yes&collected=3\" target=\"_blank\"]http://majestic-neo.com/pet_db/update.php?...yes&collected=3[/a]

    Or this URL and click on an image to try it:
    [a href=\"http://majestic-neo.com/pet_db/maps.php?map_num=1\" target=\"_blank\"]http://majestic-neo.com/pet_db/maps.php?map_num=1[/a]
  13. [code]<?
    require_once("db_connect.php");
    $query = mysql_query("SELECT * FROM site");
    $result = mysql_fetch_array($query);
    $image_1 = $result['banner'];
    $image_2 = imagecreatefrompng("$image_1");
    imagepng(".$image_2.");
    ?>[/code]

    That is my code. And this is the error I get on the page:

    Warning: imagecreatefrompng(None Yet): failed to open stream: No such file or directory in /home/magneo/public_html/banner.php on line 6

    Warning: imagepng(): supplied argument is not a valid Image resource in /home/magneo/public_html/banner.php on line 7

    Could some one please tell me what I am doing wrong?
  14. I just started to use this script and it gives the error of:

    Warning: Division by zero in /home/magneo/public_html/news/index.php on line 41

    [code]<?
    $url = "index.php?page=news";
    $count_news = mysql_num_rows(mysql_query("SELECT * FROM news"));

    if($count_news == 0) {
    echo "<center>There is no news to display.</center>";
    } else {

    if (isset($_GET['pageno'])) {
       $pageno = $_GET['pageno'];
    } else {
       $pageno = 1;
    } // if
    $query = "SELECT count(*) FROM news";
    $result = mysql_query($query);
    $numrows = mysql_num_rows($result);
    $rows_per_page = 5;
    $lastpage = ceil($numrows/$rows_per_page);
    $pageno = (int)$pageno;
    if ($pageno < 1) {
       $pageno = 1;
    } elseif ($pageno > $lastpage) {
       $pageno = $lastpage;
    } // if
    $limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page;
    $query_ = "SELECT * FROM news ORDER BY id DESC $limit";
    $result = mysql_query($query_);

    while ($ro = mysql_fetch_array($result)) {
    $id = $ro['id'];
    $author = $ro['author'];
    $title = $ro['title'];
    $content = bbcode($ro['content']);
    $date = $ro['postdate'];

    $com_link1 = "<a href='$url/comments&id=$id'>";
    $com_link2 = "</a>";
    $com_count = "SELECT * FROM comments WHERE news_id='$id'";
    $com_num = mysql_num_rows(mysql_query($com_count));
    $filename = layouts/$theme/news_template.php;
    if (is_readable($filename)) {
       include("layouts/".$theme."/news_template.php");
    } else {
    include("news/default_template.php");
    }

    if($count_news != 1 OR 0) {
    echo "<center>";
    if ($pageno == 1) {
       echo "Pages:";
    } else {
       echo " <a href='$url/index&pageno=1'>FIRST</a> | ";
       $prevpage = $pageno-1;
       echo " <a href='$url/index&pageno=$prevpage'>$prevpage</a> ";
    } // if
    echo " <b>$pageno</b> ";
    if ($pageno == $lastpage) {
       echo "";
    } else {
       $nextpage = $pageno+1;
       echo " <a href='$url/index&pageno=$nextpage'>$nextpage</a> | ";
       echo " <a href='$url/index&pageno=$lastpage'>LAST</a> ";
    }
    echo "</center>";
    }
    }
    }
    ?>[/code]

    What am I doing wrong?
×
×
  • 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.