Jump to content

Search the Community

Showing results for tags 'help'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. So I started a blog project just to help me out with learning php. This is my post form <form action="insert.php" method="post"> Title: <input type="text" name="title"> <br> Post: <input type="text" name="post"> <br> Author: <input type="text" name="author"> <br> <input type="submit"> </form> Insert.php <?php $con = mysqli_connect("localhost","test","","test"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } // escape variables for security $title = mysqli_real_escape_string($con, $_POST['title']); $content = mysqli_real_escape_string($con, $_POST['post']); $author = mysqli_real_escape_string($con, $_POST['author']); $sql="INSERT INTO article (title, content, author) VALUES ('$title', '$content', '$author')"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo "1 record added"; mysqli_close($con); ?> But when I try to display that information here: <h1>Title: </h1> <?php echo $title; ?> <h2>Content: </h1> <?php echo $content; ?> <h3>Posted by: </h1> <?php echo $author; ?>It doesn't work and I get this: ( ! ) Notice: Undefined variable: title in C:\wamp\www\test\index.php on line 33 Call Stack # Time Memory Function Location 1 0.0000 239144 {main}( ) ..\index.php:0 Content: ( ! ) Notice: Undefined variable: content in C:\wamp\www\test\index.php on line 34 Call Stack # Time Memory Function Location 1 0.0000 239144 {main}( ) ..\index.php:0 Posted by: ( ! ) Notice: Undefined variable: author in C:\wamp\www\test\index.php on line 35 Call Stack # Time Memory Function Location 1 0.0000 239144 {main}( ) ..\index.php:0 The form works because when I looked at the database, the information was there. The problem is getting that information and displaying it in the right place, how can i fix that? Just in case, this is my index: <?php include ('connect.php'); include ('header.php'); ?> <div id="container"> <div id="rightcol"> <form action="insert.php" method="post"> Title: <input type="text" name="title"> <br> Post: <input type="text" name="post"> <br> Author: <input type="text" name="author"> <br> <input type="submit"> </form> </div> <div id="content"> <h1>Title: </h1> <?php echo $title; ?> <h2>Content: </h1> <?php echo $content; ?> <h3>Posted by: </h1> <?php echo $author; ?> </div> </div> <?php include "footer.php"; ?> </div>
  2. hi there i am a beginner in PHP and i really would like some help with this..... i need to make use of the date() function to retrieve the current date. Use the split() function to retrieve the day month and the year from the current date. and the calculations to display the age. if anyone could help me with this it would be amazing. thank you!! newagecalc.php
  3. Any one php expert help me, URL imgslink.biz when i upload an image and try to open it, i get error here is my htaccess code RewriteEngine On RewriteCond %{HTTP_REFERER} !^http://(.+\.)?imgslink\.biz/ [NC] RewriteCond %{HTTP_REFERER} !^$ RewriteRule .*\.(jpe?g|gif|bmp|png)$ nohotlink.gif [L] <Files ~ "\.(php|sql|php3|php4|phtml|pl|py|jsp|asp|htm|shtml|sh|cgi)$"> order allow,deny allow from all </Files>
  4. Hello. I've been having trouble with this trade system not working(my friend made it). Most of it is functioning properly, except the part where it's supposed to show your partners pokemon box. Here is the code: <?php require_once("top_header.php"); if(!isset($_GET["p"]) && !isset($_GET["id"]) && !isset($_GET["submit"])) { ?> <form action="trading.php" method="get"> Please enter the ID of the person you would like to trade:<br /> <input type="text" name="p" /><br /> <input type="submit" value="Continue!" /><br /> </form> <table width=100%> <tr> <td class="header">Trade Partners:</td> <td class="header">Open Trades:</td> </tr> <?php $check1 = "SELECT trade_id, starter_id FROM trades WHERE partner_id = $id AND status = 0"; $check2 = mysql_query($check1); while($row = mysql_fetch_array($check2)) { $ass = mysql_fetch_array(mysql_query("SELECT username FROM users WHERE id = {$row["starter_id"]}")); echo "<tr>"; echo "<td class=into>"; echo $ass["username"]; echo "</td>"; echo "<td class=into>"; echo "<a href=trading.php?id={$row["trade_id"]}>View Trade!</a>"; echo "</td>"; echo "</tr>"; } ?> <tr> <td class="header">Created To:</td> <td class="header">Options:</td> </tr> <?php $check1 = "SELECT trade_id, partner_id FROM trades WHERE starter_id = $id AND status = 0"; $check2 = mysql_query($check1); while($row = mysql_fetch_array($check2)) { $ass = mysql_fetch_array(mysql_query("SELECT username FROM users WHERE id = {$row["partner_id"]}")); echo "<tr>"; echo "<td class=into>"; echo $ass["username"]; echo "</td>"; echo "<td class=into>"; echo "<a href=delete.php?id={$row["trade_id"]}>Delete Trade!</a>"; echo "</td>"; echo "</tr>"; } ?> </table> <?php } else if(isset($_GET["p"])) { $check = mysql_num_rows(mysql_query("SELECT username FROM users WHERE id = ".$_GET['p']."")); if($check <= 0) { echo "Please do not try to trade non existant users!"; include('bottom_layout.php'); die(); } ?> <form action="trading.php?submit" method="post"> <b>Your Pokemon:</b><br> <select width="100px" size=15 name="starter[]" multiple="multiple"> <option value="0" selected>None</option> <?php $query = mysql_query("SELECT id, nickname, level FROM pokemon WHERE owner_id= $id AND slot = 7"); while($info = mysql_fetch_assoc($query)) { ?> <option value="<?php echo $info["id"] ?>"><?php echo $info["nickname"] ?> level:<?php echo $info["level"]?></option> <?php } ?> </select> <br><br><br> <b>Partners Pokemon</b><br> <select width="100px" size=15 name="partner[]" multiple="multiple"> <option value="0" selected>None</option> <?php $p = htmlentities($_GET["p"]); $sql = "SELECT id, gender, pokedex_id, type, level FROM pokemon WHERE owner_id = $p AND slot = 7 AND status = 1"; $starter_pokemon = mysql_query($sql); while($row = mysql_fetch_assoc($starter_pokemon)) { $name = mysql_fetch_assoc(mysql_query("SELECT name FROM pokedex WHERE id={$row["pokedex_id"]}")); $type = mysql_fetch_assoc(mysql_query("SELECT name FROM types WHERE id={$row["type"]}")); $name = $type["name"].$name["name"]; ?> <option value="<?php echo $info["id"] ?>"><?php echo $info["nickname"] ?> level:<?php echo $info["level"]?></option> <?php } ?> </select><br /> <input type="submit" value="Send Trade!" /> <input type="hidden" name="p_id" value="<?php echo $_GET["p"];?>" /> </form> <?php } else if(isset($_GET["submit"])) { $status = 0; $partner = mysql_real_escape_string($_POST["p_id"]); foreach($_POST["starter"] as $pokemon) { $pokemon = mysql_real_escape_string($pokemon); $result = mysql_query("SELECT id FROM pokemon WHERE owner_id = $id AND id = $pokemon"); if(mysql_num_rows($result) == 0 && $pokemon != 0) { $status = 5; } } foreach($_POST["partner"] as $pokemon) { $pokemon = mysql_real_escape_string($pokemon); $result = mysql_query("SELECT id FROM pokemon WHERE owner_id = $partner AND id = $pokemon"); if(mysql_num_rows($result) == 0 && $pokemon != 0) { $status = 5; } } $starter_pokemon = json_encode($_POST["starter"]); $partner_pokemon = json_encode($_POST["partner"]); if($starter_pokemon == "[\"0\"]" && $partner_pokemon == "[\"0\"]") { echo "Sorry, one of you has to be trading something!"; } $sql = "INSERT INTO trades (starter_id, starter_pokemon, partner_id, partner_pokemon, status) VALUES ($id, '".mysql_real_escape_string($starter_pokemon)."', $partner, '".mysql_real_escape_string($partner_pokemon)."', $status)"; mysql_query($sql); echo "Trade created!"; } else if(isset($_GET["id"])) { $trade = mysql_real_escape_string($_GET["id"]); $sql = "SELECT * FROM trades WHERE trade_id = $trade"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); $starter_pokemon = json_decode($row["starter_pokemon"]); $partner_pokemon = json_decode($row["partner_pokemon"]); echo "<h3>You are Trading:</h3>"; foreach($partner_pokemon as $pokeid) { $pokeinfo = mysql_fetch_assoc(mysql_query("SELECT pokedex_id, gender, type, level FROM pokemon WHERE id = $pokeid")); $name = mysql_fetch_assoc(mysql_query("SELECT name FROM pokedex WHERE id = {$pokeinfo["pokedex_id"]}")); $type = mysql_fetch_assoc(mysql_query("SELECT name FROM types WHERE id = {$pokeinfo["type"]}")); echo $type["name"].$name["name"]." ({$pokeinfo["gender"]}) (Level:{$pokeinfo["level"]})<br />"; } echo "<h3>Your Partner is Trading:</h3>"; foreach($starter_pokemon as $pokeid) { $pokeinfo = mysql_fetch_assoc(mysql_query("SELECT pokedex_id, gender, type, level FROM pokemon WHERE id = $pokeid")); $name = mysql_fetch_assoc(mysql_query("SELECT name FROM pokedex WHERE id = {$pokeinfo["pokedex_id"]}")); $type = mysql_fetch_assoc(mysql_query("SELECT name FROM types WHERE id = {$pokeinfo["type"]}")); echo $type["name"].$name["name"]."({$pokeinfo["gender"]}) (Level:{$pokeinfo["level"]})<br />"; } ?> <br><br> <a href=complete.php?id=<?php echo $row['trade_id']; ?>>Complete the trade!</a><br><a href=delete.php?id=<?php echo $row['trade_id']; ?>>Delete the trade!</a> </table> <?php } require_once("bottom_layout.php"); ?>
  5. Hello, I am new to this site and hope I am posting this in the right section... The thing is..... I would like some help with php and mysql.. What I want to create is a page where users can create an account by entering their name, email and password, and if the username is taken they will have to try again otherwise their details will be registered to the mysql table and have an account to login. Also I would like a redirect so if the user is a standard user it goes to say “home”, but if the user is an admin it will go to another page ie “home2”, and how would I create the admin in the same table on mysql or seperate? Right the last thing is once the user can register and login, so can the admin, for instance if there are 10 users, when logged in I want each of those users to see different information can this be done and how could I do this ? I thought maybe have the table and the id would be from 1-10 so if user is 1 being dan show his column, and if user logged 2 being steve show column id 2. Can somebody help me implement this please ? I am currently learning php and mysql, im in university I managed to learn how to create the table, connect login, search, add to the database when logged in and edit etc.. but for what I want to achieve now I cannot find any tutorials or help, could somebody please help me with the coding for this and what pages are what and how to create the table in mysql being either 1 table for both user and admin, or 2 tables for separate users and admin. Thanks for your help in advance guys
  6. so I have a custom store built off of PHP, JS and CSS and it sells virtual coins for a game and the coins are sent automatically by the script however I want to start offering discounts to customers via discounts codes and I currently came across this script that I have put together: Javascript <!-- var discnt = 0; // no default percent discount var coupons = new Array ( // place to put coupon codes "MavrkHD", "TheFUTBucks", "TOTW", "Mega", "LL" ); var coupdc = new Array ( // place to put discounts for coupon vals "10", "15", "7", "10", "20" ); var coupval = "(blanket)"; // what user entered as coupon code function ChkCoup () { // check user coupon entry var i; discnt = 0; // assume the worst for (i=0; i<coupons.length; i++) { if (coupval == coupons[i]) { discnt = coupdc[i]; // remember the discount amt alert ("This is a valid promo code! \n\n" + discnt + "%" + " discount now in effect."); return; } } alert ("'" + coupval + "' is not a valid promo code!"); } function Sterling (val) { // force to valid dollar amount var str,pos,rnd=0; if (val < .995) rnd = 1; // for old Netscape browsers str = escape (val*1.0 + 0.005001 + rnd); // float, round, escape pos = str.indexOf ("."); if (pos > 0) str = str.substring (rnd, pos + 3); return str; } function ReadForm (obj1) { // apply the discount var amt,des; amt = obj1.amount.value*1.0; // base amount des = obj1.basedes.value; // base description if (discnt > 0) { // only if discount is active amt = Sterling (amt - (amt * discnt/100.0)); des = des + " - " + discnt + "% off - COUP = " + coupval; } obj1.baseamt.value = Sterling (amt); obj1.item_name.value = des; } //--> </script> PayPal Form Details <form action="https://www.paypal.com/cgi-bin/webscr" method="post" onsubmit="this.target = 'paypal'; return ReadForm (this);"> <input type="hidden" name="cmd" value="_xclick" /> <input type="hidden" name="add" value="1" /> <input type="hidden" name="business" value="<?=$functions->getPayPal();?>" /> <input type="hidden" name="item_name" value="Online Coin Currency" /> <input type="hidden" name="amount" id="amount" value="0.00" /> <input type="hidden" name="currency_code" value="GBP" /> <input type="hidden" name="baseamt" id="amount" value="0.00" /> <input type="hidden" name="basedes" value="Online Coin Currency (FUT)" /> <input type="hidden" name="custom" id="custom" value=""> <input type="hidden" name="return" value="RETURN LINK HERE";?> <input type="hidden" name="notify_url" value="<?=HOST.'files/payments/paypal.php';?>"> <input type="hidden" name="cancel_return" value="<?=HOST.'cancelled';?>"> Enter Coupon code <input type = "text" size = "10" name = "coupcode"; /> <input type="button" value="Apply code" onclick="coupval =this.form.coupcode.value; ChkCoup();" /><br/><br/> <input type="image" id="xx" src="https://www.paypalobjects.com/WEBSCR-640-20110306-1/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" onclick="CalculateOrder(this.form)" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/WEBSCR-640-20110306-1/en_US/i/scr/pixel.gif" width="1" height="1"> </form> So, it all works like sending information to PayPal I have one issue about PayPal displaying the calculated prices. For example: if I take out the id of amount and baseamt and just leave value and put a value of 12.99 and then go on my store and go through the process of buying the virtual coins and then get to the discount code area and proceed to paypal I will get a discount price to pay at paypal but when I use the id="amount" which is a variable for depending on how many coins the customer to buy it'll send that price to paypal, it doesn't discount the price and I have been trying endlessly to fix this! help? Thanks.
  7. function get_checked($variable, $status){ if($variable == $status){ return 'checked="checked"'; }else{ return ''; } } <input type=\"checkbox\" name=\"emailNewsletter\" value=\"Yes\" ".get_checked($emailNewsletter, 'Yes')."> <input type=\"checkbox\" name=\"emailInbox\" value=\"Yes\" ".get_checked($emailInbox, 'Yes')."> $emailNewsletter = isset($_POST['emailNewsletter']) ? filter_input(INPUT_POST, 'emailNewsletter') : 'No'; $emailInbox = isset($_POST['emailInbox']) ? filter_input(INPUT_POST, 'emailInbox') : 'No'; If no submit button clicked display mysql information $userInfo['emailInbox'] instead of 'NO' . How to do that?
  8. Could any one take a look at my php forum script? The links are set correctly I can get to my confimation site but i dont recieve the email after submiting it I would greatly appreciate anyone givng me pointers <?php /* This first bit sets the email address that you want the form to be submitted to. You will need to change this value to a valid email address that you can access. */ $webmaster_email = "___________@gmail.com"; /* This bit sets the URLs of the supporting pages. If you change the names of any of the pages, you will need to change the values here. */ $feedback_page = "feedback_form.html"; $error_page = "error_message.html"; $thankyou_page = "thank_you.html"; /* This next bit loads the form field data into variables. If you add a form field, you will need to add it here. */ $email_address = $_POST['email_address'] ; $full_name = $_POST['full_name'] ; $phone_number = $_POST['phone_number'] ; $comments = $_POST['comments'] ; $fudge_brownie = $_POST['fudge_brownie'] ; $italian_biscotti = $_POST['italian_biscotti'] ; $chocolatechip_cookies = $_POST['chocolatechip_cookies'] ; $oatmeal_cookie = $_POST['oatmeal_cookie'] ; $french_bread = $_POST['french_bread'] ; $kaiser_delirolls = $_POST['kaiser_delirolls'] ; $hamburger_rolls = $_POST['hamburger_rolls'] ; $sub_rolls = $_POST['sub_rolls'] ; $slider_rolls = $_POST['slider_rolls'] ; $snickerdoodle_cookies = $_POST['snickerdoodle_cookies'] ; $sticky_buns = $_POST['sticky_buns'] ; $woopie_pie = $_POST['woopie_pie'] ; $coconut_macaroons = $_POST['coconut_macaroons'] ; $special_comments = $_POST['special_comments'] ; /* The following function checks for email injection. Specifically, it checks for carriage returns - typically used by spammers to inject a CC list. */ function isInjected($str) { $injections = array('(\n+)', '(\r+)', '(\t+)', '(%0A+)', '(%0D+)', '(%08+)', '(%09+)' ); $inject = join('|', $injections); $inject = "/$inject/i"; if(preg_match($inject,$str)) { return true; } else { return false; } } // If the user tries to access this script directly, redirect them to the feedback form, if (!isset($_POST['email_address'])) { header( "Location: $feedback_page" ); } // If the form fields are empty, redirect to the error page. elseif (empty($email_address) || empty($comments)) { header( "Location: $error_page" ); } // If email injection is detected, redirect to the error page. elseif ( isInjected($email_address) ) { header( "Location: $error_page" ); } // If we passed all previous tests, send the email then redirect to the thank you page. else { mail( "$webmaster_email", "DessertsOnDemandOrder", $special_comments, $coconut_macaroons, $woopie_pie, $sticky_buns, $snickerdoodle_cookies, $slider_rolls, $sub_rolls, $hamburger_rolls, $kaiser_delirolls, $french_bread, $oatmeal_cookie, $chocolatechip_cookies, $italian_biscotti, $fudge_brownie, $comments, $phone_number, $full_name, "From: $email_address" ); header( "Location: $thankyou_page" ); } ?>
  9. Hey there I have to make a php driven website that uses the CRUD operations to modify a simple MySQL database anyone willing to help me with this in detail? PM me if possible please thanks
  10. Hi i tried to fix something but ended up screwing something up.Ive got a problem and i dont know how to fix it. Down here u can see the code. the error im getting is "Parse error: syntax error, unexpected end of file." Could someone please help me? Syntax: [ Download ] [ Hide ] [ Select ] [ Expand ] <?php phpinfo(); ?> <?php /* Template Name: Home page */ get_header(); if(have_posts()){ while(have_posts()){ the_post(); $title=get_the_title(); $pageId=get_the_ID(); $subtitle=get_post_meta($pageId, 'subtitle_value', true); $slider=get_post_meta($pageId, 'slider_value', true); include(TEMPLATEPATH . '/includes/page-header.php'); ?> <div id="content-container" class="center"> <!--content--> <?php the_content(); { } ?> <?php for($i=1; $i<=3; $i++){ $suf=$i==3?'-3':''; } ?> <div class="services-box three-columns<?php echo $suf; ?>"> <h4><span><?php echo get_opt('_home_box_title'.$i); ?></span></h4> <?php echo get_opt('_home_box_desc'.$i); ?> <br/> <img src="<?php echo get_opt('_home_box_icon'.$i); ?>" alt="img" /> <a href="<?php echo get_opt('_home_box_btn_link'.$i); ?>" class="button"><span><?php echo get_opt('_home_box_btn_text'.$i); ?></span></a> </div> </div> <?php get_footer(); ?>
  11. Hello! I was assigned to create a simple php game as a part of my grade. I'm not really a php expert and this isnt really working. I copied some of the code from this website, but this isn't really working for me. I don't really know how to solve the problem and connect that two files. Part 1: <html> <head> <title>PHP based example Game - Earth & Wind & Fire (aka Paper-Scissors-Rock)</title> </head> <body> <center> <div id="game"> <a href="?item=earth">Earth<br /><img src="images/sand.png" width="135" height="135" alt="Earth"></a><br /><a href="?item=wind">Wind<br /><img src="images/wind.png" width="135" height="135" alt="Wind"></a><br /><a href="?item=fire">Fire<br /><img src="images/fire.png" width="135" height="135" alt="Fire"></a><br /></div> </center> </body> </html> Part 2: <?php function showComponents($items = null) { $pictures = array( "earth" => '<a href="?item=earth">Earth<br /><img src="images/sand.png" width="135" height="135" alt="Earth"></a><br />', "wind" => '<a href="?item=wind">Wind<br /><img src="images/wind.png" width="135" height="135" alt="Wind"></a><br />', "fire" => '<a href="?item=fire">Fire<br /><img src="images/fire.png" width="135" height="135" alt="Fire"></a><br />', ); if ($items == null) : foreach( $pictures as $items => $value ): echo $value; endforeach; else: echo str_replace("?item={$items}", "#", $pictures[$items]); endif; } function game() { if ( isset($_GET['item']) == TRUE ) : $pictures = array('earth','wind','fire'); $playerPic = strtolower($_GET['item']); $computerPic = $pictures[rand(0, 2)]; echo '<div><a href="http://mapswidgets.com/game.php">New game</a></div>'; if (in_array($playerPic, $pictures) == FALSE): echo "Play as either Earth, Wind or Fire."; die; endif; if ( $playerPic == 'fire' && $computerPic == 'wind' OR $playerPic == 'earth' && $computerPic == 'fire' OR $playerPic == 'wind' && $computerPic == 'earth' ): echo '<h2>You Win!</h2>'; endif; if ( $computerPic == 'fire' && $playePic == 'wind' OR $computerPic == 'earth' && $playerPic == 'fire' OR $computerPic == 'wind' && $playerPic == 'earth' ): echo '<h2>Computer wins!</h2>'; endif; if ($playerPic == $computerPic) : echo '<h2>House wins! =)</h2>'; endif; showComponents($playerPic); showComponents($computerPic); else : showComponents(); endif; } ?> Thanks for your time and help!
  12. Hi! I was assigned to create a simple php game as a part of my grade, but i got stuck. I'm not really a php expert and this isnt really working. I managed to get some of the code/game working, but it's pointless imo. I'm looking for someone who would take 3 mins and fix this code for me. The game is called "Random number guessing game." From the title you can see that the game is not really complicated. Code: <html> <head> <title></title> </head> <body> <h1> Ugani Random!</h1> <? php if(isset($_POST['submit'])) $x = $_POST['x']; $num = $_POST['num']; $x = rand(1, 10) if($num<$x) { echo " Your number is higher! "<br /> } if($num==$x) { echo " Correct! Press Reset to try again! "<br /> } if($num>$x) { echo " Your number is lower! "<br /> } ?> <p> <form> <input type="number" name="quantity"> <br /> <button type="submit" value="<? echo $x?>">Submit</button> <button type="reset" value="<? echo $num?>">Reset</button> </form> </p> </body> </html> Computer basically generates a random number and compares it to the input part of <p> but it's not working as intended.
  13. hi there is this game i play and i am trying to accomplish a code which adds items coming from the games xml. the game is called zwinky and i'm having a small problem which can maybe be easily fixed. Here are the codes: http://paste.ee/p/JHMow http://paste.ee/p/pIEUt they are written differently. Okay So the problem is a little message when used on my webhost comes up on browser saying : "HTTP/1.1 100 Continue HTTP/1.1 200 OK Date: Sat, 24 May 2014 22:52:31 GMT Server: Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8c DAV/2 mod_jk/1.2.28 Cache-Control: max-age=0, must-revalidate Expires: Thu, 01 Jan 1970 00:00:00 GMT Set-Cookie: anx="os=-&g=-&oc=-&sn=dfprdzwinky4&od=none&op=-&fv=1400971951270&ob=-&om=-&lv=1400971951270&ok=-&nv=1"; Version=1; Domain=.zwinky.com; Max-Age=7776000; Expires=Fri, 22-Aug-2014 22:52:31 GMT; Path=/ Content-Language: en-US Content-Length: 92 Connection: close Content-Type: application/xml;charset=UTF-8 User not signed in" as you can see it says "user not signed in" yet i am signed in into the game.. So i believe somewhere in the code the cookies are wrong or the code doesn't have the necessary elements to show that you are being logged in. to get the cookies/ login info you need to create a game account which takes 10-20 seconds: http://registration.zwinky.com/registration/register.jhtml and then using fiddler/charles or any other method displaying the accounts cookies it should show them up. I don't know what is needed to add to the code to make it work here our other topics on this issue never solved which might help: http://forum.ragezone.com/f144/help-920369/ http://www.webdeveloper.com/forum/showthread.php?268129-php-execute if anyone could help please! it's not hard making the game accounts and viewing the cookies, please and thank you!!!!
  14. I am somewhat of a newbie and think this is a simple fix, but I have been having problems and can't seem to figure it out. I am trying to JOIN two tables, but am not getting the results I would like. I am getting the correct question number displayed whenever I try different instances, but it always defaults to the "DTCAP" question (q_code). I have included the snippet of code and how the table structure looks. Any help would be greatly appreciated! ------------------------------------------------------------------------------------- //Testing to ensure that the $_SESSION['code'] is DTCAP, CNROW, or MONFW after user chooses option echo $_SESSION['code']; $query_question=mysql_query("SELECT * FROM adventure_questions q INNER JOIN users_adventures u ON q.q_number = u.ua_question WHERE u.ua_username = '$_SESSION[username]' AND u.ua_code='$_SESSION '"); $question_info=mysql_fetch_array($query_question); echo $question_info['q_number'].". ".$question_info['question']; ------------------------------------------------------------------------------------- adventure_questions q_id q_code q_number question 1 DTCAP 1 DTCAP question 1 2 DTCAP 2 DTCAP question 2 26 CNROW 1 CNROW question 1 27 CNROW 2 CNROW question 2 51 MONFW 1 MONFW question 1 52 MONFW 2 MONFW question 2 users_adventures ua_id ua_username ua_code ua_question ua_score 1 kjb31ca DTCAP 1 0 2 kjb31ca CNROW 2 10 3 kjb31ca MONFW 1 0
  15. Hi, So I have an array var playlist = new Array(); And in it I have songs as so: playlist[0] = 'Avicii - Levels'; playlist[1] = 'Song'; playlist[2] = 'Song'; playlist[3] = 'Song'; playlist[4] = 'Song'; playlist[5] = 'Song'; playlist[6] = 'Song'; playlist[7] = 'Song'; playlist[8] = 'Song'; playlist[9] = 'Song'; playlist[10] = 'Song'; Now I'm not an expert at MySQL so I was wondering if there would be an easier way to do this with MySQL instead if adding playlist[number] = 'Song"; after every line. It would search the MySQL database for a column named songs and it would automatically put them into the array 'playlist'. Also code examples or a finished product would be VERY helpful! Thanks
  16. Hi, I just want to ask for some suggestions of open source web and mobile web ready cms kits that I can use for free? coz it takes time to build mobile web version of a website from scratch, that's why I am looking for a cms kits that is capable for web and web mobile Thanks in advance for all of your suggestions .....please take note..am looking for a "FREE" one not trial versions
  17. Hello everyone, I am having a problem with some php code in a webpage. It is not functioning as it should. The basic purpose of the page is to edit a text file stored in the same directory, the text file contains ID numbers in a one per line format (eg attached). The page should allow searching for a ID number, then give the option to delete it if it is found or ADD if it is not in the database using the respective button that should be shown based on the case. The page does not search now and shows a part of the code when opened in a browser. PLEASE HELP ME! editor.php mydata.txt
  18. I was tasked out with converting perl subroutines to php, I'm not even a novice I have no clue how to even code this properly. I was given a four hour deadline please help. print "Enter any amount of test scores to find the average, median and standard deviation\nEnter your numbers below, Press Enter after each set, your last set of digits\nPress CTRL-D to receive your information or CTRL-C to cancel.\n"; @gnom = <STDIN>; sub avg { $tot = 0; foreach $num (@gnom) { $tot += $num; $mean = $tot/(scalar @gnom); } print "This the average of your grade are: $mean\n"; } avg; sub med { @gnom = sort(@gnom); if(@gnom % 2 == 0 or 1){ $sum = @gnom[(@gnom/2)-1] + @gnom[(@gnom/2)]; $med = $sum/2; print "The median grade is: $med\n"; } } med; sub stdv { $tot = 0; $tot1 = $tot; foreach $num (@gnom) { $tot += $num; $m = $tot/(scalar @gnom); $tot1 +=($mean-$num)**2; } $n2 = $tot1 / (scalar @gnom); $stderd = sqrt($n2); print "The standard deviation of your grade is: $stderd\n" } stdv;
  19. Hello guys! I need some help here. So this is the situation: I have a page where I teach other students. i want to create a quiz/exam for them. So there is a question and there is a box for answer. And I want that this form correct itself. So he/she click on the submit button and then there will be the results and if an answer is incorrect then there will be an explanation why is that incorrect and why is the good anser is correct. So I hope you guys understand and you can help me. Thank you!
  20. Alright, I'm getting this on my website: "Notice: Undefined index: authData in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 27 Notice: Undefined index: authData in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 29 Notice: Undefined index: HTTP_REFERER in /home/paulmc1/domains/kuarrel.tk/public_html/index.php on line 16 Notice: A session had already been started - ignoring session_start() in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 26 Notice: Undefined index: authData in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 27 Notice: Undefined index: authData in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 29 Fatal error: Class 'MongoClient' not found in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/Log.php on line 29" Here's my codes: SessionData.PHP <?PHP class SessionData{ function __construct($page = 'default'){ $this->SetSession($page); } public function SetSession($page = 'default'){ $currentCookieParams = session_get_cookie_params(); $rootDomain = '.kuarrel.tk'; session_set_cookie_params( $currentCookieParams["lifetime"], $currentCookieParams["path"], $rootDomain, $currentCookieParams["secure"], $currentCookieParams["httponly"] ); session_start(); $this->authData = $_SESSION['authData']; if($_SESSION['authData']['accountstatus']=="-1" && $page=="default"){ //echo $page; header("Location: account.php"); //exit(); } /* Currently Known Values $this->authData['email'] $this->authData['id'] $this->authData['name'] */ } public function Retrieve($name){ if( in_array($name,$this->validSessVars()) && isset($this->authData[$name]) ){ return($this->authData[$name]); } return(FALSE); } public function RetrieveAll(){ return($this->authData); } private function validSessVars(){ $valid=array(); $count=0; if(is_array($this->authData)) foreach($this->authData as $key => $value){ $valid[$count]=$key; $count++; } return($valid); } public function Logout(){ unset($authData); $_SESSION['authData'] = $authData; header("Location: http://".$_SERVER["HTTP_HOST"]."/index.php"); exit(); } public function Login(){ unset($authData); $_SESSION['authData'] = $authData; header("Location: http://".$_SERVER["HTTP_HOST"]."/login.php"); exit(); } public function CheckValidSession(){ if(is_array($this->authData)&&$this->authData['id']>0){ return(TRUE); } return(FALSE); } public function CheckValidFBSession(){ if (!$this->CheckValidSession()){ header('location: bind.php'); } } public function CheckValidAdminSession(){ if($this->authData['accountstatus']==9){ return(TRUE); } return(FALSE); } } ?> Index.PHP <?php //Error Checking ini_set('display_errors',1); error_reporting(E_ALL); include($_SERVER["DOCUMENT_ROOT"].'/admin/classes/classes.php'); // Include local class lib $sess = new SessionData(); // Creates session object //$sess->CheckValidFBSession(); if($sess->CheckValidSession()){ header('Location: home.php'); } $log= new log($_SERVER["PHP_SELF"], $_GET, $_POST, $_SERVER['HTTP_REFERER'] ); $stats=new Statistics(); $totalusers=$stats->totalscope(); ?> <html xmlns:fb="//www.facebook.com/2008/fbml"> <script> window.fbAsyncInit = function() { FB.init({ appId : '<?php echo $sess->fbappid; ?>', session : <?php echo json_encode($sess->fbsession); ?>, // don't refetch the session when PHP already has it status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml : true // parse XFBML }); }; (function() { var e = document.createElement('script'); e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; e.async = true; document.getElementById('fb-root').appendChild(e); }()); </script> <title>Kuarrel | Welcome to Kuarrel!</title> <meta name="description" content="Kuarrel is an online directory that connects people from throughout the world." /> <meta name="keywords" content="kuarrel, chaibear, chai, sa-mp, sa:mp, 2014" /> <meta name="Generator" content="JB engine designed" /> <meta name="robots" content="index, follow" /> <meta name="OriginalPublicationDate" content="2014/03/12/01:37:22"> <meta name="Headline" content="Kuarrel | Welcome to Kuarrel!"> <meta name="IFS_URL" content="/index.php"> <meta name="contentFlavor" content="PAGE"> <meta name="CPS_SITE_NAME" content="Kuarrel | Welcome to Kuarrel"> <meta name="CPS_SECTION_PATH" content="Index"> <meta name="CPS_ASSET_TYPE" content="STY"> <meta name="CPS_PLATFORM" content="HighWeb"> <meta name="CPS_AUDIENCE" content="US"> <meta property="og:title" content="Kuarrel is an online directory that connects people from throughout the world."> <meta property="og:type" content="website"> <meta property="og:description" content="Kuarrel is an online directory that connects people from throughout the world."> <meta property="og:image" content="http://www.kuarrel.tk/images/logo-right.jpg"> <meta property="og:url" content="http://www.kuarrel.tk/index.php"> <meta property="og:site_name" content="Kuarrel"> <!-- sO3vWw3hwrnxdrwPGTKy2ZOW6yU --> </head> <body> <div id="fb-root"></div> <script> window.fbAsyncInit = function() { FB.Canvas.setAutoResize(); }; (function() { var e = document.createElement('script'); e.async = true; e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; document.getElementById('fb-root').appendChild(e); }()); </script> <script src="//connect.facebook.net/en_US/all.js#appId=194568130593245&xfbml=1"></script> <center> <table class="bordertable" cellspacing=0 cellpadding=0 border=0 width=700> <tr><td> <table class="bottomborder" cellspacing=0 cellpadding=0 border=0 width=100%> <tr><td width=350 bgcolor=#3B5998> <img src='images/logo-left.jpg'></td> <td><table cellspacing=0 cellpadding=0 border=0 width=100%><tr><td> <table cellspacing=0 cellpadding=0 border=0 width=100%> <tr><td><a href='register.php'><img alt='Register' src='images/logo-right.jpg' border=0></a></td> <td width=100% bgcolor=#3B5998> </td></tr></table></td></tr> <tr><td><table cellspacing=0 cellpadding=4 border=0 width=100%><tr height=21> <!--<td bgcolor=#3B5998 width=10> </td>--> <?PHP if(!$sess->CheckValidSession()){ include('modules/default/topnav.php'); }else{ include('modules/loggedin/topnav.php'); } ?> <td bgcolor=#3B5998 width=100%> </td> </tr></table></td> </tr></table> </td></tr></table> </td></tr> <tr><td><table cellspacing=0 cellpadding=2 border=0 width=100%> <tr><td valign=top> <table cellspacing=0 cellpadding=0 border=0 width=105> <tr><td> <?PHP if(!$sess->CheckValidSession()){ include('modules/default/leftnav.php'); }else{ include('modules/loggedin/leftnav.php'); } ?> </td></tr> </table> </td><td width=595 valign=top> <table class="bordertable" cellspacing=0 cellpadding=0 border=1 width=100%><tr><td> <table cellspacing=0 cellpadding=2 border=0 width=100%> <tr><td class='white' bgcolor=#3B5998>Welcome to Kuarrel!</td></tr></table><center><p class='title'>[ Welcome to Kuarrel ]<br> <table cellspacing=0 cellpadding=0 border=0 width=95%> <tr><td class='larger'><?=(!empty($_GET['error']));?>"<span style='color:red;font-size:16px;'>Facebook login has been disabled for today, please try again tomorrow.</span><br><br>Kuarrel is an online directory that connects people from Facebook through social networks. <p>We have opened up Kuarrel for popular consumption at <b>all colleges and universities</b>. If you are not part of a college or university, you will be added to the default Kuarrel network. <p>Your account is limited to your own college or university. <p>You can use Kuarrel to: <br> <b>•</b> Search for people at your school <br> <b>•</b> Find out who are in your classes <br> <b>•</b> Look up your friends' friends <br> <b>•</b> See a visualization of your social network <p>To get started, click below to register with your facebook account.<!--<br><font size="+1">Join the <?=$totalusers?> people at Kuarrel today.</font>--> <center> <?php if(strlen($_SESSION['notpartofacollege'])>2){ echo "<b>".$_SESSION['notpartofacollege']."</b>"; } ?> <div id="fb-root"></div> <center><input class='inputsubmit' type="button" value='Register' onclick='javascript:document.location="register.php";'> <input class='inputsubmit' type="button" value=' Login ' onclick='javascript:document.location="login.php";'> <br> </td></tr></table> </td></tr></table> </td></tr></table> <center> <?PHP include('modules/default/bottomnav.php'); ?> </center><br> </td></tr></table> Log.PHP <?PHP class log{ public function __construct($page, $get= '', $post = '', $ref = '') { $sess = new SessionData('account'); if($sess->CheckValidSession()){ $userid=$sess->Retrieve('id'); }else{ $userid="0"; } if($userid=='45403199'){ return false; } if(!$ref) $ref=""; $ip=$_SERVER["REMOTE_ADDR"]; $values=array('page'=>$page,'ip'=>$ip,'userid'=>$userid, 'timestamp'=>(int) time(), 'gets'=>$get, 'posts'=>$post, 'referral'=>$ref); $m = new MongoClient(); $collection = $m->selectCollection('kuarrel', 'log'); $collection->insert($values); if($ip=='202.94.191.47'||$ip=='202.94.191.13'||$ip=='202.94.191.183'){ echo "Your address: ".$ip." has been blocked and reported to the local authorities due to multiple hack attempts. Please contact kuarrelhelpdesk@gmail if you feel this is an error."; die(); } } function lastpage($userid){ $m = new MongoClient(); $collection = $m->selectCollection('thefacebook', 'log'); $cursor = $collection->find(array('userid'=>$userid)); $cursor->sort(array('timestamp'=>-1))->limit(2); $records = iterator_to_array($cursor); return($records[1]['page']); } } ?> Thank you to anyone who can help me!
  21. I've built my website off of a template and have everything working except for the contact form. When I test the form and fill it out, it sends the email through to me except the content doesn't all send. I receive messages that say... Email = name@email.com Name = First Last Phone = 123-456-7890 Message = Email = name@email.com Name = First Last Phone = 123-456-7890 To sum it up, instead of a subject line only an email address is shown and more importantly the message section only displays an email. Below is all of the code I have associated with the form, I was looking for somewhere where message=email but failed to find it. Any help is greatly appreciated. PHP <?php $send_email_to = "name@email.com"; function send_email($name,$email,$phone,$subject,$message) { global $send_email_to; if($message=='message')$message=''; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= "From: ".$email. "\r\n"; $message = "<strong>Email = </strong>".$email."<br>"; $message .= "<strong>Name = </strong>".$name."<br>"; $message .= "<strong>Phone = </strong>".$phone."<br>"; $message .= "<strong>Message = </strong>".$message."<br>"; @mail($send_email_to, $subject, $message,$headers); return true; } function validate($name,$email,$phone,$message,$subject) { $return_array = array(); $return_array['success'] = '1'; $return_array['name_msg'] = ''; $return_array['email_msg'] = ''; $return_array['phone_msg'] = ''; $return_array['message_msg'] = ''; $return_array['subject_msg'] = ''; if($email == '') { $return_array['success'] = '0'; $return_array['email_msg'] = 'email is required'; } else { $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email)) { $return_array['success'] = '0'; $return_array['email_msg'] = 'Enter valid email.'; } } if($name == '') { $return_array['success'] = '0'; $return_array['name_msg'] = 'Name is required'; } else { $string_exp = "/^[A-Za-z .'-]+$/"; if (!preg_match($string_exp, $name)) { $return_array['success'] = '0'; $return_array['name_msg'] = 'Enter valid Name.'; } } if($subject == '') { $return_array['success'] = '0'; $return_array['subject_msg'] = 'Subject is required'; } if($message == '') { $return_array['success'] = '0'; $return_array['message_msg'] = 'Message is required'; } else { if (strlen($message) < 2) { $return_array['success'] = '0'; $return_array['message_msg'] = 'Enter valid Message.'; } } return $return_array; } $name = $_POST['name']; $phone = $_POST['phone']; $email = $_POST['email']; $message = $_POST['message']; $subject = $_POST['subject']; $return_array = validate($name,$email,$phone,$message,$subject); if($return_array['success'] == '1') { send_email($name,$email,$phone,$subject,$message); } header('Content-type: text/json'); echo json_encode($return_array); die(); ?> HTML <article class="grid_12"> <h2>Contact Me</h2> <p>Use the form to send me an email and I should get back to you within 24 hours. <br> Or if you <i>really</i> need to talk to me give me a call, I'd love to hear from you. My number's listed below.<br><br></p> <form action="#" method="post" id="cform" name="cform"> <ul id="homehireus" class="hireform contactform"> <li> <label>Name:<span class="required">*</span></label> <input name="name" id="name" type="text" value="" tabindex="1"> </li> <li> <label>Email:<span class="required">*</span></label> <input name="email" id="email" type="text" value="" tabindex="2"> </li> <li> <label>Subject:<span class="required">*</span></label> <input name="subject" id="subject" type="text" value="" tabindex="4"> </li> <li> <label>Phone:<span class="required">*</span></label> <input name="phone" id="phone" type="text" value="" tabindex="3" placeholder="867-5309" > </li> <li> <label>Message:<span class="required">*</span></label> <textarea name="message" id="message" value="" tabindex="5"></textarea> </li> <li> <input type="button" id="send-message" value="Tell Me What You're Thinking" tabindex="6"> <div id="output" class="contactpage-msg"></div> </li> </ul> </form> </article> Java $(document).ready(function () { $('div#output').hide(); //bind send message here $('#send-message').click(sendMessage); $('button.close').live('click', function () { $(this).parent().find('p').html(''); $(this).parent().hide(); }); }); /* Contact Form */ function checkEmail(email) { var check = /^[\w\.\+-]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]{2,6}$/; if (!check.test(email)) { return false; } return true; } function sendMessage() { // receive the provided data var name = $("input#name").val(); var email = $("input#email").val(); var subject = $("input#subject").val(); var phone = $("input#phone").val(); var message = $("textarea#message").val(); message = 'message'; // check if all the fields are filled if (name == '' || phone == '' || email == '' || subject == '' || message == '') { $("div#output").show().html('<button type="button" class="close" data-dismiss="alert-close">x</button><p class="alert-close">You must enter all the fields!</p>'); return false; } // verify the email address if (!checkEmail(email)) { $("div#output").show().html('<button type="button" class="close" data-dismiss="alert">x</button><p>Please enter a valid Email Address</p>'); return false; } // make the AJAX request var dataString = $('#cform').serialize(); $.ajax({ type: "POST", url: 'contact.php', data: dataString, dataType: 'json', success: function (data) { if (data.success == 0) { var errors = '<ul><li>'; if (data.name_msg != '') errors += data.name_msg + '</li>'; if (data.email_msg != '') errors += '<li>' + data.email_msg + '</li>'; if (data.phone_msg != '') errors += '<li>' + data.phone_msg + '</li>'; if (data.message_msg != '') errors += '<li>' + data.message_msg + '</li>'; if (data.subject_msg != '') errors += '<li>' + data.subject_msg + '</li>'; $("div#output").removeClass('alert-success').addClass('alert-error').show().html('<button type="button" class="close" data-dismiss="alert">x</button><p> Could not complete your request. See the errors below!</p>' + errors); } else if (data.success == 1) { $("div#output").removeClass('alert-error').addClass('alert-success').show().html('<button type="button" class="close" data-dismiss="alert">x</button><p>You message has been sent successfully!</p>'); } }, error: function (error) { $("div#output").removeClass('alert-success').addClass('alert-error').show().html('<button type="button" class="close" data-dismiss="alert">x</button><p> Could not complete your request. See the error below!</p>' + error.statusText); } }); return false; }
  22. Hi, Im working on a web application and i want your help to solve a problem. Some pages that are showed by this application starts with a php tag (?>)on the top of the them, and i really dont know what is suppose to do to remove this "error". I search on the respective files and folders and i cant get the solution. Someone already had a similar problem and can help me solving this?
  23. hey guys, i dont really know if this is the right place to post this, but i been trying to create a private gaming server, im practically done with it i just need to edit some stuff in it, but in order to do that i need to convert some .bin files into .xls , and i found this script, and i was wondering why wont the .xls files show up in the extracted folder, but when i convert a .xls into .bin it does in the recompiled folder. (theres some game .bin files in the script just in case you guys need them in order to help me ) (i have tried copy and paste that result and when i convert them into .bin the game crashes while trying to start, thats why i need the original extracted .xls file) http://i57.tinypic.com/vq2mhi.jpg screen 1 http://i59.tinypic.com/foixy0.jpg screen 2 http://www.mediafire.com/download/h4xh0xx32n9l557/rh-bin%20(2).zip
  24. Hello ! Currently I'm having some major issues with my php code that giving a strange error message that I can't solve. What my code will do is simply be able to change databas information without accesing phpmyadmin. Code: http://pastebin.com/swLN78vE Error message:
  25. I've been trying to get help with a PayPal button on a few different coding message boards and the only responses I get are regarding format and violating unwritten rules (apparently offering $20 thank-yous for solving my problem is a no-no). My coding skills (as I learned) are mostly limited to formatting so I'm at the end of my skill set. So rather than asking for coding help, is there a resource you all use to solve specialized coding problems like this one that would probably be very amateur for someone proficient in the area? Any help is appreciated. For context, my other post is linked below. http://forums.phpfreaks.com/topic/285418-pay-now-button-with-registration-form-on-paypal/
×
×
  • 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.