Jump to content

d22552000

Members
  • Posts

    535
  • Joined

  • Last visited

    Never

Everything posted by d22552000

  1. I have made a registraition and login system. The user variables are like this when they get to any files on my site: $_SESSION['u'] = $user['username']; $_SESSION['i'] = $user['useridnum']; $_SESSION['a'] = $user['accesslevel']; Hope that helps someone out.
  2. ok so I want ot make a VERY basic personall messaging system, and this is what I have so far CREATE TABLE `pmbox` ( `id` mediumint(32) NOT NULL auto_increment, `from` varchar(64) NOT NULL, `to` varchar(64) NOT NULL, `subject` varchar(255) NOT NULL default '[No Subject]', `message` text NOT NULL, `timedate` timestamp NOT NULL default CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; That is an export of my mysql table that stores the messages. <form action="newpm.php" method="post"> <input type="text" name="touser" /> <input type="text" name="subject" /> <textarea name="text" cols="40" rows="8" /> </textarea> </form> Now what do I do exactly? lol....
  3. yay this works in ie7 now, thank you VERY much. Maybe the javascript:void did it, I have not a clue but THANK YOU!
  4. o.o I get it.. ok changing.. lets see if it works... It is funny, If I have register globals... I NEVER USE IT lol..
  5. It is bad practice to only succeed with a newline character, also use a carriage return for compatability with all systems: if($_POST['newsletter']) fwrite($file, $_POST['newsletter']."\r\n");
  6. I am making a music / social networking site. The profile pages seem to logout ANY user going to them, for no reason.. Here is my php: CODE THAT SETS SESSION IN LOGIN.PHP: session_regenerate_id(); $member=mysql_fetch_assoc($res); $_SESSION['i']=$member['uid']; $_SESSION['u']=$member['user']; session_write_close(); header("location: index.php?dologin=".rand()); //Dologin just shows the "welcome" thingy. exit(); PROFILE.PHP CODE: <?PHP include('inc.php'); if (isset($_GET['u'])) { $user = $_GET['u']; $sql = "SELECT * FROM `musix`.`userdetails` WHERE `usaer` = '".clean($user)."' LIMIT 1;"; $res = mysql_query($sql) or die(mysql_error()); $ret = "<h1>$user's Profile</h1>"; while($u = mysql_fetch_assoc($res)) { $ret.= " <table width='80%'><tr><td width='100%'> <table width='80%'> <tr><td>Occupation: </td><td>".$u['occupation']."</td></tr> <tr><td>Interests: </td><td>".$u['interests']."</td></tr> <tr><td>Location: </td><td>".$u['location']."</td></tr> <tr><td> </td><td> </td></tr> <tr><td>Favorite Movies: </td><td>".$u['movies']."</td></tr> <tr><td>Favorite Shows: </td><td>".$u['television']."</td></tr> </table></td><td align='right'> "; if (is_file('./pic/'.$user.'.jpg')) { $ret.= "<img src='./pic/$user.jpg' alt='User Picture' />\r\n"; } else if (is_file('./pic/'.$user.'.png')) { $ret.= "<img src='./pic/$user.png' alt='User Picture' />\r\n"; } else if (is_file('./pic/'.$user.'.gif')) { $ret.= "<img src='./pic/$user.gif' alt='User Picture' />\r\n"; } else if (is_file('./pic/'.$user.'.jpeg')) { $ret.= "<img src='./pic/$user.jpeg' alt='User Picture' />\r\n"; } else { $ret.= "<img src='./pic/nopic.jpg' alt='User Picture' />\r\n"; } $ret.= " </td></tr><tr><td colspan='2'><br/> <table width='100%' style='border-color: darkblue;'> <tr><th style='background-color:darkblue;'>About Me</th></tr> <tr><td style='border-color: darkblue;'>".$u['aboutme']."</td></tr> </table><br/> <table width='100%' style='border-color: darkblue;'> <tr><th style='background-color:darkblue;'>Biography</th></tr> <tr><td style='border-color: darkblue;'>".$u['biography']."</td></tr> </table><br/> <table width='100%' style='border-color: darkblue;'> <tr><th style='background-color:darkblue;'>My Favorite Songs</th></tr> <tr><td style='border-color: darkblue;'>"; $fav = str_split(';',$u['music']); foreach ($fav as $song) { $a = split(':',$song); echo "<a href='play.php?id='".$a[0]."'>".@$a[1]."</a> \r\n"; } $ret.= "</td></tr> </table> </td></tr></table> "; } html($user.'\'s Profile',$ret); } else if (!empty($_SESSION['u'])) { if (isset($_GET['edit'])) { mysql_query($sql) or die(mysql_error()); } $sql = "SELECT * FROM `musix`.`userdetails` WHERE `user` = '".$_SESSION['u']."' LIMIT 1;"; $res = mysql_query($sql) or die(mysql_error()); $ret.= "<h1>Edit Profile</h1>"; while($u = mysql_fetch_assoc($res)) { } html('Your Profile',$ret); } else { header('location: login.php'); } ?> INC.PHP: <?PHP session_set_cookie_params(3600*24*355); error_reporting(E_ALL); session_start(); mysql_connect('localhost','root','') or die(mysql_error()); mysql_select_db('musix') or die(mysql_error()); function lognm() { return gmdate('[m/d/Y H:i:s] ').$_SERVER['REMOTE_ADDR']; } function logme($str) { $str = lognm().$str; $log = fopen('`site.log','a+'); fwrite($log,$str."\r\n"); fclose($log); } function get_comments() {$id = @$_GET['id']; $comments = mysql_query('SELECT * FROM `comments` WHERE `pid`='.$id.' ORDER BY `cid` ASC'); $RET = 'Post a Comment: <form method="POST" action="comment.php"><table><tr><td>'; if (empty($_SESSION['u'])) { $RET.= 'Posting as: <input type="text" name="name" value="'.$_SERVER['REMOTE_ADDR'].'" />'; } else { $RET.= '<input type="hidden" name="name" value="'.$_SESSION['u'].'" /> Posting as: '.$_SESSION['u']; } $RET.= ' </td><td> <input type="submit" name="sub" value="Post Comment" /></td></tr> <td colspan="2"><input type="hidden" name="id" value="'.$id.'" /> <input type="hidden" name="dt" value="'.time().'" /> <textarea name="text" cols="50" rows="4"> Please enter your comment here...</textarea> </td></tr></table> </form> '; while ($row = @mysql_fetch_assoc($comments)) { $RET.= '<table width="50%" style="background-color:#191919;"><tr><th style="background-color:#595959;">'.$row['name'].'</th></tr> <tr><td style="background-color:#595959;"> '.$row['text'].'</td></tr></table>'."<br/>\r\n"; } return($RET); } function clean($str) { $str = @trim($str); if(version_compare(phpversion(),'4.3.0') >= 0) { if(get_magic_quotes_gpc()) { $str = stripslashes($str); } if(@mysql_ping()) { $str = mysql_real_escape_string($str); } else { $str = addslashes($str); } } else { if(!get_magic_quotes_gpc()) { $str = addslashes($str); } } return $str; } function html($TITLE,$RET,$HEAD = "",$down = false) { $RET = str_replace('{{BLOCK}--COMMENTS--(ID}}:',get_comments(),$RET); echo '<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Musix :: '.$TITLE.'</title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <base href="http://'.$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'].'" /> <style type="text/css"> body,table,img,td,th { font-family: Geneva, Arial, Helvetica, sans-serif; background-color: #383838; text-align:center; font-size: 14px; color: #EEEEEE; border: 0px; } textarea,input,file { background-color: #222222; color: #00DDFF; } submit,button { background-color: #050505; color: #00DD00; } a:link,link,a { color: #FF0000; } </style> '.$HEAD.' </head> '; if ($down) { echo '<body onload="timedCount();">'; } else { echo '<body>'; } echo '<div align="center"> <table width="75%" border="1"> <tr> <th width="25%" align="left"> </th> <th width="50%" align="center"> <a href="http://'.$_SERVER['SERVER_NAME'].'/six/index.php"><img src="http://'.$_SERVER['SERVER_NAME'].'/six/header.gif" alt="Header Image for Musix" style="border:0px;" /></a> </th>'; if (!empty($_SESSION['u'])) { echo ' <th width="25%" align="left"> Welcome, '.$_SESSION['u'].'! </th>'; } else { echo ' <th width="25%" align="right"> <form method="POST" action="login.php"> User: <input type="text" name="user" size="15" /><br /> Pass: <input type="password" name="pass" size="15" /><br /> <a href="register.php">Register</a> | <input type="submit" value="Login" name="quicklogin" /> </form> </th>'; } echo ' </tr> <tr> <td colspan="3"><table width="100%"><tr> <td><h3><a href="search.php">Search</a></h3></td> <td><h3><a href="up.php">Upload</a> (<a href="qup.php">Quick</a>)</h3></td>'; echo ' </tr></table></td> </tr> <tr> <td colspan="3"><div align="center">'.$RET.'</div></td> </tr> <tr> <th colspan="3">Musix® Copyright© Damon Hosting 2007. All Rights Reserved.<br/></th> </tr> </table><br/> <!-- Begin: AdBrite --> <script type="text/javascript">'; echo " var AdBrite_Title_Color = 'ff3333'; var AdBrite_Text_Color = 'CCCCCC'; var AdBrite_Background_Color = '383838'; var AdBrite_Border_Color = '191919'; </script>"; echo ' <span style="white-space:nowrap;"><script src="http://ads.adbrite.com/mb/text_group.php?sid=495634&zs=3732385f3930" type="text/javascript"></script><!-- --><a target="_top" href="http://www.adbrite.com/mb/commerce/purchase_form.php?opid=495634&afsid=1"><img src="http://files.adbrite.com/mb/images/adbrite-your-ad-here-leaderboard-w.gif" style="background-color:#191919" alt="Your Ad Here" width="14" height="90" border="0" /></a></span> <!-- End: AdBrite --></div></body></html>'; exit(); } ?> I click profile links like "profile.php?u=admin" and it logs me out, and shows me admin's profile. The login box at the top shows up instead of saying "welcome admin"... It affectively unset's session. Please help me! EDIT by toplay: please don't use that abbreviation.
  7. this error only shows in the shithole of the internet, ie7. but my site needs to be cross compatible. Your code gives me the same thing... lol.
  8. I did not know that it could only do one query at a time.. which would explain my problem. and this is PHP mysql because the ENTIRE file is php LOL calling mysql. It turns out php was my problem. I have split EVERY insert and EVERY create to its own mysql query, and it works now. I might run into an erorr soon so I won't press topic solved untill my test run finishes...
  9. Here is my MYSQL query: mysql_query("CREATE TABLE `phpbb2_auth_access` ( `group_id` mediumint( NOT NULL default '0', `forum_id` smallint(5) unsigned NOT NULL default '0', `auth_view` tinyint(1) NOT NULL default '0', `auth_read` tinyint(1) NOT NULL default '0', `auth_post` tinyint(1) NOT NULL default '0', `auth_reply` tinyint(1) NOT NULL default '0', `auth_edit` tinyint(1) NOT NULL default '0', `auth_delete` tinyint(1) NOT NULL default '0', `auth_sticky` tinyint(1) NOT NULL default '0', `auth_announce` tinyint(1) NOT NULL default '0', `auth_vote` tinyint(1) NOT NULL default '0', `auth_pollcreate` tinyint(1) NOT NULL default '0', `auth_attachments` tinyint(1) NOT NULL default '0', `auth_mod` tinyint(1) NOT NULL default '0', KEY `group_id` (`group_id`), KEY `forum_id` (`forum_id`) ) CREATE TABLE `phpbb2_banlist` ( `ban_id` mediumint( unsigned NOT NULL auto_increment, `ban_userid` mediumint( NOT NULL, `ban_ip` char( NOT NULL, `ban_email` varchar(255) default NULL, PRIMARY KEY (`ban_id`), KEY `ban_ip_user_id` (`ban_ip`,`ban_userid`) ) AUTO_INCREMENT=1 ; BUNCH OF OTHER SQL") or die(mysql_error()); Here is what the page tells me: 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 'CREATE TABLE `phpbb2_banlist` ( `ban_id` mediumint( unsigned NOT NULL auto_' at line 20 Please tell me what the problem is. I am incredibly confused. P.S. The database shows 0 tables after the page is run.
  10. not working. now im using this: but it give different errors: **PAGE HEADER STUFF AND CSS** <script language="javascript" type="text/javascript"> function popitup(url) { newwindow=window.open(url,'?','height=100,width=300,resizable=no,scrollbars=no,toolbar=no,status=no'); if (window.focus) {newwindow.focus()} return false; } </script> </head> ** PAGE BODY STUFF ** <a href='play.php?id=2318454' onclick="return popitup('splay.php?id=2318454');"> ** PAGE BODY STUFF ** Now, this works fine in forefox, opens the popup and ignores the href because it returned false. BUT IN IE 7 this gives me 1 error and goes to the HREF. Line: 30 Char: 2 Error: Invalid Argument Code: 0 Line 30 is the <A href thing
  11. <a href="javascript:window.open('splay.php?id=1871032','Play Song','height=100,width=300,resizable=no,scrollbars=no,toolbar=no,status=no');"> no matter what I do, it alwasy says: Line: 1 Char: 1 Error: Invalid Argument Code: 0 Please help me >< I am getting fed up with JS.
  12. ya sorry, I didn't have time to look up basename at the time, thanks for your guy's help. Basename did it.
  13. I have made a version of this mod for vbulletin if you would be willing to pm me, I could give you pricing information (Installation included in price.)
  14. nope, I am doing this: Scanning a directory for files using glob creating a header (h#) for them using their NAME eval'ing these files to add them to this script im in. ending that header block (/h#) currently im doing this a very long way: <?PHP function parse_plugin($con,$file) { $file = str_replace('./`admin/plugins/','',$file); $file = str_replace('bottom','',$file); $file = str_replace('middle','',$file); $file = str_replace('top','',$file); $file = str_replace('.php','',$file); $file = str_replace('/','',$file); begin_frame($file,true); eval($con); end_frame(); } foreach(glob('./`admin/plugins/top/*.php') as $file) { parse_plugin(file_get_contents($file),$file); } //--bunch of script--// foreach(glob('./`admin/plugins/middle/*.php') as $file) { parse_plugin(file_get_contents($file),$file); } //--bunch of script--// foreach(glob('./`admin/plugins/bottom/*.php') as $file) { parse_plugin(file_get_contents($file),$file); } ?>
  15. Yes, this is almost like PARSE_URL, but no this is not what I want to do. Simplest way to explain it is by example. I want to turn this: ./`admin/plugins/top/*.php Into this: * I want to get the name of the script IN the file. The files PATH, is not going to be /`admin/plugins/top/. The paths will be ./`admin/plugins/* (top | middle | bottom). How would I convert these names?
  16. fixed it was a stupid error "'" should have been ", '"
  17. ok I fixed that by splitting the hell out of it but now I get these problems: CODE: $ARR = array_map("sqlesc", array($wantusername, $wantpasshash, $secret, $editsecret, $a['inviter'], $email)); $ARG = implode(',', $ARR); $SQL = "INSERT INTO users (username, passhash, secret, "; $SQL.= "editsecret, invitedby, email, added) VALUES ( "; $SQL.= $ARG ."' ". get_date_time() ."')"; $ret = mysql_query($SQL); if (!$ret) { if (mysql_errno() == 1062) bark("Username already exists!"); bark("borked<br><br>$SQL<br><br>".mysql_error()); } The page shows:
  18. Two problems in two situtations with the same code: If I do this: implode(",", array_map("sqlesc", array($wantusername, $wantpasshash, $secret, $editsecret, $a['inviter'], $email))) ."'". get_date_time() ."')"); It does not expect the last ) out of ))). Although I count three opening (... if I do this: implode(",", array_map("sqlesc", array($wantusername, $wantpasshash, $secret, $editsecret, $a['inviter'], $email)) ."'". get_date_time() ."')"); It tells me BAD ARGUMENTS.
  19. ok I finally fixed it, this code worked: UPDATE `filepirate`.`FILES` SET `Downloads`=`Downloads`+1 WHERE `ID`=$ID
  20. please help, I need this . Then my file upload site will becomplete! with that session problem fix I already have profiles, memebrs file owners, file sizes, downloading from and uplooading to servers / ftp servers... Uploading from a computer with progress bar for ALL of them. I have been working on this for a long time. Just this stupid download counter thing now, then it's done!
  21. good job there! please click on TOPIC SOLVED at the bottom.
  22. as far as I know you can use URL's for filesize if (filesize($URL)<20480) { $strImage = file_get_contents($URL); }
  23. and I was trying to figure that one out for a good half hour
  24. I know, but htis is much SMALLER code as you have noticed. It is what im used to. It is not a bad coding practice, but its not organized either. Its not depricated and yet its not fully recommended.
  25. no, i am workking on different db's at once so I never used SELECT_DB `filepirate`.`FILES` this code will select table `FILES` in db `filepirate`
×
×
  • 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.