Skip to main content

Show Posts

This section allows you to view all Show Posts made by this member. Note that you can only see Show Posts made in areas you currently have access to.

Messages - junaid97

2
Questions / Friend System
I'm trying to make a simple social web app, with 3 Datatables:

users: id, name, email, password

friend_status: id, from_id, to_id, status

posts: id, user, content, date






I want to make a system wherein a user can send a friend request to another user; If the other user accepts, both of them are now friends.

And, I want a user to see all of his & his friend's posts only.
3
Questions / Fetching data from API and inserting in add form
I'm creating a Library Management System, and I want to fill the "Books" datatable by fetching data from Google Books API (https://developers.google.com/books/docs/v1/using).

The Books datatable has the following fields: id, title, author, image, price

Now, when I am on the books/add.php page, I want the user to write the name of the book in a textbox; and based on this query, a dropdown menu should appear, with the results from the Google Books API.

Once a user finds the desired book, he will click on it, and the title, author, image fields will get filled automatically.
The user will manually enter the price, before submitting the add form.




How can I achieve this?
4
Questions / Error 403 on submitting a form
I'm customizing the "info/contact.php" file.
I want replace the the sample contact form, with my own contact form.

When the user clicks on the submit button, an email should be sent with the form details.
This is the form code:

Code: [Select]
<div class="info-form">
        <form action="" method="post">

            <div class="name">
                <label>Enter your name..</label><br>
                <input type="text" name="name" required>
               
            </div>
           
            <div class="email">
                <label>Enter your email..</label><br>
                <input type="email" id="email" name="email"required>
               
            </div>
           
            <div class="yourmessage">
                <label>Briefly describe your topic</label><br>
                <input type="text" name="ymessage" required>
               
            </div>
           
            <input type="submit" name="submit" value="Submit">
            </form>
    </div>


And, on the same page, I have inserted a Php script that sends the email, using the mail function:

Code: [Select]
<?php
        if (!empty($_POST["email"])) {
            $to = "myemail@gmail.com"; 
            $subject = 'contact form';
            $from = "admin@theilmtech.com";
            $fromName = "Junaid Khan";
            unset($headers);
            $headers = "From: $fromName"." <".$from.">";
            $msg = "Mail: ".$_POST["email"];
            //Need to modify Header
            $mail = @mail($to, $subject, $msg, $headers);
            header("Location: info/contact.php");
        }
    ?>

When I click on the submit button, I get a 403 Forbidden error.

What can I do to solve this ?
5
Questions / Restrict Users from accessing files
My PHPRad project has user authentication enabled. And it works well.
However, I have realized that if an authorized user has a link to a file, and he shares it with any unauthorized user, the unauthorized user can simply access the link and download the file

for example : www.phpradproject.com/uploads/files/Little%20Red%20Riding%20Hood%20Presentation.ppt
From this link, anyone can download the ppt file. How can I avoid that?

From my limited research, I've learned that I need to work in the  ".htaccess" file to restrict users from accessing other folders and files.
Can you tell me the actual method ?
6
Questions / Re: Cannot Send Mail
1) When I send my email address on Password Reset Page, the page displays that the mail has been successfully sent. Even though I do not receive any email on said address.

2) I have tried, multiple times, configuring the Mail Settings. This is what I put :

// Email Configuration Default Settings
define("USE_SMTP",true);
define("SMTP_USERNAME", "MYUSERNAME");
define("SMTP_PASSWORD", "MYPASSWORD");
define("SMTP_HOST", "smtp.hostinger.in");
define("SMTP_PORT", "587");

I have used the same configuration and have successfully sent emails using custom code on smaller projects.


3) I even manually changed the Port Setting in Mailer.php; I mentioned this previously.

I am lost.
7
Questions / Re: Cannot Send Mail
1) I set the Sender Name and Sender Email in the Config.php file.

2) I also set the type of security and port my server is using in Mailer.php file.

3) I set the project in Production mode in the config.php file.

4) Once a user is added, the following code runs :

            $mailtitle      = "New User Added";
            $mailbody       = "Mail body. Support html content";
            $receiver_email = DEFAULT_EMAIL;
            $mailer         = new Mailer;
            $mailer->send_mail($receiver_email, $mailtitle, $mailbody);






Yet, I do not receive any email. Kindly help.
8
Questions / Cannot Send Mail
I have developed a project using phprad 2.7.3.
I have also setup a server on Hostinger and have used it previously to send emails using custom code (not phprad).

I want to send an email once a new user is added.
These are the steps that I have covered :

1. I Configured the Email Settings on my project : sender name, sender email, SMTP Host Server, SMTP Server Port, SMTP Username and password.

2. On PageEvents, I clicked on Users ->  Add  ->  AfterAdd.

3. Here, I posted the following code :

         $mailtitle      = "New User Added";
         $mailbody       = "Mail body. Support html content";
         $receiver_email = DEFAULT_EMAIL;
         $mailer         = new Mailer;
         $mailer->send_mail($receiver_email, $mailtitle, $mailbody);

4. I tried running the project on localhost. The page runs fine, but I donot receive any email.
5. I even tried running the project on my Hostinger's server. Again, no email received.

Kindly suggest what can I do :)