How to Create an Awesome Name Wishing Festival Web App in PHP?


#22

sir google+ or facebook share button ka bhi code dona please


#23

sir google+ or facebook share button ka code bhejona


#24

Facebook

<a href="https://facebook.com/sharer.php?u=<?php echo 'https://' . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; ?>" target="_blank">Facebook</a>

Google +

<a href="https://plus.google.com/share?url=<?php echo  'https://' . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; ?>" target="_blank">Google+</a>

#26

You can also simply implement “addthis” instead of seperately implementing share buttons


#27

Personally, I love Custom Share Buttons :slight_smile:


#28

Sir isme kuch changes karna hai know kya


#29

Agar isme kuch changes karna hai to please bataona


#30

sir ye live kam nhi kar raha hai maine apne website par upload kiya to index.php ke age nhi bad raha hai sirf blank page open ho raha hai sir please please help me


#31

did you set up the database? create table?


#32

Sir table bhi banaya table me name bhi araha Hai but display nhi ho raha Hai pura page blank show ho raha hai


#33

update your database username, password, and table name on db.php??


#34

Bro, kindly please translate in English if possible, so that it reaches everyone here and we’ll try our best to share our inputs as well. :slight_smile:


#35

[Htaccess and Security Update]

Updated File

db.php
index.php
.htaccess

Prevent XSS Attack

  • open index.php file find this line $title=htmlentities($title);
  • Replace it with below function
//Prevent XSS
$title = htmlspecialchars($title,ENT_COMPAT);

Updated index.php File

<?php

