PHP - Timed Ban Script Errors Please Help
Hi Ive made a database with the option to kick someone for a certain amount of time but seems like I'm doing something wrong somewhere can anybody please assist
My full script is
(Admin panel)
<? include "./emoticon_replace1.php"; if ($_POST["DeletePost"]) { $id = $_POST["id"]; $query = "DELETE FROM ".$dbTable." WHERE id='".$id."'"; mysql_query($query); echo "ID removed from system: ".$id; } if ($_POST["BanIP"]) { $IP_To_Add = $_POST["ip"]; if(eregi("^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$", $IP_To_Add)) { $sql = "INSERT INTO ".$IPBanTable." (ip) VALUES (\"$IP_To_Add\")"; $result = mysql_query($sql); } else { echo "Error: Not a valid IP: ".$IP_To_Add; } } if ($_POST["purge"]) { $query = "TRUNCATE TABLE ".$dbTable; mysql_query($query); echo "StringyChat purged"; } if(!$_POST["update"] || !$_POST["StringyChat_name"] || !$_POST["StringyChat_message"]) { } else { $id = $_POST["id"]; $name = $_POST["StringyChat_name"]; $message = $_POST["StringyChat_message"]; include("emoticon_replace.php"); $query = "UPDATE ".$dbTable." SET StringyChat_name='$name', StringyChat_message='$message' WHERE id='".$id."'"; $result = mysql_query($query, $db) or die("Invalid query: " . mysql_error()); } if ($_POST["EditPost"]) { $id = $_POST["id"]; $result = mysql_query("SELECT * FROM ".$dbTable." WHERE id='".$id."'", $db); $myrow = mysql_fetch_array($result); ?> <form name="StringyChat_form" method="POST" action="?mode=postman"> Name:<br> <input name="StringyChat_name" class="StringyChatFrm" type="text" size="20" maxlength="<? echo $name_size; ?>" value="<? echo $myrow["StringyChat_name"]?>"> <br> Message:<br> <textarea name="StringyChat_message" class="StringyChatFrm" cols="20" rows="4"><? echo $myrow["StringyChat_message"]?></textarea> <br> <input type="hidden" name="id" value="<? echo $id ?>"> <input name="update" class="StringyChatFrm" type="submit" value="Update"> </form> <? } ?> <a href="<? echo $_SERVER['REQUEST_URI']; ?>&m=purge">Purge StringyChat</a><br> <br> <? // Load up the last few posts. The number to load is defined by the "ShowPostNum" variable. $result = mysql_query("SELECT * FROM ".$dbTable." ORDER BY StringyChat_time DESC",$db); while ($myrow = mysql_fetch_array($result)) { $msg = $myrow["StringyChat_message"]; $msg = strip_tags($msg); $msg = eregi_replace("im#([a-z]{3})", "<img src=\"/stringychat/images/\\1.gif\" alt=\"emoticon\">",$msg); printf("<div class=\"StringyChatItem\"><h4>%s<br>\n", $myrow["StringyChat_name"]); printf("%s<p>\n",$myrow["StringyChat_ip"],"%s</p>\n"); printf("%s</h4>\n", date("H:i - d/m/y", $myrow["StringyChat_time"])); printf("%s</div>\n", $msg); if ($_POST["1h"]) { $mxitid1= $_POST["1h"]; if(eregi("^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$", $IP_To_Add)) { $sql1 = "UPDATE ".$dbTable." SET unban_time = DATE_ADD(NOW(), INTERVAL 1 DAY) WHERE mxit_id = $mxitid1)"; $result1 = mysql_query($sq1l); } else { echo "Error: Cannot Kick: ".$IP_To_Add; } } function checkban($mxitid) { // querys database $q = mysql_query("SELECT 1 FROM ".$dbTable." WHERE unban_time > NOW() AND mxit_id = '$mxitid'",$db); $get = mysql_num_rows($q); // if found if ($get == "1") { // deny user access $r=mysql_fetch_array($q); die("You have been banned from this website until $r[legnth]. If you feel this is in error, please contact the webmaster at ."); } } ?> <form name="form<? echo $myrow["id"];?>" method="post" action="?mode=postman"> <input name="id" type="hidden" value="<? echo $myrow["id"];?>"> <input name="ip" type="hidden" value="<? echo $myrow["StringyChat_ip"];?>"> <input name="EditPost" type="submit" id="EditPost" value="Edit"> <input name="DeletePost" type="submit" id="DeletePost" value="Delete"> <input name="BanIP" type="submit" id="BanIP" value="Ban <? echo $myrow["StringyChat_ip"];?>"> <input name="1h" type="submit" id="1" value="Kick <? echo $myrow["mxit_id"];?>"> <input name="1d" type="submit" id="1d" value="Kick <? echo $myrow["StringyChat_ip"];?> for 24 hours "> <input name="7d" type="submit" id="7d" value="Kick <? echo $myrow["StringyChat_ip"];?> for 7 days "> </form> <? } ?>The part I added to the above script which is giving me pain is if ($_POST["1h"]) { $mxitid1= $_POST["1h"]; if(eregi("^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$", $IP_To_Add)) { $sql1 = "UPDATE ".$dbTable." SET unban_time = DATE_ADD(NOW(), INTERVAL 1 DAY) WHERE mxit_id = $mxitid1)"; $result1 = mysql_query($sq1l); } else { echo "Error: Cannot Kick: ".$IP_To_Add; } } function checkban($mxitid) { // querys database $q = mysql_query("SELECT 1 FROM ".$dbTable." WHERE unban_time > NOW() AND mxit_id = '$mxitid'",$db); $get = mysql_num_rows($q); // if found if ($get == "1") { // deny user access $r=mysql_fetch_array($q); die("You have been banned from this website until $r[legnth]. If you feel this is in error, please contact the webmaster at ."); } }What I'm trying to do is to ban the person for 1 day. And by banning the person I want them to be blocked from my Index page from submitting a form (sending a message) which is stored as tik.php on my index page index.php <?php require_once('common.php'); include "ip-ban-time-limit.php"; checkban($_SERVER['HTTP_X_MXIT_USERID_R']); checkUser(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <head> <title>Galaxy Universe Chat</title> <link href="style/style.css" rel="stylesheet" type="text/css" /> </head> <body><br> <div id="main"> <div class="caption">Galaxy Universe Chat</div> <div id="icon"> </div> <div id="result"> Hello <?php echo $_SESSION['userName']; ?> ! <br/> <div style="color:red"><b><p>Please keep it clean and in English or you will be banned!</p></b></div> <br> <?PHP include "./stringychat.inc.php"; require_once ( 'tik.php' ); ?> <br> <p><a href="index1.php">Refresh</a> | <a href="logout.php">Log Out</a></p> </div> <div id="source">Galaxy Wars chat @ cobusbo</div> </div> </body>Seems like I've been doing something wrong with my queries... Similar TutorialsHi everyone I am pretty new to php but have been playing around with it for awhile. I have been trying to include a offline script from codecanyon located (http://codecanyon.net/item/web-construct/61643). The problem I am having is when I try to include the file as per the scripts instruction (<?php include("offline.php");?>) I get all sorts of errors on mysite (please see below for one error). I read his discussion section were one person is having the same problem I am having the script developers answers was (Place the webconstruct include after the session_start() line). I have tried that or think I did it right but still getting the same errors as before. Can someone please help me in getting this script installed? I will copy the session code below and if someone can point me to the right direction in how to resolve this issue I would be thankful. (error) Notice: Use of undefined constant (my session code) <? if ( isset($_SESSION['url']) && $_SESSION['url'] != $SITE_URL ) { session_destroy(); ?> <script language="javascript">window.location.href="index.php";</script> Thanks in advance for anyone's help! Okay, I have a script that is supposed to break if one of the errors occurs. However, it's not. I don't know if I have it coded incorrectly or what. Any help would be appreciated! Purpose of Script: The user is supposed to be able to spend "stat bonus points" to level up their stats. However, if they have 0 points, then obviously they can't spend them. If the user tries to use more points than they have, it's supposed to break too. Thanks in advance!! if (isset($_POST["statbonus"])) { include("tmpconfig.php"); $checkquery = $db->execute("SELECT * FROM `users` WHERE `id`=?", $player->id); //$rec = mysql_fetch_array($checkquery); extract($_POST); $errors = 0; $errorlist = ""; $rec = mysql_fetch_array($checkquery); extract($_POST); $errors = 0; $errorlist = ""; if (!is_numeric($stat_bonus)) { $errors++; $errorlist .= "The amount of bonus sent needs to be a whole number.<br />"; } if ($stat_bonus == "") { $errors++; $errorlist .= "The amount of bonus is required.<br />"; } if ($amount > $stat_bonus) { $errors++; $errorlist .= "You're trying to spend more stat bonus than what you have.<br />"; } if ($stat_bonus == "0") { $errors++; $errorlist .= "You need to spend more stat bonus than just zero.<br />"; } if ($errors == 0) { $query = $db->execute("UPDATE `users` SET `stat_bonus`=? WHERE `id`=?", array($player->stat_bonus - $amount, $player->id)) or die("querya failed: ". mysql_error()); if($query) $qry = $db->execute("select * from `users` where `id`=?", array($player->id)) or die("qry failed: ".mysql_error()); $rw = $qry->fetchrow(); if($qry){ $query2 = $db->execute("UPDATE `users` SET `stat_bonus`=?, $choice=$choice+$amount WHERE `id`=?", array($player->stat_bonus - $amount, $player->id)) or die("query2 failed: ". mysql_error()); if($qry){ echo("<br><br>You have successfully used your stat bonus points.<br>"); } else { echo "<font color=green><b>You have succesfully spent skill points!</b></font><br /><br />"; }}}} Hi there I am having trouble with the code below The difficulty is with this bit I think ('input type="submit"','value="Submit"') Many thanks Doug <?php echo tep_draw_form('advanced_search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', TEXT_ENTER_KEYWORDS , 'size="10" maxlength="30" onFocus="emptyMe()" style="width: ' . (BOX_WIDTH-25) . 'px"'); ?> <?php echo tep_hide_session_id() . ('input type="submit"','value="Submit"') . '</form>';?> Hi i followed a guid to create a login area to my site however i believe its a little outdated and therefore not working, i have done a little bit but being quite new i cannot find all the problems at the moment i have: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/a9855336/public_html/checklogin.php on line 12 here is my script line 12 is marked <?php $host="*************"; // Host name $username="a9855**6_root"; // Mysql username $password="************"; // Mysql password $db_name="****3***36_mail; // Database name // Connect to server and select databse. mysql_connect($host, $username, $password) mysql_select_db($db_name); // username and password sent from form $myusername=$_POST['myusername']; // line 12 $mypassword=$_POST['mypassword']; // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); // encrypt password $encrypted_mypassword=md5($mypassword); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$encrypted_mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("myusername"); session_register("mypassword"); header("location:login_success.php"); } else { echo "Wrong Username or Password"; } ?> if you help please tell me the error so i can learn to debug scripts myself in the future thanks blink359 Hi, I recently attempted to install a refer-a-friend script into my website but I really don't use PHP at all and even my html is very sloppy so it didn't get installed as planned. It currently cuts out the bottom half of my website like so: http://www.returntherake.com/refer.php Basically everything before the script is called is fine but everything after doesn't work. Heres the code from the point its installed till the end of my website. Any help would be great. Thank you so much. Quote <script language="php"> // Number of friend feilds to put on the page $tellnumber = "3"; // Subject of email $subject = "Great Poker Rakeback Site"; // Message sent in the email $message = "Look at this great site I found. I think you'll like it. It will boost your profits while playing online poker by getting you some of your rake back. http://www.ReturnTheRake.com/ When signing up with a website remember to say $_POST[name] referred you in the proper section. As you will recieve a 25% bonus on your first $20 rakeback recieved."; // Url to redirect user to once they click submit $thankyouurl = "http://www.returntherake.com/thankyou_refer.html"; ////////////////////////////////////////////////////////////////////////////////// // DO NOT EDIT ANYTHING BELOW THIS LINE // ////////////////////////////////////////////////////////////////////////////////// if($_POST[submitform] == "Submit") { $error = ""; $num=0; while($num < $tellnumber) { $num++; $temail = "femail"."$num"; $tname = "fname"."$num"; if($_POST[$tname] OR $_POST[$temail]) { if(!$_POST[$tname]) { $error .= "Missing Friends Name, Friend $num<BR>"; } if(!$_POST[$temail]) { $error .= "Missing Friends Email, Friend $num<BR>"; } } if($_POST[$temail]) { if(!ereg("@",$_POST[$temail])) { $error .= "Invalid Email Address, Friend $num<BR>"; } if(!ereg("\.",$_POST[$temail])) { $error .= "Invalid Email Address, Friend $num<BR>"; } } } if(!$_POST["name"]) { $error .= "Missing your name<BR>"; } if(!ereg("@",$_POST[email])) { $error .= "Invalid Email Address<BR>"; } if(!ereg("\.",$_POST[email])) { $error .= "Invalid Email Address<BR>"; } if($error) { ?> <BODY BGCOLOR="#ffffff"> <P><CENTER><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0"> <TR> <TD WIDTH="100%" BGCOLOR="#01864E"> <TABLE WIDTH="340" BORDER="0" CELLSPACING="1" CELLPADDING="2"> <TR> <TD WIDTH="26%" BGCOLOR="#01864E"> <B><FONT COLOR="#ffffff" SIZE="-3" FACE="Verdana">Error</FONT></B></TD> </TR> <TR> <TD WIDTH="26%" BGCOLOR="#ffffff"> <FONT COLOR="#000000" SIZE="-3" FACE="Verdana"><? echo $error; ?></FONT></TD> </TR> </TABLE></TD> </TR> </TABLE></CENTER> <? exit(); } $extra ="\r\n"; $headers = ""; $headers .= "From: $_POST[name] <$_POST[email]>".$extra; $headers .= "Reply-To: $_POST[name] <$_POST[email]>".$extra; $headers .= "Return-Path: $_POST[name] <$_POST[email]>".$extra; $headers .= "Message-ID: <".time()." - $_POST[email]>".$extra; $headers .= "X-Mailer: PHP v".phpversion().$extra; $headers .= 'MIME-Version: 1.0'.$extra.$extra; $num=0; while($num < $tellnumber) { $num++; $temail = "femail".$num; $tname = "fname".$num; $print_f_name = $_POST[$tname]; $print_f_email = $_POST[$temail]; if($_POST[$temail] AND $_POST[$tname]) { mail($print_f_email,"$subject"," Hi, $print_f_name $message From $_POST[name] ",$headers); } } header("Location: $thankyouurl"); exit(); } else { $num=0; while($num < $tellnumber) { $num++; $theboxes .= " <TR> <TD WIDTH=\"49%\" BGCOLOR=\"#ffffff\"> <CENTER><B><FONT COLOR=\"#000000\" SIZE=\"-3\" FACE=\"Verdana\">$num</FONT></B></CENTER></TD> <TD WIDTH=\"26%\" BGCOLOR=\"#ffffff\"> <CENTER><INPUT NAME=\"fname$num\" TYPE=\"text\" SIZE=\"-3\"></CENTER></TD> <TD WIDTH=\"25%\" BGCOLOR=\"#ffffff\"> <INPUT NAME=\"femail$num\" TYPE=\"text\" SIZE=\"-3\"> </TD> </TR>"; } ?> <BODY BGCOLOR="#ffffff"> <P><CENTER><FONT FACE="Verdana"><B>Tell your friend about our site</B></FONT></CENTER></P> <FORM ACTION="tellfriend.php" METHOD="POST"><P><CENTER><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0"> <TR> <TD WIDTH="100%" BGCOLOR="#01864E"> <TABLE WIDTH="340" BORDER="0" CELLSPACING="1" CELLPADDING="2"> <TR> <TD WIDTH="26%" BGCOLOR="#01864E"> <CENTER><B><FONT COLOR="#ffffff" SIZE="-3" FACE="Verdana">Your Poker Account</FONT></B></CENTER></TD> <TD WIDTH="25%"> <CENTER><B><FONT COLOR="#ffffff" SIZE="-3" FACE="Verdana">Your Email</FONT></B></CENTER></TD> </TR> <TR> <TD WIDTH="150" BGCOLOR="#ffffff"> <CENTER><INPUT NAME="name" TYPE="text" SIZE="12px"></CENTER></TD> <TD WIDTH="200" BGCOLOR="#ffffff"> <INPUT NAME="email" TYPE="text" SIZE="-3"> </TD> </TR> </TABLE></TD> </TR> </TABLE></CENTER></P><P><CENTER><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0"> <TR> <TD WIDTH="100%" BGCOLOR="#01864E"> <TABLE WIDTH="340" BORDER="0" CELLSPACING="1" CELLPADDING="2"> <TR> <TD WIDTH="49%" BGCOLOR="#01864E"></TD> <TD WIDTH="26%" BGCOLOR="#01864E"> <CENTER><B><FONT COLOR="#ffffff" SIZE="-3" FACE="Verdana">Friends name</FONT></B></CENTER></TD> <TD WIDTH="25%"> <CENTER><B><FONT COLOR="#ffffff" SIZE="-3" FACE="Verdana">Friends email</FONT></B></CENTER></TD> </TR><? echo $theboxes; ?></TABLE></TD> </TR> </TABLE></CENTER></P> <P><CENTER><INPUT NAME="submitform" TYPE="submit" VALUE="Submit"></CENTER></FORM> <? exit(); } ?> </h3> </td> </tr> </table></td> <td width="1" bgcolor="#CCCCCC"></td> </tr> <tr> <td height="1" colspan="3" bgcolor="#CCCCCC"></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td height="10" align="center" valign="top"></td> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td align="left" height="17" valign="top" class="style19"> </td> </tr> <tr> <td align="left" height="17" valign="top" class="style19"> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> <tr> <td align="left" valign="top"> </td> </tr> <tr> <td align="left" valign="top"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tbody> <tr> <td align="left" valign="top" width="11"><img src="images/footer_bg_left.gif" alt="" height="120" width="11" /></td> <td class="footer" align="left" valign="middle"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tbody> <tr> <td style="padding-left: 12px;" align="left" valign="top" width="260"><img src="images/footer_img.gif" alt="" height="110" width="249" /></td> <td align="left" valign="middle"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tbody> <tr> <td class="footer_border" align="left" valign="top"> <a href="index.php">Homea> | <a href="#">Terms & Conditions</a> | <a href="#"> Privacy Policy</a> | <a href="#">Site Map</a> | <a href="#">Contact Us</a></td> </tr> <tr> <td class="footer_border" style="font-size: 10px; line-height: 22px;" align="left" valign="top">ReturnTheRake.com Copyright © 2010, All Rights Reserved.</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> <td align="left" valign="top" width="11"><img src="images/footer_bg_right.gif" alt="" height="120" width="11" /></td> </tr> </tbody> </table> </td> </tr> <tr> <td align="left" valign="top"> </td> </tr> </tbody> </table> <br /> </body> </html> He, I am builing some kind of quiz script. I got 10 images people see and they have to say if they agree or not. Simply by clicking yes / no. First i used a submit button, but now i want it to submit whem people click yes/no. tried some stuff already but cant find the correct way. Please help here is the code: <?php session_start(); $thispage = 'test.php'; $img = array( '1','2','3','4','5','6','7','8','9','10' ); function getQuestion( $q ) { global $img; $curImg = $img[$q]; return "Do you agree? <br> <img src=\"images/{$curImg}.jpg\">"; } if ( isset( $_GET['reset'] ) ) { unset( $_SESSION['q'] ); unset( $_SESSION['answer'] ); header("Location: {$thispage}"); } if ( !isset( $_SESSION['q'] ) ) { $_SESSION['q'] = 0; } if ( !isset( $_SESSION['answer'] ) ) { $_SESSION['answer'] = array(); } if ( isset( $_POST['answer'] ) ) { $answer = $_POST['submit']; if ( $answer == '1' || $answer == '2' ) { $next = $_SESSION['q'] + 1 ; if ( array_key_exists( $next,$img ) ) { $_SESSION['answer'][$_SESSION['q']] = $answer; } $_SESSION['q'] = $next ; } } if ( $_SESSION['q'] >= count( $img ) ) { $html = ''; foreach( $_SESSION['answer'] as $q => $value ) { $html .= getQuestion( $q ) . " Answer: {$value}<br />"; } $html .= "<br /><br /><a href=\"{$thispage}?reset=Y\">Reset Quiz</a>"; } else { $question = getQuestion( $_SESSION['q'] ); $html =<<<HTML <html> <body> <h1>{$question}</h1> <input type="submit" value="Yes" name="answer" />Yes<br /> <input type="submit" value="No" name="answer" />No<br /> </form> </body> </html> HTML; } echo $html; ?> I have noticed 2 script errors on my site within the .php files but can't see why they're occurring. The first appears at the bottom of my wordpress admin page:
Notice: Array to string conversion in /home/orkwine/public_html/test/wp-includes/class.wp-scripts.php on line 123
This is the area in that file:
`$srce = apply_filters( 'script_loader_src', $src, $handle ); if ( $this->in_default_dir($srce) ) { $this->print_code .= $this->print_extra_script( $handle, false ); $this->concat .= "$handle,"; $this->concat_version .= "$handle$ver"; return true; } else { $this->ext_handles .= "$handle,"; $this->ext_version .= "$handle$ver"; } }` Line 123 is: $this->ext_version .= "$handle$ver"; The other error i am getting is: Notice: Undefined index: prettyPhoto in /home/orkwine/public_html/test/wp-includes/class.wp-scripts.php on line 185 Notice: Trying to get property of non-object in /home/orkwine/public_html/test/wp-includes/class.wp-scripts.php on line 185 These are lines 183-194 in that file:` function set_group( $handle, $recursion, $group = false ) { if ( $this->registered[$handle]->args === 1 ) $grp = 1; else $grp = (int) $this->get_data( $handle, 'group' ); if ( false !== $group && $grp > $group ) $grp = $group; return parent::set_group( $handle, $recursion, $grp ); }` Line 185 is: if ( $this->registered[$handle]->args === 1 ) Can anyone help solve these errors? The full file can be seen he http://pastebin.com/spBAhuHf Here is a link to one of the pages in the website which shows the second error. http://test.orkneywi...-borealis-35cl/ Can anyone help with this? I have a html for that posts to a form processing script which is fully functional atm, in the processing script i have if statements, if the condition is met it updates tables in database, if there not met i echo a "not met" statment. problem is my form processing script just goes straight back to the index.php page using the following code; header('Location: index.php'); here is the form processing script: <?php session_start(); header('Location: index.php'); include "connect.php"; $id = $_SESSION['id']; $user = $_SESSION['user']; $ticketNumber = $_POST[ticketNumber]; //echo $_POST[ticketNumber]; $today = date('Y-m-d H:i:s', time() - 3600); // Query "Ticket" Table to check if user has purchased a "regular" ticket within the last 24 hours $query24hour = mysql_query("SELECT * FROM tickets WHERE username = '$user' AND HOUR(TIMEDIFF(NOW() , purchaseDate)) < 24;") or die(mysql_error()); // Query "promoTickets" table to grab information of previous tickets bought to the "promotional" auction and LIMIT tickets to 1 per user for "promotional" auctions. $querySold = mysql_query("SELECT * FROM promoTickets WHERE promoID='$_POST[promoID]' AND (ticketNumber='$ticketNumber' OR username = '$user');") or die(mysql_error()); //echo $querySold; $sold = mysql_fetch_assoc($querySold); //print_r($sold); //echo $sold; //echo query24hour; $querycount24hour = mysql_num_rows($query24hour); //echo $querycount24hour; //check if ticket is sold and if user has purchased a "regular" ticket within 24 hours if(empty($sold)!=FALSE and $querycount24hour >= 1){ //Checks users balance to see if they have enough for the ticket $queryBal = mysql_query("SELECT user_iskbalance FROM users WHERE username = '$user';") or die(mysql_error()); //echo $querySold; //echo $user; //echo $queryBal; $balArray = mysql_fetch_assoc($queryBal); $bal = $balArray[user_iskbalance]; $newBal = $bal-$_POST[ticketPrice]; //check if he has the money to buy the ticket if($bal>=$_POST[ticketPrice]){ //remove the money $queryBalRemoveal = mysql_query("UPDATE `users` SET `user_iskbalance`='$newBal' WHERE `username`='$user';") or die(mysql_error()); //buy ticket & insert data into "promoTickets" table $query = mysql_query("INSERT INTO promoTickets(promoID, username, charID, ticketNumber, ticketPrice, purchaseDate) VALUES ('$_POST[promoID]', '$user', '$id', '$_POST[ticketNumber]', '$_POST[ticketPrice]', '$today');") or die(mysql_error()); } else{ die("Insufficent balance. Please add more ISK") ; } } else{ die("Ticket has already been Sold or you have already bought a ticket to this promotion..!"); } ?> any way i can get the errors to be passed onto the index.php (with the form) and echo them there? as it stands errors arnt shown to the users and its confusing people I recently switched hosts to DreamHost, and even after a completely clean install of Codesort I'm getting these errors:
The top of the Codesort admin panel:
Deprecated: Assigning the return value of new by reference is deprecated in /home/fatedus/fatedus/loved/codesort/functions.php on line 35 WARNING: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/fatedus/fatedus/loved/codesort/functions.php:35) WARNING: Cannot modify header information - headers already sent by (output started at /home/fatedus/fatedus/loved/codesort/functions.php:35)And displayed on the codes page of my fanlistings is this, too: Deprecated: Assigning the return value of new by reference is deprecated in /home/fatedus/fatedus/loved/codesort/functions.php on line 35This is line 35 of the functions.php file: $instance =& new $object;Here is a link to the script for those unfamiliar with it: http://fanupdate.net/codesort.php Here's a link to one of my fanlisting pages where the error shows up: http://odin.fated.us/codes.php Also here is a screenshot of what the error looks like inside the Codesort admin panel: http://i.imgur.com/yDlT8d9.png Help would be really appreciated, this host move has been such a pain. ;c can you run a query says every 60 seconds with out refreshing the entire page? at the moment im using <meta http-equiv="refresh" content="60;url=login_success.php"> Hello All, I am trying to create a png file (add to an existing png file). The code I have used to work without any issues until this afternoon. And I am 100% sure no one changed the code. When I try to access the logocreate.php now I get the following error Code: [Select] Warning: imagecreatefrompng(http://www.domain.com/logo/logo.png) [function.imagecreatefrompng]: failed to open stream: Connection timed out in /home/domain/public_html/logo/logocreate.php on line 8 When I access the http://www.domain.com/logo/logo.png from browser it works (image is available) Can anybody think of server side errors that may cause this? I have GD enabled and in PHP info shows allow_url_fopen On On allow_url_include Off Off Any help is greatly appreciated. Thanks. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=320284.0 Hi guys im having trouble implementing functions into some buttons. I got a kicking script from the internet that looks as follow
How do I display the actual errors in IIS 7.5? If I miss a semicolon, I get: "HTTP Error 500.0 - Internal Server Error" absolutely useless. In prior versions, I could see the line and get to the PHP error. How do I display PHP errors? I've added: set_ini('display_errors', '1'); but it doesn't help. I'm trying to post to a (SMF) simplemachines 2.0 forum using curl. I have logged in and I have tried sending all the fields, but when I try to post, I receive this message: "The following error or errors occurred while posting this message: Your session timed out while posting. Please try to re-submit your message." Do any of you know why this happens? Is the problem that when I visit the posting url, they give me a cookie that expires if I leave the posting url? I don't think the form is invalid, it looks like it has to do with the session. People at the simplemachines forum can have this problem when they try to post the ordinary way, but that is because of an inactivity period. Can my problem be because of a cookie? window.setInterval(function(){ s="<?= $lastid ?>"; $.post('../action/updatestream.php',{statusid:s.val()},function(e){ alert(e) }); }, 10000);Why isn't it working? Thanks, im getting following errors:
Warning: DOMDocument::load() [domdocument.load]: Opening and ending tag mismatch: property line 6 and xsl:for-each in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/apartment.xsl, line: 25 in/home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 9 Warning: DOMDocument::load() [domdocument.load]: Opening and ending tag mismatch: for-each line 5 and property in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/apartment.xsl, line: 26 in/home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 9 Warning: XSLTProcessor::importStylesheet() [xsltprocessor.importstylesheet]: compilation error in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 14 Warning: XSLTProcessor::importStylesheet() [xsltprocessor.importstylesheet]: xsltParseStylesheetProcess : empty stylesheet in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 14 Warning: XSLTProcessor::transformToXml() [xsltprocessor.transformtoxml]: No stylesheet associated to this object in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 16 Fatal error: Call to a member function saveXML() on a non-object in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 18 the xslt file is as following: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/19...XSL/Transform"> <xsl:output method="xml" indent="yes"/> The code below returns the correct results, which are in this case are email addresses. After each displayed value there is a br eg. emai1@hotmail.com<br>email2@hotmail.com<br>email3@ etc. So the quesion is, can i change the below codeing to prevent this. I have tried changing $message .= "<br>". $row['email'] to $message .= "\n". $row['email'] but this results in; Warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html $code = $_GET['postcode']; $message = $_GET['message']; $emailad = "email@hotmail.co.uk"; $shortcode = substr($code,0,2); $result = mysql_query("SELECT email FROM treesurgeons WHERE postcode like '%" . $shortcode . "%' ORDER BY companyName LIMIT 3") or die(mysql_error()); echo "<h2>Business Names:</h2>"; while ($row = mysql_fetch_array( $result )) { $message .= "<br>". $row['email'] ; } echo "\n"; echo $message; mail( "$emailad", "Header","$message" ); echo "<br>" . "Thank you for using our mail form."; Does anyone know of a function that I can use to get all occurring PHP errors during script execution into a string. Also, does anyone know what's wrong with php.net? It keeps saying service is down. Hello. I am at beginning with php and now trying to make an ecommerce website. I know it's a bit stupid but it works until now. This site work perfect on localhost using xampp but then I transfered it to webhost, I get a lot of errors. |