Jump to content

newb

Members
  • Posts

    454
  • Joined

  • Last visited

Everything posted by newb

  1. uhh, the html data definitely have html code inside them. http://img205.imageshack.us/img205/7595/tableod4.jpg i posted the tables to even prove it. for some reason only one will show up...
  2. ok deletion of SELECT id got rid of the unwanted zero, but still the other html blocks arent showing up. [code] <?php include "config.php"; //create connection $connection = mysql_connect("$mysql_host", "$mysql_login", "$mysql_pass") or die ("Couldnt connect to the server."); //select database mysql_select_db("$mysql_database", $connection) or die ("Couldnt select the database. ".mysql_error()); $sql = mysql_query("SELECT data FROM `p16_blocks` WHERE ID IN (0,1,2) ORDER BY `id` ASC", $connection); $row = mysql_fetch_row($sql); // STEP 1 // html definitions - format results by row $midlink = $row[0]; $footerlink = $row[1]; $copyright = $row[2]; echo $midlink; echo $footerlink; echo $copyright; ?> [/code] im stuck. :s
  3. ok this following code works a little bit: [code]<?php include "config.php"; //create connection $connection = mysql_connect("$mysql_host", "$mysql_login", "$mysql_pass") or die ("Couldnt connect to the server."); //select database mysql_select_db("$mysql_database", $connection) or die ("Couldnt select the database. ".mysql_error()); $sql = mysql_query("SELECT id,data FROM `p16_blocks` WHERE ID IN (0,1,2) ORDER BY `id` ASC", $connection); $row = mysql_fetch_row($sql); // STEP 1 // html definitions - format results by row $midlink = $row["0"]; $footerlink = $row["1"]; $copyright = $row["2"]; echo "$midlink"; echo "$footerlink"; echo "$copyright" ?> [/code] It generates this in HTML [code] 0<p align='center' class='midheader'><a href='#'>home</a> • <a href='#'>affiliates</a> • <a href='#'>servers</a> • <a href='#'>contact</a></p>[/code] It doesnt generate the rest of the html blocks, just the $midlink and for some reason it generates a 0 as well.
  4. [code]<?php include "config.php"; //create connection $connection = mysql_connect("$mysql_host", "$mysql_login", "$mysql_pass") or die ("Couldnt connect to the server."); //select database $db = mysql_select_db("$mysql_database",$connection) or die ("Couldnt select the database. ".mysql_error()); $sql = mysql_query("SELECT id,data FROM `p16_blocks` WHERE ID IN (0,1,2) ORDER BY `id` ASC");       $row = mysql_fetch_assoc($sql); // STEP 1 // html definitions - format results by row $midlink = $row[0]; $footerlink = $row[1]; $copyright = $row[2]; echo $midlink; echo $footerlink; echo $copyright; ?> [/code] wtf this query isnt running. not echoing the html data from the mysql table. pls help, my tables look like this: http://img205.imageshack.us/img205/7595/tableod4.jpg
  5. newb

    login script

    and ur code didnt work treilad
  6. newb

    login script

    it worked, and i changed code around a lil bit. [code] <form action="modules.php?name=admin&amp;op=login" method="post" enctype="multipart/form-data"> Username:&nbsp;<input type="text" name="username" /><br /> Password:&nbsp;&nbsp;<input type="password" name="password" /> <input type="submit" value="Login" /> </form> <?php require $dir."config.php"; $username = $_POST['username']; $password = $_POST['password']; $password2 = md5($_POST['password']); $query = "SELECT * FROM user WHERE username = '$username'"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { if ( $_GET['p'] == 'login' ) {   if ($username != $row['username']) {       echo "<p>Sorry, that username does not match. Use your browser back button to go back and try again.</p>";       echo "Inputed Username: '$username'<br />";       } else if ($password2 != $row['password']) {       echo "<p>Sorry, that password does not match. Use your browser back button to go back and try again.</p>";       echo "Inputed Password: '$password'<br />";   } else if ($username == $row['username'] && $password2 == $row['password']) {       session_start(); $_SESSION['username']="$username"; $_SESSION['password']="$password";       echo "<p>Hello $username, <br /><br />Welcome to the Control Panel.</p> <br /><a href=\"modules.php?name=admin&p=news\">Submit News</a>";   } else {       echo "<p>Sorry, you could not be logged in at this time. Refresh the page and try again.</p>";   } } else if ( $_GET['p'] == 'logout' ) { session_destroy(); echo "<p>$username sucessfully logged out</p>"; } }   $query = "SELECT * FROM `user` ORDER by username ASC;"; $result = mysql_query( $query ); $nums = mysql_num_rows( $result ); while($row = mysql_fetch_row($result)) { echo("<b>$row[3]</b> :: $row[2]<br> "); } echo "<br /><br />$nums Total Tables"; { }[/code] It wont log in at all now though, just gives me a blank page upon post submission. any ideas fellas?
  7. [code] <form action="modules.php?name=admin&amp;op=login" method="post" enctype="multipart/form-data"> Username:&nbsp;<input type="text" name="name" /><br /> Password:&nbsp;&nbsp;<input type="password" name="pass" /> <input type="submit" value="Login" /> </form> <?php require $dir."config.php"; $Query = "SELECT * FROM user WHERE username = '$_POST[user]'"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { $username = $row['username']; $password = $row['password']; $randomword = dsiadopdjkspodjsadchocolatemousse; if (isset($_COOKIE['cplogin'])) {   if ($_COOKIE['cplogin'] == md5($password.$randomword)) {       exit;   } else {       echo "<p>Bad cookie. Clear please clear them out and try to login again.</p>";       exit;   } } if (isset($_GET['p']) && $_GET['op'] == "login") {   if ($_POST['name'] != $username) {       echo "<p>Sorry, that username does not match. Use your browser back button to go back and try again.</p>";       exit;   } else if md5($_POST['pass']) != $password) {       echo "<p>Sorry, that password does not match. Use your browser back button to go back and try again.</p>";       exit;   } else if ($_POST['name'] == $username && md5($_POST['pass']) == $password) {       setcookie('cplogin', md5($_POST['pass'].$randomword));       echo "<p>Welcome to the Control Panel</p>";   } else {       echo "<p>Sorry, you could not be logged in at this time. Refresh the page and try again.</p>";   } } ?>[/code] i get this error: [code] Parse error: syntax error, unexpected T_STRING, expecting '(' in /home/xxxxxxxxxxxx/login.php on line 34[/code] how do i fix?
  8. Ohhhh...yep that worked! Thanks a bunch fellas!
  9. [code]<?php require "../config.php";   $id = $_GET["id"];       $sql = "SELECT * FROM `thumbs` WHERE id=$id";       $result = mysql_query($sql);                // Build Table while( $row = mysql_fetch_assoc( $result ) ) { $imageshow=$row['id']; if ( $id == "$imageshow") { echo '<br /><br /><a href="#" onclick="window.close()"><img class="displaypic" src="images/full/' . $row['category'] . '/' . $row['id'] . '.jpg"></img></a><br />';   } else {     echo "Image ID: $id Doesnt Exist";     } } ?>[/code] thats my code, when i type in, say www.mysite.com/thumbs.php?id=4543535435 it wont say 'image id: 4543535435 doesnt exist' and i know it doesnt exist in the database.
  10. im still confused. do i use eval instead of array? or what??? how do i write the code?? pls help.. -.- php newbie here.
  11. k what im trying to do is put some php code in an array and include the code. simple as that.
  12. [code]<?php $pages = array(   'main'  => '     include "../inc/config.php"; $query = "SELECT * FROM `thumbs` ORDER BY id DESC"; $result = mysql_query( $query ); if ( !$result ) {   // replace this with your own error code -- one that doesn't display the query   die($query.'<br />'.mysql_error()); } echo "<table border='0' width='100%' id='table1'><tr>";                 // Build Table while( $row = mysql_fetch_assoc( $result ) ) { $i++;   echo '<td width="33%" valign="top" height="65">';   echo '<a href="?p=' . $row['tid'] . '"><img border="0" src="images/thumbs/' . $row['tid'] . '.jpg"></img><br /></a>Title: <a href="?p=' . $row['tid'] . '">'.$row['title'].'</a><br />Published: '.$row['published'];   echo '</td>';     if ( $i == 2 ) { echo '</tr><tr>'; $i = NULL; } } echo '</tr></table>'; ', // main page if (isset($_GET['p']) && isset($pages[$_GET['p']]))               {                     include($pages[$_GET['p']]); // Include Main Page                   } else if(($p == "main") or ($p =="")) {                         include($pages['main']); } else { include($pages['error']);                      } ?>[/code] i get this error: [code] Parse error: syntax error, unexpected T_STRING, expecting ')' in /home/xx/xx/xx/thumbs.php on line 9[/code]
  13. [!--quoteo(post=386192:date=Jun 20 2006, 07:45 PM:name=legohead6)--][div class=\'quotetop\']QUOTE(legohead6 @ Jun 20 2006, 07:45 PM) [snapback]386192[/snapback][/div][div class=\'quotemain\'][!--quotec--] Please Watch your language! Thanks [/quote] dont be a fag.
  14. yeah. the pasword in vbulletin database: b6ca97cccb2cd8fa4afa7cff7d741a03 the same password i use to login my vbulletin forum (encrypted at [a href=\"http://www.iwebtool.com/md5):\" target=\"_blank\"]http://www.iwebtool.com/md5):[/a] 374789384d64563d38e5de0b357a10bc fucking weird. if i put the 2nd md5 password inside the database, it logs in perfectly so i guess the vbulletin database uses some weird encryption but i dont know what it is. [quote] EDIT: Just searched on Google, and someone posted somewhere else that vB hashes passwords through md5, then salts it, then through md5 again... Maybe you could extract the encryption function from vB and use it to encrypt your passwords?[/quote] omg thats crazy...i dont even know what vb file the function is in aahhh...........
  15. im making a member login script and using vbulletin passwords. the problem is, that vbulletin uses some weird encryption or something and when i put my password in, it says its wrong.. i thought vbulletin uses md5 but apparently they dont ... i went to another md5 encryption site, and got my password encrypted elsewhere, and it didnt match the one i got from my vbulletin database at all... here's my script.. [code]<form action="index.php?p=login" method="post" enctype="multipart/form-data">         Username: <input type="text" name="user" />         Password: <input type="password" name="pass" />         <input type="submit" value="Login" />     </form> <?     if ( $_GET['p'] == 'login' ) {        $server = "localhost";   $username = "xx";   $password = "xx";   $database = "xx";   $con = mysql_connect($server, $username, $password);   mysql_select_db($database);            // MD5 the form password         $md5Pass = md5( $_POST['pass'] );                  // Get user details from MySQL Table         $Query = mysql_query( " SELECT * FROM tbl_users WHERE username = '$_POST[user]' " );         $result = mysql_fetch_array( $Query );                  // Check that the form password matches the one in the database         if ( $md5Pass == $result['password'] ) {             echo 'User logged in';         } else {             echo 'Wrong Password, please try again';         }              }      ?>[/code] i guess vbuletin use some kinda salt or something i duno but its weird.
  16. ur CMS is cool. do u mind sharing the script wen ur done. i wud like to use it.
  17. nevermind, i found the SQL query on how to merge the two tables into one. it's this: [code] CREATE TABLE `newtable` (   `id` varchar(32) NOT NULL default '',   `title` varchar(32) NOT NULL default '',   `artist` varchar(32) NOT NULL default '',   `size` varchar(32) NOT NULL default '',   `thumb` text NOT NULL,   `fullsize` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO `newtable` Select * from table1 UNION Select * from table2; [/code] thanks for the help guys.
  18. oh ok, will merge/normalize the tables then since they have the same fields. is there a way i can do this quickly since they all have the same fields so then i dont have to re-enter all the data again?
  19. [quote] can I see what data is in table 1 where id = 15 please? [/quote] yeah sure. [img src=\"http://img230.imageshack.us/img230/3748/data1ut.jpg\" border=\"0\" alt=\"IPB Image\" /] there's what it look like. [!--quoteo(post=385487:date=Jun 18 2006, 09:41 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 18 2006, 09:41 PM) [snapback]385487[/snapback][/div][div class=\'quotemain\'][!--quotec--] I think that what he means is: "why do you have different tables when you could put them all in the same"? Like: table1: id, image [ids 1-15] table2: id. image [ids-16-26] There is no point in doing this. [/quote] itll help me organize them better. some pictures belong in certain sections on the site.
  20. the two tables dont contain the same data, i never said that. i just said that the two tables contain the same field names. the data inside the fields are different though. [quote] Is the content of your 'full image' database field the name of the image, the image itself (as a blob field), or the html code you posted?[/quote] [code]<img border='0' src='http://mysite.com/image.jpg'>[/code] that html code is in the 'fullsize' field of table2 in the 'id 18' field. i want that to echo when the browser's url is view.php?id=18 i hope i cleared up a bit.
×
×
  • 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.