Search the Community
Showing results for tags 'help'.
-
Hi. im new to the site and i need a bit of help. im coding a website for my coursework and ive created a log in script. the script works but once the user has logged in i want to get a message saying welcome "firstname" instead of welcome "username" i have managed to get it to say welcome and there username but its not very formal i would like there name they use when they register. here is the code ive got so far. any help would be greatly appriciated. <?php session_start(); $user_name = "root"; $password = ""; $database = "fixandrun"; $server = "localhost"; $db_handle = mysql_connect($server, $user_name, $password); $db_found = mysql_select_db($database, $db_handle); $username = $_POST["username"]; $password = $_POST["password"]; echo"$password"; echo"$username"; if ($db_found) { $result =mysql_query("SELECT 1 FROM staff WHERE username= '$username' and password= '$password'"); if ($result && mysql_num_rows($result) == 1) { $sqlq = mysql_query("SELECT firstname FROM staff WHERE username = '$username'"); $_SESSION['name']=$sqlq; session_register("username"); header("location:homelogged.php"); } else { Echo "Username or Password is incorrect. Click <a href='home.php'>Here</a> to be taken back to the home page."; } } else { print "Database NOT Found."; mysql_close($db_handle); } ?> and on my home page i have : <?php echo "Welcome " . $_SESSION["name"] . "<br>"; echo "last logged in at " . date("l, F d, h:i" ,time())."<br>"; ?> this works but i get welcome and 0 instead of welcome and a name
-
Hi all, I urgently need some help with a PHP project. Basically I have a system that contains infomation on a football tournament and the purpose of the system is to allow access into different venues. We have made the databases containing the data with the main tables being squad, competitor, venue and card. But what we need is one sepearate page where we would enter in a card id (already defined in card) and the venue (already choosen) and what would return is a simple message pop up saying access granted if the card state was valid (this is already decided in the card table) and the card had access to the venue choosen (again decided, in the card table). It would also need to return a message such as access denied if either the card was not in a valid state or if the card did not have those associated venues linked to it. Sorry this is very rushed and urgent! The card state can be valid, cancelled or expired so obviously access granted message for valid and access denied for cancelled or expired. Any help would be greatly appriciated!
-
Hey guys, I'm still very much a noob in learning. I need help big time. As you will see, this code is designed to make an apple like slider on a webpage. I'm looking to put the slider part with the thumbnails on the top of it instead of the bottom. Here is what I have: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head> <title>Welcome To Provision Records</title> <div id="main"> <div id="gallery"> <div id="slides"> <div class="slide"><img src="img/sample_slides/macbook.jpg" width="920" height="400" /></div> <div class="slide"><img src="img/sample_slides/iphone.jpg" width="920" height="400" /></div> <div class="slide"><img src="img/sample_slides/imac.jpg" width="920" height="400" /></div> </div> <div id="menu"> <ul> <li class="fbar"> </li> <li class="menuItem"><a href=""><img src="img/sample_slides/thumb_macbook.png" /></a></li> <li class="menuItem"><a href=""><img src="img/sample_slides/thumb_iphone.png" /></a></li> <li class="menuItem"><a href=""><img src="img/sample_slides/thumb_imac.png" /></a></li> </ul> </div> </div> </div> <style type="text/css"> body,h1,h2,h3,p,quote,small,form,input,ul,li,ol,label{ /* Page reset */ margin:0px; padding:0px; } body{ /* Setting default text color, background and a font stack */ color:#444444; font-size:13px; background: #f2f2f2; font-family:Arial, Helvetica, sans-serif; } /* Gallery styles */ #gallery{ /* CSS3 Box Shadow */ -moz-box-shadow:0 0 3px #AAAAAA; -webkit-box-shadow:0 0 3px #AAAAAA; box-shadow:0 0 3px #AAAAAA; /* CSS3 Rounded Corners */ -moz-border-radius-bottomleft:4px; -webkit-border-bottom-left-radius:4px; border-bottom-left-radius:4px; -moz-border-radius-bottomright:4px; -webkit-border-bottom-right-radius:4px; border-bottom-right-radius:4px; border:1px solid white; background:url(img/panel.jpg) repeat-x bottom center #ffffff; display:block; margin-left:auto; margin-right:auto; margin-north:auto; max-width: 100%; max-height:100%; height:auto; margin-top:180px; /* The width of the gallery <______________________________________________________*/ width:900px; overflow:hidden; } #slides{ /* This is the slide area */ height:400px; /* jQuery changes the width later on to the sum of the widths of all the slides. */ width:920px; overflow:hidden; } .slide{ float:left; } #menu{ /* This is the container for the thumbnails */ height:45px; } ul{ margin:0px; padding:0px; } li{ /* Every thumbnail is a li element */ width:60px; display:inline-block; list-style:none; height:45px; overflow:hidden; } li.inact:hover{ /* The inactive state, highlighted on mouse over */ background:url(img/pic_bg.png) repeat; } li.act,li.act:hover{ /* The active state of the thumb */ background:url(img/active_bg.png) no-repeat; } li.act a{ cursor:default; } .fbar{ /* The left-most vertical bar, next to the first thumbnail */ width:2px; background:url(img/divider.png) no-repeat right; } li a{ display:block; background:url(img/divider.png) no-repeat right; height:35px; padding-top:10px; } a img{ border:none; } /* THIS IS WHERE MY CODING SITS */ html{ overflow:hidden } body{ background-image:url(); background-repeat: no repeat; background-size:110%; } </style> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> <script type="text/javascript" > $(document).ready(function(){ /* This code is executed after the DOM has been completely loaded */ var totWidth=0; var positions = new Array(); $('#slides .slide').each(function(i){ /* Loop through all the slides and store their accumulative widths in totWidth */ positions= totWidth; totWidth += $(this).width(); /* The positions array contains each slide's commulutative offset from the left part of the container */ if(!$(this).width()) { alert("Please, fill in width & height for all your images!"); return false; } }); $('#slides').width(totWidth); /* Change the cotnainer div's width to the exact width of all the slides combined */ $('#menu ul li a').click(function(e){ /* On a thumbnail click */ $('li.menuItem').removeClass('act').addClass('inact'); $(this).parent().addClass('act'); var pos = $(this).parent().prevAll('.menuItem').length; $('#slides').stop().animate({marginLeft:-positions[pos]+'px'},450); /* Start the sliding animation */ e.preventDefault(); /* Prevent the default action of the link */ }); $('#menu ul li.menuItem:first').addClass('act').siblings().addClass('inact'); /* On page load, mark the first thumbnail as active */ }); </script> </head> <body bgcolor="#FFFFFF"> </body> </html> Also, here is the website where I got this code (I changed it a little, but not much). http://tutorialzine.com/2009/11/beautiful-apple-gallery-slideshow/#comment-1084 Any ideas?
-
- css
- javascript
-
(and 3 more)
Tagged with:
-
Someone please help... I am setting up this site with my friend, and we both have NOO idea how to do anything with PHP, and we need to get this site up soon, but we keep getting errors, and we can't figure out how to fix them!! Here is the site... take a look at everything ---> http://chachingptc.tk/ Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/bensguid/public_html/chachingptc.tk/checkban.php on line 13 Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/bensguid/public_html/chachingptc.tk/header.php on line 21 Warning: include(themes//header.php) [function.include]: failed to open stream: No such file or directory in /home/bensguid/public_html/chachingptc.tk/header.php on line 23 Warning: include(themes//header.php) [function.include]: failed to open stream: No such file or directory in /home/bensguid/public_html/chachingptc.tk/header.php on line 23 Warning: include() [function.include]: Failed opening 'themes//header.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/bensguid/public_html/chachingptc.tk/header.php on line 23 Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/bensguid/public_html/chachingptc.tk/index.php on line 5 Join now and get paid to visit websites! At Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/bensguid/public_html/chachingptc.tk/sitename.php on line 6 , you get paid to click on ads and visit websites. The process is easy! You simply click a link and view a website for a few seconds to earn money. You don't need any skills. This is because all you need to do is visit the sites we provide you with. You can earn even more by referring friends. Payment requests can be made every day and are processed through AlertPay. The minimum payout is $2 for Free Members Warning: mysql_fetch_array() expects parameter 1 to be resource, string given in /home/bensguid/public_html/chachingptc.tk/index.php on line 19 Join Now! Advertise here! Setting up and displaying your link for Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/bensguid/public_html/chachingptc.tk/sitename.php on line 6 members to visit is fast and simple. We charge $ Warning: mysql_fetch_array() expects parameter 1 to be resource, string given in /home/bensguid/public_html/chachingptc.tk/index.php on line 31 per Warning: mysql_fetch_array() expects parameter 1 to be resource, string given in /home/bensguid/public_html/chachingptc.tk/index.php on line 35 member visits and each visit will last at least 30 seconds. Outside visits are unlimited and included within the price. We will review your website and will have it active within 24 hours. You don’t need an account to order advertising at Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/bensguid/public_html/chachingptc.tk/sitename.php on line 6 , you simply need to complete the form then pay the fee. If you would like a large package then please feel free to contact us. We will review your website within just a few hours or less. But will NOT accept illegal or adult material neither the use of frame breakers. Read More... Warning: mysql_fetch_array() expects parameter 1 to be resource, string given in /home/bensguid/public_html/chachingptc.tk/index.php on line 45 Warning: mysql_fetch_array() expects parameter 1 to be resource, string given in /home/bensguid/public_html/chachingptc.tk/index.php on line 50 Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/bensguid/public_html/chachingptc.tk/checkban.php on line 13 Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/bensguid/public_html/chachingptc.tk/footer.php on line 19 Warning: include(themes//footer.php) [function.include]: failed to open stream: No such file or directory in /home/bensguid/public_html/chachingptc.tk/footer.php on line 21 Warning: include(themes//footer.php) [function.include]: failed to open stream: No such file or directory in /home/bensguid/public_html/chachingptc.tk/footer.php on line 21 Warning: include() [function.include]: Failed opening 'themes//footer.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/bensguid/public_html/chachingptc.tk/footer.php on line 21
-
Hi Guys Thanks for all the help. I managed to ficx my form issues and now I have another problem 'DOWNLOAD SCRIPT". I think the main problem I have here is the directory for the download. Everything works fine on EasyPHP development plartform at home but when I tried it on my mates site www.drumafrica.biz it outputs the follwing error: Notice: Use of undefined constant __DIR__ - assumed '__DIR__' in /homepages/25/d423356896/htdocs/FTPweb/DRUM/MyDwnlods/index.php on line 5 I think i am failing to write the correct path (directory) for php to find live path, on the home server I simply use "/" and it works. I use Filezilla for FTPing. I nearly forgot I am using windows 7 and XP. All my PHP is tested on EasyPHP5. I ahve indluded the script that I am having a problem with. Please log on to drumafrica.biz. The file will be on there until tomorrow, tuesday 26th,pleae help thanks. List of files inside MyDwnlds 1. index.php 2. downloadme.php 3. MyDownloads folder contains files to download -------------- index.php code: ---------------- <?php error_reporting(-1); define( "DOWNLOAD_ROOT", __DIR__ . "/" ); //This is the problem require_once("downloadme.php"); $download_path = DOWNLOAD_ROOT . "Mydownloads/"; $file = $_REQUEST['f']; $args = array( 'download_path' => $download_path, 'file' => $file, 'extension_check' => TRUE, 'referrer_check' => FALSE, 'referrer' => NULL, ); $download = new rocasa_download( $args ); $download_hook = $download->get_download_hook(); //$download->rocasa_print($download_hook); //exit; if( $download_hook['download'] == TRUE ) { /* You can write your logic before proceeding to download */ /* Let's download file */ $download->get_download(); } ?> Feel free to email me kay98kl@yahoo.com
-
I have been tasked to create a small program in any language I know, which is PHP. It will be a console app (I can't install a LAMP stack etc) and it has to: Allow one of six minibeasts to be selected from a menu Enter and store the name and grid co-ordinates of the selected minibeast Display how often each minibeast was found Display the minibeasts found in each grid co-ordinate So far in PHP I have got a welcome screen, then some of the menu from which they can input what minibeast they want to select information for (sort of). I have the actual menu worked out, it's a simple "echo" after all, but I need to work out how to execute different code based on their input. This is my main file: require_once 'functions.php'; require_once 'config.php'; welcome(); // Adds the welcome message to the program menu(); // Adds the selection menu to the console app getUserInput(); This is functions.php with all my functions: <?php // This holds all of the functions for the // program // Welcome function (just text really) function welcome(){ echo " Welcome to the console application. "; echo " To begin using the program, type a number from the list below and then press \"ENTER\" to execute it. "; echo " For help, type \"help\" and execute it, for credits type \"credits\" and execute and for prog. info type \"info\". Version $vernumber "; } // Next is the selection menu function menu(){ echo " Please execute a number from below: 1. Slug 2. Centipede 3. Ladybird 4. Snail 5. Woodlouse 6. Worm 7. Exit "; } // Add the input catcher function getUserInput(){ fwrite(STDOUT, "Enter your choice\n"); $selected = fgets(STDIN); if ($selected = "1"){ echo "hi"; } elseif($selected = "2"){ } } ?> This is where the problems start. I take their input as $selected, but the if statement is for some reason not working. Then I need to work out how to execute the function again if they enter nothing. Could this be accomplished in a while.. loop? Thanks a lot
-
I am trying to get user input from the command line, but everytime I run this no matter what I enter I get "hi" returned. I don't know why this isn't working, and was hoping someone could take a quick look at it. Thank you: function getUserInput(){ fwrite(STDOUT, "Enter your choice\n"); $selected = fgets(STDIN); if ($selected = "josh"){ echo "hi"; } else{ break; } }
-
Hello, I'm new on this site and I want to introduce myself. Name: Dylan. Age: 13 years old. What I am: Web developer, Gamer Sex: Man For all the web developers that work with PHP, HTML, CSS and JS I wanted to ask if him/her want to help me with my site. It's a big project and I really can use a little bit of help. It's a gaming site, I already have the ideas, some PHP apps and the layout. If u want to help leave a comment with your: Name, (Skype Name) and your Email. If u want to help also put this in your post: "Helping MrDev." Thanks for reading.
-
Hiya i'm working on a project, which involves a list of checkboxes which are automaticly populated by the database which is currently working at while ($row = mysql_fetch_array($sql)) { $id = $row['id']; $hotbox = $row['hot_job']; ?> <form name='hotbox' action='hot_update.php' method='POST'> <tr><td><strong><?php echo $id; ?></strong></td> <td><input name="ONOFF<? echo $row['id']; ?>" type="checkbox" id="ONOFF" value="1" <?php if ($row['hot_job'] == 'YES') { echo "checked";} else {} ?> </td></tr> <?php } ?> however when the user has unchecked/checked the correct boxes and clickes update, nothing changes. Here is my current code foreach($_POST['id'] as $id) { $onoff = 0; if (isset($_POST["ONOFF".$id])) { $onoff = 1; } if($onoff == 1) { $sql1="UPDATE jobs SET hot_job='".$onoff."' WHERE id='".$id."'"; } else { $sql1="UPDATE jobs SET hot_job='".$onoff."' WHERE id='".$id."'"; } echo $id; echo $onoff; $result1=mysql_query($sql1); } ?> The mysql setup is id hot_job 1 YES 2 YES 3 NO 4 YES ect Any help would be greatly appreciated
-
Hello everyone, I am totally new to PHP and have been assigned with a project. Doing this manually will take me a lifetime so I'm hoping one of you coding gurus can help me out here. We have a webpage, it has only one field. In that field, if you put in a number, it returns an employee name (based on their employee number). I want to see if we can write a script to increment from employee number 1 to 100000 and with each increment, it would record (somewhere), the employee number used and the output shown. I'm not even sure if PHP is the right tool for this - any help here will be greatly appreciated.
-
Hello all, I was trying to use PHP to echo a Javascript function but it wasn't going well at all. I am wondering, is it possible to do the following: <script type="text/javascript"><span id="formResponse"></script> Thank you, Josh.
- 3 replies
-
- javascript
- html
-
(and 3 more)
Tagged with:
-
Hello I have been working on developing a custom forum software for personal use. I have everything done accept for the youtube integratio the align and link features in the post. As of right now Im more concerned with the youtube integration. I am currently using js to add the button and tags to the post and php to implement what the tags do. Currently the button is fine it posts the youtube tags which are [vid][/vid] I am just having trouble figuring out how to assing a variable so that a user can input the video id. I am trying to replace {PARAM} with the video id. here is what I have on the php file. ; $r = str_replace("[vid]","<object width='425' height='344'><param name='movie' value='http://www.youtube.com/v/{PARAM}'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/{PARAM}' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='425' height='344'></embed></object>",$r); $r = str_replace("[/vid]","",$r); $r = str_replace("{PARAM}", "KcuJAe3TrQw",$r); I have put a video id of KcuJAe3TrQw in quotes to see if the youtube will get put in if I just use the tags and it indeed does. What I want to do is replace the id with a variable that I can let the user asign the id to... How would I do this or something relevant that would work. Also if you have any spare time I would love to know what I am doing wrong with the align $r = str_replace(" [center]","align=center",$r); $r = str_replace("[/center] ","'>",$r); Thanx for looking at my post and I hope you can help me
-
I have a code that is made to take city and state names form a text file, and input random content strings as well as the state and abbreviation into a database. The code runs fine when just entering the content of the text file, but once you try and add in the random content, it doesnt insert all 50 states. Sometimes its in the 40s, and some in the 30s, but never all 50. Here is the code below. states.txt Alabama = al: Alaska = ak: Arizona = az: Arkansas = ar: California = ca: Colorado = co: Connecticut = ct: Delaware = de: Florida = fl: Georgia = ga: Hawaii = hi: Idaho = id: Illinois = il: Indiana = in: Iowa = ia: Kansas = ks: Kentucky = ky: Louisiana = la: Maine = me: Maryland = md: Massachusetts = ma: Michigan = mi: Minnesota = mn: Mississippi = ms: Missouri = mo: Montana = mt: Nebraska = ne: Nevada = nv: New Hampshire = nh: New Jersey = nj: New Mexico = nm: New York = ny: North Carolina = nc: North Dakota = nd: Ohio = oh: Oklahoma = ok: Oregon = or: Pennsylvania = pa: Rhode Island = ri: South Carolina = sc: South Dakota = sd: Tennessee = tn: Texas = tx: Utah = ut: Vermont = vt: Virginia = va: Washington = wa: West Virginia = wv: Wisconsin = wi: Wyoming = wy: content.php <?php // Sentance 1 Part 1 $p1s1v1p1 = "If you are in need of"; $p1s1v2p1 = "If you are considering"; $p1s1v3p1 = "If you are thinking about getting"; $p1s1v4p1 = "If you are contemplating getting"; $p1s1v5p1 = "If you are going to get"; $p1s1v6p1 = "If you are getting ready to get"; $p1s1v7p1 = "If you are looking for"; $p1s1v8p1 = "If you are seeking"; $p1s1v9p1 = "If your business is in need of"; $p1s1v10p1 = "If your business is considering getting"; $p1s1v11p1 = "If your business is looking for"; $p1s1v12p1 = "If the next step for your business is"; $p1s1v13p1 = "If your business is getting ready to purchase"; $p1s1v14p1 = "If your business is considering purchasing"; $p1s1v15p1 = "If you want"; // Sentance 1 Part 2 $p1s1v1p2 = "website design"; $p1s1v2p2 = "website design"; $p1s1v3p2 = "website design"; $p1s1v4p2 = "website design"; $p1s1v5p2 = "website design"; $p1s1v6p2 = "website design"; $p1s1v7p2 = "website design"; $p1s1v8p2 = "website design"; $p1s1v9p2 = "website design"; $p1s1v10p2 = "website design"; $p1s1v11p2 = "website design"; $p1s1v12p2 = "website design"; $p1s1v13p2 = "website design"; $p1s1v14p2 = "website design"; $p1s1v15p2 = "website design"; // Sentance 1 Part 3 $p1s1v1p3 = ", then you have come to the right place."; $p1s1v2p3 = ", then you can consider this your last stop."; $p1s1v3p3 = ", then you can stop your shopping now."; $p1s1v4p3 = ", then you have met your match."; $p1s1v5p3 = ", then you have found the professional service for you."; $p1s1v6p3 = ", then you have found the place to get professional service and savings."; $p1s1v7p3 = ", then you have come to the right place if you are looking to save while getting quality design."; $p1s1v8p3 = ", then you have come to the right place if you are looking for the best service with the most competitive prices."; $p1s1v9p3 = ", then you can make this your last stop if you want to get a combination of quality and a great price."; $p1s1v10p3 = ", then you need to look no further."; $p1s1v11p3 = ", then you need to look no further for the combination of quality and savings."; $p1s1v12p3 = ", then we are the place for you."; $p1s1v13p3 = ", then we are the place for you to start."; $p1s1v14p3 = ", then we are here to help."; $p1s1v15p3 = ", then you have met your match if you are looking for a great price and superior quality."; // Sentance 2 Part 1 $p1s2v1p1 = "Prior to getting started,"; $p1s2v2p1 = "Before you get started,"; $p1s2v3p1 = "Dont just start getting quotes just yet,"; $p1s2v4p1 = "Dont just go out and get started,"; $p1s2v5p1 = "Dont just run out and start asking for quotes,"; $p1s2v6p1 = "Before you start getting quotes,"; $p1s2v7p1 = "Before your business starts asking for quotes,"; $p1s2v8p1 = "Before you start getting quotes for your business,"; $p1s2v9p1 = "Prior to getting your businesses' quotes,"; $p1s2v10p1 = "Prior to requesting quotes for your site,"; $p1s2v11p1 = "Prior to requesting your businesses website quotes,"; $p1s2v12p1 = "Prior to receiving any quotes,"; $p1s2v13p1 = "Before you get any quotes for your business website,"; $p1s2v14p1 = "Before you ask for any business website quotes,"; $p1s2v15p1 = "Prior to asking for any quotes for your businesses website,"; // Sentance 2 Part 2 $p1s2v1p2 = "there are a few things you should know,"; $p1s2v2p2 = "there are a few things that you should consider,"; $p1s2v3p2 = "there are many things that you should consider,"; $p1s2v4p2 = "there are many things that you should know first,"; $p1s2v5p2 = "there are things that you need to consider first,"; $p1s2v6p2 = "there are several things that you need to know,"; $p1s2v7p2 = "there are many things to take into consideration,"; $p1s2v8p2 = "there are several things to take into consideration,"; $p1s2v9p2 = "there are a few things to take into consideration,"; $p1s2v10p2 = "there are quite a few that you should consider,"; $p1s2v11p2 = "there are a handful of things that you need to know,"; $p1s2v12p2 = "there are a great number of things that you should know,"; $p1s2v13p2 = "there are a handful of things to take into consideration,"; $p1s2v14p2 = "there are an abundance of things to take into consideration,"; $p1s2v15p2 = "there are a great deal of things that you should know,"; // Sentance 2 Part 3 $p1s2v1p3 = "about web design in $statename."; $p1s2v2p3 = "about web design in $statename."; $p1s2v3p3 = "about web design in $statename."; $p1s2v4p3 = "about web design in $statename."; $p1s2v5p3 = "about web design in $statename."; $p1s2v6p3 = "about web design in $statename."; $p1s2v7p3 = "about web design in $statename."; $p1s2v8p3 = "about web design in $statename."; $p1s2v9p3 = "about web design in $statename."; $p1s2v10p3 = "about web design in $statename."; $p1s2v11p3 = "about web design in $statename."; $p1s2v12p3 = "about web design in $statename."; $p1s2v13p3 = "about web design in $statename."; $p1s2v14p3 = "about web design in $statename."; $p1s2v15p3 = "about web design in $statename."; ///////////////////// Randomize Parts \\\\\\\\\\\\\\\\\\\\\\ include("randomize.php"); ?> randomize.php <?php //Paragraph 1 Sentance 1 $p1s1p1_array = array("$p1s1v1p1", "$p1s1v2p1", "$p1s1v3p1", "$p1s1v4p1", "$p1s1v5p1", "$p1s1v6p1", "$p1s1v7p1", "$p1s1v8p1", "$p1s1v9p1", "$p1s1v10p1", "$p1s1v11p1", "$p1s1v12p1", "$p1s1v13p1", "$p1s1v14p1", "$p1s1v15p1"); $p1s1p1 = $p1s1p1_array[array_rand($p1s1p1_array)]; $p1s1p2_array = array("$p1s1v1p2", "$p1s1v2p2", "$p1s1v3p2", "$p1s1v4p2", "$p1s1v5p2", "$p1s1v6p2", "$p1s1v7p2", "$p1s1v8p2", "$p1s1v9p2", "$p1s1v10p2", "$p1s1v11p2", "$p1s1v12p2", "$p1s1v13p2", "$p1s1v14p2", "$p1s1v15p2"); $p1s1p2 = $p1s1p2_array[array_rand($p1s1p2_array)]; $p1s1p3_array = array("$p1s1v1p3", "$p1s1v2p3", "$p1s1v3p3", "$p1s1v4p3", "$p1s1v5p3", "$p1s1v6p3", "$p1s1v7p3", "$p1s1v8p3", "$p1s1v9p3", "$p1s1v10p3", "$p1s1v11p3", "$p1s1v12p3", "$p1s1v13p3", "$p1s1v14p3", "$p1s1v15p3"); $p1s1p3 = $p1s1p3_array[array_rand($p1s1p3_array)]; //Paragraph 1 Sentance 2 $p1s2p1_array = array("$p1s2v1p1", "$p1s2v2p1", "$p1s2v3p1", "$p1s2v4p1", "$p1s2v5p1", "$p1s2v6p1", "$p1s2v7p1", "$p1s2v8p1", "$p1s2v9p1", "$p1s2v10p1", "$p1s2v11p1", "$p1s2v12p1", "$p1s2v13p1", "$p1s2v14p1", "$p1s2v15p1"); $p1s2p1 = $p1s2p1_array[array_rand($p1s2p1_array)]; $p1s2p2_array = array("$p1s2v1p2", "$p1s2v2p2", "$p1s2v3p2", "$p1s2v4p2", "$p1s2v5p2", "$p1s2v6p2", "$p1s2v7p2", "$p1s2v8p2", "$p1s2v9p2", "$p1s2v10p2", "$p1s2v11p2", "$p1s2v12p2", "$p1s2v13p2", "$p1s2v14p2", "$p1s2v15p2"); $p1s2p2 = $p1s2p2_array[array_rand($p1s2p2_array)]; $p1s2p3_array = array("$p1s2v1p3", "$p1s2v2p3", "$p1s2v3p3", "$p1s2v4p3", "$p1s2v5p3", "$p1s2v6p3", "$p1s2v7p3", "$p1s2v8p3", "$p1s2v9p3", "$p1s2v10p3", "$p1s2v11p3", "$p1s2v12p3", "$p1s2v13p3", "$p1s2v14p3", "$p1s2v15p3"); $p1s2p3 = $p1s2p3_array[array_rand($p1s2p3_array)]; ?> runstates.php <?php include("database/connect.php"); $data = file_get_contents('states.txt'); // Get the file content $data = str_replace(array("\n", "\r"), '', $data); // Clear newline characters $data = explode(':', $data); // Get each record by : at end of line unset($data[count($data) - 1]); // Clear the last empty element $final_array = array(); foreach($data AS $row){ // Loop the exploded data $final_array[] = explode(' = ', $row); // Explode each row by Space=Space to each row of final_array } //////////////////////////////////////////////////// DONT FORGET TO CHANGE THE DILIMETER \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ $row = 0; while ($row < 50) { $statename = $final_array[$row][0]; $abrev = $final_array[$row][1]; include("content.php"); $insert = mysql_query("INSERT INTO states (state, abrev, p1s1p1, p1s1p2, p1s1p3, p1s2p1, p1s2p2, p1s2p3) VALUES ('$statename', '$abrev', '$p1s1p1', '$p1s1p2', '$p1s1p3', '$p1s2p1', '$p1s2p2', '$p1s2p3')"); echo "$row entered <br />"; $row++; } ?> Any reason as to why it dosent input all 50 states when the runstates.php is ran?[/color]
-
Hello Everyone! I am new here. I have visited this site many times before for info but haven't joined until now. I now find myself with a problem that I can not figure out on my own. I purchased a wordpress template and it come pre-loaded with many useful shortcodes. One of which caught my eye but I can seem to get the code for it to look the way I want it to. Hense why I am here with the pros asking for help. I will try to post as much detail as possible in the text below to help you assist me in this project. The short code in wordpress is this: [callout title="Visit Our Patient Portal" button="Patient Registration" link="http://google.com" buttoncolor="green" target="_blank" buttonmargin="4px 0 0 0;"]Very user friendly and easy to use![/callout] This entered looks like this on the home page: The callout code in the shortcode.php file looks like this: function minti_callout( $atts, $content = null) { extract( shortcode_atts( array( 'title' => '', 'button' => '', 'buttonsize' => 'normal', 'buttoncolor' => 'alternative-1', 'link' => '', 'target' => '_self', 'buttonmargin' => '0px' ), $atts ) ); return '<div class="callout"><div class="border clearfix"><div class="callout-content"> <h2 class="highlight">' .$title. '</h2>' . do_shortcode($content) . ' </div><div class="callout-button" style="margin:' .$buttonmargin. ';"> <a class="button ' .$buttonsize. ' ' .$buttoncolor. '" href="' .$link. '" target="' .$target. '">' .$button. '</a> </div></div></div>'; } function minti_box( $atts, $content = null) { extract( shortcode_atts( array( 'style' => '1' ), $atts ) ); return '<div class="description clearfix style-' .$style. '">' . do_shortcode($content) . '</div>'; } I am trying to add two more buttons for a total of three using the short code but this is my downfall. I want it to look like this: If you think that you can help, Please post here and let me know. I have been working on this for 3 days straight and I can't get it to work. I wish PHP was as easy as Photoshop. Thanks in advance, Bigsease30
-
Hi I need help, this was my first time setting up a web based form and using php. I created two forms hidden on a website that a href link will be sent to our clients to direct them to a survey. I have set everything up and everything is working but for some reason when the client hits send the data that the form captures is not pulled though to the admin email set up. I know it's something to do with my php. these are the surveys http://www.selections.co.za/feedbackSurveys/Survey_Supplier2012.html http://www.selections.co.za/feedbackSurveys/Survey_Student2012.html and this is my PHP doc for both. I can't see where i'm going wrong. Please help i'm desperate and need to get this working ASAP. I just can't SEE where I have made the error. HUGE Thanks Student php <?php /* Subject and Email Variables */ $emailSubject = 'Student Survey Completed '; $webMaster = 'nataliea@selections.co.za' ; /* Gathering Data Variables */ $emailField = $_POST['name']; $surnameField = $_POST['surname']; $institutionField = $_POST['institution']; $yearField = $_POST['year']; $telField = $_POST['tel']; $emailField = $_POST['email']; $productInfoField = $_POST['RadioGroup1']; $interactivePresentationField = $_POST['RadioGroup2']; $learnSomethingNewField = $_POST['RadioGroup3']; $commentsField = $_POST['comments']; $productsField = $_POST['products']; $body = <<<EOD <br><hr><br> Name: $name <br> Surname: $surname <br> Institution: $institution <br> Year: $year <br> Tel: $tel <br> Email: $email <br> Product Information: $productInfo <br> Interactive Presentation: $interactivePresentation <br> Learn Something New: $learnSomethingNew <br> Comments: $comments <br> Products: $products <br> EOD; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /* Results rendered as HTML */ $theResults = <<<EOD <html> <head> <title>Selections Warehouse Student Feedback</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <style type="text/css"> <!-- body { background-color: #ADADA5; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; line-height: normal; font-weight: normal; color: #666666; text-decoration: none; } .style14 {color: #69AAB7; font-weight: bold; font-size:8px; } .style4 { font-size: 11px; font-weight: bold; text-align: center; color: #000000; } --> </style> </head> <div> <div align="left"> <table width="658" align="center"> <tr> <td width="650" colspan="2" align="center" valign="top"><img src="../Ref/header_2.png" alt="1" width="650" height="200" /></td> </tr> <tr> <td width="650" height="59" colspan="2" align="center" valign="top" bgcolor="#FFFFFF"><p> </p> <p>Thank you for successfully completing the student feedback servey. </p> <p>Sould you have any questions please feel free to contact us.</p> <p> </p></td> </tr> <tr> <td height="28" colspan="2" align="center" valign="middle" bgcolor="#D0CEC7" class="style4">Ground Floor, Wembly Square 2, Solan Street, Gardens, 8001 - Tel: 021 815 5798 - <a href="http://www.selections.co.za">www.selections.co.za</a></td> </tr> <tr> <td height="10" colspan="2" align="center" valign="middle" class="style4"><span class="style14">FIND US ON FACEBOOK AND LIKE OUR PAGE TO FIND OUT MORE ABOUT OUR UPCOMING FUNCTIONS, EXHIBITIONS AND EVENTS. </span></td> </tr> <tr> <td height="28" colspan="2" align="center" valign="middle" class="style4"><table width="14%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td align="right" valign="top"> </td> <td align="middle" valign="top" width="5"></td> <td align="right" valign="top"><a href="http://pinterest.com/selectionswct/" title="Pintrest"><img src="../Ref/pinttrest.jpg" width="24" height="24" style="display:block;" border="0" alt="1"/></a></td> <td align="middle" valign="top" width="5"></td> <td align="right" valign="top"><a href="https://twitter.com/SelectionsW" title="twitter"><img src="../Ref/image_8451441.gif" width="24" height="24" style="display:block;" border="0" alt="1"/></a></td> <td align="middle" valign="top" width="5"></td> <td align="right" valign="top"><a href="https://www.facebook.com/pages/Selections-Warehouse/161945277215671" title="fb"><img src="../Ref/image_4604455.gif" width="24" height="24" style="display:block;" border="0" alt="1"/></a></td> </tr> </table> <div align="center"></div></td> </tr> </table> </div> </div> </body> </html> EOD; echo "$theResults"; ?> Supplier php <?php /* Subject and Email Variables */ $emailSubject = 'Supplier Survey Completed '; $webMaster = 'nataliea@selections.co.za' ; /* Gathering Data Variables */ $emailField = $_POST['name']; $surnameField = $_POST['surname']; $companyField = $_POST['company']; $telField = $_POST['tel']; $emailField = $_POST['email']; $displayField = $_POST['RadioGroup1']; $feedbackField = $_POST['RadioGroup2']; $serviceField = $_POST['RadioGroup3']; $remainField = $_POST['RadioGroup4']; $activitiesField = $_POST['activities']; $improvementField = $_POST['improvements']; $body = <<<EOD <br><hr><br> Name: $name <br> Surname: $surname <br> Company: $company <br> Tel: $tel <br> Email: $email <br> Display: $RadioGroup1 <br> Feedback: $RadioGroup2 <br> Service: $RadioGroup3 <br> Remain: $RadioGroup4 <br> Activities: $activities <br> Improvement: $improvements <br> EOD; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /* Results rendered as HTML */ $theResults = <<<EOD <html> <head> <title>Selections Warehouse Supplier Feedback</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <style type="text/css"> <!-- body { background-color: #ADADA5; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; line-height: normal; font-weight: normal; color: #666666; text-decoration: none; } .style14 {color: #69AAB7; font-weight: bold; font-size:8px; } .style4 { font-size: 11px; font-weight: bold; text-align: center; color: #000000; } --> </style> </head> <div> <div align="left"> <table width="658" align="center"> <tr> <td width="650" colspan="2" align="center" valign="top"><img src="../Ref/header.png" alt="1" width="650" height="200" /></td> </tr> <tr> <td width="650" height="59" colspan="2" align="center" valign="top" bgcolor="#FFFFFF"><p> </p> <p>Thank you for successfully completing the supplier servey. </p> <p>Sould you have any questions please feel free to contact us.</p> <p> </p></td> </tr> <tr> <td height="28" colspan="2" align="center" valign="middle" bgcolor="#D0CEC7" class="style4">Ground Floor, Wembly Square 2, Solan Street, Gardens, 8001 - Tel: 021 815 5798 - <a href="http://www.selections.co.za">www.selections.co.za</a></td> </tr> <tr> <td height="10" colspan="2" align="center" valign="middle" class="style4"><span class="style14">FIND US ON FACEBOOK AND LIKE OUR PAGE TO FIND OUT MORE ABOUT OUR UPCOMING FUNCTIONS, EXHIBITIONS AND EVENTS. </span></td> </tr> <tr> <td height="28" colspan="2" align="center" valign="middle" class="style4"><table width="14%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td align="right" valign="top"> </td> <td align="middle" valign="top" width="5"></td> <td align="right" valign="top"><a href="http://pinterest.com/selectionswct/" title="Pintrest"><img src="../Ref/pinttrest.jpg" width="24" height="24" style="display:block;" border="0" alt="1"/></a></td> <td align="middle" valign="top" width="5"></td> <td align="right" valign="top"><a href="https://twitter.com/SelectionsW" title="twitter"><img src="../Ref/image_8451441.gif" width="24" height="24" style="display:block;" border="0" alt="1"/></a></td> <td align="middle" valign="top" width="5"></td> <td align="right" valign="top"><a href="https://www.facebook.com/pages/Selections-Warehouse/161945277215671" title="fb"><img src="../Ref/image_4604455.gif" width="24" height="24" style="display:block;" border="0" alt="1"/></a></td> </tr> </table> <div align="center"></div></td> </tr> </table> </div> </div> </body> </html> EOD; echo "$theResults"; ?>
-
I've begged people all over the web for help with this problem. It's hard to explain because people read about it, and they think I just don't know how to execute simple navigation on WordPress. Let me try to explain: I have a website run by WordPress. I need to edit the home page. When I click Pages-->All Pages-->Home which is linked to home, it's empty. When I go to Apperence-->Editor-->Front Page Page Template it gives me PHP code to dictate basic template stuff, it won't let me edit As you can see from the site, I have things other than the featured items and so on, like the "Bridgett Provenzano" letter at the bottom. But on my supposed home page there is nothing, on my specific theme settings, I have the featured items written out and I have the PHP code for the temlpate but none of that lets me edit the stuff on the front that I need to edit, namley the stuff under the featured items. I hired someone but I don't have any money in the budget to do that again. He somehow added some text into the front page even though I see no way to do so, and cant see where he added it when I look at the code. I'm at a loss. I'm going nuts here trying to figure this out. I don't know PHP, it looks as confusing as hell.
-
Hello. I was wondering whether I could request some help about adding a change pass function to my login / register script on PHP/JQuery/MySQL. I have started the change pass function a little (the form is fully done and checks whether the required fields are filled in) but the rest is way above my current knowledge that involves PHP, I am more of a HTML person. Also, I would highly appreciate it if you could let me know whether this is vulnerable to SQL injection, I doubt it is because I've added some extra "mysql_real_escape_string();" to the script but all comments would help. I am useless at PHP <.< I have marked in the code where I have started the change pass function to make it a little easier to find. Here is the code: <?php error_reporting(E_ALL ^ E_NOTICE); define('INCLUDE_CHECK',true); require 'connect.php'; require 'functions.php'; // Those two files can be included only if INCLUDE_CHECK is defined session_name('tzLogin'); // Starting the session session_set_cookie_params(2*7*24*60*60); // Making the cookie live for 2 weeks session_start(); if($_SESSION['id'] && !isset($_COOKIE['tzRemember']) && !$_SESSION['rememberMe']) { // If you are logged in, but you don't have the tzRemember cookie (browser restart) // and you have not checked the rememberMe checkbox: $_SESSION = array(); session_destroy(); // Destroy the session } if(isset($_GET['logoff'])) { $_SESSION = array(); session_destroy(); header("Location: http://127.0.0.1/"); exit; } if($_POST['submit']=='Login') { // Checking whether the Login form has been submitted $err = array(); // Will hold our errors if(!$_POST['logusername'] || !$_POST['password']) $err[] = 'All fields are required.'; if(!count($err)) { $_POST['logusername'] = mysql_real_escape_string($_POST['logusername']); $_POST['password'] = mysql_real_escape_string($_POST['password']); $_POST['rememberMe'] = (int)$_POST['rememberMe']; // Escaping all input data $row = mysql_fetch_assoc(mysql_query("SELECT * FROM playerdata WHERE user='{$_POST['logusername']}' AND password='".sha1($_POST['password'])."'")); if($row['user']) { // If everything is OK login $_SESSION['user'] = $row['user']; $_SESSION['id'] = $row['id']; $_SESSION['rememberMe'] = $_POST['rememberMe']; // Store some data in the session setcookie('tzRemember',$_POST['rememberMe']); } else $err[]='You have entered an invalid username or password.'; } if($err) $_SESSION['msg']['login-err'] = implode('<br />',$err); // Save the error messages in the session header("Location: http://127.0.0.1/"); exit; } else if($_POST['submit']=='Register') { // If the Register form has been submitted $err = array(); if (!preg_match('/^[A-Za-z]{4,9}_{1}[A-Za-z]{4,9}$/', $_POST['username'])) { $err[] = 'Your username must be in the format of "John_Smith" (include the underscore) with a maximum of 19 characters and a minimum of 9. No other special characters are allowed.'; } $email = $_POST['email']; $query = sprintf("SELECT * FROM playerdata WHERE email='%s'", mysql_real_escape_string($email)); $result = mysql_query($query); if(!$result) { $err[]='There has been an error with your connection, please refresh the page and try again.'; } else { if(mysql_num_rows($result) > 0) { $err[]='That email address already exists.'; } } if(!checkEmail($_POST['email'])) { $err[]='Your email address is not valid.'; } if(!count($err)) { // If there are no errors $pass = substr(sha1($_SERVER['REMOTE_ADDR'].microtime().rand(1,100000).rand(170000,200000)),0,6); // Generate a random password $_POST['email'] = mysql_real_escape_string($_POST['email']); $_POST['username'] = mysql_real_escape_string($_POST['username']); // Escape the input data mysql_query(" INSERT INTO playerdata(user,password,level,money,email,ip,datetime) VALUES( '".$_POST['username']."', '".sha1($pass)."', '1', '20', '".$_POST['email']."', '".$_SERVER['REMOTE_ADDR']."', NOW() )"); if(mysql_affected_rows($link)== 1) { send_mail( 'bugsyccfc@googlemail.com', $_POST['email'], 'Welcome to Domination Roleplay.', 'Your password is: '.$pass); $_SESSION['msg']['reg-success']='An email has been sent containing your password. '.$pass; } else $err[]='That username has already been taken.'; } if(count($err)) { $_SESSION['msg']['reg-err'] = implode('<br />',$err); } header("Location: http://127.0.0.1/"); exit; } else if($_POST['submit']=='Confirm') // [size=4][b]Change Pass Starts Here[/b][/size] { $err = array(); // Will hold our errors if(!$_POST['password2'] || !$_POST['password3']) $err[] = 'All fields are required.'; header("Location: http://127.0.0.1/"); exit; } // [size=4][b]Change Pass Ends Here[/b][/size] (No idea what to do now) [b]Change pass form is below[/b] $script = ''; if($_SESSION['msg']) { // The script below shows the sliding panel on page load $script = ' <script type="text/javascript"> $(function(){ $("div#panel").show(); $("#toggle a").toggle(); }); </script>'; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Domination Roleplay UCP - Home</title> <!-- CCS Links --> <link rel="stylesheet" type="text/css" href="data/css/register.css" media="screen" /> <link rel="stylesheet" type="text/css" href="data/css/slide.css" media="screen" /> <!-- End of CCS Links --> <!-- Javascript Links --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <!-- PNG FIX for IE6 --> <!-- http://24ways.org/2007/supersleight-transparent-png-in-ie6 --> <!--[if lte IE 6]> <script type="text/javascript" src="http://127.0.0.1/data/js/supersleight-min.js"></script> <![endif]--> <script src="data/js/slide.js" type="text/javascript"></script> <?php echo $script; ?> <!-- End of Javascript Links --> </head> <!-- Login/Register UCP --> <div id="toppanel"> <div id="panel"> <div class="content clearfix"> <div class="left"> <h1>The Sliding jQuery Panel</h1> <h2>A register/login solution</h2> <p class="grey">You are free to use this login and registration system in you sites!</p> <h2>A Big Thanks</h2> <p class="grey">This tutorial was built on top of <a href="http://web-kreation.com/index.php/tutorials/nice-clean-sliding-login-panel-built-with-jquery" title="Go to site">Web-Kreation</a>'s amazing sliding panel.</p> </div> <?php if(!$_SESSION['id']): ?> <div class="left"> <!-- Login Form --> <form class="clearfix" action="" method="post"> <h1>Member Login</h1> <?php if($_SESSION['msg']['login-err']) { echo '<div class="err">'.$_SESSION['msg']['login-err'].'</div>'; unset($_SESSION['msg']['login-err']); } ?> <label class="grey" for="username">Username:</label> <input class="field" type="text" name="logusername" id="logusername" value="" size="23" maxlength="19" /> <label class="grey" for="password">Password:</label> <input class="field" type="password" name="password" id="password" size="23" maxlength="13" /> <label><input name="rememberMe" id="rememberMe" type="checkbox" checked="checked" value="1" /> Remember me</label> <div class="clear"></div> <input type="submit" name="submit" value="Login" class="bt_login" /> </form> </div> <div class="left right"> <!-- Register Form --> <form action="" method="post"> <h1>Not a member yet? Sign Up!</h1> <?php if($_SESSION['msg']['reg-err']) { echo '<div class="err">'.$_SESSION['msg']['reg-err'].'</div>'; unset($_SESSION['msg']['reg-err']); } if($_SESSION['msg']['reg-success']) { echo '<div class="success">'.$_SESSION['msg']['reg-success'].'</div>'; unset($_SESSION['msg']['reg-success']); } ?> <label class="grey" for="username">Username:</label> <input class="field" type="text" name="username" id="username" value="" size="23"maxlength="19" /> <label class="grey" for="email">Email:</label> <input class="field" type="text" name="email" id="email" size="23" /> <label>A password will be sent to your email address provided.</label> <input type="submit" name="submit" value="Register" class="bt_register" /> </form> </div> <?php else: ?> <div class="left"> <?php $query = sprintf("SELECT * FROM `playerdata` WHERE `user` = '%s'", mysql_real_escape_string($_SESSION['user'])); $result = mysql_query($query)or die(mysql_error()); echo '<h1><b><font color="#FFFFFF">'.$_SESSION['user'].'s User Control Panel</font></h1></b>'; echo '<p><b><font color="#FF0000">IP Address</font>: <font color="#FFFFFF">'.$_SERVER['REMOTE_ADDR'].'</font></p></b>'; while($row = mysql_fetch_array($result)) { echo '<p><b><font color="#FF0000">Registered</font>: <font color="#FFFFFF">'.$row['datetime'].'</font></p></b>'; echo '<p><b><font color="#FF0000">Cash</font>: <font color="#009933">$'.$row['money'].'</font></p></b>'; echo '<p><b><font color="#FF0000">Level</font>: <font color="#FFFFFF">'.$row['level'].'</font></p></b>'; } ?> <a href="?logoff">Log Out</a> </div> <div class="left right"> <h1>Your Account Settings</h1> <?php echo '<h2><font color="#FFFFFF">Change Password</font></h2>' [b][size=4]// Change Pass Form[/size][/b] ?> <form action="" method="post"><br /> <label class="grey" for="password">Existing Password:</label> <input class="field" type="password" name="password2" id="password2" size="23" maxlength="13" /> <label class="grey" for="password">New Password:</label> <input class="field" type="password" name="password3" id="password3" size="23" maxlength="13" /> <label class="grey" for="password">Confirm Password:</label> <input class="field" type="password" name="password4" id="password4" size="23" maxlength="13" /> <input type="submit" name="submit" value="Confirm" class="bt_changepass" /> </div> <?php endif; ?> </div> </div> <!-- /login --> <!-- The tab on top --> <div class="tab"> <ul class="login"> <li class="left"> </li> <li>Welcome <?php echo $_SESSION['user'] ? $_SESSION['user'] : 'Guest';?>!</li> <li class="sep">|</li> <li id="toggle"> <a id="open" class="open" href="#"><?php echo $_SESSION['id']?'Open Panel':'Log In | Register';?></a> <a id="close" style="display: none;" class="close" href="#">Close Panel</a> </li> <li class="right"> </li> </ul> </div> <!-- / top --> </div> <!--Login/Register UCP --> </body> </html> Thanks a lot for taking your time to help!
-
Hello all, I am working on this query to show past records of data for all of the records in this particular table. This is an archive table so there are multiple entries of the same person in the database. The difference is the date that they were entered, which is an auto entry value added on the date it is uploaded. Here is the query: "SELECT politicians.id, politicians.`Last Name`, politicians.`First Name`, politicians.`District`, archive.`firstname`, archive.`lastname`, archive.rank, archive.era FROM politicians, archive WHERE politicians.`Last Name`=archive.lastname AND politicians.`First Name`=archive.firstname ORDER BY date LIMIT 150"; The problem is that I only need the latest entry from the persons information and I am getting multiple from past dates. They need to be ordered by their past rank, but from the last date of the entry. Any ideas?? P.S I know I already posted this in the applications section. I posted it there by accident
-
How doi do this in php Please help foreach account if adfundnotificicationdata exists if adfund is lower than threshold && current notificationdata is higher than threshold sendmail... update notificationdata... else insert new data
-
please i've been trying to create a registration form for my website and it seems like its taking forever..... i've got some error of which i have tried to rectify but to no avail, so decided post the code and the error to see if someone might be of help to me <?php $required=array("fname" => "Firstname", "lname" => "Lastname", "email" => "Email address", "password" => "Password"); foreach ($required as $field => $label) { if (isset($_POST[$field])) { $warnings[$field] = "Required"; } } if (isset($_POST["email"])&& !ereg("^[^@]+@([a-z\-]+\.)+[a-z]{2,4}$", $_POST["email"])) $warnings["email"] = "Invalid email"; if (isset($_POST["telephone"])&& !ereg("^\([[:digit:]]{3}\)[[:digit:]]{4}-[[:digit:]]{4}$", $_POST["telephone"])) $warnings["telephone"] = "Must be (555)0000-0000"; $password=$_POST["password"]; $salt=rand(100000,999999); $encrypted= (md5($salt.$password)); if (empty($warnings) > 0) { ?> <form action = "register.php" method=post> <table border=0> <tr> <td>Firstname:</td> <td><input type=text size=30 name="fname" value="<?php echo (isset($_POST["fname"])? $_POST ["fname"]:"");?>" > </td> <td><?php echo (isset($warnings["fname"])? $warnings["fname"]:"");?> </td> </tr><br/> <tr> <td>Lastname:</td> <td><input type=text size=30 name="lname" value="<?php echo (isset($_POST["lname"])? $_POST ["lname"]:"");?>"> </td> <td><?php echo (isset($warnings["lname"])? $warnings["lname"]:"");?> </td> </tr> <tr> <td>Email address:</td> <td><input type=text size=30 name="email" <?php if (isset($warnings["email"])) echo "STYLE=\"shaded\"";?> value="<?php echo (isset($_POST["email"])? $_POST["email"]:"");?>"> </td> <td><?php echo (isset($warnings["email"])? $warnings["email"]:"");?> </td> </tr> <tr> <td>Password:</td> <td><input type=password size=30 name="password" value="<?php echo (isset($_POST["password"])? $_POST["password"]:"");?>"> </td> <td><?php echo (isset($warnings["password"])? $warnings[password]:"");?> </td> </tr> <tr> <td>Telephone:</td> <td><input type=text size=30 name="telephone" value="<?php echo (isset($_POST["telephone"])? $_POST["telephone"]:"")?>"> </td> <td><?php echo (isset($warning["telephone"])? $warnings["telephone"]:"");?> </td> </tr> <tr> <td>sex:</td> <td><?php include("sex.php"); ?> </td> <td></td> </tr> <tr> <td>Date of birth:</td> <?php $menu = generate_menu("year", $endYear = '', $startYear = '1900'); function generate_menu($name, $endYear = '', $startYear = '1900' ) { $selected = "<SELECT NAME=\"$name\">"; for ( $i = $startYear; $i <= $endYear; $i++ ) { $selected .= "<OPTION "; ( $i == date('Y') ) ? $selected .= "selected='selected'" : $selected = ''; $selected .= "value=\'$i\'>$i</OPTION>"; } $selected .= "</SELECT>"; return($selected); } ?> <? $month = array(1=> "Jan", 2=> "Feb", 3=> "Mar", 4=> "Apr", 5=> "May", 6=> "Jun", 7=> "Jul", 8=> "Aug", 9=> "Sep", 10=> "Oct", 11=> "Nov", 12=> "Dec"); $default = "1"; $option = generate_menu("month", $month, $default); function generate_menu($name, $month, $default="") { $select = "<SELECT NAME=\"$name\">"; foreach($month as $value => $label) { $select .= "<OPTION "; if ($value == $default) $select .= "selected='selected'"; $select .= "value=\'$value\'>$label</OPTION>"; } $select .= "</SELECT>"; return($select); } ?> <? $function = generate_menu("day"); function generate_menu($name) {$sel = "<SELECT NAME=\"$name\">"; for ( $i = 1; $i <= 31; $i++ ) { $sel .= "<OPTION "; ( $i == date('j') ) ? $sel .= "selected='selected'" : $sel = ''; $sel .= "value=\'$i\'>$i</OPTION>"; } $sel .= "</SELECT>"; return($sel); } ?> <td> <?php print $menu;?> </td> <td> <?php print $option;?> </td> <td> <?php print $function;?> </td> </tr> </TABLE> <INPUT TYPE=SUBMIT VALUE="Register"> </form> <?php } else { echo "Thank you for registering"; } ?> error Fatal error: Call to undefined function generate_menu() in C:\xampp\htdocs\form.php on line 65
-
hello, I have an employee in / out board that someone else coded, and I am trying to generate a report from a table of data. I have the logic in my head, just not sure how to get it down to work correctly. It's currently written in PHP with a mysql database backend. For example. Data Table: ---------------------------------------------------------------- ID - NAME - DIRECTION - DATED - DATET ---------------------------------------------------------------- 37 Employee1 2 2012-09-09 20:53:25 37 Employee1 1 2012-09-09 20:53:33 39 Employee2 2 2012-09-10 07:58:51 37 Employee1 2 2012-09-10 09:08:56 39 Employee2 1 2012-09-10 17:03:29 37 Employee1 1 2012-09-10 17:10:47 37 Employee1 2 2012-09-11 08:14:14 39 Employee2 2 2012-09-11 08:14:22 37 Employee1 1 2012-09-11 12:51:59 39 Employee2 1 2012-09-11 12:53:12 37 Employee1 2 2012-09-11 14:44:26 39 Employee2 2 2012-09-11 14:44:36 39 Employee2 1 2012-09-11 14:44:36 39 Employee2 2 2012-09-11 14:44:36 39 Employee2 1 2012-09-11 16:43:59 37 Employee1 1 2012-09-11 17:16:26 ---------------------------------------------------------------- Direction (From Above) 1 = Out 2 = In ----------------------------------------------------- I'm going to create a couple of different reports, but the first one will look like: Name Date Time In Time Out Time In Time Out Total Time: --------------------------------------------------------------------------------------- Employee1 9/9/12 20:53 20:53 0:00 9/10/12 09:08 17:10 8:02 9/11/12 08:14 12:51 14:44 17:16 7:09 ----------- 15:11 Employee2 9/10/12 7:58 17:03 9:05 9/11/12 8:14 12:53 14:44 16:43 7:11 ----------- 16:16 can someone point me in the right direction for this ? thanks
-
Hi, I am new to php programming but found a script that checks email validation. The script works fine but instead of displaying the error message "Email address is invalid" I would like the script to go to an error page that I have designed. Below is a section of the script I am using. Any ideas? stristr($_REQUESTemail," ")){$errors[] = "Email address is invalid";}else{$ Thanks
-
Hello I'm having a problem with my php script. It's about writing lines to a text file. The script runs normally without any errors, but it leaves the text file empty, no matter how many times I run it. I'm using WAMP server. Here's the code: <?php //kratke varijable $tireqty=$_POST['tireqty']; $oilqty=$_POST['oilqty']; $sparkqty=$_POST['sparkqty']; $adress=$_POST['adress']; $DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT']; $date = date('H:i, jS F Y'); ?> <html> <head> <meta charset="utf-8"> <title>Bob's Auto parts - Order results</title> </head> <body> <h1>Bob's Auto Parts</h1> <h2> Order Results</h2> <?php echo "<p>Order processed at ".date ('H:i, jS F Y')."</p>"; echo "<p>Your order is as follows: </p>"; $totalqty=0; $totalqty=$tireqty+$sparkqty+$oilqty; echo "Item ordered: ".$totalqty."<br />"; if ($totalqty == 0) { echo "You didn't order anyting from previous page!<br />"; } else { if($tireqty>0) echo $tireqty." tires<br />"; if($oilqty>0) echo $oilqty." oil<br />"; if($sparkqty>0) echo $sparkqty." sparks<br / >"; } $totalamount=0.00; define('TIREPRICE', 100); define('OILPRICE', 10); define('SPARKPRICE', 4); $totalamount = $tireqty * TIREPRICE + $oilqty * OILPRICE + $sparkqty * SPARKPRICE; echo 'Subtotal: $'.number_format($totalamount,2).'<br />'; $taxrate = 0.20; // local sales tax is 20% $totalamount = $totalamount * (1 + $taxrate); echo 'Total including tax: $'.number_format($totalamount,2).'<br />'; echo '<p>Adress to ship to is '.$adress.'</p>'; $outputstring = $date."\t".$tireqty." tires \t".$oilqty." oil\t" .$sparkqty." spark plugs\t\$".$totalamount ."\t". $adress."\n"; //open file for appending @ $fp = fopen("$DOCUMENT_ROOT/../orders/orders.txt", 'ab'); if(!$fp) { echo "<p><strong> Your order could not be processed at this time.<br> Please try again later. </strong></p></body></html>"; exit; } flock($fp, LOCK_EX); echo fwrite($fp, $outputstring, strlen($outputstring)); flock($fp, LOCK_UN); fclose($fp); echo "<p>Order written.</p>"; ?> </body> </html> Thanks in advance for any help.
-
hello i did a php message system where it get data from sql and it extracts the message that the person wrote you, but is separated into conversations so in the inbox i want it to show only the last message shown, witch it works ONLY for the first person that sends you a message not for the other persons that send you messages so i made a data base where conversation_hash is unique and you it has ids in string separated by a "," <?php $b = mysql_query("SELECT * FROM conversations"); while($a = mysql_fetch_array($B)){ $hash = $a['conversation_hash']; $ids = $a['ids']; $ids = explode(",", $ids); if(array_search($id, $ids) == true){ $ids = array_filter($ids, 'strlen'); foreach($ids as $o){ if($o !== $id){ print_r($ids); echo $o; $y = mysql_query("SELECT * FROM messages WHERE conversation_hash='$hash' AND from_id='$o' ORDER BY message_id DESC "); $t = mysql_fetch_array($y); ?> <div class="message"> <center> <table width="600"> <tr> <td width="75" rowspan="2"> <img src="/elitequorum/<?php echo $t['image_location']; ?>" height="75" width="75" /> </td> <td height="39"> </td> <td height="" rowspan="2"> <table height="75"> <tr> <td width="450" style="vertical-align:middle;" height="55"> <?php echo $t['message']; ?> </td> </tr> <tr> <td style="text-align:right; vertical-align:bottom;" height="5"> <?php echo $t['date']; ?> </td> </tr> </table> </td> </tr> <tr> <td width="75" height="34"> <?php echo $t['username']; ?> </td> </tr> </table> </center> </div> <?php } } } } ?> to do some testing if the information is getting where is suppost to i did some print_r(); and the information does go but it doesnt go in the SQL as a loop, i dont get any PHP/SQL error but the script is not working correctly, this is what i get: ---------------------------------------------------------------------- image1| Message1 | date2 | ----------------------------------------- broken(image2)| empty(message2) | empty(date2) | ---------------------------------------------------------------------------------------- And this is what im suppos to get: ---------------------------------------------------------------------- image1| Message1 | date2 | ----------------------------------------- image2| message2 | date2 |
-
I keep getting error: PHP Error Message Warning: mysql_query() [function.mysql-query]: Access denied for user 'a6743732'@'localhost' (using password: NO) in /home/a6743732/public_html/chat.php on line 25 PHP Error Message Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/a6743732/public_html/chat.php on line 25 Access denied for user 'a6743732'@'localhost' (using password: NO) <?php session_start(); //CREDITS TO MODERNSONIC FROM 3DSPLAZA-3DSPAINT-SOMELUIGI.COM-3DSMEGUSTA-DSISTARZ for this chat script! //CREDITS TO MARIOERMANDO FOR THE TABLE CREATOR //CREDITS TO JUNAID FOR THE AUTO REFRESH...THAT WILL ONLY WORKS IF YOU SEPARATE THE MESSAGE FILE. ?> <? //AUTO TABLE CREATOR BY MARIOERMANDO //http://3DSFun.heliohost.org/ //http://marioermando.tumblr.com $sql = "CREATE TABLE chat( id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), user TEXT(30), message TEXT(40))"; $result = mysql_query($sql) or die(mysql_error()); ?> <script type='text/javascript'> function updateChat() { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { document.getElementById("").innerHTML = xmlhttp.responseText; } } xmlhttp.open("GET",".php?error=",true); xmlhttp.send(); } </script> <body onload="setInterval('updateChat()',2000);"> <div id="chat" style="witdth:320px height:200px; overflow:auto;"> <?php $user = $_SESSION['username']; //database infos $con = mysql_connect("mysql10.000webhost.com","a6743732_pokeb","***********"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("a6743732_pokeb", $con); if ($_POST['submit']) { $_POST['message'] = mysql_real_escape_string(htmlentities($_POST['message'])); $sql = "INSERT INTO chat (user, message) VALUES ('$user', '$_POST[message]')"; $result = mysql_query($sql) or die(); } session_start(); if (!empty($_SESSION['username'])) // he got it. { echo ""; } else // bad info. { header('Location: connexion.php'); } //db connect $user = $_SESSION['username']; $con = mysql_connect("mysql10.000webhost.com","a6743732_pokeb","***********"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("a6743732_pokeb", $con); //max messages $result = mysql_query("SELECT * FROM chat ORDER BY id DESC LIMIT 0, 15"); while($row = mysql_fetch_array($result)) { //smilies $smIn=array("R:"); $smOut=array("EPIC FACE URL"); $o_user = $row['user']; $message = $row['message']; $message = str_replace($smIn, $smOut, $message); echo '<u>'. $o_user . '</u>: '. $message . '</font>'. '</font>'. '</b>' ; echo "<br>"; } ?> </div> <style> #chat { background-color:green; width:320px; height:200px; overflow:auto; } </style> <form action="chat.php" method="POST"> <input type="text" name="message"><input type="submit" value="Chat" name="submit"> </form> <meta name="viewport" content="width=320"> <br> <a href="index.php"><img src="[url="http://png-2.findicons.com/files/icons/1572/minicons/48/refresh.png%22></a>refresh"]http://png-2.findico...ng"></a>refresh[/url] <br> Chat! </body>