Jump to content

chriscloyd

Members
  • Posts

    488
  • Joined

  • Last visited

Posts posted by chriscloyd

  1. <?php
    $dbhost = 'localhost';
    $dbuser = '***********';
    $dbpass = '***********f';

    $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');

    $dbname = '**********';
    mysql_select_db($dbname);

    ?>
  2. [code]<?php
    print "<table border=1 class=list>";
    echo("<thead><tr><td><a href=index.php?sortid=0>Site Name</a></td><td><a href=index.php?sortid=1>Editor Rating</a></td><td><a href=index.php?sortid=2>Visitor Rating</a></td><td><a href=index.php?sortid=3>Date Added</a></td><td><a href=index.php?sortid=4>Publisher</a></td></tr></thead><tbody>");

    switch ($_GET['sortid']) {
      case 0 : $column = 'name'; break;
      case 1 : $column = 'editorrating'; break;
      case 2 : $column = 'rating'; break;
      case 3 : $column = 'dateadded'; break;
      case 3 : $column = 'publisher'; break;
      default : $column = 'name';
    }
    $result = mysql_query("SELECT * FROM site ORDER BY $column ASC LIMIT (20, 0");
    while ($qry = mysql_fetch_array($result))
    {
    print "<tr>";
    print "<td><a href=site.php?id=$qry[id]>$qry[name]</a>" ;
    date_default_timezone_set("US/Eastern");
    list($year, $mon, $day) = explode('-', $qry[4]);
    $sevenDays = (7 * 24 * 60 * 60); // 604,800 seconds in 7 days
    $entryTime = strtotime("$year-$mon-$day");
    $now = strtotime("now");
    if (($now - $entryTime) < $sevenDays)
    {
    echo "<img src='images/new.gif'>";
    }
    "</td>";

    //Assuming each editorrating correpsonding an image name w/ that rating
    If ($qry['editorrating'] == "") {$image = '0.png';
    } else{
    $image = $qry['editorrating'] . '.png';
    }

    //Display user's rating image
    echo "<td><img src=\"images/{$image}\" /></td>";


    //Get User's ID rating and display rating image based on that rating
    $id = $qry['id'];
    $qry_rating = mysql_query("SELECT rating FROM site where id='$id'");           
    list($rating) = mysql_fetch_row($qry_rating);
    $new_rating2 = (string)$rating;








    //gets the average rating from the database and put into an image variable
    $rateA = explode(".", $new_rating2);
    $rateA[1] = ((int)$rateA[1] <= 49) ? NULL : $rateA[1];
    $rateA[1] = ((int)$rateA[1] >= 50 && (int)$rateA[1] <= 99) ? "5" : $rateA[1];

    //store rating in image2 variable
    $image2 = $rateA[0] . $rateA[1] . '.png';
       
    //Display user's rating image2
    echo "<td><img src=\"images/{$image2}\" /></td>";

    //Display dateadded
    print "<td>$qry[dateadded]</td>";
    //Display publisher
    print "<td>$qry[publisher]</td>";
    print "</tr>";
    }

    print "</tbody></table>";
    ?>[/code]

    i changed ur query to limit between 20 and 0
    so if u have 7 it will show all but if u have more than 20 it will only show the top 20
  3. here is the error i have

    [quote]Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/chris/public_html/login.php on line 11

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/chris/public_html/login.php on line 12

    Warning: Cannot modify header information - headers already sent by (output started at /home/chris/public_html/login.php:11) in /home/chris/public_html/login.php on line 28
    [/quote]

    and this is the code that is there

    [code]<?php
    session_start();
    include("db.php");

    if(!$email || !$password){
    $error = "Please Fill Out Both Fields!";
    header("Location: index.php?error=".$error."");
    } else {
    $getinfo = mysql_query("SELECT password FROM users WHERE email = '$email'");
    $check_admin = mysql_query("SELECT password FROM admins WHERE email = '$email'");
    $admin = mysql_fetch_array($check_admin);
    $user = mysql_fetch_array($getinfo);
    if($admin == 1){
    if(md5($password) == $admin['password']){
    $_SESSION['cssadmin'] = $email;
    }
    }
    if($user == 1){
    if(md5($password) == $user['password']){
    $_SESSION['css'] = $email;
    header("Location: index.php");
    } else {
    $error = "The Password You Entered Was Incorrect!";
    header("Location: index.php?error=".$error."");
    }
    } else {
    $error = "Their Is No Such Email Registered Here!";
    header("Location: index.php?error=".$error."");
    }
    }
    ?>[/code]
  4. i have a script where i can deny a users application

    heres the mailing script
    [code]if(isset($message)){
    $message = addslashes(htmlspecialchars($message));
    $email = $email;
    $subject = $subject;
    $headers1 = "MIME-Version: 1.0\r\n";
    $headers1 .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers1 .= "From: Application@conception-host.com\r\n";

    if(!mail('$email','$subject','$message','$headers1')){
    echo 'Could Not Send Email, Did not Delete Application';
    } else {
    mysql_query("DELETE FROM app WHERE email='$email'")
    or die(mysql_error());
    echo '<br><br><br>Email Has Been Sent And Application Has Been Deleted';
    }
    } else {
    echo '<form name="form1" method="post" action="?function=deny">
      <table width="332" border="0" cellspacing="5" cellpadding="0">
    <tr>
      <td width="73">Email</td>
      <td width="244">'.$_GET['email'].'
      <input name="email" type="hidden" id="email" value="'.$_GET['email'].'"></td>
    </tr>
    <tr>
      <td>Subject</td>
      <td>Application Review
      <input name="subject" type="hidden" id="subject" value="Application Review"></td>
    </tr>
    <tr>
      <td valign="top"><p>Message<br>
      <span class="var"><strong>Default<br>
    Message
      </strong></span></p>        </td>
      <td><textarea name="message" cols="30" rows="5" class="inputs">Application Review
    -----------------------------------------

    To Whom This May Concern,

    I regret to inform you that you failed your application
    process.  It might not be that you failed exactly
    but, we might have filled up that position.  If you would
    like another chance feel free to send another application
    but, write more infomation about your self and give more
    expirence.

    Application Procceser
    Conception-Host.com
    #CHOST</textarea></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type="submit" name="Submit" value="Send"></td>
    </tr>
      </table>
    </form>';
    }[/code]

    but it says the echo that email had been sent but its not sending and i get this wierd error above that message that says
    /var/chroot/home/content/c/h/r/chriscloyd/dead.letter... Saved message in /var/chroot/home/content/c/h/r/chriscloyd/dead.letter
  5. this is my code

    [code]<?php
    include("db.php");
    if($_FILES["file"]["name"]){

    $dir = "pictures/".$_FILES["file"]["name"];

    if(move_uploaded_file($_FILES["file"]["tmp_name"], $dir){
    $file = $dir;
    $filename = $file;
    header('Content-type: image/jpeg');
    list($width, $height) = getimagesize($filename);
    $newwidth = 150;
    $newheight = 150;
    $thumb = imagecreatetruecolor($newwidth, $newheight);
    $source = imagecreatefromjpeg($filename);
    imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
    imagejpeg($thumb);
    $dir2 = "thumbnails/".$_FILES["file"]["name"];
    $thumbnail = move_uploaded_file(imagejpeg($thumb), $dir2);
    $query = "INSERT INTO gallery SET image = '$dir', thumbnail = '$thumbnail'";
    $result = mysql_query($query);
    if($result){
    echo "The image has been uploaded";
    }else{
    echo "There was an error uploading to the database.<br />".mysql_error();
    }

    }else{
    echo "There was an error uploading the file";

    }
    }


    ?> [/code]

    i get this error

    Parse error: syntax error, unexpected '{' in /home/.giro/chriscloyd/idoliztic-designs.com/upload.php on line 7
  6. i just dont know why it will work when u go to the actuall page like
    http://www.aspire-hosting.net/includes/latestthreads.php
    but not when u go to
    http://www.aspire-hosting.net

    I have tried where i just post the code on the index.php file but it still wont show!
  7. [code]<?php
    include("threaddb.php");
    $latest = mysql_query("SELECT * FROM thread ORDER BY threadid DESC LIMIT 7") or die(mysql_error());
    echo '<table width="193" border="0" bordercolor="#000000" bgcolor="#FFFFFF">';
    while ($row = mysql_fetch_array($latest)){

    $title = $row['title'];
    $threadid = $row['threadid'];
    echo '<tr>
    <td width="105"><div align="left">'.$title.'</div></td>
    <td width="78"><div align="center"><a href="forums/showthread.php?t'.$threadid.'">View</a></div></td>
    </tr>';
    }
    echo '</table>';
    ?>[/code]
  8. ya the error im getting now is

    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 'threadid LIMIT 7' at line 1

    and my mysql_query is

    mysql_query("SELECT * FROM thread ORDER BY threadid DESC threadid LIMIT 7") or die(mysql_error());
  9. i get this error

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/.giro/thegtz/aspire-hosting.net/includes/latestthreads.php on line 5

    and my code is

    [code]<?php
    include("threaddb.php");
    $latest = mysql_query("SELECT * FROM 'thread' ORDER BY date DESC 'threadid' LIMIT '7'");
    echo '<table width="193" border="0" bordercolor="#000000" bgcolor="#FFFFFF">';
    while ($row = mysql_fetch_array ($latest)){
    echo '<tr>
        <td width="105"><div align="left">'.$row['title'].'</div></td>
        <td width="78"><div align="center"><a href="forums/showthread.php?t'.$row['threadid'].'">View</a></div></td>
      </tr>';
    }
    echo '</table>';
    ?>[/code]

    can someone help me fast please
×
×
  • 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.