Jump to content

JustMike

Members
  • Posts

    33
  • Joined

  • Last visited

Everything posted by JustMike

  1. I changed my jquery code and now I have this: $(document).ready(function(){$('.ajaxForm').each(function (){if( $(this).attr('data-id') == $('.postStreamComment').attr('data-id') ) { $('.postStreamComment').click(function(e){ e.preventDefault(); $.post( '/stream/post-comment', { commentText:$('.comment-'+$(this).attr('data-id')).val(), stream_id:$(this).attr('data-id') }, function( data ){ $('.comment-'+$(this).attr('data-id')).val('') }, 'json' ); });}});}); Now it posts the correct information into the database but the code that should clear the comment input (this code: $('.comment-'+$(this).attr('data-id')).val('') ) is not working... Can you tell me what I'm doing wrong now please? Thank you! Edit -------------------- Solved the problem, put the code just outside $.post(). Thanks for the help!
  2. In the network tab i get this in the general section: And this in the form data section: Now it sends the correct id/text to the db but it redirects me to http://localscript.dev/stream/post-comment ...
  3. Sorry, the typo was repaired in my file (just after posting this and I forgot to correct here too), but in the database is inserted only the id of the the last post. I'm a jquery beginner (so... probably I'm wrong, because i'm still learning), but I think it should be something like this: $(document).ready(function(){ $('.postStreamComment').click(function(){ // e.preventDefault(); $.ajax({ url: 'stream/post-comment', type: "post", data: { $('.ajaxForm').each(function(){ 'commentText':$('input[name=commentText]').val(), 'stream_id':$('input[name="stream_id"]').attr('value') }); }, success: function(data){ $('.ajaxClear').val(''); alert($('input[name=stream_id]').val()); //this alerts the id of the last post every time... } }); return false; });});
  4. Hi, I have a problem with ajax posting into db, the post_id is not inserted into db, instead is inserted 0. In the firebug console i get this message: POST http://localscript.dev/stream/post-comment 200 OK If i inspect the element with firebug the hidden input with the id is correct. I have a form looking like this: <form action="stream/post-comment" method="POST" class="ajaxForm"> <inpu type="hidden" name="stream_id" value="<?php echo $stream['id']; ?>"> <div class="col-md-10" style="padding-left: 0px;"> <input type="text" name="commentText" class="form-control ajaxClear"> </div> <div class="col-md-1" style="padding: 0px;"> <input type="submit" value="Post" class="btn btn-primary postStreamComment"> </div></form> on the stream/post-comment file i have something like this: $id = $_POST['stream_id'];$comment = htmlspecialchars($_POST['commentText']);$user = $_SESSION['user_id'];$mysqli->query("INSERT INTO stream_comments('post_id', 'comment', 'posted_by') VALUES('{$id}', '{$comment}', '{$user}')") or trigger_error($mysqli->error); and in my js file i have this code: $(document).ready(function(){ $('.postStreamComment').click(function(){ $.ajax({ url: 'stream/post-comment', type: "post", data: { 'commentText':$('input[name=commentText]').val(), 'stream_id':$('input[name=stream_id]').val() }, success: function(data){ $('.ajaxClear').val(''); } }); return false; });}); What is the problem with my code? Thanks!
  5. Thanks, I solved the problem. There was a error in the __construct (I had the same name for two variables) and one in the createbackup method... the final mysqldump command is this: $actualCreateBackup = "mysqldump --opt --host=".$this->dbHost." --user=".$this->user." --password=".$this->password." ".$this->dbName." > ".$this->sqlFile;
  6. Hi, I'm trying to create a php class that creates a database backup but the result is an empty file. Here is my code so far: Note: The uploadBackup() method is not ready yet, I'm still trying to figure out the createbackup() method... <?phpclass dropboxbackup{ // temp directiry public $tempDir; // MySQL DB connection data (username, password, database, host and prefix) private $user; private $password; private $dbName; private $dbHost; //DropBox Information private $dropbox_user; private $dropbox_pass; private $dropbox_loc; //File Information private $fileName; private $sqlFile; public $dbPrefix; private $d = DIRECTORY_SEPARATOR; public function __construct($td, $u, $p, $n, $h, $p){ $this->tempDir = $td; $this->user = $u; $this->password = $p; $this->dbName = $n; $this->dbHost = $h; $this->dbPrefix = $p; } public function createbackup(){ $creationDate = date('Y_m_d'); $this->sqlFile = $this->tempDir."{$this->d}".$this->dbPrefix."_".$creationDate.".sql"; //$actualCreateBackup = "mysqldump -u".$this->user."-p".$this->password." ".$this->dbName." > ".$sqlFile; //$actualCreateBackup = "C:WebServermysqlbinmysqldump --opt -h".$this->dbHost." -u".$this->user."-p".$this->password." ".$this->dbName." > ".$sqlFile; //$actualCreateBackup = "mysqldump -h".$this->dbHost." -u".$this->user." -p'".$this->password."' ".$this->dbName." > ".$sqlFile; $actualCreateBackup = "C:WebServermysqlbinmysqldump --opt --host=".$this->dbHost." --user=".$this->user." --password=".$this->password." ".$this->dbName." > ".$this->sqlFile; //shell_exec($actualCreateBackup); exec($actualCreateBackup); } public function deleteBackup(){ unlink($this->sqlFile); } public function uploadBackup(){ try { // Upload database backup to Dropbox $uploader = new DropboxUploader($this->dropbox_user, $this->dropbox_pass); $uploader->upload($this->sqlFile, $this->dropbox_loc); }catch(Exception $e){ die($e->getMessage()); } } } and the class is instantiated in index.php : <?phpinclude("dropboxbackup.php");$a = new dropboxbackup('temp', 'root', '', 'db_name', 'localhost', 'prefix_');$a->createbackup();?> After I hit index.php I get an empty file in the temp directory named prefix__2014_06_02.sql What I'm doing wrong? I searched this problem on google but I still can't figure it out... the root user is set to ALL PRIVILEGES, the database information is correct...
  7. I don't know what happened, but I deleted the entire source code and uploaded it again without the .htaccess file and now works perfectly. Anyway, thanks for your help!
  8. This is the code, and on the first line is the php opening tag, <?php And on the second line is this exact code require_once "include/code.php"; I changet the " with ' but it shows the same error. I checked my core.php file for errors and works, now I deleted the content of the .htaccess file and now shows a blank page what page I'm trying to access.
  9. I deleted that line and now I can see only this in the browser:
  10. Hi, I have a problem after I moved a site froma a webhosting company to another. After I finished moving the files and the database I had the surprise to see the php code in the browser. For example, this is my home.php file: <?phprequire_once "include/code.php";loggedinorreturn();if($USER){ if ($_SERVER["REQUEST_METHOD"] === "POST" && $USER) { $choice = mysql_real_escape_string(htmlspecialchars($_POST["choice"])); if ($USER && $choice != "" && $choice < 256 && $choice == floor($choice)){ $res = sql_query("SELECT id FROM polls ORDER BY added DESC LIMIT 1") or sqlerr(); $arr = mysql_fetch_assoc($res) or die("No poll"); $pollid = $arr["id"]; $userid = $USER["id"]; $res = sql_query("SELECT * FROM pollanswers WHERE pollid=$pollid && userid=$userid") or sqlerr(); $arr = mysql_fetch_assoc($res); if ($arr) die("Dupe vote"); mysql_query("INSERT INTO pollanswers VALUES(0, $pollid, $userid, $choice)") or sqlerr(); mysql_query("UPDATE users SET poll_voted = 'yes' WHERE id = $USER[id] AND poll_voted = 'no'") or sqlerr(); if (mysql_affected_rows() != 1) stderr("Error", "An error occured. Your vote has not been counted."); header("Location: home.php"); die; } }}stdhead("Home");//news + poll (side by side ?)if($USER){echo "<table border='0' width='910'>";echo "<tr><td class='news_side' style='padding: 5px;vertical-align: top;'>";//news START $select_news = mysql_query("SELECT * FROM news_items") or sqlerr(__FILE__,__LINE__); echo "<div id='accordion'>"; while($row = mysql_fetch_assoc($select_news)){ echo "<h3><b>".$row['title']."</b> added on <em>".$row['added']."</em></h3>"; echo "<div><p>".$row['body']."</p></div>"; } echo "</div>"; echo '<script> $( "#accordion" ).accordion(); </script>';//news END//seeding opportunity Startif($USER['id'] == 1){ $uid = $USER['id'];$t_q1 = <<<SQLSELECT userid AS uid, torrentid AS tid, complete_date AS cd, id AS tidt, leechers AS l FROM snatched, torrent INNER JOIN on(torrentid = id)WHERE uid = {$uid} AND cd <> '0000-00-00 00:00:00' AND l <> '0'SQL;# $my_q = "SELECT * FROM snatched WHERE userid = {$uid} AND complete_date <> '0000-00-00 00:00:00'";$tq = @mysql_query($t_q1); if(mysql_num_rows($tq) != 0){ $htmlout = "<br/><div id='accordion'>"; $htmlout .= "<h3>Seeding Opportunity</h3>"; $htmlout .= "<div><p></p></div>"; $htmlout .= "</div>"; echo $htmlout; }}//seeding opportunity End//chat STARTecho "<table align='center' colspan='0' cellspacing='0' style='background-color: #49939a;border-radius: 5px;width: 636px;margin-top: 10px;'><tr><td style='background: url(themes/Jungle2/images/chat_new_index.png);background-color: #367074; width: 636px; height: 20px;padding: 0; margin: 0;'><font style='font-size: 11px; color: white; float: right;padding-right: 5px;'> [<a style="color:#FFFFFF;" href="javascript: void(0)" onclick="window.open('shoutbox_popup.php', 'windowname1', 'width=588, height=450'); return false;"><font style=''>Open chat in Pop-Up</font></a>] [<a style='color:#FFFF99;' href='shoutbox' target='sbox'>refresh</a>] </font> </td></tr>";echo "<tr><td>";echo "<iframe src='shoutbox.php' width='630' height='300' align='center' frameborder='0' name='sbox' marginwidth='0' class='sbced' marginheight='0' border='0'></iframe>";echo "</td></tr>";echo "<tr><td>";echo " <form action='shoutbox.php' method='get' target='sbox' style='padding-bottom: 0px;' name='shbox' onSubmit='mySubmit()'> <span align='center'> <img src='pic/shout_now_arrow.PNG'> <input class='inputf' type='text' name='shbox_text' size='60' style='height: 18px;background: url(pic/shout_msg_bg_1.png);border: 1px solid #5a5a5a;'> <input type='submit' class='button1' value=' Shout! ' style='background: url(pic/shout_msg_bg_1.png);border: 1px solid #5a5a5a;'> <input type='hidden' name='sent' value='yes'> <span align='center'> <a href="javascript: SmileIT(':-)','shbox','shbox_text')" style='padding: 0px 3px 0px 3px;'><img border=0 src=pic/smilies/smile1.gif border='0'></a> <a href="javascript: SmileIT(':smile:','shbox','shbox_text')" style='padding: 0px 3px 0px 3px;'><img border=0 src=pic/smilies/smile2.gif border='0'></a> <a href="javascript: SmileIT(':-D','shbox','shbox_text')" style='padding: 0px 3px 0px 3px;'><img border=0 src=pic/smilies/grin.gif border='0'></a> <a href="javascript: SmileIT(':-|','shbox','shbox_text')" style='padding: 0px 3px 0px 3px;'><img border=0 src=pic/smilies/noexpression.gif border='0'></a> <a href="javascript: SmileIT(':-/','shbox','shbox_text')" style='padding: 0px 3px 0px 3px;'><img border=0 src=pic/smilies/confused.gif border='0'></a> <a href="javascript: SmileIT(':-(','shbox','shbox_text')" style='padding: 0px 3px 0px 3px;'><img border=0 src=pic/smilies/sad.gif border='0'></a> <a href="javascript: SmileIT(':weep:','shbox','shbox_text')" style='padding: 0px 3px 0px 3px;'><img src=pic/smilies/weep.gif border='0'></a> <a href="javascript: SmileIT(':-O','shbox','shbox_text')" style='padding: 0px 3px 0px 3px;'><img src=pic/smilies/ohmy.gif border='0'></a> <a href="javascript: SmileIT('8-)','shbox','shbox_text')" style='padding: 0px 3px 0px 3px;'><img src=pic/smilies/cool1.gif border='0'></a> <a href="javascript: SmileIT(':yawn:','shbox','shbox_text')" style='padding: 0px 3px 0px 3px;'><img src=pic/smilies/yawn.gif border='0'></a> <a href="javascript: SmileIT(':sly:','shbox','shbox_text')" style='padding: 0px 3px 0px 3px;'><img src=pic/smilies/sly.gif border='0'></a> <a href="javascript: SmileIT(':weirdo:','shbox','shbox_text')" style='padding: 0px 3px 0px 3px;'><img src=pic/smilies/weirdo.gif border='0'></a> <a href="javascript: SmileIT(':sneaky:','shbox','shbox_text')" style='padding: 0px 3px 0px 3px;'><img src=pic/smilies/sneaky.gif border='0'></a> <a href="javascript: SmileIT(':kiss:','shbox','shbox_text')" style='padding: 0px 3px 0px 3px;'><img src=pic/smilies/kiss.gif border='0'></a> <a href="javascript: SmileIT(':evil:','shbox','shbox_text')" style='padding: 0px 3px 0px 3px;'><img src=pic/smilies/evil.gif border='0'></a> <a href="javascript: SmileIT(':yucky:','shbox','shbox_text')" style='padding: 0px 3px 0px 3px;'><img src=pic/smilies/yucky.gif border='0'></a> <a href="javascript: SmileIT(':wave:','shbox','shbox_text')" style='padding: 0px 3px 0px 3px;'><img src=pic/smilies/wave.gif border='0'></a> <a href="javascript: SmileIT(':?:','shbox','shbox_text')" style='padding: 0px 3px 0px 3px;'><img src=pic/smilies/question.gif border='0'></a> <a href="javascript: SmileIT(':lol:','shbox','shbox_text')" style='padding: 0px 3px 0px 3px;'><img src=pic/smilies/laugh.gif border='0'></a> <a href="javascript: PopMoreSmiles('shbox','shbox_text')" style='font-family: philosopher; font-size: 14px;'><b>All Smilies</b></a> </span> </form>";echo "</td></tr>";echo "</table>";//chat END/*Active Users START*****************************************************/ if (get_user_class() >= UC_POWER_USER){ $dt = gmtime() - (60 * 5); $dt = sqlesc(get_date_time($dt)); $res = sql_query("SELECT id, username, iconitasb, class, warned, donor, isdj, gender FROM users WHERE last_access >= $dt ORDER BY class DESC") or print(mysql_error()); $numberactive = mysql_num_rows($res); while ($arr = mysql_fetch_assoc($res)) { if ($activeusers) $activeusers .= ",n"; switch ($arr["class"]) { case UC_HUNTER:$arr["username"] = '<font color="#151B8D">'.$arr['username'].'</font>'; break; case UC_STAFFLEADER:$arr["username"] = '<font color="#F0F8FF" style="font-size: 12px;">'.$arr['username'].'</font>';break; case UC_SYSOP:$arr["username"] = "<font color="#6eb7be" style='font-size: 12px;'>" . $arr["username"] . "</font>";break; case UC_CODDER:$arr["username"] = "<font color="#2F4F4F" style='font-size: 12px;'>" . $arr["username"] . "</font>";break; case UC_ELITE:$arr["username"] = "<font color="#4B0082" style='font-size: 12px;'>" . $arr["username"] . "</font>";break; case UC_ADMINISTRATOR:$arr["username"] = "<font color="#E2A012" style='font-size: 12px;'>" . $arr["username"] . "</font>";break; case UC_ELITEMOD:$arr["username"] = "<font color="#F0E68C" style='font-size: 12px;'>" . $arr["username"] . "</font>";break; case UC_MODERATOR:$arr["username"] = "<font color="#696969" style='font-size: 12px;'>" . $arr["username"] . "</font>";break; case UC_POWER:$arr["username"] = "<font color="#00BFFF" style='font-size: 12px;'>" . $arr["username"] . "</font>";break; case UC_UPLOADER:$arr["username"] = "<font color="#FA8072" style='font-size: 12px;'>" . $arr["username"] . "</font>";break; case UC_JUNIOR_UPLOADER:$arr["username"] = "<font color="#046288" style='font-size: 12px;'>" . $arr["username"] . "</font>";break; case UC_ICELEGEND:$arr["username"] = "<font color="#BA55D3" style='font-size: 12px;'>" . $arr["username"] . "</font>";break; case UC_SPECIALVIP:$arr["username"] = "<font color="#7B68EE" style='font-size: 12px;'>" . $arr["username"] . "</font>";break; case UC_EXTREMVIP:$arr["username"] = "<font color="#1F005C" style='font-size: 12px;'>" . $arr["username"] . "</font>";break; case UC_VIP:$arr["username"] = "<font color="#008000" style='font-size: 12px;'>" . $arr["username"] . "</font>";break; case UC_ICE_LOVER:$arr["username"] = "<font color="#008080" style='font-size: 12px;'>" . $arr["username"] . "</font>";break; case UC_EXTREME_USER:$arr["username"] = "<font color="#7F6A00" style='font-size: 12px;'>" . $arr["username"] . "</font>";break; case UC_POWER_USER:$arr["username"] = "<font color="#80A82A" style='font-size: 12px;'>" . $arr["username"] . "</font>";break; case UC_USER:$arr["username"] = "<font color="#000000" style='font-size: 12px;'>" . $arr["username"] . "</font>";break; case UC_HAHALERA:$arr["username"] = "<font color="#FF0000" style='font-size: 12px;'>" . $arr["username"] . "</font>";break; }$arr["username"] = '<a href="userdetails?id='.$arr['id'].'">'.$arr["username"].'</a>';if ($arr["donor"] == "yes") $star = "<img src="pic/star.gif" alt="Donated"/>";else $star = "";if ($arr["warned"] == "yes") $warn = "<img src="pic/warned.gif" alt="Warned"/>";else $warn = "";if ($arr["isdj"] == "yes") $isdjj = "<img src=/pic/isdj.gif title='This user is DJ'>";else $isdjj = "";$donator = $arr["donor"] > 0; if ($donator) $activeusers .= ""; $activeusers .= $arr["username"].$star.$warn.$isdjj;}if (!$activeusers) $activeusers = "Nici un user online in ultimele 5 minute."; $dt = gmtime() - 3600;$dt = sqlesc(get_date_time($dt));$res = sql_query("SELECT id, username, class, warned, donor FROM users WHERE last_access >= $dt ORDER BY username") or print(mysql_error());while ($arr = mysql_fetch_assoc($res))if ($rec["value"] < $numberactive) sql_query("UPDATE config SET value=$numberactive, text='".get_date_time()."' WHERE name='max_online'");echo "<table align='center' colspan='0' cellspacing='0' style='background-color: #49939a;border-radius: 5px;width: 636px;margin-top: 10px;'><tr><td style='background: url(themes/Jungle2/images/active_users_title.PNG);background-color: #367074; width: 636px; height: 20px;padding: 0; margin: 0;'></td></tr><tr><td>";echo $activeusers;echo "</td></tr></table>";}/*Active Users END*****************************************************/ //forumsecho "<table align='center' colspan='0' cellspacing='0' style='background-color: #49939a;border-radius: 5px;width: 636px;margin-top: 10px;'><tr><td style='background: url(themes/Jungle2/images/now_in_forums_title.png);background-color: #367074; width: 636px; height: 20px;padding: 0; margin: 0;'></td></tr><tr><td>"; echo "<table width='100%'> <td style='background: #366f74;border:1px solid #778d44;'>Topic</td> <td style='background: #366f74;border:1px solid #778d44;' width='7%'>Author</td> <td style='background: #366f74;border:1px solid #778d44;' width='25%'>Last Post</td> </tr>"; $res = mysql_query("SELECT posts.id AS pid, posts.topicid, posts.userid AS userpost, posts.added, topics.id AS tid, topics.userid AS usertopic, topics.subject, topics.forumid, topics.lastpost, topics.views, forums.name, forums.minclassread, forums.postcount, users.username, topicposter.username AS tusername FROM posts, topics, forums, users, users AS topicposter WHERE posts.topicid = topics.id AND topics.forumid = forums.id AND posts.userid = users.id AND topics.userid = topicposter.id AND minclassread <=" . $USER["class"] . " ORDER BY posts.added DESC LIMIT 5");$i = 0; while ($postsx = mysql_fetch_assoc($res)) { $i++; if($i == 5){$dotted_style = "";}else{ $dotted_style = "style='border-bottom: 1px dotted black;font-size:14px;'"; } $title = ucwords($postsx["subject"]); echo "<tr>"; echo "<td {$dotted_style}> <a style='color: #cbd93f;font-family: philosopher;' href="forums.php?action=viewtopic&topicid={$postsx["tid"]}&page=p{$postsx["pid"]}#{$postsx["pid"]}"><b><i>{$title}</i></b></a><br />in <a style='color: #92b058;font-family: philosopher;' href="forums.php?action=viewforum&forumid={$postsx["forumid"]}">{$postsx["name"]}</a></td>"; echo "<td {$dotted_style}><a style='color: #cbd93f;font-family: philosopher;' href=userdetails.php?id={$postsx["usertopic"]}><b>{$postsx["tusername"]}</b></a></td>"; echo "<td {$dotted_style}>{$postsx["added"]}<br />by <a style='color: #cbd93f;font-family: philosopher;' href=userdetails.php?id={$postsx["userpost"]}><b>{$postsx["username"]}</b></a></td>"; echo "</tr>"; } echo "</table>";echo "</td></tr></table>";//forumsecho "<table align='center' colspan='0' cellspacing='0' style='background-color: #49939a;border-radius: 5px;width: 636px;margin-top: 10px;'><tr><td style='background: url(themes/Jungle2/images/affiliates_title_bg.png);background-color: #367074; width: 636px; height: 20px;padding: 0; margin: 0;'></td></tr><tr><td>";echo "<marquee onMouseover='this.scrollAmount=2' onMouseout='this.scrollAmount=6'><a target='_blank' href='http://www.alphatherm.org/'><img width='160' height='32' border='0' alt='AlphaTherm' title='AlphaTherm' src='/pic/alpha_term.gif'><a target='_blank' href='http://www.icetorrent.org/'><img src='http://img96.imageshack.us/img96/5152/icetorrento.png' WIDTH=160 HEIGHT=32></a><a target='_blank' href='http://www.ronudism.ro/'><img src='/pic/RoNudism.jpg' WIDTH=160 HEIGHT=32></a><a target='_blank' href='http://www.restaurant-bellini.ro'><img src='pic/bellini.png' title='Bellini, Restaurant Italian' WIDTH=160 HEIGHT=32></a></marquee>";echo "</td></tr></table>";echo "</td><td class='poll_side' style='width: 250px;padding: 5px;vertical-align: top;'>";/*poll START*****************************************************/ // Get current poll $res = sql_query("SELECT * FROM polls ORDER BY id DESC LIMIT 1") or sqlerr(); if($pollok=(mysql_num_rows($res))) { $arr = mysql_fetch_assoc($res); $pollid = $arr["id"]; $userid = $USER["id"]; $question = $arr["question"]; $o = array($arr["option0"], $arr["option1"], $arr["option2"], $arr["option3"], $arr["option4"], $arr["option5"], $arr["option6"], $arr["option7"], $arr["option8"], $arr["option9"], $arr["option10"], $arr["option11"], $arr["option12"], $arr["option13"], $arr["option14"], $arr["option15"], $arr["option16"], $arr["option17"], $arr["option18"], $arr["option19"]); // Check if user has already voted $res = sql_query("SELECT * FROM pollanswers WHERE pollid=$pollid AND userid=$userid") or sqlerr(); $arr2 = mysql_fetch_assoc($res); } $poll_title = ""; if($pollok) {echo "<p id='poll'>"; ?> <table align = "center" colspan='0' cellspacing='0' style='background-color: #49939a;border-radius: 5px;width: 246px;'> <tr> <td colspan="3" style='background: url(themes/Jungle2/images/poll_title_bar.png);background-color: #367074; width: 246px; height: 20px;padding: 0; margin: 0;'> <?php if (get_user_class() >= UC_ELITE) { echo "<font style='font-size: 11px; color: white; float: right;padding-right: 5px;'> [<a style='color:#F04F4F;font-size:10px;' href='makepoll?returnto=main'><b>New Poll</b></a>] [<a style='color:#F04F4F;font-size:10px;' href='makepoll?action=edit&pollid=$arr[id]&returnto=main'><b>Edit</b></a>] [<a style='color:#F04F4F;font-size:10px;' href='polls?action=delete&pollid=$arr[id]&returnto=main'><b>Delete</b></a>] </font>"; } ?> </td></tr> <tr> <td align="center" colspan='3' > <CENTER><? print("<div align='center' id='poll' style='color:000000;font-size:14px;font-family:philosopher;'> <b>".str_replace('','',$question)."</b></div>"); print("<table border="0" cellspacing="0" cellpadding="0"><tr><td align="left" style = 'font-weight: normal;'>"); $voted = $arr2; if ($voted) { if ($arr["selection"]) $uservote = $arr["selection"]; else $uservote = -1; // we reserve 255 for blank vote. $res = sql_query("SELECT selection FROM pollanswers WHERE pollid=$pollid AND selection < 20") or sqlerr(); $tvotes = mysql_num_rows($res); $vs = array(); // array of $os = array(); while ($arr2 = mysql_fetch_row($res)) $vs[$arr2[0]] += 1; reset($o); for ($i = 0; $i < count($o); ++$i) if ($o[$i]) $os[$i] = array($vs[$i], $o[$i]); function srt($a,$ { if ($a[0] > $b[0]) return -1; if ($a[0] < $b[0]) return 1; return 0; } if ($arr["sort"] == "yes") usort($os, srt); print("<table align="left" width="100%" border="0" cellspacing="0" cellpadding="0">"); $i = 0; while ($a = $os[$i]) { if ($i == $uservote) $a[1] .= " *"; if ($tvotes == 0) $p = 0; else $p = round($a[0] / $tvotes * 100); if ($i % 2) $c = ""; else $c = ""; /* */ print("<tr> <td style='font-family:verdana,serif; font-size:11px;color:#363636; border-bottom: 1px dotted black;' align='bottom' width='100%' $c> →<b>".stripslashes($a[1]). "</b><BR><div style='height: 12px; background-color: red;background: url(pic/graph_middle_1.gif); float: left;width: ".($p * 3).";max-width: 225px;' ></div><span style='color:#363636;font-size:10px;vertical-align:top;font-family:verdana;float:right'>$p%</span></td></tr>"); ++$i; } print("<tr><td align='center' style='padding:5px;color:#000000;font-size:12px;font-family:verdana;'><b>Votes: $tvotes</b></td></tr>"); print("</table><br>"); print("</table>"); $tvotes = number_format($tvotes); } else { print("<form method="post" action="index">n"); $i = 0; while ($a = $o[$i]) { print("<input style='padding-top:3px;' type="radio" name="choice" value="$i" /><font style='font-family:verdana; font-size:11px;color:#363636;'>$a</font><br />n"); ++$i; } print("<br />"); print("<p align="center"><input type="submit" value="Vote!" class="btn" /></p></form></table>"); }?></CENTER></tr></td></table><?echo "</p>"; } else { echo "<table width="100%" border="0" cellspacing="0" cellpadding="10"><tr><td align="center">n"; echo "<table class="cedreapoll" border="0" bgcolor="#63a006" cellspacing="0" cellpadding="0"><tr><td class="text">"; echo"<h3>No Active Polls</h3>n"; echo "</td></tr></table></td></tr></table>"; }/*poll END*****************************************************/ /*Site Stats Start*****************************************************/ //most wanted movie$s = mysql_query("SELECT * FROM torrents ORDER BY seeders+leechers DESC LIMIT 1") or sqlerr(__FILE__,__LINE__);$mw_tor = mysql_fetch_assoc($s);echo "<table align='center' colspan='0' cellspacing='0' style='background-color: #49939a;border-radius: 5px;width: 246px;margin-top: 10px;'><tr><td style='background: url(themes/Jungle2/images/most_wanted_movie.png);background-color: #367074; width: 246px; height: 20px;padding: 0; margin: 0;'></td></tr>";$id= $mw_tor['id']; if ($mw_tor["extern"] == "yes") {$dllink = "<a href="downloaddht.php/$id/" . rawurlencode($mw_tor["filename"]) . "">";}else {$dllink = "<a href="download.php/$id/" . rawurlencode($mw_tor["filename"]) . "">";}echo "<tr><td>";echo "<center><a href='details?id=".$mw_tor['id']."'><img src=".$mw_tor['poster']." title='".$mw_tor['name']."' alt='".$mw_tor['name']."' style='width: 170px; height: 210px;padding: 5px 0px 2px 0px;'/></a>";echo "<br/><p style='font-family: philosopher; font-size: 14px; padding-top: 0px; padding-bottom: 0px;'><font style='color: #80e600;'><b>Seeders</b></font>: ".$mw_tor['seeders']." <font style='color: #ff0000;'><b>Leechers</b></font>: ".$mw_tor['leechers']."</p>";echo $dllink."<img src='themes/Jungle2/images/download_mw_movie.png'/></a>";echo "</center>";echo "</tr></td>";echo "</table>";//most wanted movieif (get_user_class() >= UC_ELITE){if(isset($_GET['update_stats']) && $_GET['update_stats'] == 1){ $registered = number_format(get_row_count("users")); $torrents = number_format(get_row_count("torrents")); $tseeders = get_row_count("peers", "WHERE seeder='yes' AND userid != '0'"); $tleechers = get_row_count("peers", "WHERE seeder='no'"); $tpeers = ($tseeders + $tleechers); $update_stats=true;$file = fopen("site_stats.txt","w") or die("Cannot open the file");while($update_stats){$string = "<span style='font-size: 14px;display: block;border-bottom: 1px dotted black;'><img src='pic/Membre.gif'/><b>Registered users:</b> {$registered}</span><span style='font-size: 14px;display: block;border-bottom: 1px dotted black;'><img src='pic/filehosting.png'/><b>Torrents:</b> {$torrents}</span><span style='font-size: 14px;display: block;border-bottom: 1px dotted black;'><img src='pic/speed_up.png'/><b>Seeders:</b> {$tseeders}</span><span style='font-size: 14px;display: block;border-bottom: 1px dotted black;'><img src='pic/speed_down.png'/><b>Leechers:</b> {$tleechers}</span><span style='font-size: 14px;display: block;'><img src='pic/ocean.gif'/><b>Peers:</b> {$tpeers}</span>";fwrite($file, $string);$update_stats = false;}fclose($file);}$update_stats = " [<a style='color:#FFFF99;' href='home.php?update_stats=1'>Update</a>] ";}echo "<table align='center' colspan='0' cellspacing='0' style='background-color: #49939a;border-radius: 5px;width: 246px;margin-top: 10px;'><tr><td style='background: url(themes/Jungle2/images/stats_top_bg.PNG);background-color: #367074; width: 246px; height: 20px;padding: 0; margin: 0;'><font style='font-size: 11px; color: white; float: right;padding-right: 5px;'>{$update_stats} </font></td></tr>";echo "<tr><td>";$stats_file_name = "site_stats.txt";$handle = @fopen($stats_file_name, "r");if ($handle) { while (($buffer = fgets($handle, 4096)) !== false) { echo $buffer; } if (!feof($handle)) { echo "Error: unexpected fgets() failn"; } fclose($handle);}echo "</tr></td>";echo "</table>";/*Site Stats End*****************************************************/ /*FaceBook Like Pluginecho "<table align='center' colspan='0' cellspacing='0' style='background-color: #49939a;border-radius: 5px;width: 246px;margin-top: 10px;'><tr><td style='background: url(themes/Jungle2/images/like_us_title.png);background-color: #367074; width: 246px; height: 20px;padding: 0; margin: 0;'></td></tr><tr><td><script src='http://connect.facebook.net/en_US/all.js#xfbml=1'></script><fb:like-box href='http://www.facebook.com/pages/Jungla-Urbana/186496421393843' width='220' height='180' show_faces='true' stream='false' header='false'></fb:like-box></tr></td></table>";*///sidebar endecho "</td></tr>";echo "</table>";$disclaimer = "<h5 style='margin:0;padding: 0px 0px 4px 0px;'>Disclaimer</h5><font style='font-size: 12px;'>None of the files shown here are actually hosted on this server. The links are provided solely by this site's users. The administrator of this site cannot be held responsible for what its users post, or any other actions of its users. You may not use this site to distribute or download any material when you do not have the legal rights to do so. It is your own responsibility to adhere to these terms.</font>";echo "<table style='width: 930px; padding: 15px;'><tr><td>$disclaimer</td></tr></table>";}stdfoot();?> This is the same page loaded by the browse: I don't know htaccess, but I assumed the problem is from there because I tryed changing some things there and the website started to give me errors. Here is my .htaccess file: Options +FollowSymLinksOptions Indexes FollowSymLinks IncludesOptions +IncludesAddType text/html .htmAddOutputFilter INCLUDES .htmAddType text/html .phpAddOutputFilter INCLUDES .phpAddType application/x-httpd-php .htmRewriteEngine onErrorDocument 403 /403.phpErrorDocument 404 /404.phpErrorDocument 500 /500.php# showarticle.php ## with or without trailing slash #RewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^([^/]+)/([^/]+)/?$ showarticle.php?parentarea=$1&area=$2 [L]## this is always with trailing slash #RewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^([^/]+)/$ showarticles.php?parentarea=$1 [L,QSA]RewriteRule ^sticky$ s_items.phpRewriteRule ^announce$ announce.phpRewriteRule ^index$ index.phpRewriteRule ^home$ home.phpRewriteRule ^browse$ browse.phpRewriteRule ^upload$ upload.phpRewriteRule ^viewrequests$ viewrequests.phpRewriteRule ^forums$ forums.phpRewriteRule ^shoutbox$ shoutbox.phpRewriteRule ^shoutbox_popup$ shoutbox_popup.phpRewriteRule ^sbban$ sbban.phpRewriteRule ^chat$ chat.phpRewriteRule ^details$ details.phpRewriteRule ^userdetails$ userdetails.phpRewriteRule ^rulesro$ rulesro.phpRewriteRule ^rules$ rules.phpRewriteRule ^rulesen$ rulesen.phpRewriteRule ^faq$ faq.phpRewriteRule ^faqen$ faqen.phpRewriteRule ^staff$ staff.phpRewriteRule ^controlpanel$ controlpanel.phpRewriteRule ^staff_chat$ staff_chat.phpRewriteRule ^setclass$ setclass.phpRewriteRule ^invite$ invite.phpRewriteRule ^slots$ slots.phpRewriteRule ^logout$ logout.phpRewriteRule ^mytorrents$ mytorrents.phpRewriteRule ^my_items$ my_items.phpRewriteRule ^friends$ friends.phpRewriteRule ^messages$ messages.phpRewriteRule ^games$ games.phpRewriteRule ^casino$ casino.phpRewriteRule ^radio$ radio.phpRewriteRule ^topten$ topten.phpRewriteRule ^wishlist$ wishlist.phpRewriteRule ^subtitles$ subtitles.phpRewriteRule ^mybonus$ mybonus.phpRewriteRule ^bug_report$ bug_report.phpRewriteRule ^blackjack$ blackjack.phpRewriteRule ^barbut$ barbut.phpRewriteRule ^arcade$ arcade.phpRewriteRule ^lotto-tickets$ lotto-tickets.phpRewriteRule ^lotto-players$ lotto-players.phpRewriteRule ^edit$ edit.phpRewriteRule ^downloaddht$ downloaddht.phpRewriteRule ^download$ download.phpRewriteRule ^download_txt$ download_txt.phpRewriteRule ^add$ add.phpRewriteRule ^add2$ add2.phpRewriteRule ^coins$ coins.phpRewriteRule ^simpaty$ simpaty.phpRewriteRule ^viewnfo$ viewnfo.phpRewriteRule ^snatches$ snatches.phpRewriteRule ^thanks$ thanks.phpRewriteRule ^comment$ comment.phpRewriteRule ^my$ my.phpRewriteRule ^login$ login.phpRewriteRule ^signup$ signup.phpRewriteRule ^signupref$ signupref.phpRewriteRule ^recover$ recover.phpRewriteRule ^useragreement$ useragreement.phpRewriteRule ^makepoll$ makepoll.phpRewriteRule ^polls$ polls.phpRewriteRule ^refferer$ refferer.phpRewriteRule ^tv$ tv.phpRewriteRule ^tags$ tags.phpRewriteRule ^sendmessage$ sendmessage.phpRewriteRule ^statistics$ statistics.phpRewriteRule ^stats2$ stats.phpRewriteRule ^clientlister$ clientlister.phpRewriteRule ^statsuploaders2$ statsuploaders2.phpRewriteRule ^pretime$ pretime.phpRewriteRule ^testip$ testip.phpRewriteRule ^faqmanage$ faqmanage.phpRewriteRule ^warned$ warned.phpRewriteRule ^users$ users.phpRewriteRule ^uploaders$ uploaders.phpRewriteRule ^fake_upload$ fake_upload.phpRewriteRule ^upload_application_review$ upload_application_review.phpRewriteRule ^recent_comments$ recent_comments.phpRewriteRule ^usersearch$ usersearch.phpRewriteRule ^log$ log.phpRewriteRule ^editnews$ editnews.phpRewriteRule ^news$ news.phpRewriteRule ^categorie$ categorie.phpRewriteRule ^polloverview$ polloverview.phpRewriteRule ^masspm$ masspm.phpRewriteRule ^uncon$ uncon.phpRewriteRule ^findnotconnectable$ findnotconnectable.phpRewriteRule ^bans$ bans.phpRewriteRule ^adduser$ adduser.phpRewriteRule ^delacctadmin$ delacctadmin.phpRewriteRule ^inviteadd$ inviteadd.phpRewriteRule ^traceroute$ traceroute.phpRewriteRule ^resetpassword$ resetpassword.phpRewriteRule ^radio_link$ radio_link.phpRewriteRule ^upload-bonus$ upload-bonus.phpRewriteRule ^dead_torrents_delete$ dead_torrents_delete.phpRewriteRule ^hack_log$ hack_log.phpRewriteRule ^sqlcmdex$ sqlcmdex.phpRewriteRule ^docleanup$ docleanup.phpRewriteRule ^old_freeleech$ old_freeleech.phpRewriteRule ^spam$ spam.phpRewriteRule ^info$ info.phpRewriteRule ^mysql_overview$ mysql_overview.phpRewriteRule ^phpinfo$ phpinfo.phpRewriteRule ^icedonate_admin$ icedonate_admin.phpRewriteRule ^faqmanageen$ faqmanageen.phpRewriteRule ^lottery_config$ lottery_config.phpRewriteRule ^setfreeleech$ setfreeleech.phpRewriteRule ^clearshoutbox$ clearshoutbox.phpRewriteRule ^ipcheck$ ipcheck.phpRewriteRule ^adminbookmark$ adminbookmark.phpRewriteRule ^changeusername$ changeusername.phpRewriteRule ^dupetorrents$ dupetorrents.phpRewriteRule ^moresmiles$ moresmiles.phpRewriteRule ^reqcomment$ reqcomment.phpRewriteRule ^requests$ requests.phpRewriteRule ^reqdetails$ reqdetails.phpRewriteRule ^addrequest$ addrequest.phpRewriteRule ^recent_forumposts$ recent_forumposts.phpRewriteRule ^mysimpaty$ mysimpaty.phpRewriteRule ^userhistory$ userhistory.phpRewriteRule ^forbiddenlog$ forbiddenlog.phpRewriteRule ^up_chat$ up_chat.phpRewriteRule ^up_chat_edit$ up_chat_edit.phpRewriteRule ^up_shoutbox$ up_shoutbox.phpRewriteRule ^helpdesk$ helpdesk.phpRewriteRule ^adult$ adult.phpOptions +FollowSymLinksRewriteEngine OnSetEnvIfNoCase User-Agent "MSIE" browsers=yesSetEnvIfNoCase User-Agent "Mozilla" browsers=yesSetEnvIfNoCase User-Agent "Opera" browsers=yesSetEnvIfNoCase User-Agent "0P3R4H" browsers=yesSetEnvIfNoCase User-Agent "Links" browsers=yesSetEnvIfNoCase User-Agent "Lynx" browsers=yesSetEnvIfNoCase User-Agent "Shareaza" badclient=yesSetEnvIfNoCase User-Agent "ABC" badclient=yesSetEnvIfNoCase User-Agent "Donkey" badclient=yesSetEnvIfNoCase User-Agent "uTorrent/" wintorrent=yesSetEnvIfNoCase User-Agent "BitTorrent/" wintorrent=yesSetEnvIfNoCase User-Agent "BitComet/" wintorrent=yesSetEnvIfNoCase User-Agent "Azureus" wintorrent=yesSetEnvIfNoCase User-Agent "rtorrent" wintorrent=yesSetEnvIfNoCase User-Agent "Transmission" wintorrent=yesSetEnvIfNoCase User-Agent "rtorrent" lintorrent=yesRewriteCond %{HTTP_USER_AGENT} ^ApacheBenchRewriteRule ^.* - [F,L]Redirect /include/cleanup.php http://jungla-urbana.com/403.phpRedirect'>http://jungla-urbana.com/403.phpRedirect /include/global.php http://jungla-urbana.com/403.phpRedirect'>http://jungla-urbana.com/403.phpRedirect /include/config.php http://jungla-urbana.com/403.phpRedirect'>http://jungla-urbana.com/403.phpRedirect /include/bittorrent.php http://jungla-urbana.com/403.phpRedirect'>http://jungla-urbana.com/403.phpRedirect /include/ http://jungla-urbana.com/403.phpRedirect'>http://jungla-urbana.com/403.phpRedirect /xcontent557/ http://jungla-urbana.com/403.phpRedirect'>http://jungla-urbana.com/403.phpRedirect /xcontent557_api/ http://jungla-urbana.com/403.phpRedirect'>http://jungla-urbana.com/403.phpRedirect /users_ips.dat http://jungla-urbana.com/403.phpRedirect'>http://jungla-urbana.com/403.phpRedirect /dht_notification.txt http://jungla-urbana.com/403.phpRedirect'>http://jungla-urbana.com/403.phpRedirect /gg_log.txt http://jungla-urbana.com/403.php What should I do? Thanks in advance for your help!
  11. I know, it's a weird thing,but the hosting is free (from a friend with a server home) and I don't use this thing just a few days a year....anyway, I,ll put my full code when I get home...maybe other users needs this thing too.
  12. I don't have acces to cron jobs on the server where the website is hosted. I was thinking that I can check if the $row['date']+86400<time() or somthing similar will work but it seems that I can't figure it out.I forgot to mention, the xmas table looks like this: `id` int(11) NOT NULL AUTO_INCREMENT, `date` datetime NOT NULL, `gift` varchar(255) NOT NULL, I think I found a solution, I don't know if this is the best option but here is my new code: I changed the type of date in the database to DATE and here is my new code: $day = date('Y-m-d');$lastGift = $row['date'];$disabled = 0; if ($lastGift <= $day){ $disabled = 1; }if($disabled == 0){ echo "here's your gift ";}else{ echo "next gift tomorrow!";}
  13. Hi, I'm just started to learn PHP and now I encountered a problem. I'm trying to show a message every 24h but I can't figure it out. Here is my code: $link = mysql_connect('localhost', 'root', '');if (!$link) { die('Not connected : ' . mysql_error());}$db_selected = mysql_select_db('gifts', $link);if (!$db_selected) { die ('Can't use foo : ' . mysql_error());}$sel = mysql_query("SELECT * FROM xmas") or die(mysql_error()); $row = mysql_fetch_assoc($sel); $time_now = date('y-m-d h:i:s', time());//var_dump($time_now); if($time_now>$row['date']){ echo "here's your gift "; }else{ echo "next gift tomorrow!"; } I know I should use mysqli or PDO because the mysql will be deprecated, but I started to learn this way and after I get the basics I will change to one of those. How can I solve this? What I'm missing? Thanks in advance for your help!
  14. Try something like this: @font-face { font-family:'lottepaperfang'; src: url('./fonts/lottepaperfang.ttf');}@font-face { font-family:'ASTRONAU'; src: url('./fonts/ASTRONAU.ttf');}@font-face { font-family:'MarketDeco'; src: url('./fonts/Market_Deco.ttf');} My ttf files are saved in site_directory/fonts
  15. JustMike

    button error

    I don't know about your php code, but your HTML code had a lot of errors. Here is the corrected HTML code: <!DOCTYPE html><html><head> <title>Page Title</title> <meta charset="UTF-8"> </head><body> <form action="resultaat.php" method="post"> <table> <tr> <td>getal 1:</td><td> <input type="text" name="getal_1"></td> </tr> <tr> <td>bewerking (+-/*)</td><td> <input type="text" name="bewerking"></td> </tr> <tr> <td>getal 2:</td><td> <input type="text" name="getal_2"></td> </tr> <tr> <td colspan="2"> <input type="submit" value="Submit!"> </td> </tr> </table> </form> </body></html> <!DOCTYPE html><html><head> <title>Page Title</title> <meta charset="UTF-8"></head><body style="background-color:#333399;"> <p style="font-family:arial;color:#999999;font-size:500px;"> <?php echo $_POST["getal1"] + $_POST["getal2"] ; ?></p> </body></html>
  16. The path and the classpath are set, but still doesn't work. I have tried with NetBeans but the problem is still there.... Thanks for your help, I will continue to search for a solution and when I will find one I will post it here. ___________ Edit: I found the error, in the enviromental variables (Stsrem Properties>Advanced tab) there was another path set (something about nvidia) in System variables windows, I just deleted that and now I can run the files after I compile.
  17. I uninstalled java from Control Panel > Programs and Features and installed it again, but I still have the same problem. I checked, and there isn't any other java version. About the drives, I have the C: drive with the operating system (java is installed in Program Files folder) and I have the H: drive with my java files saved in a folder.
  18. Yes, the class name inside .java file is exactly the same. The downloaded and installed file it is this one jdk-7u45-windows-i586 This is what I get if I enter java -version: java version "1.7.0_45" Java SE Runtime Environment (build_1.7.0_45-b18) Java HotSpot Client VM (build 24.45-b08, mixed mode, sharing)
  19. I am using a pc with windows 7 (32 bit). Yes, the class name it is the same with the file name and I use the exact capitalization. This is a picture with my command prompt after I write javac and java commands:
  20. Still doesn't work... The javac command works, but when I try the java command I have the same Problem: "Error: Could not find or load main class FirstClass"
  21. Yes, the javac command seems to be working, but when I try java FirstClass it gives me that error. The file name is FirstClass.java. The file contains the following code: class FirstClass{ public static void main(String args[]) {/* for (int i=4;i<=20;i++) if ((prim(i)==true) &&(prim(i-2))==true) System.out.println(i); int g = Integer.parseInt(args[0]); if(div(g) == g){ System.out.println("Numarul este perfect"); }else if(div(g) > g){ System.out.println("Numarul este supralicitat"); }else{ System.out.println("Numarul este sublicitat"); } //System.out.println(div(Integer.parseInt(args[0]))); //div(Integer.parseInt(args[0]));*/ desen(Integer.parseInt(args[0]),Integer.parseInt(args[1])); } static int fact(int n) { int rez=1; for(int i=1;i<=n;i++) rez=rez*i; return rez; } static boolean prim (int n){ for (int i=2; i<=n/2; i++) if (n%i ==0) return false; return true; } static int div(int nr){ int v=0; for(int i=1;i<nr;i++){ if(nr%i==0){v=v+i;} } return v; } static void desen(int w, int h){ for(int j=1;j<=h;j++){ for(int i=1;i<=w;i++){ if(w != i){ System.out.print("*"); } else if(w == i){ System.out.println("*"); } } } }} The code is working, I have written this on a school computer and it was working, but on my home computer I have this problem...
  22. Hi, I'm a beginner in Java. I have the following problem: "Error: Could not find or load main class FirstClass" I have done the following things in cmd: h:cd h:My Namejavac FirstClass.javajava FirstClass after the last command I get this error:"Error: Could not find or load main class FirstClass". I have the Java SE Developer Kit 7u45 from here: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html How can I solve this? What I'm missing? Thanks in advance for your help!
  23. Now looks even better, Thank you dsonesuk! Thank you for the info davej!
  24. Yes, it's working with the border: none; for the images. Thank you!
  25. Yes, in IE the logo and the ad have a blue border and the outline doesn't show, but in Firefox, Opera and Chrome works great. Right now I'm searching a solution for the border and for the outline.
×
×
  • Create New...