Jump to content

Search the Community

Showing results for tags 'php'.

  • 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. Why does php show undefined variable? I researched and found out that if the variables aren't set then they will likely show undefined variable. However, I used the isset function to check if the variable is undefined and if it is then set it to $varaible ="" . That didn't work and then later i tried $variable = NULL. What should I do Can you please see the code and tell me what shall i do. Thanks a million <?php require_once("includes/connection.php")?> <?php require_once("includes/function.php") ?> <?php require_once("includes/header.php") ?> <?php if(isset($_GET['subj'])){ $sel_subj = NULL; $sel_subj = $_GET['subj']; } elseif (isset($_GET['page'])){ $sel_page = NULL; $sel_page = $_GET['page'] ; } else { $sel_subj= NULL; $sel_page =NULL; } ?> <table id = "structure" > <tr> <td id = "navigation" > <ul class= "subjects" > <?php $subject_set = get_all_subjects(); while ($subject = mysql_fetch_array($subject_set)){ // <a href = "content.php?subj=1" > if ($sel_subj == $subject["id"]){ echo "<li class = \"selected\" "; }else{ echo "<li> "; } "<a href = \"content.php?subj=" . urlencode($subject["id"]) . "\">" . $subject["menu_name"]. "</a></li>" ; $page_set = get_pages_for_subjects( $subject["id"] ) ; echo " <ul class = \"pages\"> "; while ($page = mysql_fetch_array($page_set)){ echo "<li><a href = \"content.php?page=" . urlencode($page["id"]) . "\">" . $page["menu_name"] . "</a></li>" ; } echo "</ul>" ; } ?> </ul> </td> <td id= "page" > <h1> Main Area To Get Your Information </h1> <?php echo $sel_subj ; ?> <br/> <?php echo $sel_page ; ?> <br/> </td> </tr> </table> <?php include ("includes/footer.php") ?> The variable im refering to is $sel_subj and $sel_page at the top of the code. Here is an attachment of the error
  2. Good Day Guys I have a bit of a urgent problem. Here is my Query: $query = "SELECT distinct Img.propertyId as PropertyId, Title, ImageUrl, Location, Bedrooms, Bathrooms, Parking, Price FROM PROPERTIES as Prop LEFT JOIN IMAGES as Img ON Img.PropertyId = Prop.PropertyId WHERE 1=1 AND Price >=1000 AND Price <=5000 "; I have a problem and the problem is here - AND Price >=1000 AND Price <=5000. This works fine but the problem comes as soon as I add more: For example: if I add OR Price >5000 AND Price <=10000 then it displays all my results from 1000 to 10000 and I want it to be if I select 5000 - 10000 it needs to display only the results between 5000 and 10000. Can someone please help me?
  3. I cannot redirect to other page even I enter correct information and recaptcha in activation form. Anyone who can check what going wrong in my activation script? Here is my php activation check script: <?php require_once('recaptchalib.php'); $privatekey = "6LfTwvMSAAAAABt03yGb0_12rgLNrCDuoibU4gbh"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { // What happens when the CAPTCHA was entered incorrectly die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } else { $username = $_POST['username']; $activation_code = $_POST['activation_code']; $db_host = "server"; $db_name = "table"; $db_use = "use"; $db_pass = "pass"; $link = mysqli_connect($db_host, $db_use, $db_pass); mysqli_select_db($link, $db_name); $command = "UPDATE email_activation SET check_activation='$activation_code' WHERE username='$username' and activation='$activation_code'"; $result = mysqli_query($command); if ($result) { $query = "SELECT * FROM email_activation where username LIKE '%$username%' LIMIT 0 , 1 "; $result = mysqli_query($query) OR die(mysqli_error()); while($row = mysqli_fetch_array($result)) { $username = $row['username']; $password = $row['password']; $email = $row['email']; $postcode = $row['postcode']; $query = "INSERT INTO member (username, password, email, postcode) VALUES ('$username','$password','$email','$postcode')"; $result = mysqli_query($link, $query) OR die(mysqli_error()); if ($result) { $_SESSION['user_logged'] = '1'; header("location:index.html"); echo "Congratulations. Your membership has been activated redirecting..."; }else{ header("location:index.html"); echo ("Congratulations. Your membership has been activated but it's can't saved in database."); } } }else{ header("location:activation-form.php"); echo ("You've entered an invalid username / activation code – please retry"); } } ?>
  4. i want do do something like this i am using filegetcontent & it give me something like <tag1><tag2>abc</tag2><tag3>....[some junk]</tag5></tag1> & in another case it give me <tag1><tag2>123</tag2><tag3>....[some junk]</tag5></tag1> so i want to do something like this if with filegetcontent i get abc { do this } if with filegetcontent i get 123 {do that} else {die();} how to do that ??? plz help me
  5. Hi, I have multiple table Table -1 order_no name 1 raj table -2 order_no name 1 raj table 3 order_no name 1 raj table 4 order_no name 1 raj table 5 order_no name 1 raj I want a query to check if the id (one) is present in all tables or not, i create this. select order_no from prepress, press, postpress, qc, binding, dispatch where order_no=prepress.order_no AND order_no=press.order_no AND order_no=postpress.order_no AND order_no=qc.order_no AND order_no=binding.order_no AND order_no=dispatch.order_no but the ambiguous error for order_no. how to achieve this can anyone suggest me? thanks
  6. Hello every body i have a array like this Array ( [19/5/14] => Array ( [94-DE-80-28-CF-BC] => Array ( [7] => Array ( [qax] => 1 ) ) } } I want to add new array under the [94-DE-80-28-CF-BC] => Array.. I am doing code but what it does it overrides the full array inside that array and create a new one... The code i've used is | array_push( $vis[$date][$macp], array( "$id"=>array( "$country"=>1 ) ));
  7. Newb here. My form works with sessions and the video loads etc, data submits, etc. all that is good. But i've gotten lost in the complexity of the build it seems and my html has become malformed I think. As a result each submission or page reload inserts another form inside the form inside the form etc etc etc. It some sort of weird looping madness or something. I'm very new to classes and how they work and i can't find where the madness is coming from. To duplicate the error, fill out the form and submit (the video won't play in firefox so use safari or chrome to test). I've been trying to resolve this for hours - i'm very lost in the complexity. <?php # '../' == sub-folder. use './' == root require '../inc_0700/config_inc.php'; #provides configuration, pathing, error handling, db credentials echo '<link rel="stylesheet" type="text/css" href="w05c09_gojiraIncidentReport.css">'; //END CONFIG AREA ---------------------------------------------------------- # Read the value of 'action' whether it is passed via $_POST or $_GET with $_REQUEST if(isset($_REQUEST['act'])){$myAction = (trim($_REQUEST['act']));}else{$myAction = "";} switch ($myAction){//check 'act' for type of process case "display": # 2)Display user's name! showObjects(); break; case "clear": # 3 Clear the session data clearObjects(); showForm(); break; default: # 1)Ask user to enter their name showForm(); } function showForm(){# shows form so user can enter their name. Initial scenario get_header(); #defaults to header_inc.php echo '<script type="text/javascript" src="' . VIRTUAL_PATH . 'include/util.js"></script> <script type="text/javascript"> function checkForm(thisForm){//check form data for valid info if(empty(thisForm.YourName,"Please Enter Your Name")){return false;} return true;//if all is passed, submit! } </script> <video id="bgVideo" preload="auto" autoplay="true" loop="loop" muted="muted" volume="0" poster="_bgGrfxs/bg_vidGlobe.jpg"> <source src="_bgVideo/bg_vidLoop.mp4" type="video/mp4"/> <source src="_bgVideo/bg_vidLoop.ogv" type="video/ogg"/> </video> <!-- This image stretches exactly to the browser width/height and lies behind the video--> <div id="bodyDummy"> <!-- <h3 align="center"">' . smartTitle() . '</h3>--> <br /> <br /> <br /> <br /> <br /> <br /> <form align="center" action="' . THIS_PAGE . '" method="post" onsubmit="return checkForm(this);"> <img width="10%" src="img_logo-panPacificDefenseCenter.png" alt="Kaiju Incident Reporter"/> <br /> <h2 style="color: #ff6d26;">Incident Report Form</h2> <br /> <!-- incWho? --> <br /> <b>Reporting Officer ID:</b><br /> <input type="text" name="incWho" placeholder="Please enter your full name here" /> <br /> <br /> <!-- incWhat --> <b><a id="orange" href="http://godzilla.wikia.com/wiki/Main_Page">Massive Unidentified Terrestrial Organism encountered:</a></b><br /> <select type="text" name="incWhat" data-placeholder="Select Incident Location..." class="chzn-select" multiple style="width:354px;" tabindex="40"> '; include 'ddlist-Kaiju.php'; echo '</select> <br /> <br /> <!-- incWhen = date of incident --> <b>Date of Incident:</b><br /> <input type="text" name="incWhen" placeholder="Please enter your full name here" /> <br /> <br /> <!-- incWhere --> <b>Incident Location:</b><br /> <select type="text" name="incWhere" data-placeholder="Select Incident Location..." multiple style="width:354px;" tabindex="111"> '; include 'ddlist-countriesInternational.php'; echo '</select> <br /> <br /> <!-- incWhy --> <b>Incident notes:</b><br /> <textarea name="incWhy" cols="54" rows="3" placeholder="Please enter any details you can recall of the incident - if incident is still occurring run" ></textarea> <br /> <br /> <!-- incScale --> <b>Rate the severity of the incident (0 to 5):</b> <br /> <br /> <input type="range" data-show-value="true" data-hightlight="true" data-popup-enabled="true" name="incScale" min="0" max="5" value="0" onchange="updateTextInput(this.value);"> <br /> <br /> <input id="go" type="submit" value="Go!"> </p> <input type="hidden" name="act" value="display" /> </form> <br /> <p style="#444"><i>Once you have completed your incident report, Run! For the love god man run, run for the hills and be safe!</i></p> '; get_footer(); #defaults to footer_inc.php echo '</div><!-- END bodyDummy -->'; } function showObjects() {#form submits here we show entered name //dumpDie($_POST); //if the session is not started, that could be a problem get_header(); #defaults to footer_inc.php if(!isset($_SESSION)){session_start();} echo "<br />"; if(!isset($_SESSION['kSession'])) {//if no session exists, create it $_SESSION['kSession']= array(); } //we need to add post data here $_SESSION['kSession'] [] = new incReport($_POST['incWho'], $_POST['incWhat'], $_POST['incWhen'], $_POST['incWhere'], $_POST['incWhy'], $_POST['incScale']); $totalScale = 0; foreach($_SESSION['kSession'] as $incReport)//loop thru each array item { echo $incReport; $totalScale += $incReport->incScale; } $totalReports = count($_SESSION['kSession']); $aveRating = $totalScale/$totalReports; echo '<div style="margin: auto; padding:0 10px; background-color:#ff6d26;width: 300px";><p style="color:white;">Average Incident Severity:</p> <h1 style="color:white;";>'; echo "$aveRating"; echo'</h1></div>'; if ($aveRating == 5){ echo '<p>Five: We suggest you make peace with this, your final moment.. enjoy the sunset before that giant foot comes down on you.</p>';} if ($aveRating == 4){ echo '<p>Four: The end is near, run man run, she isn\'t worth it, save yourse<p>lf.</p>';} if ($aveRating == 3){ echo '<p>Three: And your still there? Seriously?</p>';} if ($aveRating == 2){ echo '<p>Two: Take a picture, it will last longer. Now. Run for the hills!</p>';} if ($aveRating == 1){ echo '<p>One: Have you considered running?</p>';} if ($aveRating == 0){ echo '<p>Zero: This would be a good time to consider moving to a safer vantage point.</p></form></div><!--end dummy-->';} //get_footer(); #defaults to footer_inc.php //------end of work area-------// get_header(); #defaults to footer_inc.php if(!isset($_POST['incWho']) || $_POST['incWhat'] == ''){//data must be sent feedback("No form data submitted"); #will feedback to submitting page via session variable myRedirect(THIS_PAGE); } if(preg_match('[^A-Za-z0-9]', $_POST['incWho'])){//data must be alphanumeric only feedback("Only letters & numbers are allowed."); #will feedback to submitting page via session variable myRedirect(THIS_PAGE); } $myName = strip_tags($_POST['incWho']);# here's where we can strip out unwanted data } function clearObjects(){ //echo "clearing objects here"; if(!isset($_SESSION)){session_start();} unset($_SESSION['kSession']); feedback("session cleared"); } class incReport{ public $incWho = ""; public $incWhat = ""; public $incWhen = ""; public $incWhere = ""; public $incWhy = ""; public $incScale = ""; function __construct($incWho, $incWhat, $incWhen, $incWhere, $incWhy, $incScale){ $this->incWho=$incWho; $this->incWhat=$incWhat; $this->incWhen=$incWhen; $this->incWhere=$incWhere; $this->incWhy=$incWhy; $this->incScale=$incScale; } function __toString(){ static $kID = 1;//kaiju incident number $myReturn = '<video id="bgVideo" preload="auto" autoplay="true" loop="loop" muted="muted" volume="0" poster="_bgGrfxs/bg_vidGlobe.jpg"> <source src="_bgVideo/bg_vidLoop.mp4" type="video/mp4"/> <source src="_bgVideo/bg_vidLoop.ogv" type="video/ogg"/> </video> <div id="bodyDummy"> <br /> <br /> <br /> <br /> <br /> <br /> <form><p> Incident ID: kID00' . $kID ; //works $kID++; //iterate report $myReturn .= ' | Incident Reported by: ' . $this->incWho . ' ' ;//works $myReturn .= ' | Massive Terrestial Organsim Observed: ' . $this->incWhat . ' ' ;//shows where... $myReturn .= ' | Date of Incident: ' . $this->incWhen . ' ' ; //works $myReturn .= ' | Incident Location: ' . $this->incWhere . ' '; //shows what $myReturn .= ' | Incident Details: ' . $this->incWhy. ' '; // working $myReturn .= ' | Incident Severity: ' . $this->incScale . '</p> <p align="center"><a href="' . THIS_PAGE . '">File Report, then Run!</a> | <a href="' . THIS_PAGE . '?act=clear">Reset</a></p> ' ; return $myReturn; } }
  8. I have users in my database with many stored points ie age, gender, interests etc. about 20 points in all. I have a table of products that I want to recommend only applicable products. They each have saved like minage, maxage, gender, interest etc for the ideal consumer. ie dress gender=f This is the bare bones of what I have so far: $result = mysql_query("SELECT * FROM user_table WHERE hash='$session_id'"); $rowuser = mysql_fetch_array($result); $result = mysql_query("SELECT * FROM products"); $rowproducts = mysql_fetch_array($result); So now I have $rowuser['gender'] = m , how do I remove all from $rowproducts where gender = f? Is there a best way to do this knowing I have about 20 points to go through before I am left with an array with just the best selection of products for this user in it?
  9. I am writing a script that will parse my PHP classes and check for things like coupling, visualize my objects and connections, dependencies, check for convention usage, etc. So, I have a simple file upload. I'm never saving the files, just get contents and dump the file and work with the string version. I'm writing it for me, but I figure I might want to open it for others to use in the future, so I may as well write it that way to begin with -- so I need to validate user input. Problem is, the user input is supposed to be valid PHP code. I'm thinking that, as long as I'm careful, I shouldn't be executing any code contained in strings, but I'm no security expert and I want a warm fuzzy that my thought on this is correct. What kinds of things do I need to look out for? Is it possible to inject when working with strings? My initial thought is to regex the entire file and replace key portions with known replacements. So ( and ) would become !* and !^ or $ would become @~ (combinations that -- I think -- don't make sense to php?) But that may be completely unnecessary processing time if I'm not in any danger, here. Thanks ahead of time for any help. PS - as a side question -- what's the best way to verify a file is a php file? I know of getimagesize for images, but should I just check for <? to verify it's php? That seems like it would be too easy to fool -- then again, it might not matter much. -Adam
  10. http://paste.ee/p/OhiWv The above is a link to a readable version of my code. The XMLHTTPREQUEST worked, and the array was pulled down. Was able to print out the undecoded/unparsed array. However, immediately afterwards, all code stops working. <script> var xhr; if (window.XMLHttpRequest) { // Mozilla, Safari, ... xhr = new XMLHttpRequest(); } else if (window.ActiveXObject) { // IE 8 and older xhr = new ActiveXObject("Microsoft.XMLHTTP"); } xhr.open("POST", "PHPLibrary/selectMemberResults.php", true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send(); xhr.onreadystatechange = display_data; var $phparray function display_data() { if (xhr.readyState == 4) { if (xhr.status == 200) { //alert(xhr.responseText); $phparray = xhr.responseText; document.getElementById("suggestion").innerHTML = $phparray; // // //......................................................? // The above line of code is the last thing to print or // to do anything that returns to the browser.... //.......................................................? // All lines below do nothing............................? // } else { //alert('There was a problem with the request.'); } } } document.write("Length of phparray Array :" + $phparray.length + "<"); var output = JSON.parse($phparray, function (key,val) { if ( typeof val === 'string' ) { // regular expression to remove extra white space if ( val.indexOf('\n') !== -1 ) { var re = /\s\s+/g; return val.replace(re, ' '); } else { return val; } } return val; } ); document.write("Length of Array :" + $output.length + "<"); for (var i=0; i < $output.length; i++) { document.getElementById("suggestion").innerHTML = $output[i].MEMBER_NAME; } </script>
  11. Hi I have this Query and would like to get help on this. I have a table with Price in it and on my search form I have Min Price and Max Price, I want to connect the min and max price to price so that when people do a search ith will display the results between the min and max price they chose, for instants: Min Price = 1000 and Max Price = 10000 it have to give me that results between that 1000 and 10000. $query = "SELECT distinct Img.propertyId as PropertyId, Title, ImageUrl, Location, Bedrooms, Bathrooms, Parking, Price FROM PROPERTIES as Prop LEFT JOIN IMAGES as Img ON Img.PropertyId = Prop.PropertyId WHERE 1=1 "; Thank you
  12. Hi all, I have a looping error in my PHP. I am trying to add use a while statement to gather the users first and last name in to a string, add them to an array called $friendname, then check that the $friendname[] is only output/echoed once. At the moment the code looks good to me but with multiple rows with the same name associated, the name is echoed the same amount of times as rows, instead of once as it is supposed to be. Any ideas anyone? while($row2 = mysqli_fetch_assoc($result2)) { $friendcode = $row2['Code']; $names = "SELECT FirstName, LastName from users WHERE Code = '$friendcode' AND Code != '$crewcode'"; $resultnames = mysqli_query($cxn,$names) or die ("Can't get friends names."); while($rownames = mysqli_fetch_assoc($resultnames)) { $friendname = array(); $newfriendname = ($rownames['FirstName'].' '.$rownames['LastName']); if (!in_array($newfriendname, $friendname)) { array_push($friendname, "$newfriendname"); echo $newfriendname; } } }
  13. I guys, i´m seting up a template from themeforest for a customer, and i got to change the charset of the pages, it seems that everything was working, but to my surprise the text inside the h1 tags did not accepted the latin caracters, i`ve tryed everything but they still not changed, can you give me a hand?
  14. HI, I am a beginner at programing and I have to do this project where it is asking me to valid ISBN 10 and 13 using MySQL database to store the information. I checked my php code to validate ISBN 10 and 13 and it works, but when I try to store the data to MySQL it is not working. What I mean is that when I click ShowISBN link it doesn't show this information: ISBN Number ISBN Type Date Entered using timestamp Valid or Invalid This is the codes I have for input page of ISBN page: <?php //this is the isset function which allows us to submit back //to the same form. If there isn't anything in the ISBN, it will //show the bottom part of the form if(isset($_POST["ISBN"])|| empty($_POST['isbn_type']) || empty($_POST['Valid_Invalid'])) { $ISBN = $_POST["ISBN"];; $IsbnType = $_POST["isbn_type"];; $VaorIn = $_POST["Valid_Invalid"];; $ISBN_Arr = str_split($ISBN); $not10 =0; $notNum=0; $notX=0; //entering error checking for the code //check for 10 first, if clear do additional checking if(strlen($ISBN) == 10) {//start further error checking //check to make sure first 9 are numeric for($i=0;$i<=8;$i++) { if(!is_numeric($ISBN_Arr[$i])) $notNum = 1; }//end for loop check //check to see if there is a X or a x if($ISBN_Arr[9]=='x' || $ISBN_Arr[9]=='X') { $ISBN_Arr[9] = 10; } //if not an x, is it at least numeric? else if (!is_numeric($ISBN_Arr[9]) ) { $notX=1; } }//end additional error checking else { $not10=1; }//end not 10 check //start of error messages if prereqs are not met if($notNum ==1 || $notX ==1 || $not10) { Print "<h2>Input error</h2><br/>"; Print "Here is the error(s) discovered:<br/>"; if($notNum ==1) print"Your ISBN contains non-numeric data.<br/>"; if($notX ==1) print"The last digit is not a number or a X.<br/>"; if($not10 ==1) print"ISBN 10 number should contain 10 characters.<br/>"; include"ISBN_not_val_include.html"; } //end error checking else{ $chk_sum_num=10; $chk_sum =0; for($i=0;$i<=9;$i++) { $chk_sum +=$ISBN_Arr[$i] *$chk_sum_num; //print"$ISBN_Arr[$i] | $chk_sum_num<br/>"; $chk_sum_num--; }//end for loop $is_valid_ISBN= $chk_sum%11; //print"chk_sum: $chk_sum </br> is_valid_ISBN: $is_valid_ISBN</br>"; if($is_valid_ISBN==0) { print"<h3>VALID</h3><br/>"; print"$ISBN is a VALID 10 digit ISBN number.<br/>"; include"ISBN_val_include.html"; } else{ print"<h3>INVALID</h3><br/>"; print"$ISBN is an INVALID 10 number ISBN.<br/>"; include"ISBN_not_val_include.html"; }//end is_valid if }//end }//end is set if else{ include"ISBN_val_include.html"; }//end isset else ?> </form> <p><a href="_ShowISBN10and13DBProject.php">Show ISBN </a></p> </body> </html> This is the second part of the code that incorporates php and MySQL: <?php if (empty($_POST['ISBN'])|| empty($_POST['isbn_type']) || empty($_POST['Valid_Invalid'])) echo "<p>You must enter a Valid ISBN 10 to Continue! Please Click your browser's Back Button to return to the input page of ISBN 10 with Database.</p>\n"; else { $DBConnect = @mysql_connect("xxx.xxx.xx.xxx", "xxxxxxxx", "xxxxxxxx"); if($DBConnect === false) echo"<p>Unable to conenct to the database server.</p>" . "<p>Error code " . mysql_errno() . ": " . mysql_error() . "</p>"; else{ $DBName = "xxxxxxxx"; if (!@mysql_select_db($DBName, $DBConnect)) { $SQLstring = "CREATE DATABASE $DBName"; $QueryResult = @mysql_query($SQLstring, $DBConnect); if ($QueryResult === FALSE) echo "<p>Unable to execute the query.</p>" . "<p>Error code " . mysql_errno($DBConnect) . ": " . mysql_error($DBConnect) . "</p>"; else echo "<p>You are the first visitor!</p>"; } mysql_select_db($DBName, $DBConnect); $TableName = "isbn"; $SQLstring = "SHOW TABLES LIKE '$TableName'"; $QueryResult = @mysql_query($SQLstring, $DBConnect); if ($QueryResult === FALSE) echo "<p>Unable to create the table.</p>" . "<p>Error code " . mysql_errno($DBConnect) . ": " . mysql_error($DBConnect) . "</p>"; $ISBNum = stripslashes($_POST['ISBN']); $ISBNType = stripslashes($_POST['isbn_type']); $VaORIn = stripslashes($_POST['Valid_Invalid']); $SQLstring = "INSERT INTO $TableName VALUES(NULL, '$ISBNum', '$ISBNType', '$VaORIn')"; $QueryResult = @mysql_query($SQLstring, $DBConnect); if($QueryResult === false) echo"<p>Unable to execute the query.</p>" . "<p>Error code " . mysql_errno($DBConnect) . ": " . mysql_error($DBConnect) . "</p>"; else echo"<h1>Thank you for trying our ISBN 10 program!</h1>"; mysql_close($DBConnect); } } ?><!--End PHP Script--> This is the page where it is not working! <?php $DBConnect = @mysql_connect("xxx.xxx.xx.xxx", "xxxxxxx", "xxxxx"); if($DBConnect === false) echo"<p>Unable to conenct to the database server.</p>" . "<p>Error code " . mysql_errno() . ": " . mysql_error() . "</p>"; else{ $DBName = "xxxxxx"; if (!@mysql_select_db($DBName, $DBConnect)) echo"<p>There are no entries in the guest book!</p>"; else { $TableName = "isbn"; $SQLstring = "SELECT * FROM $TableName"; $QueryResult = @mysql_query($SQLstring, $DBConnect); if (mysql_num_rows($QueryResult) == 0) echo"<p>There are no entries in the ISBN 10 Database!</p>"; else{ echo"<p>The following ISBN have been recorded:</p>"; echo"<table width='100%' border='1'>"; echo"<tr><th>ISBN Number</th><th>ISBN Type</th><th> Date Entred</th><th> Valid OR Invalid</th></tr>"; while (($Row = mysql_fetch_assoc($QueryResult)) !==FALSE) { echo "<tr><td>{$Row['ISBN']}</td>"; echo "<tr><td>{$Row['isbn_type']}</td>"; echo "<tr><td>{$Row['TIMESTAMP']}</td>"; echo "<td>{$Row['Valid_Invalid']}</td></tr>"; } } mysql_free_result($QueryResult); } mysql_close($DBConnect); } When I click show ISBN nothing happens and I am not shore why! This is how I have my table setup in MySQL Manually by clicking table and create table: Columns: count int(11) Al PK ISBN varchar(45) isbn_type varchar(45) TIMESTMP datetime PK Valid_Invalid varchar(45) Can someone please tell me why when I click Show ISBN in the input page the first code pasted I get nothing! How do I fix the issue because my validation works, but it's not storing it or showing up when click Show ISBN! Any help will be appreciate it!
  15. My error happens on line #81 My error: Parse error: syntax error, unexpected 'class' (T_CLASS), expecting function (T_FUNCTION) in w06c02cxx.php on line 81 Troubleshooting notes: I've been reviewing this exercise throughout the weekend trying to find my error. I've used my code editors syntax highlighting tools (BBedit 10), but still the error persists. I learned about the 20/20/20 rule during this process and have practiced that while attempting to debug the code. I've scoured the web trying to find examples to help me, but i'm a new and nothing i've thus found has helped me to resolve my error, hoping someone here can help. I think the error is happening in my survey class, somewhere before line #81 Link to error: http://zephir.seattlecentral.edu/~jstein11/itc250/z14/surveys/w06c02cxx.php require '../inc_0700/config_inc.php'; #provides configuration, pathing, error handling, db credentials $config->titleTag = smartTitle(); #Fills <title> tag. If left empty will fallback to $config->titleTag in config_inc.php $config->metaDescription = smartTitle() . ' - ' . $config->metaDescription; //END CONFIG AREA ---------------------------------------------------------- get_header(); #defaults to header_inc.php $mySurvey = new Survey(1);//all our code happens in here if ($mySurvey->isValid){ echo ' The title of the surevis is ' . $mySurvey->Title . ' <br />'; echo ' The title of the surevis is ' . $mySurvey->Description . ' <br />'; }else{echo ' No such survey exists';} dumpDie($mySurvey); //like var_dump inside/available this app because of common file get_footer(); #defaults to footer_inc.php class Survey{//class creates one object at a time, creates as many as you want //create properties public $SurveyID = 0; public $Title = ''; public $Description = ''; public $isValid = FALSE; public $Questions = array();// how we add an array of questions to a survey function __construct($id){ $id = (int)$id; //cast to an integer - stops most sequal injection in this case if($id == 0){ return false; //don't bother asking database, there is no frog, don't ask - no data no dice } $sql = "select Title, Description, SurveyID from sp14_surveys where SurveyID = $id"; $result = mysqli_query(IDB::conn(),$sql) or die(trigger_error(mysqli_error(IDB::conn()), E_USER_ERROR)); //echo '<div align="center"><h4>SQL STATEMENT: <font color="red">' . $sql . '</font></h4></div>'; if(mysqli_num_rows($result) > 0) {#there are records - present data while($row = mysqli_fetch_assoc($result)) {# pull data from associative array $this->SurveyID = (INT)$row['SurveyID']; $this->Title = $row['Title']; $this->Description = $row['Description']; } $this->isValid = TRUE; } @mysqli_free_result($result);//at symbol surpresses multiple copies of an error silences a line basically $sql = "select * from sp14_questions where Survey14 = $id"; $result = mysqli_query(IDB::conn(),$sql) or die(trigger_error(mysqli_error(IDB::conn()), E_USER_ERROR)); if(mysqli_num_rows($result) > 0) {#there are records - present data while($row = mysqli_fetch_assoc($result)) {# pull data from associative array $this->Questions[] = new Question((INT)$row['QuestionID'],$row['Question'],$row['Description']); } }//end of constructor }//end of survey class //BEGIN new question object class Question{ public $QuestionID = 0; public $Text = ''; public $Description = ''; function __construct($QuestionID, $Question, $Description){ $this->QuestionID = $QuestionID; $this->Question = $Question;// field is named Question $this->Description = $Description;// the context info about the question asked }//END question Constructor }// END question Class } w06c02cxx.php
  16. I have a sign up form to send the activation code to the new user via email.My question is how to restrict the user who is not a member using activation form page in PHP unless their use a sign up form first? here is my sign up form and activation form: sign up form <style type="text/css"> <!-- .style1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12; } .style5 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; font-weight: bold; } .style7 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; } --> </style> <form name="form1" method="post" action="email-activation-script.php"> <div align="center"> <p class="style5"> Form Registration </p> <table width="35%" border="0"> <tr> <td class="style7">Username</td> <td class="style7">:</td> <td class="style1"><span class="style7"> <label> <input name="username" type="text" id="username"> </label> </span></td> </tr> <tr> <td class="style7"> Email </td> <td class="style7">:</td> <td class="style1"><span class="style7"> <label> <input name="email" type="text" id="email"> </label> </span></td> </tr> <tr> <td class="style7">Password</td> <td class="style7">:</td> <td class="style1"><span class="style7"> <label> <input name="password" type="password" id="password"> </label> </span></td> </tr> <tr> <td class="style7"> </td> <td class="style7"> </td> <td class="style1"><span class="style7"> <label> <input type="submit" name="Submit" value="Register"> <input type="reset" name="Submit2" value="Cancel"> </label> </span></td> </tr> </table> </div> </form> activation form: <form name="form1" method="post" action="check-activation-script.php"> <div align="center"> <table width="35%" border="0"> <tr> <td>Username</td> <td>:</td> <td><label> <input name="username" type="text" id="username"> </label></td> </tr> <tr> <td>Activation Code </td> <td><label>:</label></td> <td><input name="activation_code" type="text" id="activation_code"></td> </tr> <tr> <td> </td> <td> </td> <td><label> <input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Cancel"> </label></td> </tr> </table> </div> </form>
  17. <?php error_reporting(E_ALL); include_once("conninfo2.php"); include_once('classes/bcrypt.php'); class User { private $_bcrypt; $this->_bcrypt = new Bcrypt; if($this->_bcrypt->verify($password, $this->data()->password)){ } if(isset($_POST['username'])) { $firstname = strip_tags($_POST['firstname']); $surname = strip_tags($_POST['surname']); $pnumber = strip_tags($_POST['pnumber']); $username = strip_tags($_POST['username']); $email1 = strip_tags($_POST['email1']); $email2 = strip_tags($_POST['email2']); $password1 = $_POST['password1']; $password2 = $_POST['password2']; //code below will make sure all fields are filled in if(trim($firstname) == "" || trim($surname) == "" || trim($pnumber) == "" || trim($username) == "username" || trim($email1) == "" || trim($email2) == "" ||trim($password1) == "" || trim($password2) == "") { echo "Error, all fileds need to be filled in"; $db = null; exit(); } //code below checks that the emails entered both match one another if($email1 != $email2) { echo "Emails do not match, please try again"; $db = null; exit(); } //code below matches the passwords entered else if($password1 != $password2) { echo "Passwords do not match please try again"; exit(); } if(!filter_var($email1, FILTER_VALIDATE_EMAIL)) { echo "Your email is invalid, please try again"; $db = null; exit(); } //checks if the email exists within the database $stmt = $db->prepare("SELECT email FROM login WHERE email=:email1 LIMIT 1"); $stmt->bindValue(':email1',$email1, PDO::PARAM_STR); try{ $stmt->execute(); $count = $stmt->rowCount(); } catch(PDOException $e) { echo $e->getMessage(); $db = null; exit(); } //checks if the username exists $usernameSQL = $db->prepare("SELECT username FROM login WHERE username=:username LIMIT 1"); $usernameSQL->bindValue(':username',$username,PDO::PARAM_STR); try{ $usernameSQL->execute(); $usernameCount = $usernameSQL->rowCount(); } catch(PDOExemption $e) { echo $e->getMessage(); $db = null; exit(); } //checks if the email is already within the database if($count > 0) { echo "This email already exists"; $db = null; exit(); } //checks the username if($usernameCount > 0) { echo "This username is unavailable please try another"; $db = null; exit(); } $user = new User; $bcrypt = new Bcrypt; try { $email1->create(array( 'username' => Input::get('username'), 'password1' => $bcrypt->hash(Input::get('password')), 'firstname' => Input::get('name'), 'surname' => Input::get('surname'), 'pnumber' => Input::get('pnumber'), 'email1' => Input::get('email'), 'ipaddress' => Input::get('ipaddress'), 'signup_date' => date('Y-m-d H:i:s'), 'group' => 1 )); //grab the last id used within the database $lastId = $db->lastInsertId(); $stmt3 = $db->prepare("INSERT INTO activated (user, token) VALUES ('$lastId', :token)"); $stmt3->bindValue(':token',$token,PDO::PARAM_STR); $stmt3->execute(); //email activation $from = "From Auto Responder @ Mediaedit <admin@mediaedit.com>"; $subject = "IMPORTANT: Please activate your account"; $link = 'http://mediaed.it/roxanne/activate.php?user='.$lastId.'&token='.$token.''; //email body $message = " Thanks for register with Mediaedit, before your able to use our services you will need to verify your email so that we know your human $link "; //headers $headers = 'MIME-Version: 1.0' . "rn"; $headers .= "Content-type: textrn"; $headers .= "From: Mediaedit"; //send email now mail($email1, $subject, $message, $headers, '-f noreply@mediated.it'); $db->commit(); echo "Thanks for registering, before you can us our services you need to activate your account an email has been sent which you will recieve shortly"; $db = null; exit(); } catch(PDOException $e){ $db->rollBack(); echo $e->getMessage(); $db = null; exit(); } } ?> i keep getting Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION
  18. Here is my add driver button $( "#addDriver" ).button().click(function( event ) { event.preventDefault(); var dn = $("input[name=driver_name]").val(); var ds = $("input[name=driver_status]").val(); var dataString = 'driver_name='+ dn + '&driver_status='+ ds; //Here is where im trying to load it but it's not working $('#driversTable').jtable('load'); if(dn == '' || ds == '' ) { alert("Fill up all Fields with \'*\'"); } else { $.ajax({ type: "POST", url: "processDriver.php", data: dataString, dataType: "json", success: function(data){ if(!data.error && data.success) { alert(data.successMsg); $("input[name=driver_name]").val(''); $("input[name=driver_status]").val(''); } else { alert(data.errorMsg); } } }); } }); And here is my jTable init $("#driversTable").jtable({ title: 'Drivers', actions: { listAction: "getAllDrivers.php", }, fields: { did: { key: true, list: false }, dID: { title: 'Driver ID', width: '7%' }, dName: { title: 'Name', width: '7%' }, dStatus: { title: 'Status', width: '12%' } } }); $('#driversTable').jtable('load'); I want it to be right after adding a new record i want the table to refresh without refreshing the page. I tried the load and reload functions of jtable is not working or am i just putting them on the wrong place of my code?
  19. optionsT Does not show any results.Dont know where is the problem. <script type="text/javascript" language="javascript"> function AddItemInList(fromLeftToRight, isAll){ var list1 = document.getElementById('listBoxF'); var list2 = document.getElementById('listBoxT'); if(Boolean(fromLeftToRight) == true){ MoveItems(list1,list2,isAll); }else{ MoveItems(list2,list1,isAll); } return false; } function MoveItems(listFrom, listTo, isAll){ var toBeRemoved = ""; if(listFrom.options.length > 0){ for (i=0; i<listFrom.length; i++){ if (listFrom.options[i].selected || (isAll == true)){ if(Exist(listTo, listFrom.options[i].value) == 0){ listTo[listTo.length] = new Option(listFrom.options[i].text, listFrom.options[i].value, true); toBeRemoved = toBeRemoved + listFrom.options[i].value + ';'; } } } ClearSelection(listTo); RemoveFromList(listFrom, toBeRemoved); }else{ alert('Unable to Move Items. List is Empty!'); } } function RemoveFromList(listFrom, items){ var toBeRemoved = items.split(';'); for (var i=0; i < toBeRemoved.length; i++){ for (var j = 0; j < listFrom.length; j++){ if (listFrom.options[j] != null && listFrom.options[j].value == toBeRemoved[i]){ listFrom.options[j] = null; } } } } function ClearSelection(list){ list.selectedIndex = -1; } function Exist(list, value){ var flag = 0; for (var i=0; i < list.length; i++){ if (list.options[i].value == value){ flag = 1; break; } } return flag; } </script> <?php $opt = isset($_POST['optionsT']) ? $_POST['optionsT'] : ''; if(!empty($_POST['submit'])){ print $opt; } print" <form method=\"POST\"> <table style=\"width:100%\"> <tr valign=\"top\"> <td>Options</td> <td> <select multiple size=\"5\" name=\"optionsF\" id=\"listBoxF\" style=\"width:350px\"> <option value=\"1\">1</option> <option value=\"2\">2</option> <option value=\"3\">3</option> <option value=\"4\">4</option> </select> <div align=\"center\"> <input type=\"button\" onclick=\"return AddItemInList(true,true)\" value=\"+ All\"> <input type=\"button\" onclick=\"return AddItemInList(true,false)\" value=\"+\"> <input type=\"button\" onclick=\"return AddItemInList(false,false)\" value=\"-\"> <input type=\"button\" onclick=\"return AddItemInList(false,true)\" value=\"- All\"> </div> <select multiple size=\"5\" name=\"optionsT[]\" id=\"listBoxT\" style=\"width:350px\"> </select> </td> </tr> <tr> <td></td> <td><input type=\"submit\" name=\"submit\" value=\"Submit\"></td> </tr> </table> </form>"; ?>
  20. Hi PHP freaks!! I have manage to make a script to upload file in database and its working. I will share to you the codes so for other viewers and readers to use also. if($result){ if($_FILES['LRCard']['name'] != ""){ $filename = $_FILES['LRCard']['name']; $ext = strrchr($filename,"."); $LRCardname = $student_id; $LRCardname .="_". $filename; if($ext ==".jpg" || $ext ==".jpeg" || $ext ==".JPG" || $ext ==".JPEG" || $ext ==".gif" || $ext ==".GIF"){ $size = $_FILES['LRCard']['size']; if($size > 0 && $size < 5000000){ $archive_dir = "LRCards"; $userfile_tmp_name = $_FILES['LRCard']['tmp_name']; if(move_uploaded_file($userfile_tmp_name, "$archive_dir/$LRCardname")){ /* if LRC is successfully uploaded then LRC is stored in database. */ mysql_query("update student_information set LRCard='$LRCardname' where student_id='$student_id'", $link_id); $flag = "success"; if(mysql_error()!=null){ die(mysql_error()); } } else{ if(file_exists('LRCard/' . $LRCardname)) { unlink('LRCards/' . $LRCardname); } rollbackData(); } } else{ if(file_exists('LRCards/' . $LRCardname)) { unlink('LRCard/' . $LRCardname); } rollbackData(); die("You can upload LRCard of 5 MB size only. Please, try again."); } } else{ if(file_exists('LRCards/' . $LRCardname)) { unlink('LRCards/' . $LRCardname); } rollbackData(); die("You can upload LRCard of .jpg, .jpeg, .gif extensions only. Please, try again. "); } } } else{ $flag="error"; } if($flag == "success"){ mysql_query(" COMMIT "); $flag="success"; if(mysql_error() != null){ die(mysql_error()); } } Now, my problem is how to make a Php script to DOWNLOAD this uploaded file considering the 1. file path 2. file name 3. file extension. 4. student_id (to determine the specific file from a specific student) My plan is to make a download button which hyperlink to download.php and after clicking that button the specified file to a specific student id will automatically be downloaded by the browser.
  21. Hello I've got this form that keeps messing up. You can get to the link here: http://alexis-apparel.host56.com/ Attached below are all the files. I must have this done by the end of the month please help index.html html_form_send.php upload_file.php
  22. I set up functionality for a client that got moved to their server after I wrote and tested the functionality. It does not work on their server and I am trying to trouble shoot the problem as I do not have ftp access to the server. I believe that I have narrowed it down to either I do not know how to access the temp files on their server, Windows IIS, OR the security on the server is not allowing me to upload to the temp files. Here is the form used to upload to the server. <form enctype="multipart/form-data" action="#" method="post" > <input type="hidden" name="upload_csv" value="TRUE" /> <p><label for="userfile">Upload CSV:</label> <input type="hidden" name="MAX_FILE_SIZE" value="45000000" /> <input type="file" id="userfile" name="userfile" title="userfile" value="" /></p> <p><input type="submit" name="upload_csv" value="Upload CSV" /></p> </form> Here is the test code: <?php $csvfile = $_FILES['userfile']['tmp_name']; $size = $_FILES['userfile']['size']; if($_POST['upload_csv']){ //---------------------------------validation code here if($problem){ echo '<div class="error">Did not pass validation</div>'; include("upload_csv.inc.php"); }else{ if (($handle = fopen($csvfile, "r")) !== FALSE) { //--------------------------------------------------------------this is where the code that imports the data from the csv and to the database goes echo '<div class="message"><p>CSV has been opened!</p></div>'; }elseif(!$csvfile){ echo '<div class="error">Problem #1</div>'; }else{ echo '<div class="error">Problem #2</div>'; } } }else{ include("upload_csv.inc.php"); } ?> This code generated the error message: Problem #2. One more bit of information: the permissions on the server is set so that nothing can be uploaded by an external script. I do not know much about servers, but it seems to me that because the security is so tight on the server, the security is the reason that this does not work...??? I appreciate help with this. I just am not knowledgeable on how the $_FILES['userfile']['tmp_name'] code actually works?
  23. Newbie here, would love some help to find out what I'm doing wrong on this code. I'm using phpChart to make a graph. This is my code, but the graph does not appear. <?php require_once("phpChart_Lite/conf.php"); include 'connection.php'; ?> <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>phpChart - Basic Chart</title> </head> <body> <?php $query = mysqli_query($con, "SELECT krl FROM diesel WHERE sted = 'Borgeskogen' ORDER BY dato ASC"); // set array $price = array(); // look through query while($row = mysqli_fetch_assoc($query)){ // add each row returned into an array $price[] = $row['krl']; } //$pc = new C_PhpChartX(array(array(11, 9, 5, 12, 14)),'basic_chart'); $pc = new C_PhpChartX(array($price),'basic_chart'); $pc->set_animate(true); $pc->draw(); ?> </body> </html>
  24. Hello All, I've added search to my CMS and one column of data in particular is a date column. My whileLoop spits out data I want however it sorts the date field ASC but I need is DESC. I've tried adding the ORDER BY in several different ways however I keep getting an error... what would be the best approach to get it to sort the way I want using my current SELECT statement $search_sql = " SELECT * FROM tracking INNER JOIN sender ON tracking_sender_id = sender_id INNER JOIN method ON tracking_method_id = method_id WHERE (tracking_recepient LIKE '%" . $_POST['search'] . "%')"; the above code works fine but the output sorts ASC, can seem to add the ORDER BY in an appropriate manner to get it DESC. Any advice ? Thank you in advance
  25. Hello you awesome coders. I am getting a strange mesage on this site and need some help if you can to fix. the site is showing this error Notice: Undefined index: Submit in E:\Domains\a\aet.uk.net\user\htdocs\contact.php on line 84 at this page; http://aet.uk.net/contact.php Can you help! the form wont post or work. cheers chris <?php include_once("photoman/common.php");?> <!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> <?php include("includes/header.php"); ?> <script language="JavaScript" type="text/javascript" src="<?php echo $pref ?>scripts/formcheck.js"></script> </head> <body> <?php include("includes/banner.php"); ?> <div id="content" class="<?php echo $sectname ?>"> <?php $pageimage = "includes/$sectname.swf"; if (file_exists($pageimage)) { ?> <script type="text/javascript"> AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','789','height','197','title','<?php echo $sectname." page" ?>','src','includes/<?php echo $sectname ?>','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','includes/<?php echo $sectname ?>' ); //end AC code </script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="789" height="197" title="<?php echo $sectname." page" ?>"> <param name="movie" value="includes/<?php echo $sectname ?>.swf" /> <param name="quality" value="high" /> <embed src="includes/<?php echo $sectname ?>.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed> </object></noscript> <?php } else { $pageimage = "includes/$sectname.jpg"; $pagemax = 250; if (file_exists($pageimage)) { list($sw, $sh, $type, $attr) = getimagesize($pageimage); printf("<div id='pagephoto'><img src=%s alt='%s' %s></div>", $pageimage, $sectname." page image", $attr ); } else { $pageimage = "includes/$sectname.gif"; if (file_exists($pageimage)) { list($sw, $sh, $typwe, $attr) = getimagesize($pageimage); printf("<div id='pagephoto'><img src=%s %s></div>", $pageimage, $attr); } } } ?> <?php $submenu = getMenuXML($sectname); if (count($submenu) > 0 ) { ?> <ul> <?php foreach ($submenu as $subitem) { $imagename = $subitem['image']; if ($imagename == "") { ?> <li><a href="<?php echo $pref ?><?php echo $subitem['href']; ?>"> <?php echo $subitem['name']; ?> </a> </li> <?php } else { ?> <li><a href="<?php echo $pref ?><?php echo $subitem['href']; ?>" onmouseover="MM_swapImage('<?php echo $imagename; ?>','','<?php echo $pref ?>images/<?php echo $subitem['rollover']; ?>',1)" onmouseout="MM_swapImgRestore()"> <img src="<?php echo $pref ?>images/<?php echo ($pagename == $sectname)?$subitem['rollover']:$subitem['image']; ?>" alt="<?php echo $subitem['name']; ?>" id="<?php echo $imagename; ?>" /> </a></li> <?php } } } ?> <div id="pagetext"> <?php $pagefile = "includes/$filename.htm"; if (file_exists($pagefile)) { $text = file_get_contents($pagefile); echo($text); } else { ?> <?php } ?> <?php if($_POST['Submit'] == "Send") { ?> <h2>Thank you for your interest1</h2> <p>We will contact you shortly.</p> <?php // send email $gall = new GalleryXML(); $mailsubj = "Enquiry from ".$gall->gettitle(); $mailto = $gall->getemail(); $mailhead = "From: ".$_POST['email']; $mailbody = "Enquiry from ".$gall->gettitle()."\n"; $mailbody = $mailbody."Name: \t".$_POST['name']."\n"; $mailbody = $mailbody."Phone: \t".$_POST['phone']."\n"; $mailbody = $mailbody."Email: \t".$_POST['email']."\n"; $mailbody = $mailbody."Message: \t".$_POST['message']."\n"; if ($debug) printf("Email message<br>To: %s<br>Subj: %s<br>Email body: %s<br> Header: %s<br>", $mailto, $mailsubj, $mailbody, $mailhead); mail($mailto, $mailsubj, $mailbody, $mailhead); } ?> <table width="50%"> <form action="<?php echo($PHP_SELF)?>" method="post" enctype="multipart/form-data" name="contactform" onSubmit="RGB_validateForm('name','','R','phone','','RisPhone','email','','RisEmail');return document.MM_returnValue"> <tr> <th scope="row">Name</th> <td><input name="name" type="text" id="name" size="32"></td> </tr> <tr> <th scope="row">Telephone</th> <td><input name="phone" type="text" id="phone" size="24"></td> </tr> <tr> <th scope="row">Email</th> <td><input name="email" type="text" id="email" size="32"></td> </tr> <tr> <th scope="row">Message</th> <td><textarea name="message" cols="48" rows="6" id="message"></textarea> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" id="Submit" value="Send"> <input type="reset" name="Reset" id="Reset" value="Reset"> </tr> </form> </table> </div> <?php include("includes/footer.php"); ?> </body> </html>
×
×
  • 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.