Jump to content

twistedvengeance

Members
  • Posts

    19
  • Joined

  • Last visited

Everything posted by twistedvengeance

  1. I may have been confused as to what you were planning on doing. I assumed you wanted it to pop up, like Facebook, when the event happens. PHP can't do that, since it would be active-reload. My apologies.
  2. Aside from the fact that I gave him 99% of what he needs, nothing with this code is wrong. I have re-coded this so it works properly. Don't be an ass if you don't have the desire to try and help someone out.
  3. ASP and Ruby. PHP will not do this to the full extent you want.
  4. Despite how long and hard I worked on this, I'll give you the beginning of what you need. This will not insert any information into a database. Also, the top part of this is on google. <?php $uploaded = false; $name = 1; if(isset($_POST['Upload'])){ $allowedExts = array("jpg", "jpeg", "png", "gif"); $extension = end(explode(".", $_FILES["file"]["name"])); if (($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")){ if($_FILES["file"]["size"] < 2000000){ if(in_array($extension, $allowedExts)){ if ($_FILES["file"]["error"] > 0){ echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; }else{ $_FILES["file"]["name"] = $name . ".jpg"; while(file_exists("template/gallery/" . $_FILES["file"]["name"])){ $name++; $_FILES["file"]["name"] = $name . ".jpg"; } while(file_exists("template/php/user/uploaded/" . $_FILES["file"]["name"])){ $name++; $_FILES["file"]["name"] = $name . ".jpg"; } $location = "template/php/user/uploaded/"; move_uploaded_file($_FILES["file"]["tmp_name"], "$location" . $_FILES["file"]["name"]); echo "Thanks for uploading!"; echo "<a href=\"$location$name.jpg\">Click to see</a>"; $uploaded = true; } }else{ echo "Invalid file"; } }else{ echo "File is too big!"; } }else{ echo "Invalid File Type"; } } if($uploaded == false){?> <div id="posts"> <form method="post" action="" enctype="multipart/form-data" name="form1"> <span>Picture:</span> <input name="file" type="file" class="box"/> <input type="submit" id="mybut" value="Upload" name="Upload"/> </form> <span>Only JPG(JPEG) files allowed.</span> </div> <?php } ?>
  5. <?php $id = $_SESSION['userID']; if (($_GET['do'] == 'follow') && !empty($_GET['id'])){ if(($_SESSION['auth']) && !empty($_SESSION['current_user_id'])){ if ($_SESSION['current_user_id'] == $_GET['current_user_id']){ $you = intval($_SESSION['current_user_id']); $them = intval($_GET['id']); $sql = "INSERT INTO `follow` (`user_id`, `follow_user_id`) VALUES ('$you', '$them')"; if (!mysql_query($sql)){ if (mysql_errno($link_identifier) == 1062) { /* Why is this even here? */ } } } } } ?> Your problem was you didn't have your variables escaped with ' '. so you were saying VALUES(code,code) not VALUES('code','code');
  6. Then you have an error somewhere else in your code, post 5-10 more lines on either side of the code so we can see what might be causing errors. Or even the entire script if it's not huge.
  7. You are calling if(array_search($id, $ids) == true){ Which isn't true. You are defining $ids = $a['ids']; $ids = explode(",", $ids); So just set it to $id = $a['ids']; $ids = explode(",", $id);
  8. $usr = "user"; $pwd = "pass"; $db = "schedules"; $db2 = "schedulesArchive"; $host = "localhost"; # connect to database $cid = mysql_connect($host,$usr,$pwd); if (!$cid) { echo("ERROR: " . mysql_error() . "\n"); } $year=Date("Y"); $db2 = $db2 . $year . "foo"; SQL = "CREATE TABLE $db2 SELECT * FROM $db.foo"; $result = mysql_db_query($db,$SQL,$cid); # check for error if (!$result) { echo("ERROR: " . mysql_error() . "\n$SQL\n"); }
  9. eval("$keys .= " . $value['set_function'] . "'" . $value['value'] . "','" . $key . "');");
  10. body{ position: relative; } .footer{ position: fixed; bottom: 10px; }
  11. <table width="525" border="0" cellpadding="40" height="63" > <?php $query = "select * from fixtures group by date having count(*) > 1"; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { $date= $row['date']; $oDate = strtotime($date); $sDate = date("D M j Y",$oDate); ?> <tr><td colspan="8" align="left" class="td"><b><?php echo $sDate; ?></b></td></tr> <?php $query2 = "select * from fixtures where date = '$date'"; $result2 = mysql_query($query2); while($row2 = mysql_fetch_array($result2)) { $first = $row2['firstTeam']; $second = $row2['secondTeam']; $time = $row2['time']; $gameid = $row2['gameId']; $date_now = date("Y-m-d"); $time_now = gmdate("H:i:s"); $time2 = strtotime($time); $real_time = date("H:i", $time2); $timeMinus1Hour = gmdate("H:i", strtotime("-1 hour", strtotime($time))); if( $date <= $date_now && $time_now <= $timeMinus1Hour) { ?> <script type="text/javascript"> $('#fixtures').click(function (){ return false; }); </script> <tr class="big"> <td width="56" align="left" style="color:#709b52;"><a href="" class="result_hover">results</a></td> <td width="182" align="right"><a href="forecast.php?first1=<?php echo $first; ?>&second1=<?php echo $second; ?>&game_id=<?php echo $gameid; ?>" id="fixtures"> <?php echo $first; ?></a></td> <td width="-31" align="center"><a href="forecast.php?first1=<?php echo $first; ?>&second1=<?php echo $second; ?>&game_id=<?php echo $gameid; ?>" id="fixtures">vs</a></td> <td width="-12" align="left"><a href="forecast.php?first1=<?php echo $first; ?>&second1=<?php echo $second; ?>&game_id=<?php echo $gameid; ?>" id="fixtures"><?php echo $second; ?></a></td> <td><a href="forecast.php" id="fixtures"><?php echo $real_time; ?></a></td> </tr> <?php } } } ?> Reposting for code syntax
  12. You could also use classes, I think. <?php class Beginning{ function Opening(){ ['your code'] } } class End extends Beginning{ function End(){ ['ending code'] } }
  13. Thanks for trying to help guys, I figured it out. My function wasn't being called in the right place.
  14. So I did that, and got a "unknown variable" blah blah, and fixed that by placing all of my POST checks into a function and calling it inside of my CheckInput function, but I'm still getting the error.
  15. I feel like an idiot for not seeing that, but that didn't change anything unfortunately.
  16. perhaps trying doing public $yourarray = array($_POST); Not sure if that would work or not.
  17. I am getting no errors, nothing is happening. It's like the submit button isn't being checked. I am connecting to the database. I have used the queries on another script to test them.
  18. So me and my team of developers are creating a web based flash game, and I've been working on the register page. Thing is, I can't get it to submit the given information to the database. I think it may be something to do with my functions, since this is the first I've worked heavily with them. *EDIT* I added in the whole page incase there was some confusion <?php $name = $_POST['name']; //Get Name $password = $_POST['password']; //Get Password $ppassword = $_POST['ppassword']; //Get Repeated Password $username = $_POST['username']; //Get Username $email = $_POST['email']; //Get Email $age = $_POST['age']; //Get Age $hashname = (md5($hash . $name)); //Hash Name $hashpw = (md5($hash . $password)); //Hash Password $checkcont = file('blocked.txt'); //Blocked User Input Content function Register(){ // Insert Function /* Create User Login Account*/ mysql_query("INSERT INTO accounts ( name , password , username , email , age ) VALUES ( $name , $password , $username , $email, $age )"); /* Create User Character Field 1 */ mysql_query("INSERT INTO users ( chr , password , username , slot , auth , exp , money , name ) VALUES ( 'null' , $hashpw , $username , 1 , 1 , 'null' , 'null' , $hashname)"); /* Create User Character Field 2 */ mysql_query("INSERT INTO users ( chr , password , username , slot , auth , exp , money , name ) VALUES ( 'null' , $hashpw , $username , 2 , 1 , 'null' , 'null' , $hashname)"); /* Create User Character Field 3 */ mysql_query("INSERT INTO users ( chr , password , username , slot , auth , exp , money , name ) VALUES ( 'null' , $hashpw , $username , 3 , 1 , 'null' , 'null' , $hashname)"); } function Email(){ //Create & Send Email Link } function CheckInput(){ //Check User Input $errors = 0; //Set Errors Null $swears = 0; //Set Swears Null $notos = 0; //Set TOS Null if($name !== null){ if($name !== $checkcont){ if($password !== null){ if($password !== $checkcont){ if($ppassword !== null){ if($username !== null){ if($username !== $checkcont){ if($email !== null){ if(isset($_POST['tos'])){ if($age !== null){ Register(); }else{ $errors++; } }else{ $notos = 1; } }else{ $errors++; } }else{ $swears++; } }else{ $errors++; } }else{ $errors++; } }else{ $swears++; } }else{ $errors++; } }else{ $swears++; } }else{ $errors++; } } if(isset($_POST['submit'])){ CheckInput(); } ?> <?php $browser = array( 'version' => '0.0.0', 'majorver' => 0, 'minorver' => 0, 'build' => 0, 'name' => 'unknown', 'useragent' => '' ); $browsers = array( 'firefox', 'msie', 'opera', 'chrome', 'safari', 'mozilla', 'seamonkey', 'konqueror', 'netscape', 'gecko', 'navigator', 'mosaic', 'lynx', 'amaya', 'omniweb', 'avant', 'camino', 'flock', 'aol' ); if (isset($_SERVER['HTTP_USER_AGENT'])) { $browser['useragent'] = $_SERVER['HTTP_USER_AGENT']; $user_agent = strtolower($browser['useragent']); foreach($browsers as $_browser) { if (preg_match("/($_browser)[\/ ]?([0-9.]*)/", $user_agent, $match)) { $browser['name'] = $match[1]; $browser['version'] = $match[2]; @list($browser['majorver'], $browser['minorver'], $browser['build']) = explode('.', $browser['version']); break; } } } ?> <html> <!-- This Is Our Header --> <head> <script> function getbrowser(){ open = window.open("getbrowser.php", "open", "location=1,status=1,scrollbars=1, width=300,height=300"); open.moveTo(0, 0); } </script> <title> The Dragon Seigeā„¢ Register </title> <?php if($browser['name'] == "chrome"){ $using = 1; echo "<link href=\"styles/chromereg.css\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\" />"; }elseif($browser['name'] == "firefox"){ $using = 2; echo "<link href=\"styles/firefoxreg.css\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\" />"; } if(($using !== 1) && ($using !== 2)){ echo ""; } ?> </head> <!-- This Ends Our Header --> <!-- This Is Our Body --> <body> <?php if(($using == 1) || ($using == 2)){?> <div id="registerwrap"> <?php include('inc/header.php'); ?> <div class="content"> <center> <div id="registercont"> <h2> Registration </h2> <hr width="99.9%" color="red" size="5px" /> <?php if($errors > 0){ //If Errors, Make Aware echo "There are errors on your registration.<br/>";} if($swears > 0){ //If Swears, Make Aware echo "Please do not use inappropriate content.<br/>";} if($notos > 0){ //If NoTos, Make Aware echo "Please accept the Terms Of Service.<br/>";} ?> <form action="" method="post"> <fieldset> <legend>Personal / Login Information</legend> <table width="98%"> <tr> <td width="49%">Name:[Full Name]</td> <td width="49%"><input type="text" style="width: 98%;" name="name" id="name"></td> </tr> <tr> <td>Password:<br/>[6-30 Characters]</td> <td><input type="password" style="width: 98%;" name="password" id="password"></td> </tr> <tr> <td>Re-Enter Password:</td> <td><input type="password" style="width: 98%;" name="ppassword" id="ppassword"></td> </tr> <tr> <td>Username:<br/>[Login Name]</td> <td><input type="text" style="width: 98%;" name="username" id="username"></td> </tr> <tr> <td>e-Mail:[Activation]</td> <td><input type="email" style="width: 98%;" name="email" id="email"></td> </tr> <tr> <td>Age:[For Content]</td> <td><select name="age" id="age" style="width:98%;"> <option value="noage" id="noage" name="noage">Select Age</option> <?php $age = 13; while($age < 41){ //Make Age Field echo "<option value=\"$age\">" . $age . "</option>"; $age++; } ?> <option value="other" id="other" name="other">Older</option> </td> </tr> </table> </fieldset> <p align="left">By agreeing to these terms of service, you hereby agree that you are either of legal age, or have consent of a parent and/or guardian, to view and play this game. You agree to abide by the rules of the game, along with being respectful to all players. You understand that the proper consequences will be taken against you if you break any rule of the game, or break the terms of service.</p> <div id="tos"> <table width="100%"> <tr> <td width="85%">I Understand And Agree To The Terms Of Service.</td> <td width="5%"><input type="checkbox" style="margin-top:2px;" name="tos" id="tos" /></td> </tr> </table> </div> <br/> <input type="submit" style="background-color: white;" value="Register" name="Register" id="Register" /> </form> </div> </center> <?php include('inc/footer.php'); ?> </div> </div> <?php }else{ ?> <body onload="getbrowser()"> <?php } ?> </body> <!-- This Ends Our Body --> </html> Now, I'm no expert at PHP, but I honestly don't understand why this isn't working. Can anyone give me some tips? Thanks!
  19. Hey guys, my name's David, I'm 18 currently, and I've been working in PHP since I was about 14. Honestly, I think that the OOP standard for PHP is ridiculous to follow, so I don't really use it. Anyway, I look forward to getting to know some of you on here.
×
×
  • 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.