Jump to content

Search the Community

Showing results for tags 'php'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

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


Languages

Found 974 results

  1. I'm working on a Contact Form for my website. It works, except the "Phone" field doesn't show a phone number in the sent message. It's just blank where the number should be displayed. What am I doing wrong? - Thanks HTML: <div class="contact-form"> <h2 class="style">Contact Us</h2> <form action="contact.php" method="post" id="form"> <div> <span><label>NAME</label></span> <span><input name="cf_name" type="text" class="textbox"></span> </div> <div> <span><label>EMAIL</label></span> <span><input name="cf_email" type="text" class="textbox"></span> </div> <div> <span><label>PHONE</label></span> <span><input name="cf_phone" type="text" class="textbox"></span> </div> <div> <span><label>MESSAGE</label></span> <span><textarea name="cf_message"> </textarea></span> </div> <div> <span><input type="submit" value="Send"></span> </div> </form> </div> PHP: <?php $field_name = $_POST['cf_name']; $field_email = $_POST['cf_email']; $field_phone = $_POST['cf_phone']; $field_message = $_POST['cf_message']; $mail_to = 'somebody@invalid.com'; $subject = 'Message from a website visitor '.$field_name; $body_message = 'From: '.$field_name."\n"; $body_message .= 'E-mail: '.$field_email."\n"; $body_message .= 'Phone: '.$field_phone."\n"; $body_message .= 'Message: '.$field_message; $headers = 'From: '.$field_email."\r\n"; $headers .= 'Reply-To: '.$field_email."\r\n"; $mail_status = mail($mail_to, $subject, $body_message, $headers); if ($mail_status) { ?> <script language="javascript" type="text/javascript"> alert('Thank you for the message. We will contact you shortly.'); window.location = 'index.html'; </script> <?php
  2. hi , in the python requests POST tutorial in the site , there is this piece of code , url = 'https://ipaddress of my server .../myphp.php' myjson = {'somekey': 'somevalue'} x = requests.post(url, json = myjson) it sends the json data to a php file in a server that i have access to how can I access json data in myphp.php file in the server ??? thanks
  3. Tarun

    PHP

    i have created one php file and html file and connected to each other. But here i want a help reqards to php. Details mentioned below: This is my HTML file: <form method="post" action="contact.php"> <textarea name="message"></textarea> <input type="submit"> </form> This is my PHP file: <?php if($_POST["message"]) { mail("your@email.address", "Form to email message", $_POST["message"], "From: an@email.address"); } ?> Here i want to know is if i want to add another textarea say it as name in HTML, so can you help me with the PHP coding, as i have tried with adding the another text area in PHP to retrieve data to my email, but i am not able to receive that.
  4. Hello everyone, i have created a html form and a button. Javascript reacts to the button click sends the html values to functions.php and there i have a function to insert into the wordpress database. Every field is working and is being inserted into the database but i have some problems to upload and save a image file with these steps. Iam not using a html form i wanted to go the javascript way. Is there any option/solution to insert an image file as blob into mysql using php without form submit just via javascript ajax ? Thanks and best regards, Atilla
  5. Hello! I need to know how to create a sitemap, which updates automatically according to web posts. Our company website is https://www.albacars.ae/ , a used car dealer in UAE, we post cars everyday, and it should be updated automatically on sitemap. Instead of doing this manual, is there any way to do? Thank you!
  6. Hi I have a query that returns the count of entries based on CURDATE(), it works for any dat in this month (April) but does not work for next month (May). I think it is something to do with CURDATE()+3 returns 2018-04-31 which should be 2018-05-01 This Works as Date is in April SELECT COUNT(Machine) FROM production WHERE Status = 'Confirmed' AND DATE(FROM_UNIXTIME(production.Required)) = CURDATE() This does not work as in May SELECT COUNT(Machine) FROM production WHERE Status = 'Confirmed' AND DATE(FROM_UNIXTIME(production.Required)) = CURDATE()+3
  7. Hello All, I'm trying to create a table of images in which each image would be a different link to a product on our website. I'm just learning how to code so I appreciate any help you can give! Attached is pdf showing the general layout of what I'm trying to do. Thanks! Line Card 10-16-18.pdf
  8. iwato

    Undefined Variable

    GREETING: Happy New Year, W3Schools! I am looking forward to another year of online progress. Hopefully many of the problems that I have been experiencing for the last year and a half will disappear with the addition of a brand new iMac that can handle the latest PHP and MySql software. This said, I remain the advanced novice that I am and very much hope that you will continue to stand by my side. BACKGROUND: Please find below a set of code that permits one new set of functionality, but destroys another. The related error messages are provided beneath the code. if (isset($_GET['refer_type']) && filter_var($_GET['refer_type'], FILTER_VALIDATE_INT)) { $refer_type = $_GET['refer_type']; } else { $refer_type = 0; } if (isset($_GET['panel_type']) && filter_var($_GET['panel_type'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH)) { $panel_type = $_GET['panel_type']; if (isset($_GET['lang_type']) && filter_var($_GET['lang_type'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH)) { $lang_type = $_GET['lang_type']; } } else { $panel_type = 0; } ERROR MESSAGES: [05-Jan-2020 04:10:40 UTC] PHP Notice: Undefined variable: lang_type in /home/thege0/public_html/grammarcaptive.com/devcptv18rs/overview.html on line 99 QUESTION: Can you see anything in the code line if (isset($_GET['lang_type']) && filter_var($_GET['lang_type'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH)) { $lang_type = $_GET['lang_type']; } or elsewhere that could be triggering the error. The code line just given is new and is clearly the initial, but maybe not the final source of the problem. By the way, when the code was first introduced, it did not appear to create a problem. Only several days later did the problem appear. Roddy
  9. Dear all, In my project, I am using an emebedded webserver LIGHTTPD with PHP. Within the main webpage, I use slider to write its value within a local file on my Linux OS. I wrote the slider like this: <input type="range" name="lightInputName" id="lightInputId" value="1" min="1" max="20" onchange="getvalor(this.value);" oninput="lightOutputId.value = lightInputId.value"> <input size="1" type="text" name="lightOutputName" id="lightOutputId"></input> What I want to do is to know if a javascript and/or PHP script is able to read the value of the slider, and copy it onto a local file. I don't have any idea on how to do this. Many thanks for your guidance. Best regards,
  10. Dear all, I am working on an embedded Linux platform with Lighttpd and PHP-7.0. My goal is using some HTML button and sliders to write some values on a local file. For example, if I click on a HTML button, I want to create and write a text file located in /home/$USER/ To do that, I build some files HTML <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>AI-VISION</title> <style> </style> </head> <body> <form action="test1.php" method="POST"> <input type="submit" value="Open Script"> </form> </body> </html> PHP <?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); exec("/bin/bash /var/www/html/test.sh"); ?> SHELL BASH #!/bin/bash cd /home/$USER/ touch testFile && echo "This is a test" > testFile So, when I launch the Shell Script like this: cd /var/www/html ./test.sh It works fine, and when I launch the PHP script like this: cd /var/www/html php test1.php It works also. My problem is when I want to launch it through the webpage...it doesn't works. I think because I have some wrong permissions, so I did this: sudo usermod -a -G www-data $USER sudo chgrp -R www-data /var/www/html sudo chmod -R g+w /var/www/html But no luck, I still doesn't work. Do you have an idea of the problem ? Thanks for your help and support. Regards,
  11. Hi all, Working with: Linux Debian Lighttpd Server PHP7.0 I want to launch some shell scripts pressing HTML buttons. All the files are placed in /var/www/html The rights are done by: sudo chown www-data:www-data /var/www/ So, I wrote a very simple code: HTML test code (index.html): <form action="openApp.php"> <input type="submit" value="Open Script"> </form> PHP test code (openApp.php): <?php exec('test.sh'); header('Location: http://localhost/index.html?success=true'); ?> But no luck, nothing is working. Note that the shell script just create an empty file like that: touch /home/$USER/testFile Also, my Lighttpd configuration file is like that: server.modules = ( "mod_access", "mod_alias", "mod_compress", "mod_fastcgi", "mod_redirect", ) May be I am wrong with that piece of code. Do I need some Javascript to do the job ? May be the rights are wrong ? Could you help me please ? I am stuck with that. Thank you for your help and support
  12. Hi everyone. Anyone noticed that htmlentities() aren't working in php? Nor are htmlspecialcharacters. See: https://www.w3schools.com/php/phptryit.asp?filename=tryphp_func_string_htmlentities Any ideas?? I have also written a quick and dirty test routine which I have run on my server: <?php if(isset($_POST['char'])) { $char = $_POST['char']; $char2 = htmlspecialchars($char); $char3 = htmlentities($char); echo 'Teclado: ' . $char . '<br /><br />'; echo 'Repuesta 1: ' . $char2 . '<br /><br />'; echo 'Repuesta 2: ' . $char3; } echo '<form action = "char_test.php" method = "post"> <input type = "text" name = "char" size = "6"> <input type = "submit" name = "submit" value = "Search!" /> </form>'; It runs but doesn't return any ASCII entities. HELP!! Max
  13. Please someone give details about what is difference between get and post in php?
  14. Hi everyone, I need a help...I don't understand why it is not work. I'm trying to "update" data in database, but it couldn't do that. Maybe there is wrong script in PHP. Can you find what did I do wrong? //Edit data from database if(isset($_GET['edit'])) { $edit = $_GET['edit']; $update = "select * FROM sampleDB where ID = '$edit';"; $updated = mysqli_query($GaryDB, $update); $change = mysqli_fetch_assoc($updated); if($change) { $editted = "<tr><td colspan='4'><input type='text' name='update' value='".$change['ID']."' readonly></td></tr> <tr><td colspan='5'><input type='text' name='update1' value='".$change['FirstName']."'></td></tr> <tr><td colspan='5'><input type='text' name='update2' value='".$change['LastName']."'></td></tr> <tr><td colspan='5'><input type='text' name='update3' value='".$change['City']."'></td></tr> <tr><td colspan='5'><input type='text' name='update4' value='".$change['State']."'></td></tr> <tr><td><input type='radio' name='update5' value='EST'>EST</td><td><input type='radio' name='update5' value='CST'> CST</td><td><input type='radio' name='update5' value='MST'> MST</td><td><input type='radio' name='update5' value='PST'> PST</td></tr> <tr><td colspan='5'><input type='submit' name='updateddata' value='Update data'></td><tr>"; if(isset($_POST['updateddata'])) { $updateFirst = $_POST['update1']; $updateLast = $_POST['update2']; $updateCity = $_POST['update3']; $updateState = $_POST['update4']; $updateTime = $_POST['update5']; $updated = "UPDATE `sampleDB` SET `FirstName`='$updateFirst', `LastName`='$updateLast', `City`='$updateCity', `State`='$updateState', `TimeZone`='$updateTime' WHERE `ID` = '$edit';"; $up_date = mysqli_query($GaryDB, $update); if(isset($up_date)) { header('location: sampleDB.php'); } else { $updated2 = "Could not updated data"; } } } } Anyone can help will be very appreciate Thanks, Gary
  15. Sigmahokies

    PHP email

    Hi everyone, Can anyone help me underatdn why my email in php didn't work. I set up the email form in web, seem it didn't send at all. I put boolean with email, then I tested to fill out text to send email, then it said it didn't send email at all. What did I do wrong? <?php $error = ""; if($_SERVER['REQUEST_METHOD'] == "POST") { if (empty($_POST['email'])) { $error = "<tr><td colspan='2'>E-mail is required</td></tr>"; } elseif (empty($_POST['FirstName'])) { $error = "<tr><td colspan='2'>First Name is required</td></tr>"; } elseif (empty($_POST['LastName'])) { $error = "<tr><td colspan='2'>Last Name is required</td></tr>"; } elseif (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { $error = "<tr><td colspan='2'>Invalid e-mail format</td></tr>"; } else { $first = $_POST['FirstName']; $last = $_POST['LastName']; $email = $_POST['email']; $comment = $_POST['comment']; $title = $_POST['Title']; $emailGary = "XXXX@gmail.com"; if(mail($emailGary, $title, $comment)) { $sent = "<tr><td colspan='2'>E-mail has been sent</td></tr>"; } else { $sent = "<tr><td colspan='2'>E-mail has not sent</td></tr>"; } } } ?> <body class="background"> <h5><a href="#garydtaylor">XXXX</a></h5> <div class="w3-row"> <div class="w3-col" style="width:300px; text-align: left; padding-left: 50px;"><p>Hello</p></div> <div class="w3-rest w3-round" style="text-align: left; padding-left: 50px;"><p>Hello</p> <form action="resume.php" method="post"> <table cellpadding="5"> <tr><td>* First Name:</td><td><input type="text" name="FirstName"></td></tr> <tr><td>* Last Name:</td><td><input type="text" name="LastName"></td></tr> <tr><td>* Title:</td><td><input type="text" name="Title"></td></tr> <tr><td>* Email:</td><td><input type="text" name="email"></td></tr> <tr><td valign="top">* Comment:</td><td><textarea maxlength="5000" cols="18" rows="6" type="text" name="comment"></textarea></td></tr> <tr></tr><td></td><td><input type="submit" name="submit" class="w3-round" style="background: maroon; color: white; height: 25px; width: 175px;" value="E-mail to Gary Taylor"></td> <?php echo $error ?> <?php echo $sent ?> </table> </form> </div> </div> </div> </body> </html> Can you help me? Of course, i will use CSS to make it decoration as style, but I want to make sure it works. Thanks, Gary
  16. I followed the following tutorial and I was finally able to add a slide in menu on my WordPress site. However, I noticed that the body scrolls when moving up and down on my mobile phone. Can someone explain to me how I can disable body scroll when the menu is opened? Many thanks in advance! Tutorial: https://www.w3schools.com/howto/howto_js_sidenav.asp <script> function openNav() { document.getElementById("mySidenav").style.width = "100%"; } function closeNav() { document.getElementById("mySidenav").style.width = "0"; } </script>
  17. I am writing a CRUD and this is a test page to combine 3 separate files into one page. If I comment out the final "else" section entirely the first "if" section and the "else if" section work fine, no errors. After I remove the comment marks for the final "else" section I get this error: PHP Parse error: syntax error, unexpected '?>' in /public_html/crud/test.php on line 139 (<- the line 139 the error points to is the final php closing tag before the closing body tag) It should be obvious, simple, but I can't find any reason why it is throwing out that error and breaking the page (it is just a blank white page). I'm sure somebody can scan through the code and see what I'm missing. Thanks. <!DOCTYPE html> <html> <head> <?php require_once "../HeaderStuff.php"; require_once "../connection.php"; ?> <style> table { width: 100%; } th {background-color: #f1f1c1;} .margin {margin-top: 4em;} </style> </head> <body style="background-color:<?php echo $bgColor; ?>"> <?php $choice = $_GET['choice']; $id = $_GET['id']; if ($choice == 'blogsEdit') { ?> <table class="w3-table-all"> <thead> <tr> <th class="textBig w3-padding-32 w3-left-align">Website Administration - Edit Blog</th> </tr> </thead> </table> <?php $sql = "SELECT id, cat, Fdate, title, para1, story, pic, picAlt FROM blogs WHERE id = $id"; $result = mysqli_query($link, $sql); if (mysqli_num_rows($result) > 0) { // output data of each row while($row = mysqli_fetch_assoc($result)) { // Display each field of the records. $id=$row['id']; // the blog id $cat=$row['cat']; // the blog category $Fdate=$row['Fdate']; // the blog date $title=$row['title']; // short title of the blog $para1=$row['para1']; // the introduction paragraph $story=$row['story']; // the rest of the blog after the intro paragraph $pic=$row['pic']; // picture for the blog $picAlt=$row['picAlt']; // alt text for the picture ?> <fieldset> <form action="blogsUpdate.php" method="post"> <table class="w3-table-all"> <tr> <th>Category:</th> <td><?php echo $cat; ?></td> </tr> <tr> <th>Blog Date:</th> <td><input type="text" name="Fdate" value="<?php echo $Fdate; ?>" /></td> </tr> <tr> <th>Blog Title</th> <td><input type="text" name="title" size="150" value="<?php echo $title; ?>" /></td> </tr> <tr> <th>Intro Paragraph</th> <td><textarea name="para1" id="para1" cols="150" rows="5"><?php echo $para1; ?></textarea></td> </tr> <tr> <th>Story</th> <td><textarea name="story" id="story" cols="150" rows="10"><?php echo $story; ?></textarea></td> </tr> <tr> <th>Picture File Name</th> <td><input type="text" name="pic" size="50" value="<?php echo $pic; ?>" /></td> </tr> <tr> <th>Picture Alt Text</th> <td><input type="text" size="150" name="picAlt" value="<?php echo $picAlt; ?>" /></td> </tr> <tr> <input type="hidden" name="id" value="<?php echo $id; ?>" /> <td colspan="2"><button type="submit">Save Changes</button></td> </tr> </table> </form> </fieldset> <?php } } else { echo "0 results"; } } else if ($choice == 'lessonsEdit') { ?> <table class="w3-table-all"> <thead> <tr> <th class="textBig w3-padding-32 w3-left-align">Website Administration - Edit Lesson</th> </tr> </thead> </table> <?php $sql = "SELECT id, cat, Fname FROM blogs WHERE id = $id"; $result = mysqli_query($link, $sql); if (mysqli_num_rows($result) > 0) { // output data of each row while($row = mysqli_fetch_assoc($result)) { // Display each field of the records. $id=$row['id']; // the lesson id $cat=$row['cat']; // the lesson category $Fname=$row['Fname']; // the file name ?> <fieldset> <form action="lessonsUpdate.php" method="post"> <table class="w3-table-all"> <tr> <th>Category:</th> <td><?php echo $cat; ?></td> </tr> <tr> <th>File Name:</th> <td><input type="text" name="Fname" value="<?php echo $Fname; ?>" /></td> </tr> <tr> <input type="hidden" name="id" value="<?php echo $id; ?>" /> <td colspan="2"><button type="submit">Save Changes</button></td> </tr> </table> </form> </fieldset> <?php } } else { echo "0 results"; } } else ($choice == 'writsEdit') { ?> <table class="w3-table-all"> <thead> <tr> <th class="textBig w3-padding-32 w3-left-align">Website Administration - Edit Writing</th> </tr> </thead> </table> <?php $sql = "SELECT id, cat, title, story FROM blogs WHERE id = $id"; $result = mysqli_query($link, $sql); if (mysqli_num_rows($result) > 0) { // output data of each row while($row = mysqli_fetch_assoc($result)) { // Display each field of the records. $id=$row['id']; // the writing id $cat=$row['cat']; // the category $title=$row['title']; // title of the writing $story=$row['story']; // the poem or story ?> <fieldset> <form action="writsUpdate.php" method="post"> <table class="w3-table-all"> <tr> <th>ID:</th> <td><?php echo $id; ?></td> </tr> <tr> <th>Category:</th> <td><?php echo $cat; ?></td> </tr> <tr> <th>Title</th> <td><input type="text" name="title" size="150" value="<?php echo $title; ?>" /></td> </tr> <tr> <th>Story</th> <td><textarea name="story" id="story" cols="150" rows="10"><?php echo $story; ?></textarea></td> </tr> <tr> <input type="hidden" name="id" value="<?php echo $id; ?>" /> <td colspan="2"><button type="submit">Save Changes</button></td> </tr> </table> </form> </fieldset> <?php } } else { echo "0 results"; } } ?> </body> </html>
  18. In the lesson on PHP Filters in the code sample "Validate an Integer" there is the following code: <?php $int = 100; if (!filter_var($int, FILTER_VALIDATE_INT) === false) { echo("Integer is valid"); } else { echo("Integer is not valid"); } ?> Why use this expression: (!filter_var($int, FILTER_VALIDATE_INT) === false) instead of what seems to me to be the more logical expression?: (filter_var($int, FILTER_VALIDATE_INT) === true) Thanks.
  19. CHALLENGE (WELL, KIND OF): Please find below two sets of code. The first is a short-hand snippet of code fits that within a larger block of code. The second is my own long-hand interpretation of what it means. SHORT-HAND: $str_browser_language = !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? strtok(strip_tags($_SERVER['HTTP_ACCEPT_LANGUAGE']), ',') : ''; $str_browser_language = !empty($_GET['language']) ? $_GET['language'] : $str_browser_language; LONG-HAND: if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $str_browser_language = strtok(strip_tags($_SERVER['HTTP_ACCEPT_LANGUAGE']), ','); } else { if (!empty($_GET['language'])) { $str_browser_language = $_GET['language']; } else { $str_browser_language = ''; } } QUESTION: Is my interpretation correct? If not, please explain, in what manner I have erred. Roddy
  20. Hi. How can I open the read more link in a new page. Just like Facebook when you click on the continue reading, it shows the current clicked post in a new page.
  21. Hello frns, i learnt how to get the gps coordinates from w3school tutorials but a small question how to alter the user if he blocks the gps access request through code <script> var x = document.getElementById("gpsloc"); function getLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition, showError); } else { x.value = "Geolocation is not supported by this device."; } } function showPosition(position) { x.value = position.coords.latitude + "," + position.coords.longitude; } function showError(error) { switch(error.code) { case error.PERMISSION_DENIED: x.value = "User denied the request for Geolocation." break; case error.POSITION_UNAVAILABLE: x.value = "Location information is unavailable." break; case error.TIMEOUT: x.value = "The request to get user location timed out." break; case error.UNKNOWN_ERROR: x.value = "An unknown error occurred." break; } } </script> what i want to make is page should check the state of permission and if permission is denied page should alert or keep re-request permission to allow please assist
  22. How to avoid form resubmission <?php require_once('../Connections/localhost.php'); ?> <?php //initialize the session if (!isset($_SESSION)) { session_start(); } // ** Logout the current user. ** $logoutAction = $_SERVER['PHP_SELF']."?doLogout=true"; if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){ $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){ //to fully log out a visitor we need to clear the session varialbles $_SESSION['MM_Username'] = NULL; $_SESSION['MM_UserGroup'] = NULL; $_SESSION['PrevUrl'] = NULL; unset($_SESSION['MM_Username']); unset($_SESSION['MM_UserGroup']); unset($_SESSION['PrevUrl']); $logoutGoTo = "../app/index.php?la=r"; if ($logoutGoTo) { header("Location: $logoutGoTo"); exit; } } ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $colname_teachers = "-1"; if (isset($_SESSION['MM_Username'])) { $colname_teachers = $_SESSION['MM_Username']; } mysql_select_db($database_localhost, $localhost); $query_teachers = sprintf("SELECT * FROM teachers WHERE employee_id = %s", GetSQLValueString($colname_teachers, "text")); $teachers = mysql_query($query_teachers, $localhost) or die(mysql_error()); $row_teachers = mysql_fetch_assoc($teachers); $totalRows_teachers = mysql_num_rows($teachers); $colname_school = "-1"; if (isset($row_teachers['school_id'])) { $colname_school = $row_teachers['school_id']; } mysql_select_db($database_localhost, $localhost); $query_school = sprintf("SELECT * FROM schools WHERE id = %s", GetSQLValueString($colname_school, "int")); $school = mysql_query($query_school, $localhost) or die(mysql_error()); $row_school = mysql_fetch_assoc($school); $totalRows_school = mysql_num_rows($school); date_default_timezone_set("Asia/kolkata");?> <!doctype html> <html lang="en"> <head> <meta http-equiv="Refresh" content="1600"> <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="../app/css/app.css" type="text/css"> <?php include('../app/includes/favicon.php'); ?> <meta name="Description" content="Andhra Pradesh Department of School Education Teacher & Student online Attendence with Photo Geo Tagging "> <title>Location Check</title> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> </script> <![endif]--> </head> <body> <?php include('../app/includes/header.php'); ?> <marquee direction="left"> <h2>DEPARTMENT OF SCHOOL EDUCATION</h2> </marquee> <main> <nav> <ul> <li><a href="../app/teacher1.php">HOME</a></li> <li><a href="../app/test.php">MDM</a></li> <li><a href="<?php echo $logoutAction ?>">Logout</a></li> <li></li> </ul> </nav> <article> <fieldset> <legend>Local Storage Test</legend> <form id="geotag" method="post" enctype="multipart/form-data" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>"> <table width="auto" align="center"> <tbody> <tr> <td><label class="cameraikon" for="image"></label></td> </tr> <tr> <td> <input id="image" type="file" name="image" accept="image/*" capture="camera" onChange="this.form.submit()"> </td> </tr> <tr><td><input type="button" id="upload" value="upload"></td></tr> <tr><td><div id="loader" style="display: none"></div></td></tr> <tr><td height="auto" style="margin-top: 50px;"> <?php if(isset($_FILES['image']['name'])){ $img = $_FILES['image']['tmp_name']; $targDir="../app/geotagged_imgs/"; $imgExtension= strtolower(pathinfo(basename($_FILES['image']['name']),PATHINFO_EXTENSION)); $imgname = "APEDU_".date('d-m-Y_h|i|s').".".$imgExtension; $tmpimg=imagecreatefromjpeg($img); imagejpeg($tmpimg,$targDir.$imgname,50); // move_uploaded_file($_FILES['image']['tmp_name'],$targDir.$imgname); echo '<p id = "result">'.$imgname.'<br>UPLOADED SUCCESSFULLY.</p><br>'; imagedestroy($tmpimg); echo '<br><img src="../app/geotagged_imgs/'.$imgname.'" class="thumbnail"><br>'; empty($_FILES['image']['name']); empty($_FILES['image']['tmp_name']); print_r($_FILES['image']['name']); } ?> </td></tr> </tbody> </table> </form> </fieldset> </article> </main> <footer> ™ and © 2019 A M Productions. All rights reserved. Property of Sikander. Use of this website (including any and all parts and components) constitutes your acceptance of these Terms and Conditions and Privacy Policy. Ad Choices. The materials on this website are not to be sold, traded or given away. Any copying, manipulation, publishing, or other transfer of these materials, except as specifically provided in the terms and conditions of use, is strictly prohibited. Smoking Policy</footer> </body> </html> <script> y = document.getElementById("upload").addEventListener("click",sikki); function sikki() { document.getElementById("loader").style.display = "block"; } </script> <?php mysql_free_result($teachers); mysql_free_result($school); ?>
  23. BACKGROUND: I have a page that, when loaded, creates several values via PHP. These values are assigned to several Javascript variables on the same page. I have verified that the assignment succeeds. When a visitor clicks on the page a visible div on the page is filled with the content of another div on the same page page, and additional javascript and CSS are loaded from another document. I have verified that this latter load does succeed, and that at least one of the functions contained therein is accessible. DILEMMA: Unfortunately, this freshly loaded Javascript is unable to find the values of the Javascript variables to which the PHP values were assigned when the page was initially downloaded. QUESTION ONE: What are the plausible reasons for not being able to find the relevant variables? QUESTION TWO: How do I make them findable? Roddy
  24. So i'm not still really familiar with regex and how does it work, but i have issue with my code. I have ¤ in my text and it gets replace with unicode ? block. https://en.wikipedia.org/wiki/Specials_(Unicode_block) for me and I don't get why. Here is the code I'm using. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> #kool { width:800px; border:groove; margin:0 auto; padding:25px; } </style> </head> <body> <?php /* Test preg_replace function */ $preg_pattern = "/[^A-Za-z0-9!\"#%£&()=@\s]/"; if (isset($_GET['preg'])) { echo "<div id='kool'>"; echo "<b>Original string: </b> " . $_GET['preg']; echo "<hr>"; echo "<b>Preg pattern: </b> " . $preg_pattern; echo "<hr>"; echo "<b>Result: </b> " . preg_replace($preg_pattern,"",$_GET['preg']); echo "</div>"; } ?> <form method="get" action="preg_test.php"> <input type="text" name="preg" <?php if (isset($_GET['preg'])) { echo " value='" . $_GET['preg'] . "'"; } ?>> <input type="submit"> </form> </body> </html> And here is the string I'm trying to use. Test 0-9, Specialcharacters: !"#¤%&/()=? Result image below Any guides / help appreciated.
×
×
  • Create New...