/*
Plugin Name: MSK Festival Wishes Web App
Plugin URI: https://www.allwebtuts.com/festival-wishes-web-app/
Description: Festival Wishes Web App - A PHP Plugin Which Helps us to Create an Awesome SEO Friendly Festival Event Wishing Web App with Custom Greeting Wishes Page.
Version: 1.2
Author: Santhosh veer
Author URI: https://www.mskian.com
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/

include('db.php');

if(isset($_POST['create-wish']))
{

//prevent sql injection
$title=mysqli_real_escape_string($con,$_POST["title"]);

//prevent xss
$title = htmlspecialchars($title,ENT_COMPAT);

//friendly URL conversion
function to_prety_url($str){
    if($str !== mb_convert_encoding( mb_convert_encoding($str, 'UTF-32', 'UTF-8'), 'UTF-8', 'UTF-32') )
        $str = mb_convert_encoding($str, 'UTF-8', mb_detect_encoding($str));
    $str = htmlentities($str, ENT_NOQUOTES, 'UTF-8');
    $str = preg_replace('`&([a-z]{1,2})(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig);`i', '\1', $str);
    $str = html_entity_decode($str, ENT_NOQUOTES, 'UTF-8');
    $str = preg_replace(array('`[^a-z0-9]`i','`[-]+`'), '-', $str);
    $str = strtolower( trim($str, '-') );
    return $str;
}
$str=to_prety_url($title);

// sql query for inserting data into database
$sql_query = "INSERT INTO event_wishes (title,str) VALUES ('$title','$str')";
$result_set=mysqli_query($con,$sql_query);

// Redirect to Greeting Page
//Replace http://localhost/$str with your Greeting WEB APP URL
header("Location: http://localhost/$str");
exit();

}

?>

<!DOCTYPE html>
<html lang="en" itemscope itemtype="http://schema.org/WebSite">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php $current_page = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
 echo '<link rel="canonical" href="'.$current_page.'" itemprop="url"/>'; ?>


<!-- Edit the Meta Tags Add your Own Meta Contents  -->
<!-- Seo Meta Tags -->
<title>Mskian Festival Wishes Web App</title>
<meta name="description" content="Create an Awesome Name Wishing Festival Web App."/>
<meta name="robots" content="index,follow">
<link href='YOUR FAVICON URL' rel='icon' type='image/x-icon'/>

<!-- Twitter Card data -->
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Mskian Festival Wishes Web App" />
<meta name="twitter:description" content="Create an Awesome Name Wishing Festival Web App." />
<meta name="twitter:image" content="THUMBNAIL IMAGE FOR TWITTER SHARE" />
<meta name="twitter:site" content="@yourtwitterusername" />
<meta name="twitter:creator" content="@yourtwitterusername" />

<!-- Facebook Open Graph data -->
<meta property="og:title" content="Mskian Festival Wishes Web App" />
<meta property="og:type" content="website"/>
<meta property="og:url" content="YOUR WEB APP URL" />
<meta property="og:image" content="THUMBNAIL IMAGE FOR FACEBOOK SHARE" />
<meta property="og:description" content="Create an Awesome Name Wishing Festival Web App." /> 
<meta property="og:site_name" content="YOUR SITE NAME" />
<meta property="fb:app_id" content="APP ID" />

<!-- Google+ Meta Tags. -->
<meta itemprop="name" content="Mskian Festival Wishes Web App">
<meta itemprop="description" content="Create an Awesome Name Wishing Festival Web App.">
<meta itemprop="image" content="THUMBNAIL IMAGE FOR GOOGLE+ SHARE">



<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<link href='https://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>


<style type="text/css">
    body {
    font-family: 'Montserrat', sans-serif;
    font-size: 18px;
}

h1{
    font-size: 2.3em;
    font-weight: 600;
    margin: 20px 0 10px 0;
    letter-spacing: -1px;
}


.login-form {
    margin: 0 auto !important;
    float: none;
    padding: 15px;
}

.login-form form.form-horizontal {
    padding: 10px 20px;
}

.bold{
    font-weight: 700;
}
</style>

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
    <![endif]-->

</head>
<body>
<br />
<br />


<div class="col-md-6 col-lg-5 col-sm-8 center-block well login-form">
<h2 class="no-margin text-center">Create Greeting</h2>
<div class="clearfix">&nbsp;</div>
<form method="post" class="form-horizontal" data-parsley-validate>
<div class="form-group">
<input type="text" class="form-control" name="title" placeholder="Your Name" data-parsley-required="true">
 </div>
<div class="form-group">
<button type="submit" name="create-wish" class="btn btn-success btn-block btn-lg">Create Wish</button>
</div>
</form>
 </div>
</div>
<div class="clearfix">&nbsp;</div>



<!-- JavaScript -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/parsley.js/2.5.1/parsley.min.js"></script>

</body>
</html>
  • db.php
<?php

    $dbhost = 'localhost';
    $dbuser = 'YOUR DB USER';
    $dbpass = 'YOUR DB PASS';
    $dbname = 'YOUR DB NAME';

    $con=mysqli_connect($dbhost, $dbuser, $dbpass,$dbname) //connect to the database server
    or die ("Could not connect to mysql because ".mysqli_error());
    mysqli_query($con, "SET NAMES 'utf8'");
    mysqli_select_db($con,$dbname)  //select the database
    or die ("Could not select to mysql because ".mysqli_error());

    ?>
  • .htaccess
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ userwish.php?str=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ userwish.php?str=$1

If you are already using this Wish Script - Update the index.php, db.php and .htaccess file.

Github - https://github.com/mskian/Name-Wishing-Festival-Web-App-in-PHP-MYSQL


#36

Sir i have made the site but i want to configure the frontend of my choice but sit u have made class attribute so from where i can change the style css of the web app and the background of it.


#37

add the background color on body class

body {
    background-color: #ffffff;
    font-family: 'Montserrat', sans-serif;
    font-size: 18px;
}
  • Replace #ffffff with your color code

#38

Fix 404 Page Redirection

If you are Facing a 404 Error while redirecting to wish page follow this Method to Fix the 404 Page Error.

  • Open .htaccess file
  • Remove the default SEO Friendly rewrite rule & Add this Below rule to Fix the Greeting page displaying the 404 Error
RewriteEngine on
RewriteBase /
RewriteRule ^([a-zA-Z0-9_-]+)$ userwish.php?str=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ userwish.php?str=$1

#39

Happy New year Name Wishing Web APP :100: - [ Available on Github - Free & Open Source ] :slight_smile:

Contribute? - Fork & Send Pull Request :electric_plug:


Add Social Profile Icons Without Plugin on Wordpress
#40

@pradeepkumar bro I want to Update the Post bro I can’t the edit this post :roll_eyes: